Bug 1898499 - Rename building_with_gnu_cc into a more explicit name r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D211369
This commit is contained in:
serge-sans-paille
2024-05-24 10:26:49 +00:00
parent 2cf44dc031
commit 4b16ea5207
4 changed files with 26 additions and 22 deletions

View File

@@ -12,7 +12,7 @@ check_and_add_flag("-fno-sized-deallocation", compiler=cxx_compiler)
check_and_add_flag("-fno-aligned-new", compiler=cxx_compiler) check_and_add_flag("-fno-aligned-new", compiler=cxx_compiler)
with only_when(building_with_gnu_cc): with only_when(building_with_gnu_compatible_cc):
with only_when(~developer_options): with only_when(~developer_options):
add_flag("-ffunction-sections") add_flag("-ffunction-sections")
add_flag("-fdata-sections") add_flag("-fdata-sections")
@@ -185,12 +185,12 @@ def file_prefix_map_flags(path_remapping, path_remappings, compiler):
set_config("MOZ_FILE_PREFIX_MAP_FLAGS", file_prefix_map_flags) set_config("MOZ_FILE_PREFIX_MAP_FLAGS", file_prefix_map_flags)
@depends(developer_options, when=building_with_gnu_cc) @depends(developer_options, when=building_with_gnu_compatible_cc)
def check_build_id_uuid(developer_options): def check_build_id_uuid(developer_options):
return developer_options return developer_options
@depends(developer_options, when=building_with_gnu_cc) @depends(developer_options, when=building_with_gnu_compatible_cc)
def check_build_id_sha1(developer_options): def check_build_id_sha1(developer_options):
return not developer_options return not developer_options
@@ -200,28 +200,28 @@ check_and_add_flag("-pipe", when=building_with_gcc)
check_and_add_linker_flag("-Wl,--build-id=uuid", when=check_build_id_uuid) check_and_add_linker_flag("-Wl,--build-id=uuid", when=check_build_id_uuid)
check_and_add_linker_flag("-Wl,--build-id=sha1", when=check_build_id_sha1) check_and_add_linker_flag("-Wl,--build-id=sha1", when=check_build_id_sha1)
check_and_add_asm_flag("-Wa,--noexecstack", when=building_with_gnu_cc) check_and_add_asm_flag("-Wa,--noexecstack", when=building_with_gnu_compatible_cc)
check_and_add_linker_flag("-Wl,-z,noexecstack", when=building_with_gnu_cc) check_and_add_linker_flag("-Wl,-z,noexecstack", when=building_with_gnu_compatible_cc)
check_and_add_linker_flag("-Wl,-z,text", when=building_with_gnu_cc) check_and_add_linker_flag("-Wl,-z,text", when=building_with_gnu_compatible_cc)
check_and_add_linker_flag("-Wl,-z,relro", when=building_with_gnu_cc) check_and_add_linker_flag("-Wl,-z,relro", when=building_with_gnu_compatible_cc)
check_and_add_linker_flag("-Wl,-z,now", when=building_with_gnu_cc) check_and_add_linker_flag("-Wl,-z,now", when=building_with_gnu_compatible_cc)
check_and_add_linker_flag("-Wl,-z,nocopyreloc", when=building_with_gnu_cc) check_and_add_linker_flag("-Wl,-z,nocopyreloc", when=building_with_gnu_compatible_cc)
check_and_add_linker_optimize_flag("-Wl,-dead_strip", when=target_is_darwin & ~dtrace) check_and_add_linker_optimize_flag("-Wl,-dead_strip", when=target_is_darwin & ~dtrace)
have_linker_support_ignore_unresolved = try_link( have_linker_support_ignore_unresolved = try_link(
flags=["-Wl,--ignore-unresolved-symbol,environ"], flags=["-Wl,--ignore-unresolved-symbol,environ"],
check_msg="for --ignore-unresolved-symbol option to the linker", check_msg="for --ignore-unresolved-symbol option to the linker",
when=building_with_gnu_cc & gcc_use_gnu_ld, when=building_with_gnu_compatible_cc & gcc_use_gnu_ld,
) )
add_old_configure_assignment( add_old_configure_assignment(
"HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED", have_linker_support_ignore_unresolved "HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED", have_linker_support_ignore_unresolved
) )
@depends("--enable-address-sanitizer", building_with_gnu_cc) @depends("--enable-address-sanitizer", building_with_gnu_compatible_cc)
def check_Bsymbolic(enable_asan, building_with_gnu_cc): def check_Bsymbolic(enable_asan, building_with_gnu_compatible_cc):
return enable_asan and building_with_gnu_cc return enable_asan and building_with_gnu_compatible_cc
# ASan assumes no symbols are being interposed, and when that happens, # ASan assumes no symbols are being interposed, and when that happens,

