From 842093bb843ae6c719c2b1cf32eb749cab9e46ca Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 15 Feb 2024 15:34:49 +0100 Subject: [PATCH] Define _POSIX_C_SOURCE globally Stop trying to maintain a per-file _POSIX_C_SOURCE. Instead, require POSIX.1-2008 globally. A lot of core source files depend on that already. Some care must be taken on a few select files where we need a bit more than POSIX. Some files need XSI extensions (_XOPEN_SOURCE) and some files need BSD extensions (_DEFAULT_SOURCE). In both cases, these feature test macros imply _POSIX_C_SOURCE. Make sure to not define both these macros and _POSIX_C_SOURCE explicitly to avoid POSIX requirement conflicts (e.g. _POSIX_C_SOURCE says POSIX.1-2001 but _XOPEN_SOURCE says POSIX.1-2008). Additionally, there is one special case in render/vulkan/vulkan.c. That file needs major()/minor(), and these are system-specific. On FreeBSD, _POSIX_C_SOURCE hides system-specific symbols so we need to make sure it's not defined for this file. On Linux, we can explicitly include and ensure that apart from symbols defined there the file only uses POSIX toys. --- backend/backend.c | 1 - backend/drm/atomic.c | 1 - backend/drm/drm.c | 1 - backend/drm/libliftoff.c | 1 - backend/drm/properties.c | 1 - backend/drm/util.c | 1 - backend/libinput/events.c | 1 - backend/libinput/tablet_pad.c | 1 - backend/libinput/tablet_tool.c | 1 - backend/multi/backend.c | 1 - backend/session/session.c | 1 - backend/wayland/backend.c | 1 - backend/wayland/output.c | 1 - backend/wayland/pointer.c | 1 - backend/wayland/seat.c | 1 - backend/wayland/tablet_v2.c | 1 - backend/x11/backend.c | 1 - backend/x11/output.c | 1 - examples/cairo-buffer.c | 1 - examples/embedded.c | 1 - examples/fullscreen-shell.c | 1 - examples/output-layers.c | 1 - examples/output-layout.c | 1 - examples/pointer.c | 1 - examples/rotation.c | 1 - examples/scene-graph.c | 1 - examples/simple.c | 1 - examples/tablet.c | 3 ++- examples/touch.c | 1 - meson.build | 1 + render/allocator/allocator.c | 1 - render/allocator/drm_dumb.c | 1 - render/allocator/gbm.c | 1 - render/dmabuf.c | 1 - render/egl.c | 1 - render/gles2/pass.c | 1 - render/gles2/pixel_format.c | 1 - render/gles2/renderer.c | 1 - render/gles2/texture.c | 1 - render/vulkan/renderer.c | 1 - render/vulkan/texture.c | 1 - render/vulkan/vulkan.c | 4 ++-- render/wlr_renderer.c | 1 - tinywl/tinywl.c | 1 - types/data_device/wlr_data_device.c | 1 - types/data_device/wlr_data_offer.c | 3 ++- types/data_device/wlr_data_source.c | 1 - types/data_device/wlr_drag.c | 1 - types/output/output.c | 1 - types/scene/drag_icon.c | 1 - types/scene/layer_shell_v1.c | 1 - types/scene/wlr_scene.c | 1 - types/scene/xdg_shell.c | 1 - types/seat/wlr_seat.c | 1 - types/seat/wlr_seat_keyboard.c | 1 - types/seat/wlr_seat_pointer.c | 1 - types/seat/wlr_seat_touch.c | 1 - types/tablet_v2/wlr_tablet_v2.c | 4 ---- types/tablet_v2/wlr_tablet_v2_pad.c | 4 ---- types/tablet_v2/wlr_tablet_v2_tablet.c | 4 ---- types/tablet_v2/wlr_tablet_v2_tool.c | 4 ---- types/wlr_cursor.c | 1 - types/wlr_cursor_shape_v1.c | 1 - types/wlr_data_control_v1.c | 1 - types/wlr_drm.c | 1 - types/wlr_export_dmabuf_v1.c | 1 - types/wlr_ext_foreign_toplevel_list_v1.c | 1 - types/wlr_foreign_toplevel_management_v1.c | 1 - types/wlr_fractional_scale_v1.c | 1 - types/wlr_gamma_control_v1.c | 1 - types/wlr_idle_notify_v1.c | 1 - types/wlr_input_device.c | 1 - types/wlr_input_method_v2.c | 3 --- types/wlr_keyboard.c | 1 - types/wlr_keyboard_group.c | 1 - types/wlr_keyboard_shortcuts_inhibit_v1.c | 1 - types/wlr_layer_shell_v1.c | 1 - types/wlr_linux_dmabuf_v1.c | 1 - types/wlr_pointer_constraints_v1.c | 1 - types/wlr_pointer_gestures_v1.c | 4 ---- types/wlr_presentation_time.c | 1 - types/wlr_primary_selection.c | 1 - types/wlr_primary_selection_v1.c | 1 - types/wlr_relative_pointer_v1.c | 1 - types/wlr_screencopy_v1.c | 1 - types/wlr_security_context_v1.c | 1 - types/wlr_session_lock_v1.c | 1 - types/wlr_shm.c | 4 +--- types/wlr_tearing_control_v1.c | 1 - types/wlr_text_input_v3.c | 3 --- types/wlr_transient_seat_v1.c | 1 - types/wlr_virtual_keyboard_v1.c | 1 - types/wlr_virtual_pointer_v1.c | 1 - types/wlr_xcursor_manager.c | 1 - types/wlr_xdg_activation_v1.c | 1 - types/wlr_xdg_decoration_v1.c | 1 - types/wlr_xdg_foreign_v1.c | 1 - types/wlr_xdg_foreign_v2.c | 1 - types/xdg_shell/wlr_xdg_popup.c | 1 - types/xdg_shell/wlr_xdg_positioner.c | 1 - types/xdg_shell/wlr_xdg_shell.c | 1 - types/xdg_shell/wlr_xdg_surface.c | 1 - types/xdg_shell/wlr_xdg_toplevel.c | 1 - util/log.c | 1 - util/shm.c | 1 - util/time.c | 1 - util/token.c | 1 - xcursor/wlr_xcursor.c | 1 - xcursor/xcursor.c | 4 ++-- xwayland/selection/incoming.c | 1 - xwayland/selection/selection.c | 1 - xwayland/server.c | 1 - xwayland/sockets.c | 3 ++- xwayland/xwayland.c | 1 - xwayland/xwm.c | 3 --- 115 files changed, 12 insertions(+), 139 deletions(-) diff --git a/backend/backend.c b/backend/backend.c index 0021dbae6..de2acfe38 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index 6588bdc01..bbbd064e6 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 420806037..d92b41d36 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/drm/libliftoff.c b/backend/drm/libliftoff.c index 534e5ef29..334a660c2 100644 --- a/backend/drm/libliftoff.c +++ b/backend/drm/libliftoff.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/drm/properties.c b/backend/drm/properties.c index 4f4951771..ecd0d910e 100644 --- a/backend/drm/properties.c +++ b/backend/drm/properties.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/drm/util.c b/backend/drm/util.c index 0e7f3f8b1..a14e5e1ef 100644 --- a/backend/drm/util.c +++ b/backend/drm/util.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 4726e32b2..dcc651378 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c index e53275281..3cf7f1429 100644 --- a/backend/libinput/tablet_pad.c +++ b/backend/libinput/tablet_pad.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 1c85d08bc..f3266c284 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/multi/backend.c b/backend/multi/backend.c index dc2668bb9..740e1d6fa 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/backend/session/session.c b/backend/session/session.c index 4ae67c7c1..5fb20c226 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 7629ff710..9522de405 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/wayland/output.c b/backend/wayland/output.c index b8760793b..2d3e32696 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/backend/wayland/pointer.c b/backend/wayland/pointer.c index 0cad97203..f795d12d8 100644 --- a/backend/wayland/pointer.c +++ b/backend/wayland/pointer.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c index d88a370f3..0de149bb6 100644 --- a/backend/wayland/seat.c +++ b/backend/wayland/seat.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/backend/wayland/tablet_v2.c b/backend/wayland/tablet_v2.c index a3604b51b..6d793881f 100644 --- a/backend/wayland/tablet_v2.c +++ b/backend/wayland/tablet_v2.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 3c963a286..ec15a9c97 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/backend/x11/output.c b/backend/x11/output.c index 0c4966c60..51a8459d1 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/examples/cairo-buffer.c b/examples/cairo-buffer.c index d46198787..7de4a053b 100644 --- a/examples/cairo-buffer.c +++ b/examples/cairo-buffer.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include diff --git a/examples/embedded.c b/examples/embedded.c index 7b33d8390..ff8b8851f 100644 --- a/examples/embedded.c +++ b/examples/embedded.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/examples/fullscreen-shell.c b/examples/fullscreen-shell.c index 46923d9ff..c12f126e9 100644 --- a/examples/fullscreen-shell.c +++ b/examples/fullscreen-shell.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/examples/output-layers.c b/examples/output-layers.c index 1b34d5845..cd05d9f0e 100644 --- a/examples/output-layers.c +++ b/examples/output-layers.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/examples/output-layout.c b/examples/output-layout.c index 4400685c3..3a3eeb24f 100644 --- a/examples/output-layout.c +++ b/examples/output-layout.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/examples/pointer.c b/examples/pointer.c index 7d1f4e4bd..bb249b423 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/examples/rotation.c b/examples/rotation.c index 7ee8dc780..351973f61 100644 --- a/examples/rotation.c +++ b/examples/rotation.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/examples/scene-graph.c b/examples/scene-graph.c index cbc091369..fb530c067 100644 --- a/examples/scene-graph.c +++ b/examples/scene-graph.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/examples/simple.c b/examples/simple.c index 1a018829a..81ed2e0e9 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/examples/tablet.c b/examples/tablet.c index c97cafe42..7e9116a8e 100644 --- a/examples/tablet.c +++ b/examples/tablet.c @@ -1,4 +1,5 @@ -#define _XOPEN_SOURCE 600 +#undef _POSIX_C_SOURCE +#define _XOPEN_SOURCE 600 // for M_PI #include #include #include diff --git a/examples/touch.c b/examples/touch.c index f0aca30d4..e1bd73818 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/meson.build b/meson.build index 95803a22d..c3ea7fc67 100644 --- a/meson.build +++ b/meson.build @@ -21,6 +21,7 @@ little_endian = target_machine.endian() == 'little' big_endian = target_machine.endian() == 'big' add_project_arguments([ + '-D_POSIX_C_SOURCE=200809L', '-DWLR_USE_UNSTABLE', '-DWLR_LITTLE_ENDIAN=@0@'.format(little_endian.to_int()), '-DWLR_BIG_ENDIAN=@0@'.format(big_endian.to_int()), diff --git a/render/allocator/allocator.c b/render/allocator/allocator.c index e0620a1b7..639b52bec 100644 --- a/render/allocator/allocator.c +++ b/render/allocator/allocator.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/render/allocator/drm_dumb.c b/render/allocator/drm_dumb.c index 6de44f402..eb4ce99fe 100644 --- a/render/allocator/drm_dumb.c +++ b/render/allocator/drm_dumb.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/render/allocator/gbm.c b/render/allocator/gbm.c index 25ddbbae4..baa0fb6eb 100644 --- a/render/allocator/gbm.c +++ b/render/allocator/gbm.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/render/dmabuf.c b/render/dmabuf.c index b0b8ef418..7096dbc08 100644 --- a/render/dmabuf.c +++ b/render/dmabuf.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/render/egl.c b/render/egl.c index 162634be9..ac991295e 100644 --- a/render/egl.c +++ b/render/egl.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/render/gles2/pass.c b/render/gles2/pass.c index 4c9f9e28b..9177b0a1f 100644 --- a/render/gles2/pass.c +++ b/render/gles2/pass.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/render/gles2/pixel_format.c b/render/gles2/pixel_format.c index fdf091f15..5cdf8c995 100644 --- a/render/gles2/pixel_format.c +++ b/render/gles2/pixel_format.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index a71423c0c..e095f469c 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/render/gles2/texture.c b/render/gles2/texture.c index d326da9d2..d66e9c161 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index 05486a0f8..d433f495b 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/render/vulkan/texture.c b/render/vulkan/texture.c index a3fede041..51372b5fe 100644 --- a/render/vulkan/texture.c +++ b/render/vulkan/texture.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/render/vulkan/vulkan.c b/render/vulkan/vulkan.c index 8e9d9288a..54bfa77a4 100644 --- a/render/vulkan/vulkan.c +++ b/render/vulkan/vulkan.c @@ -1,5 +1,5 @@ -#if !defined(__FreeBSD__) -#define _POSIX_C_SOURCE 200809L +#if defined(__FreeBSD__) +#undef _POSIX_C_SOURCE #endif #include #include diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index 0ddb364ed..513fecbd7 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index 0342ec54e..ec8f3c038 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/types/data_device/wlr_data_device.c b/types/data_device/wlr_data_device.c index d482a0a2c..3b5b8a668 100644 --- a/types/data_device/wlr_data_device.c +++ b/types/data_device/wlr_data_device.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/data_device/wlr_data_offer.c b/types/data_device/wlr_data_offer.c index b1bff3373..4bb9d0c24 100644 --- a/types/data_device/wlr_data_offer.c +++ b/types/data_device/wlr_data_offer.c @@ -1,4 +1,5 @@ -#define _XOPEN_SOURCE 700 +#undef _POSIX_C_SOURCE +#define _XOPEN_SOURCE 700 // for ffs() #include #include #include diff --git a/types/data_device/wlr_data_source.c b/types/data_device/wlr_data_source.c index 5fcc617b2..15fb9929e 100644 --- a/types/data_device/wlr_data_source.c +++ b/types/data_device/wlr_data_source.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c index fdbf1b8c9..42691116e 100644 --- a/types/data_device/wlr_drag.c +++ b/types/data_device/wlr_drag.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/output/output.c b/types/output/output.c index 511bc0ec9..4376da991 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/scene/drag_icon.c b/types/scene/drag_icon.c index 7b4fa55b0..b508487e0 100644 --- a/types/scene/drag_icon.c +++ b/types/scene/drag_icon.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include "wlr/types/wlr_compositor.h" #include diff --git a/types/scene/layer_shell_v1.c b/types/scene/layer_shell_v1.c index 710b709e1..67fdda287 100644 --- a/types/scene/layer_shell_v1.c +++ b/types/scene/layer_shell_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 7c5071799..7e5b31363 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/scene/xdg_shell.c b/types/scene/xdg_shell.c index 7ebef33ec..9e3ffb05f 100644 --- a/types/scene/xdg_shell.c +++ b/types/scene/xdg_shell.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/seat/wlr_seat.c b/types/seat/wlr_seat.c index 73e307861..2e8e4a844 100644 --- a/types/seat/wlr_seat.c +++ b/types/seat/wlr_seat.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/seat/wlr_seat_keyboard.c b/types/seat/wlr_seat_keyboard.c index 0193d58d9..dcbc0a3d6 100644 --- a/types/seat/wlr_seat_keyboard.c +++ b/types/seat/wlr_seat_keyboard.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c index 5e4401f90..1d57fff2a 100644 --- a/types/seat/wlr_seat_pointer.c +++ b/types/seat/wlr_seat_pointer.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/seat/wlr_seat_touch.c b/types/seat/wlr_seat_touch.c index 3843b5ee0..5a1400065 100644 --- a/types/seat/wlr_seat_touch.c +++ b/types/seat/wlr_seat_touch.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/tablet_v2/wlr_tablet_v2.c b/types/tablet_v2/wlr_tablet_v2.c index d93e92d62..3182effeb 100644 --- a/types/tablet_v2/wlr_tablet_v2.c +++ b/types/tablet_v2/wlr_tablet_v2.c @@ -1,7 +1,3 @@ -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif - #include #include #include diff --git a/types/tablet_v2/wlr_tablet_v2_pad.c b/types/tablet_v2/wlr_tablet_v2_pad.c index bf8fb7044..76208cace 100644 --- a/types/tablet_v2/wlr_tablet_v2_pad.c +++ b/types/tablet_v2/wlr_tablet_v2_pad.c @@ -1,7 +1,3 @@ -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif - #include #include #include diff --git a/types/tablet_v2/wlr_tablet_v2_tablet.c b/types/tablet_v2/wlr_tablet_v2_tablet.c index af374b6f0..184570f67 100644 --- a/types/tablet_v2/wlr_tablet_v2_tablet.c +++ b/types/tablet_v2/wlr_tablet_v2_tablet.c @@ -1,7 +1,3 @@ -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif - #include #include #include diff --git a/types/tablet_v2/wlr_tablet_v2_tool.c b/types/tablet_v2/wlr_tablet_v2_tool.c index a5a45485f..9700e9043 100644 --- a/types/tablet_v2/wlr_tablet_v2_tool.c +++ b/types/tablet_v2/wlr_tablet_v2_tool.c @@ -1,7 +1,3 @@ -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif - #include #include #include diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index a1d6b0425..16c3a08a6 100644 --- a/types/wlr_cursor.c +++ b/types/wlr_cursor.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_cursor_shape_v1.c b/types/wlr_cursor_shape_v1.c index f83fdcde2..d9f26f92b 100644 --- a/types/wlr_cursor_shape_v1.c +++ b/types/wlr_cursor_shape_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_data_control_v1.c b/types/wlr_data_control_v1.c index e4f3223b4..88f23ae46 100644 --- a/types/wlr_data_control_v1.c +++ b/types/wlr_data_control_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_drm.c b/types/wlr_drm.c index a75f3042e..9cbc4cecb 100644 --- a/types/wlr_drm.c +++ b/types/wlr_drm.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_export_dmabuf_v1.c b/types/wlr_export_dmabuf_v1.c index d2fc574ce..69245e373 100644 --- a/types/wlr_export_dmabuf_v1.c +++ b/types/wlr_export_dmabuf_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_ext_foreign_toplevel_list_v1.c b/types/wlr_ext_foreign_toplevel_list_v1.c index 947131830..6c059e64e 100644 --- a/types/wlr_ext_foreign_toplevel_list_v1.c +++ b/types/wlr_ext_foreign_toplevel_list_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/types/wlr_foreign_toplevel_management_v1.c b/types/wlr_foreign_toplevel_management_v1.c index 80b1fc5a6..23935d489 100644 --- a/types/wlr_foreign_toplevel_management_v1.c +++ b/types/wlr_foreign_toplevel_management_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/types/wlr_fractional_scale_v1.c b/types/wlr_fractional_scale_v1.c index d98527587..60797469a 100644 --- a/types/wlr_fractional_scale_v1.c +++ b/types/wlr_fractional_scale_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_gamma_control_v1.c b/types/wlr_gamma_control_v1.c index c24da9a21..3780bda88 100644 --- a/types/wlr_gamma_control_v1.c +++ b/types/wlr_gamma_control_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_idle_notify_v1.c b/types/wlr_idle_notify_v1.c index 9997631b0..6283dc6a3 100644 --- a/types/wlr_idle_notify_v1.c +++ b/types/wlr_idle_notify_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_input_device.c b/types/wlr_input_device.c index 7de98b75f..ede2e04d8 100644 --- a/types/wlr_input_device.c +++ b/types/wlr_input_device.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/types/wlr_input_method_v2.c b/types/wlr_input_method_v2.c index 1bad7b144..e50b02a0b 100644 --- a/types/wlr_input_method_v2.c +++ b/types/wlr_input_method_v2.c @@ -1,6 +1,3 @@ -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif #include #include #include diff --git a/types/wlr_keyboard.c b/types/wlr_keyboard.c index 7baad3b2e..98978ee1d 100644 --- a/types/wlr_keyboard.c +++ b/types/wlr_keyboard.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_keyboard_group.c b/types/wlr_keyboard_group.c index b4c7e552e..ef557a958 100644 --- a/types/wlr_keyboard_group.c +++ b/types/wlr_keyboard_group.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_keyboard_shortcuts_inhibit_v1.c b/types/wlr_keyboard_shortcuts_inhibit_v1.c index f6e17424d..0e4355616 100644 --- a/types/wlr_keyboard_shortcuts_inhibit_v1.c +++ b/types/wlr_keyboard_shortcuts_inhibit_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_layer_shell_v1.c b/types/wlr_layer_shell_v1.c index 17674780d..a59f1104a 100644 --- a/types/wlr_layer_shell_v1.c +++ b/types/wlr_layer_shell_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_linux_dmabuf_v1.c b/types/wlr_linux_dmabuf_v1.c index 416428227..13e82760c 100644 --- a/types/wlr_linux_dmabuf_v1.c +++ b/types/wlr_linux_dmabuf_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_pointer_constraints_v1.c b/types/wlr_pointer_constraints_v1.c index cea59b186..f3c8fb74b 100644 --- a/types/wlr_pointer_constraints_v1.c +++ b/types/wlr_pointer_constraints_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_pointer_gestures_v1.c b/types/wlr_pointer_gestures_v1.c index 0628bb509..0763f3ac3 100644 --- a/types/wlr_pointer_gestures_v1.c +++ b/types/wlr_pointer_gestures_v1.c @@ -1,7 +1,3 @@ -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif - #include #include #include diff --git a/types/wlr_presentation_time.c b/types/wlr_presentation_time.c index 49887173c..35b960d02 100644 --- a/types/wlr_presentation_time.c +++ b/types/wlr_presentation_time.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_primary_selection.c b/types/wlr_primary_selection.c index d4687b815..e3212d6fe 100644 --- a/types/wlr_primary_selection.c +++ b/types/wlr_primary_selection.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_primary_selection_v1.c b/types/wlr_primary_selection_v1.c index af232ef7c..0a5f0fbdc 100644 --- a/types/wlr_primary_selection_v1.c +++ b/types/wlr_primary_selection_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_relative_pointer_v1.c b/types/wlr_relative_pointer_v1.c index 6ac846e1c..94fb1555e 100644 --- a/types/wlr_relative_pointer_v1.c +++ b/types/wlr_relative_pointer_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c index 40e9577bf..34f6c5b61 100644 --- a/types/wlr_screencopy_v1.c +++ b/types/wlr_screencopy_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_security_context_v1.c b/types/wlr_security_context_v1.c index ce7def5c1..a43af9e0f 100644 --- a/types/wlr_security_context_v1.c +++ b/types/wlr_security_context_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_session_lock_v1.c b/types/wlr_session_lock_v1.c index 4c094da9e..73874f859 100644 --- a/types/wlr_session_lock_v1.c +++ b/types/wlr_session_lock_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_shm.c b/types/wlr_shm.c index 4704df7a3..6160c4b0a 100644 --- a/types/wlr_shm.c +++ b/types/wlr_shm.c @@ -1,6 +1,4 @@ -#if !defined(__FreeBSD__) -#define _POSIX_C_SOURCE 200112L -#endif +#undef _POSIX_C_SOURCE #define _DEFAULT_SOURCE // for MAP_ANONYMOUS #include #include diff --git a/types/wlr_tearing_control_v1.c b/types/wlr_tearing_control_v1.c index a1898b4d7..cd7cd5a59 100644 --- a/types/wlr_tearing_control_v1.c +++ b/types/wlr_tearing_control_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/types/wlr_text_input_v3.c b/types/wlr_text_input_v3.c index 11944f26a..936eca1a0 100644 --- a/types/wlr_text_input_v3.c +++ b/types/wlr_text_input_v3.c @@ -1,6 +1,3 @@ -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif #include #include #include diff --git a/types/wlr_transient_seat_v1.c b/types/wlr_transient_seat_v1.c index 92b18e844..379ce0a37 100644 --- a/types/wlr_transient_seat_v1.c +++ b/types/wlr_transient_seat_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_virtual_keyboard_v1.c b/types/wlr_virtual_keyboard_v1.c index 639156faa..8a6d107d5 100644 --- a/types/wlr_virtual_keyboard_v1.c +++ b/types/wlr_virtual_keyboard_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_virtual_pointer_v1.c b/types/wlr_virtual_pointer_v1.c index 8e34b6c42..6fcd0e940 100644 --- a/types/wlr_virtual_pointer_v1.c +++ b/types/wlr_virtual_pointer_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_xcursor_manager.c b/types/wlr_xcursor_manager.c index 96679d581..b45dcd7b1 100644 --- a/types/wlr_xcursor_manager.c +++ b/types/wlr_xcursor_manager.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_xdg_activation_v1.c b/types/wlr_xdg_activation_v1.c index cd382713e..8e0fb0618 100644 --- a/types/wlr_xdg_activation_v1.c +++ b/types/wlr_xdg_activation_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/types/wlr_xdg_decoration_v1.c b/types/wlr_xdg_decoration_v1.c index d32b15dcf..d16ac7c5a 100644 --- a/types/wlr_xdg_decoration_v1.c +++ b/types/wlr_xdg_decoration_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/wlr_xdg_foreign_v1.c b/types/wlr_xdg_foreign_v1.c index d4bcc6a73..12cd4fc09 100644 --- a/types/wlr_xdg_foreign_v1.c +++ b/types/wlr_xdg_foreign_v1.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/types/wlr_xdg_foreign_v2.c b/types/wlr_xdg_foreign_v2.c index f600d5337..4cfbe77b6 100644 --- a/types/wlr_xdg_foreign_v2.c +++ b/types/wlr_xdg_foreign_v2.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c index ffd58a613..97e6c8e25 100644 --- a/types/xdg_shell/wlr_xdg_popup.c +++ b/types/xdg_shell/wlr_xdg_popup.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/xdg_shell/wlr_xdg_positioner.c b/types/xdg_shell/wlr_xdg_positioner.c index dae879bbe..6a991bbac 100644 --- a/types/xdg_shell/wlr_xdg_positioner.c +++ b/types/xdg_shell/wlr_xdg_positioner.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/xdg_shell/wlr_xdg_shell.c b/types/xdg_shell/wlr_xdg_shell.c index d6784d1b7..3baea04eb 100644 --- a/types/xdg_shell/wlr_xdg_shell.c +++ b/types/xdg_shell/wlr_xdg_shell.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include "types/wlr_xdg_shell.h" diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c index 1e14c07ed..029ab81a6 100644 --- a/types/xdg_shell/wlr_xdg_surface.c +++ b/types/xdg_shell/wlr_xdg_surface.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199309L #include #include #include diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c index 7f67aeafd..488e454ce 100644 --- a/types/xdg_shell/wlr_xdg_toplevel.c +++ b/types/xdg_shell/wlr_xdg_toplevel.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/util/log.c b/util/log.c index 9996ab8ad..a329b43be 100644 --- a/util/log.c +++ b/util/log.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/util/shm.c b/util/shm.c index 6fddebbb8..5eb87bb89 100644 --- a/util/shm.c +++ b/util/shm.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200112L #include #include #include diff --git a/util/time.c b/util/time.c index 78faac560..bc4a10637 100644 --- a/util/time.c +++ b/util/time.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include diff --git a/util/token.c b/util/token.c index 09702e55f..2d58d1698 100644 --- a/util/token.c +++ b/util/token.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include "util/token.h" #include "wlr/util/log.h" diff --git a/xcursor/wlr_xcursor.c b/xcursor/wlr_xcursor.c index 620b6c781..c57d8175b 100644 --- a/xcursor/wlr_xcursor.c +++ b/xcursor/wlr_xcursor.c @@ -23,7 +23,6 @@ * SOFTWARE. */ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/xcursor/xcursor.c b/xcursor/xcursor.c index 17ad758bb..663467097 100644 --- a/xcursor/xcursor.c +++ b/xcursor/xcursor.c @@ -23,8 +23,8 @@ * SOFTWARE. */ -#define _POSIX_C_SOURCE 200809L -#define _DEFAULT_SOURCE +#undef _POSIX_C_SOURCE +#define _DEFAULT_SOURCE // for d_type in struct dirent #include #include #include diff --git a/xwayland/selection/incoming.c b/xwayland/selection/incoming.c index c2e1e712c..4a0b450c1 100644 --- a/xwayland/selection/incoming.c +++ b/xwayland/selection/incoming.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/xwayland/selection/selection.c b/xwayland/selection/selection.c index 0079df2fd..4d1e366eb 100644 --- a/xwayland/selection/selection.c +++ b/xwayland/selection/selection.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/xwayland/server.c b/xwayland/server.c index 6dd422466..4f92879d1 100644 --- a/xwayland/server.c +++ b/xwayland/server.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/xwayland/sockets.c b/xwayland/sockets.c index 873fde8db..9e287f361 100644 --- a/xwayland/sockets.c +++ b/xwayland/sockets.c @@ -1,4 +1,5 @@ -#define _XOPEN_SOURCE 700 +#undef _POSIX_C_SOURCE +#define _XOPEN_SOURCE 700 // for S_ISVTX #include #include #include diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c index 0ffc1fefe..c4ca9ae44 100644 --- a/xwayland/xwayland.c +++ b/xwayland/xwayland.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 9a6cf7716..c75f2be76 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1,6 +1,3 @@ -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif #include #include #include