]> granicus.if.org Git - llvm/commitdiff
Build LLVM with -Wstrict-prototypes enabled
authorAlex Lorenz <arphaman@gmail.com>
Thu, 31 Aug 2017 13:23:24 +0000 (13:23 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Thu, 31 Aug 2017 13:23:24 +0000 (13:23 +0000)
Clang 5 supports -Wstrict-prototypes. We should use it to catch any C
declarations that declare a non-prototype function.

rdar://33705313

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312240 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/HandleLLVMOptions.cmake

index 868061400231e5198b289354fcde53607e6cc0e5..a293dde149911f85f7d6644bb20884410fabe132 100644 (file)
@@ -581,6 +581,8 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
 
   # Enable -Wstring-conversion to catch misuse of string literals.
   add_flag_if_supported("-Wstring-conversion" STRING_CONVERSION_FLAG)
+  # Enable -Wstrict-prototypes to catch incorrectly declared functions in C.
+  add_flag_if_supported("-Wstrict-prototypes" STRICT_PROTOTYPES_FLAG)
 endif (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
 
 if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT LLVM_ENABLE_WARNINGS)