diff --git a/meson.build b/meson.build index 484e7e8ed..0744164f3 100644 --- a/meson.build +++ b/meson.build @@ -567,8 +567,10 @@ foreach m : struct_members endif endforeach +glib_gnu_cc_compiler = cc.get_id() == 'gcc' or cc.get_id() == 'clang' + # Compiler flags -if cc.get_id() == 'gcc' or cc.get_id() == 'clang' +if glib_gnu_cc_compiler warning_common_args = [ '-Wduplicated-branches', '-Wfloat-conversion', @@ -1784,7 +1786,7 @@ g_sizet_compatibility = { # Do separate checks for gcc/clang (and ignore other compilers for now), since # we need to explicitly pass -Werror to the compilers. # FIXME: https://github.com/mesonbuild/meson/issues/5399 -if cc.get_id() == 'gcc' or cc.get_id() == 'clang' +if glib_gnu_cc_compiler foreach type_name, size_compatibility : g_sizet_compatibility g_sizet_compatibility += { type_name: size_compatibility and cc.compiles( @@ -2082,7 +2084,7 @@ if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' or cc.links(atomictest, na glib_conf.set('__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4', true) endif - if cc.get_id() == 'gcc' or cc.get_id() == 'clang' + if glib_gnu_cc_compiler sync_swap_test = ''' int main() { int atomic = 2;