diff options
author | Alex Richardson <alexrichardson@google.com> | 2023-06-26 12:24:39 -0700 |
---|---|---|
committer | Alex Richardson <alexrichardson@google.com> | 2023-11-13 11:06:22 -0800 |
commit | dc298fecb79608e6628bd730ece42a6a77197a3c (patch) | |
tree | 2ff965dc9db726a643b2dd1bb99e323a725925bc | |
parent | 877226f01fb75d7989acfdcd5a86754f16fe5365 (diff) | |
download | llvm-dc298fecb79608e6628bd730ece42a6a77197a3c.zip llvm-dc298fecb79608e6628bd730ece42a6a77197a3c.tar.gz llvm-dc298fecb79608e6628bd730ece42a6a77197a3c.tar.bz2 |
[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
-rw-r--r-- | compiler-rt/cmake/builtin-config-ix.cmake | 1 | ||||
-rw-r--r-- | compiler-rt/lib/builtins/CMakeLists.txt | 1 | ||||
-rw-r--r-- | compiler-rt/test/builtins/lit.cfg.py | 7 |
3 files changed, 8 insertions, 1 deletions
diff --git a/compiler-rt/cmake/builtin-config-ix.cmake b/compiler-rt/cmake/builtin-config-ix.cmake index 5ccc5d7..b40138a 100644 --- a/compiler-rt/cmake/builtin-config-ix.cmake +++ b/compiler-rt/cmake/builtin-config-ix.cmake @@ -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 diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt index 360fdb0..069d33b 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -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) diff --git a/compiler-rt/test/builtins/lit.cfg.py b/compiler-rt/test/builtins/lit.cfg.py index 22fea26..508fe97 100644 --- a/compiler-rt/test/builtins/lit.cfg.py +++ b/compiler-rt/test/builtins/lit.cfg.py @@ -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( |