aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
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/drm
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/drm')
-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
5 files changed, 0 insertions, 5 deletions
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>