aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2024-02-15 15:34:49 +0100
committerSimon Ser <contact@emersion.fr>2024-02-15 15:41:12 +0100
commit842093bb843ae6c719c2b1cf32eb749cab9e46ca (patch)
treee35b8ce8e288fbdfcc78994a49b332b53867a3cd /backend
parentefa706b76902f50582c46b5b9f730696d04801b0 (diff)
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 <sys/sysmacros.h> and ensure that apart from symbols defined there the file only uses POSIX toys.
Diffstat (limited to 'backend')
-rw-r--r--backend/backend.c1
-rw-r--r--backend/drm/atomic.c1
-rw-r--r--backend/drm/drm.c1
-rw-r--r--backend/drm/libliftoff.c1
-rw-r--r--backend/drm/properties.c1
-rw-r--r--backend/drm/util.c1
-rw-r--r--backend/libinput/events.c1
-rw-r--r--backend/libinput/tablet_pad.c1
-rw-r--r--backend/libinput/tablet_tool.c1
-rw-r--r--backend/multi/backend.c1
-rw-r--r--backend/session/session.c1
-rw-r--r--backend/wayland/backend.c1
-rw-r--r--backend/wayland/output.c1
-rw-r--r--backend/wayland/pointer.c1
-rw-r--r--backend/wayland/seat.c1
-rw-r--r--backend/wayland/tablet_v2.c1
-rw-r--r--backend/x11/backend.c1
-rw-r--r--backend/x11/output.c1
18 files changed, 0 insertions, 18 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 <assert.h>
#include <errno.h>
#include <stdlib.h>
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 <drm_fourcc.h>
#include <stdlib.h>
#include <stdio.h>
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 <assert.h>
#include <drm_fourcc.h>
#include <drm_mode.h>
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 <fcntl.h>
#include <libliftoff.h>
#include <sys/stat.h>
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 <assert.h>
#include <stdbool.h>
#include <stddef.h>
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 <assert.h>
#include <drm_fourcc.h>
#include <drm_mode.h>
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 <libinput.h>
#include <stdlib.h>
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 <assert.h>
#include <string.h>
#include <libinput.h>
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 <string.h>
#include <assert.h>
#include <libinput.h>
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 <assert.h>
#include <stdbool.h>
#include <stdlib.h>
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 <assert.h>
#include <libudev.h>
#include <stdarg.h>
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 <assert.h>
#include <fcntl.h>
#include <limits.h>
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 <assert.h>
#include <stdint.h>
#include <stdio.h>
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 <assert.h>
#include <stdlib.h>
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 <assert.h>
#include <stdint.h>
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 <assert.h>
#include <math.h>
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 <assert.h>
#include <fcntl.h>
#include <limits.h>
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 <assert.h>
#include <stdlib.h>