diff options
author | David Robillard <d@drobilla.net> | 2022-04-22 16:42:41 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-04-23 21:18:56 -0400 |
commit | adc8d07a210adcea86024121b53f28170141dae4 (patch) | |
tree | 32e7ac406504eea060456261bad8223cc7c706e2 | |
parent | c7c45e1b7b32cb8a9cab173138e9ab7dedff2b12 (diff) | |
download | pugl-adc8d07a210adcea86024121b53f28170141dae4.tar.gz pugl-adc8d07a210adcea86024121b53f28170141dae4.tar.bz2 pugl-adc8d07a210adcea86024121b53f28170141dae4.zip |
Move reserved platform defines from code to build system
Numerous things warn about this, and it's generally a bad idea to put these in
the code since it can result in incompatibly compiled code being linked
together. Unfortunately this makes building manually (without the build
system) more fiddly, but such is life.
-rw-r--r-- | examples/file_utils.c | 4 | ||||
-rw-r--r-- | examples/meson.build | 14 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | src/.clang-tidy | 4 | ||||
-rw-r--r-- | src/x11.c | 4 | ||||
-rw-r--r-- | test/.clang-tidy | 1 | ||||
-rw-r--r-- | test/meson.build | 1 | ||||
-rw-r--r-- | test/test_utils.h | 2 |
8 files changed, 10 insertions, 22 deletions
diff --git a/examples/file_utils.c b/examples/file_utils.c index 3b7c530..f769dc6 100644 --- a/examples/file_utils.c +++ b/examples/file_utils.c @@ -1,10 +1,6 @@ // Copyright 2019-2020 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#if !defined(__APPLE__) && !defined(_GNU_SOURCE) -# define _GNU_SOURCE -#endif - #include "file_utils.h" #ifdef _WIN32 diff --git a/examples/meson.build b/examples/meson.build index b952c6b..d57fea4 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -34,6 +34,7 @@ if get_option('strict') example_c_args += [ '-Wno-float-equal', '-Wno-padded', + '-Wno-reserved-id-macro', ] elif cc.get_id() == 'gcc' example_c_args += [ @@ -54,7 +55,6 @@ if is_variable('cpp') '-Wno-documentation-unknown-command', # Cairo '-Wno-old-style-cast', '-Wno-padded', - '-Wno-reserved-id-macro', '-Wno-switch-enum', ] elif cpp.get_id() == 'gcc' @@ -80,18 +80,20 @@ if opengl_dep.found() source = [example] target = example.split('.')[0] dependencies = [gl_backend_dep] + defines = [] if target == 'pugl_shader_demo' source += ['file_utils.c', 'glad/glad.c'] dependencies += [dl_dep] + defines += ['-D_POSIX_C_SOURCE=200809L'] elif target == 'pugl_print_events' dependencies += [stub_backend_dep] endif executable(target, source, include_directories: includes, - c_args: example_defines + example_c_args, - cpp_args: example_defines + example_cpp_args, + c_args: example_defines + example_c_args + defines, + cpp_args: example_defines + example_cpp_args + defines, dependencies: dependencies) endforeach endif @@ -113,15 +115,17 @@ if vulkan_dep.found() source = [example] target = example.split('.')[0] dependencies = [dl_dep, vulkan_backend_dep] + defines = [] if target == 'pugl_vulkan_cpp_demo' source += ['file_utils.c'] + defines += ['-D_POSIX_C_SOURCE=200809L'] endif executable(target, source, include_directories: includes, - c_args: example_defines + example_c_args, - cpp_args: example_defines + example_cpp_args, + c_args: example_defines + example_c_args + defines, + cpp_args: example_defines + example_cpp_args + defines, dependencies: dependencies) endforeach endif diff --git a/meson.build b/meson.build index 8f7d3b0..9530cbf 100644 --- a/meson.build +++ b/meson.build @@ -45,7 +45,6 @@ if get_option('strict') '-Wno-documentation', # Cairo '-Wno-documentation-unknown-command', # Cairo '-Wno-padded', - '-Wno-reserved-id-macro', '-Wno-reserved-identifier', # Cairo, FD_ZERO '-Wno-switch-default', '-Wno-switch-enum', @@ -180,6 +179,7 @@ elif host_machine.system() == 'windows' else # X11 x11_dep = cc.find_library('X11') + core_args += '-D_POSIX_C_SOURCE=200809L' xcursor_dep = cc.find_library('Xcursor', required: false) if xcursor_dep.found() diff --git a/src/.clang-tidy b/src/.clang-tidy index 29f7e2e..981e098 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -4,10 +4,6 @@ Checks: > -*magic-numbers, -altera*, -bugprone-easily-swappable-parameters, - -bugprone-reserved-identifier, - -cert-dcl37-c, - -cert-dcl51-cpp, - -cert-flp30-c, -hicpp-multiway-paths-covered, -hicpp-signed-bitwise, -llvm-header-guard, @@ -3,10 +3,6 @@ // Copyright 2011-2012 Ben Loftis, Harrison Consoles // SPDX-License-Identifier: ISC -#ifndef _POSIX_C_SOURCE -# define _POSIX_C_SOURCE 199309L -#endif - #include "x11.h" #include "attributes.h" diff --git a/test/.clang-tidy b/test/.clang-tidy index 832c2d0..76de2d9 100644 --- a/test/.clang-tidy +++ b/test/.clang-tidy @@ -3,7 +3,6 @@ Checks: > -*-magic-numbers, -*-uppercase-literal-suffix, -altera*, - -bugprone-reserved-identifier, -bugprone-suspicious-include, -cert-dcl37-c, -cert-dcl51-cpp, diff --git a/test/meson.build b/test/meson.build index 9de43da..893d824 100644 --- a/test/meson.build +++ b/test/meson.build @@ -162,7 +162,6 @@ elif is_variable('cpp') if cpp.get_id() == 'clang' unified_args += [ '-Wno-old-style-cast', - '-Wno-reserved-id-macro', '-Wno-switch-default', '-Wno-switch-enum', '-Wno-unused-macros', # Mac diff --git a/test/test_utils.h b/test/test_utils.h index fc4c1e0..0108435 100644 --- a/test/test_utils.h +++ b/test/test_utils.h @@ -4,8 +4,6 @@ #ifndef TEST_TEST_UTILS_H #define TEST_TEST_UTILS_H -#define __STDC_FORMAT_MACROS 1 - #include "pugl/pugl.h" #include <inttypes.h> |