From 7c9a19479be7f104061053620c487b6d754f9526 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Thu, 4 Sep 2025 21:49:52 +0200 Subject: [PATCH] Check that -Wno-gnu compiler flag is supported before using Very old compilers, such as gcc 4.2.1 on OSX Snow Leopard / PowerPC, will error out when encountering this unsupported flag Additionally, use this flag only when building bsting with unit test support, since the non-standard code warnings that we silence with this flag lies in libcheck that we link with --- meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 1a3276f..539f148 100644 --- a/meson.build +++ b/meson.build @@ -5,10 +5,13 @@ pkg = import('pkgconfig') add_project_arguments('-pedantic', language: 'c') add_project_arguments('-Wstrict-prototypes', language: 'c') add_project_arguments('-Wcast-align', language: 'c') -add_project_arguments('-Wno-gnu', language: 'c') add_project_arguments('-fno-common', language: 'c') add_project_arguments('-fvisibility=hidden', language: 'c') +if get_option('enable-tests') and cc.has_argument('-Wno-gnu') + add_project_arguments('-Wno-gnu', language: 'c') +endif + bstring_inc = include_directories(['.', 'bstring']) bgets_test_code = '''