[builtins] Build with -Wbuiltin-declaration-mismatch if supported
GCC is able to check that the signatures of the builtins are as expected and this shows some incorrect signatures on ld80 platforms (i.e. x86). The *tf* functions should take 128-bit arguments but until the latest fixes they used 80-bit long double. Differential Revision: https://reviews.llvm.org/D153814
This commit is contained in:
@@ -18,6 +18,7 @@ builtin_check_c_compiler_flag(-fno-profile-generate COMPILER_RT_HAS_FNO_PROFILE_
|
||||
builtin_check_c_compiler_flag(-fno-profile-instr-generate COMPILER_RT_HAS_FNO_PROFILE_INSTR_GENERATE_FLAG)
|
||||
builtin_check_c_compiler_flag(-fno-profile-instr-use COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG)
|
||||
builtin_check_c_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)
|
||||
builtin_check_c_compiler_flag(-Wbuiltin-declaration-mismatch COMPILER_RT_HAS_WBUILTIN_DECLARATION_MISMATCH_FLAG)
|
||||
builtin_check_c_compiler_flag(/Zl COMPILER_RT_HAS_ZL_FLAG)
|
||||
|
||||
builtin_check_c_compiler_source(COMPILER_RT_HAS_ATOMIC_KEYWORD
|
||||
|
||||
@@ -760,6 +760,7 @@ else ()
|
||||
endif()
|
||||
|
||||
append_list_if(COMPILER_RT_HAS_STD_C11_FLAG -std=c11 BUILTIN_CFLAGS)
|
||||
append_list_if(COMPILER_RT_HAS_WBUILTIN_DECLARATION_MISMATCH_FLAG -Werror=builtin-declaration-mismatch BUILTIN_CFLAGS)
|
||||
|
||||
# Don't embed directives for picking any specific CRT
|
||||
if (MSVC)
|
||||
|
||||
@@ -10,9 +10,14 @@ config.test_source_root = os.path.dirname(__file__)
|
||||
|
||||
# Test suffixes.
|
||||
config.suffixes = [".c", ".cpp", ".m", ".mm"]
|
||||
extra_flags = ['-Wall']
|
||||
if config.compiler_id == "GNU":
|
||||
# detect incorrect declarations of libgcc functions
|
||||
extra_flags.append("-Werror=builtin-declaration-mismatch")
|
||||
|
||||
|
||||
# Define %clang and %clangxx substitutions to use in test RUN lines.
|
||||
config.substitutions.append(("%clang ", " " + config.clang + " "))
|
||||
config.substitutions.append(("%clang ", " " + config.clang + " " + " ".join(extra_flags)))
|
||||
|
||||
if config.host_os == "Darwin":
|
||||
config.substitutions.append(
|
||||
|
||||
Reference in New Issue
Block a user