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 0021dbae..de2acfe3 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 6588bdc0..bbbd064e 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 42080603..d92b41d3 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 534e5ef2..334a660c 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 4f495177..ecd0d910 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 0e7f3f8b..a14e5e1e 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 4726e32b..dcc65137 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 e5327528..3cf7f142 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 1c85d08b..f3266c28 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 dc2668bb..740e1d6f 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 4ae67c7c..5fb20c22 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 7629ff71..9522de40 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 b8760793..2d3e3269 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 0cad9720..f795d12d 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 d88a370f..0de149bb 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 a3604b51..6d793881 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 3c963a28..ec15a9c9 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 0c4966c6..51a8459d 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 d4619878..7de4a053 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 7b33d839..ff8b8851 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 46923d9f..c12f126e 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 1b34d584..cd05d9f0 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 4400685c..3a3eeb24 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 7d1f4e4b..bb249b42 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 7ee8dc78..351973f6 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 cbc09136..fb530c06 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 1a018829..81ed2e0e 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 c97cafe4..7e9116a8 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 f0aca30d..e1bd7381 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 95803a22..c3ea7fc6 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 e0620a1b..639b52be 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 6de44f40..eb4ce99f 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 25ddbbae..baa0fb6e 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 b0b8ef41..7096dbc0 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 162634be..ac991295 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 4c9f9e28..9177b0a1 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 fdf091f1..5cdf8c99 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 a71423c0..e095f469 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 d326da9d..d66e9c16 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 05486a0f..d433f495 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 a3fede04..51372b5f 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 8e9d9288..54bfa77a 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 0ddb364e..513fecbd 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 0342ec54..ec8f3c03 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 d482a0a2..3b5b8a66 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 b1bff337..4bb9d0c2 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 5fcc617b..15fb9929 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 fdbf1b8c..42691116 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 511bc0ec..4376da99 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 7b4fa55b..b508487e 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 710b709e..67fdda28 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 7c507179..7e5b3136 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 7ebef33e..9e3ffb05 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 73e30786..2e8e4a84 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 0193d58d..dcbc0a3d 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 5e4401f9..1d57fff2 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 3843b5ee..5a140006 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 d93e92d6..3182effe 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 bf8fb704..76208cac 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 af374b6f..184570f6 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 a5a45485..9700e904 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 a1d6b042..16c3a08a 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 f83fdcde..d9f26f92 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 e4f3223b..88f23ae4 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 a75f3042..9cbc4cec 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 d2fc574c..69245e37 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 94713183..6c059e64 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 80b1fc5a..23935d48 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 d9852758..60797469 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 c24da9a2..3780bda8 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 9997631b..6283dc6a 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 7de98b75..ede2e04d 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 1bad7b14..e50b02a0 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 7baad3b2..98978ee1 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 b4c7e552..ef557a95 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 f6e17424..0e435561 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 17674780..a59f1104 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 41642822..13e82760 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 cea59b18..f3c8fb74 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 0628bb50..0763f3ac 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 49887173..35b960d0 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 d4687b81..e3212d6f 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 af232ef7..0a5f0fbd 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 6ac846e1..94fb1555 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 40e9577b..34f6c5b6 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 ce7def5c..a43af9e0 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 4c094da9..73874f85 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 4704df7a..6160c4b0 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 a1898b4d..cd7cd5a5 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 11944f26..936eca1a 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 92b18e84..379ce0a3 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 639156fa..8a6d107d 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 8e34b6c4..6fcd0e94 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 96679d58..b45dcd7b 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 cd382713..8e0fb061 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 d32b15dc..d16ac7c5 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 d4bcc6a7..12cd4fc0 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 f600d533..4cfbe77b 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 ffd58a61..97e6c8e2 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 dae879bb..6a991bba 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 d6784d1b..3baea04e 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 1e14c07e..029ab81a 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 7f67aeaf..488e454c 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 9996ab8a..a329b43b 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 6fddebbb..5eb87bb8 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 78faac56..bc4a1063 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 09702e55..2d58d169 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 620b6c78..c57d8175 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 17ad758b..66346709 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 c2e1e712..4a0b450c 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 0079df2f..4d1e366e 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 6dd42246..4f92879d 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 873fde8d..9e287f36 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 0ffc1fef..c4ca9ae4 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 9a6cf771..c75f2be7 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