[mlir] Change deprecated -Werror-implicit-function-declaration to -Werror=implicit...
authorFangrui Song <i@maskray.me>
Thu, 5 Nov 2020 02:33:51 +0000 (18:33 -0800)
committerFangrui Song <i@maskray.me>
Thu, 5 Nov 2020 02:33:51 +0000 (18:33 -0800)
This -Werror- form has been deprecated since 2007 (GCC r122017).

And only enable it for CMAKE_C_FLAGS. C++ does not need it.

mlir/CMakeLists.txt

index 90cb422..0954eea 100644 (file)
@@ -12,7 +12,8 @@ include(AddMLIR)
 
 # Forbid implicit function declaration: this may lead to subtle bugs and we
 # don't have a reason to support this.
-add_flag_if_supported("-Werror-implicit-function-declaration" WERROR_IMPLICIT_FUNCTION_DECLARATION)
+check_c_compiler_flag("-Werror=implicit-function-declaration" C_SUPPORTS_WERROR_IMPLICIT_FUNCTION_DECLARATION)
+append_if(C_SUPPORTS_WERROR_IMPLICIT_FUNCTION_DECLARATION "-Werror=implicit-function-declaration" CMAKE_C_FLAGS)
 
 # Installing the headers and docs needs to depend on generating any public
 # tablegen'd targets.