[PATCH] D19692: [CMake] NFC. Add support for testing the compiler without testing the linker

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 11:45:01 PDT 2016


rnk added a subscriber: rnk.

================
Comment at: compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake:55
@@ +54,3 @@
+  set(${output} ${result} PARENT_SCOPE)
+  if(${result})
+    message(STATUS "Performing Test ${output} - Success")
----------------
Trusting the return code of the compiler is a bit naive. Upstream cmake tests all of the following messages to find unsupported flags:
```
macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
   set(${_VAR}
     FAIL_REGEX "[Uu]nrecogni[sz]ed .*option"               # GNU, NAG
     FAIL_REGEX "unknown .*option"                          # Clang
     FAIL_REGEX "optimization flag .* not supported"        # Clang
     FAIL_REGEX "unknown argument ignored"                  # Clang (cl)
     FAIL_REGEX "ignoring unknown option"                   # MSVC, Intel
     FAIL_REGEX "warning D9002"                             # MSVC, any lang
     FAIL_REGEX "option.*not supported"                     # Intel
     FAIL_REGEX "invalid argument .*option"                 # Intel
     FAIL_REGEX "ignoring option .*argument required"       # Intel
     FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel
     FAIL_REGEX "[Uu]nknown option"                         # HP
     FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
     FAIL_REGEX "command option .* is not recognized"       # XL
     FAIL_REGEX "command option .* contains an incorrect subargument" # XL
     FAIL_REGEX "not supported in this configuration. ignored"       # AIX
     FAIL_REGEX "File with unknown suffix passed to linker" # PGI
     FAIL_REGEX "[Uu]nknown switch"                         # PGI
     FAIL_REGEX "WARNING: unknown flag:"                    # Open64
     FAIL_REGEX "Incorrect command line option:"            # Borland
     FAIL_REGEX "Warning: illegal option"                   # SunStudio 12
     FAIL_REGEX "[Ww]arning: Invalid suboption"             # Fujitsu
   )
endmacro ()
```

We don't support most of those compilers, but we do support MSVC, which ignores unknown flags, so we need to do something here.


Repository:
  rL LLVM

https://reviews.llvm.org/D19692





More information about the llvm-commits mailing list