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 fa3dd08fca
commit 869f6f9bc2
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)
with only_when(building_with_gnu_cc):
with only_when(building_with_gnu_compatible_cc):
with only_when(~developer_options):
add_flag("-ffunction-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)
@depends(developer_options, when=building_with_gnu_cc)
@depends(developer_options, when=building_with_gnu_compatible_cc)
def check_build_id_uuid(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):
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=sha1", when=check_build_id_sha1)
check_and_add_asm_flag("-Wa,--noexecstack", when=building_with_gnu_cc)
check_and_add_linker_flag("-Wl,-z,noexecstack", when=building_with_gnu_cc)
check_and_add_linker_flag("-Wl,-z,text", when=building_with_gnu_cc)
check_and_add_linker_flag("-Wl,-z,relro", when=building_with_gnu_cc)
check_and_add_linker_flag("-Wl,-z,now", when=building_with_gnu_cc)
check_and_add_linker_flag("-Wl,-z,nocopyreloc", 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_compatible_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_compatible_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_compatible_cc)
check_and_add_linker_optimize_flag("-Wl,-dead_strip", when=target_is_darwin & ~dtrace)
have_linker_support_ignore_unresolved = try_link(
flags=["-Wl,--ignore-unresolved-symbol,environ"],
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(
"HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED", have_linker_support_ignore_unresolved
)
@depends("--enable-address-sanitizer", building_with_gnu_cc)
def check_Bsymbolic(enable_asan, building_with_gnu_cc):
return enable_asan and building_with_gnu_cc
@depends("--enable-address-sanitizer", building_with_gnu_compatible_cc)
def check_Bsymbolic(enable_asan, building_with_gnu_compatible_cc):
return enable_asan and building_with_gnu_compatible_cc
# 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}"
flags.append(f"-l{lib}")
check_when = building_with_gnu_cc
check_when = building_with_gnu_compatible_cc
if when is not None:
check_when &= when
@ -49,7 +49,7 @@ have_res_ninit = try_link(
body="int foo = res_ninit(&_res);",
check_msg="for res_ninit()",
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)
@ -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
# they both are just symlinks to libSystem and explicitly linking
# 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")
set_define(
"HAVE_DLADDR", depends(dladdr_check)(lambda check: "1" if check.found else "0")
@ -77,13 +77,15 @@ set_config(
"C_R_LIBS",
["-lc_r"],
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(
"SOCKET_LIBS",
["-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 = (
@ -91,7 +93,7 @@ moz_use_pthreads = (
| check_symbol_in_libs(
[None, "pthread"],
symbol="pthread_create",
when=building_with_gnu_cc & ~target_is_darwin,
when=building_with_gnu_compatible_cc & ~target_is_darwin,
).found
)
@ -116,7 +118,7 @@ with only_when(moz_use_pthreads):
set_config("MOZ_USE_PTHREADS", True)
with only_when(building_with_gnu_cc):
with only_when(building_with_gnu_compatible_cc):
@template
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.
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)

View File

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