[Mlir-commits] [mlir] 3bed2a7 - Build MLIR with -Werror=mismatched-tags (NFC)

Mehdi Amini llvmlistbot at llvm.org
Tue Dec 7 21:59:18 PST 2021


Author: Mehdi Amini
Date: 2021-12-08T05:59:06Z
New Revision: 3bed2a7212ceef611d74c9a2aa679cec31375cee

URL: https://github.com/llvm/llvm-project/commit/3bed2a7212ceef611d74c9a2aa679cec31375cee
DIFF: https://github.com/llvm/llvm-project/commit/3bed2a7212ceef611d74c9a2aa679cec31375cee.diff

LOG: Build MLIR with -Werror=mismatched-tags (NFC)

This is a defensive action to catch at build time on Linux failures that
may happen only on Windows otherwise.

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

Added: 
    

Modified: 
    mlir/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 6be0b35338c05..28018350cb43d 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -48,6 +48,13 @@ endif()
 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)
 
+# Forbid mismatch between declaration and definition for class vs struct. This is
+# harmless on Unix systems, but it'll be a ticking bomb for MSVC/Windows systems
+# where it creeps into the ABI.
+check_c_compiler_flag("-Werror=mismatched-tags" C_SUPPORTS_WERROR_MISMATCHED_TAGS)
+append_if(C_SUPPORTS_WERROR_MISMATCHED_TAGS "-Werror=mismatched-tags" CMAKE_C_FLAGS)
+append_if(C_SUPPORTS_WERROR_MISMATCHED_TAGS "-Werror=mismatched-tags" CMAKE_CXX_FLAGS)
+
 # Installing the headers and docs needs to depend on generating any public
 # tablegen'd targets.
 # mlir-generic-headers are dialect-independent.


        


More information about the Mlir-commits mailing list