diff options
author | Simon Ser <contact@emersion.fr> | 2024-02-15 15:34:49 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2024-02-15 15:41:12 +0100 |
commit | 842093bb843ae6c719c2b1cf32eb749cab9e46ca (patch) | |
tree | e35b8ce8e288fbdfcc78994a49b332b53867a3cd /examples | |
parent | efa706b76902f50582c46b5b9f730696d04801b0 (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 'examples')
-rw-r--r-- | examples/cairo-buffer.c | 1 | ||||
-rw-r--r-- | examples/embedded.c | 1 | ||||
-rw-r--r-- | examples/fullscreen-shell.c | 1 | ||||
-rw-r--r-- | examples/output-layers.c | 1 | ||||
-rw-r--r-- | examples/output-layout.c | 1 | ||||
-rw-r--r-- | examples/pointer.c | 1 | ||||
-rw-r--r-- | examples/rotation.c | 1 | ||||
-rw-r--r-- | examples/scene-graph.c | 1 | ||||
-rw-r--r-- | examples/simple.c | 1 | ||||
-rw-r--r-- | examples/tablet.c | 3 | ||||
-rw-r--r-- | examples/touch.c | 1 |
11 files changed, 2 insertions, 11 deletions
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 <stdbool.h> #include <stdlib.h> 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 <EGL/egl.h> #include <EGL/eglext.h> #include <GLES2/gl2.h> 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 <getopt.h> #include <stdbool.h> #include <stdio.h> 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 <getopt.h> #include <stdbool.h> #include <stdio.h> 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 <drm_fourcc.h> #include <limits.h> #include <math.h> 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 <assert.h> #include <math.h> #include <stdio.h> 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 <drm_fourcc.h> #include <getopt.h> #include <math.h> 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 <assert.h> #include <getopt.h> #include <stdbool.h> 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 <inttypes.h> #include <stdio.h> #include <stdlib.h> 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 <math.h> #include <stdio.h> #include <stdlib.h> 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 <drm_fourcc.h> #include <math.h> #include <stdint.h> |