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

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 07:29:18 PST 2022


thakis created this revision.
thakis added reviewers: kubamracek, dvyukov.
Herald added subscribers: Enna1, dberris.
Herald added a project: All.
thakis requested review of this revision.

This would've helped find the bug mentioned in 9531fc37fb8b84e4 <https://reviews.llvm.org/rG9531fc37fb8b84e448144fc2318e28fa0654a47e>
faster.


https://reviews.llvm.org/D139432

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


Index: compiler-rt/cmake/config-ix.cmake
===================================================================
--- compiler-rt/cmake/config-ix.cmake
+++ compiler-rt/cmake/config-ix.cmake
@@ -271,6 +271,9 @@
 # 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139432.480486.patch
Type: text/x-patch
Size: 717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221206/ea6473f8/attachment.bin>


More information about the llvm-commits mailing list