mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 10:42:11 +01:00
build: Add variable to check if a GNU C compiler is used
This applies to both gcc and clang, without having to repeat the same check multiple times and involving strings
This commit is contained in:
parent
589c8295ea
commit
3bba0adcc1
@ -567,8 +567,10 @@ foreach m : struct_members
|
|||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
glib_gnu_cc_compiler = cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
||||||
|
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
if glib_gnu_cc_compiler
|
||||||
warning_common_args = [
|
warning_common_args = [
|
||||||
'-Wduplicated-branches',
|
'-Wduplicated-branches',
|
||||||
'-Wfloat-conversion',
|
'-Wfloat-conversion',
|
||||||
@ -1784,7 +1786,7 @@ g_sizet_compatibility = {
|
|||||||
# Do separate checks for gcc/clang (and ignore other compilers for now), since
|
# Do separate checks for gcc/clang (and ignore other compilers for now), since
|
||||||
# we need to explicitly pass -Werror to the compilers.
|
# we need to explicitly pass -Werror to the compilers.
|
||||||
# FIXME: https://github.com/mesonbuild/meson/issues/5399
|
# 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
|
foreach type_name, size_compatibility : g_sizet_compatibility
|
||||||
g_sizet_compatibility += { type_name: size_compatibility and
|
g_sizet_compatibility += { type_name: size_compatibility and
|
||||||
cc.compiles(
|
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)
|
glib_conf.set('__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4', true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
if glib_gnu_cc_compiler
|
||||||
sync_swap_test = '''
|
sync_swap_test = '''
|
||||||
int main() {
|
int main() {
|
||||||
int atomic = 2;
|
int atomic = 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user