View File

@@ -14,7 +14,7 @@ def check_clock_monotonic_support(lib=None, when=None):
check_msg += f" in {lib}" check_msg += f" in {lib}"
flags.append(f"-l{lib}") flags.append(f"-l{lib}")
check_when = building_with_gnu_cc check_when = building_with_gnu_compatible_cc
if when is not None: if when is not None:
check_when &= when check_when &= when
@@ -49,7 +49,7 @@ have_res_ninit = try_link(
body="int foo = res_ninit(&_res);", body="int foo = res_ninit(&_res);",
check_msg="for res_ninit()", check_msg="for res_ninit()",
flags=depends(when=building_linux)(["-D_BSD_SOURCE=1"]), flags=depends(when=building_linux)(["-D_BSD_SOURCE=1"]),
when=building_with_gnu_cc & ~target_is_netbsd & ~target_is_openbsd, when=building_with_gnu_compatible_cc & ~target_is_netbsd & ~target_is_openbsd,
) )
set_define("HAVE_RES_NINIT", have_res_ninit) set_define("HAVE_RES_NINIT", have_res_ninit)
@@ -59,7 +59,7 @@ set_define("HAVE_RES_NINIT", have_res_ninit)
# We don't want to link against libm or libpthread on Darwin since # We don't want to link against libm or libpthread on Darwin since
# they both are just symlinks to libSystem and explicitly linking # they both are just symlinks to libSystem and explicitly linking
# against libSystem causes issues when debugging (see bug 299601). # against libSystem causes issues when debugging (see bug 299601).
with only_when(building_with_gnu_cc): with only_when(building_with_gnu_compatible_cc):
dladdr_check = check_symbol_in_libs([None, "dl"], symbol="dladdr") dladdr_check = check_symbol_in_libs([None, "dl"], symbol="dladdr")
set_define( set_define(
"HAVE_DLADDR", depends(dladdr_check)(lambda check: "1" if check.found else "0") "HAVE_DLADDR", depends(dladdr_check)(lambda check: "1" if check.found else "0")
@@ -77,13 +77,15 @@ set_config(
"C_R_LIBS", "C_R_LIBS",
["-lc_r"], ["-lc_r"],
when=check_symbol_in_lib( when=check_symbol_in_lib(
"c_r", symbol="gethostbyname_r", when=building_with_gnu_cc "c_r", symbol="gethostbyname_r", when=building_with_gnu_compatible_cc
), ),
) )
set_config( set_config(
"SOCKET_LIBS", "SOCKET_LIBS",
["-lsocket"], ["-lsocket"],
when=check_symbol_in_lib("socket", symbol="socket", when=building_with_gnu_cc), when=check_symbol_in_lib(
"socket", symbol="socket", when=building_with_gnu_compatible_cc
),
) )
moz_use_pthreads = ( moz_use_pthreads = (
@@ -91,7 +93,7 @@ moz_use_pthreads = (
| check_symbol_in_libs( | check_symbol_in_libs(
[None, "pthread"], [None, "pthread"],
symbol="pthread_create", symbol="pthread_create",
when=building_with_gnu_cc & ~target_is_darwin, when=building_with_gnu_compatible_cc & ~target_is_darwin,
).found ).found
) )
@@ -116,7 +118,7 @@ with only_when(moz_use_pthreads):
set_config("MOZ_USE_PTHREADS", True) set_config("MOZ_USE_PTHREADS", True)
with only_when(building_with_gnu_cc): with only_when(building_with_gnu_compatible_cc):
@template @template
def check_std_atomic_requirements(flag=None, when=None): def check_std_atomic_requirements(flag=None, when=None):

View File

@@ -1724,7 +1724,9 @@ host_windows_abi = windows_abi(host, host_c_compiler)
# Generic compiler-based conditions. # Generic compiler-based conditions.
building_with_gcc = depends(c_compiler)(lambda info: info.type == "gcc") building_with_gcc = depends(c_compiler)(lambda info: info.type == "gcc")
building_with_gnu_cc = depends(c_compiler)(lambda info: info.type != "clang-cl") building_with_gnu_compatible_cc = depends(c_compiler)(
lambda info: info.type != "clang-cl"
)
@depends(cxx_compiler, ccache_prefix) @depends(cxx_compiler, ccache_prefix)

View File

@@ -1471,7 +1471,7 @@ with only_when(compile_environment & depends(target.os)(lambda os: os != "WINNT"
includes=["langinfo.h"], includes=["langinfo.h"],
body="char* cs = nl_langinfo(CODESET);", body="char* cs = nl_langinfo(CODESET);",
check_msg="for nl_langinfo and CODESET", check_msg="for nl_langinfo and CODESET",
when=building_with_gnu_cc, when=building_with_gnu_compatible_cc,
), ),
) )