[compiler-rt] 4b88fdb - [compiler-rt] Make get_test_cc_for_arch() complain on accidental extra args

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 05:34:37 PST 2022


Author: Nico Weber
Date: 2022-12-07T08:34:20-05:00
New Revision: 4b88fdbdc7182c2f336ae0b4b2d69a55535294ac

URL: https://github.com/llvm/llvm-project/commit/4b88fdbdc7182c2f336ae0b4b2d69a55535294ac
DIFF: https://github.com/llvm/llvm-project/commit/4b88fdbdc7182c2f336ae0b4b2d69a55535294ac.diff

LOG: [compiler-rt] Make get_test_cc_for_arch() complain on accidental extra args

This would've helped find the bug mentioned in 9531fc37fb8b84e4
faster.

Differential Revision: https://reviews.llvm.org/D139432

Added: 
    

Modified: 
    compiler-rt/cmake/config-ix.cmake

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index fd7daa50bdd99..3f2d38c010bb2 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -271,6 +271,9 @@ endfunction()
 # specific architecture.  When cross-compiling, this is controled via
 # COMPILER_RT_TEST_COMPILER and COMPILER_RT_TEST_COMPILER_CFLAGS.
 macro(get_test_cc_for_arch arch cc_out cflags_out)
+  if (NOT ${ARGC} EQUAL 3)
+    message(FATAL_ERROR "got too many args. expected 3, got ${ARGC} (namely: ${ARGV})")
+  endif()
   if(ANDROID OR (NOT APPLE AND ${arch} MATCHES "arm|aarch64|riscv32|riscv64"))
     # This is only true if we are cross-compiling.
     # Build all tests with host compiler and use host tools.


        


More information about the llvm-commits mailing list