From 50679dba044f37ed4aeae5c6b58550baefe968dd Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 6 Jul 2020 11:25:32 +0100 Subject: [PATCH] build: Add feature test flags to project-wide preprocessor flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rather than defining them piecemeal in each C and H file, and having problems with headers being included in different orders so that `_POSIX_C_SOURCE` gets a value which is too low, just define the feature test flags in `meson.build`. See `man 7 feature_test_macros`. This is useful for when building sysprof as a subproject beneath a project which doesn’t define these macros, or which targets an older C standard than `gnu11`. Signed-off-by: Philip Withnall --- meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index e1e9b42d..26f289f0 100644 --- a/meson.build +++ b/meson.build @@ -87,7 +87,10 @@ add_project_arguments([ '-I' + meson.build_root(), # config.h ], language: 'c') -global_c_args = [] +global_c_args = [ + '-D_GNU_SOURCE', + '-D_POSIX_C_SOURCE=200809L', +] test_c_args = [ '-Wcast-align', '-Wdeclaration-after-statement',