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.
This commit is contained in:
Simon Ser 2024-02-15 15:34:49 +01:00
parent efa706b769
commit 842093bb84
115 changed files with 12 additions and 139 deletions

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <errno.h>
#include <stdlib.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <drm_fourcc.h>
#include <stdlib.h>
#include <stdio.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <drm_fourcc.h>
#include <drm_mode.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <fcntl.h>
#include <libliftoff.h>
#include <sys/stat.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <drm_fourcc.h>
#include <drm_mode.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <libinput.h>
#include <stdlib.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <string.h>
#include <libinput.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <string.h>
#include <assert.h>
#include <libinput.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200112L
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <libudev.h>
#include <stdarg.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <fcntl.h>
#include <limits.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 199309L
#include <assert.h>
#include <stdint.h>
#include <stdio.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <stdlib.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <stdint.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <math.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <fcntl.h>
#include <limits.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <stdlib.h>