From: River Riddle Date: Fri, 10 Apr 2020 19:57:18 +0000 (-0700) Subject: [mlir] Emit errors if global constructors are found within lib/ X-Git-Tag: llvmorg-12-init~9394 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3db57d14ecf55efd86cd3007dc755d27669e7828;p=platform%2Fupstream%2Fllvm.git [mlir] Emit errors if global constructors are found within lib/ Summary: This avoids adding any additional global constructors, like cl::opt. There is a temporary exception on IR/, which has a few cl::opts that require a bit of plumbing to remove. Differential Revision: https://reviews.llvm.org/D77824 --- diff --git a/mlir/lib/CMakeLists.txt b/mlir/lib/CMakeLists.txt index c51e780..c139231 100644 --- a/mlir/lib/CMakeLists.txt +++ b/mlir/lib/CMakeLists.txt @@ -1,3 +1,6 @@ +# Enable errors for any global constructors. +add_flag_if_supported("-Werror=global-constructors" WERROR_GLOBAL_CONSTRUCTOR) + add_subdirectory(Analysis) add_subdirectory(Conversion) add_subdirectory(Dialect) diff --git a/mlir/lib/IR/CMakeLists.txt b/mlir/lib/IR/CMakeLists.txt index 64998e4..c5dc2d2 100644 --- a/mlir/lib/IR/CMakeLists.txt +++ b/mlir/lib/IR/CMakeLists.txt @@ -1,3 +1,6 @@ +# TODO: Remove the need for global constructors within IR/ +add_flag_if_supported("-Wno-global-constructors" WNO_GLOBAL_CONSTRUCTOR_MLIR_IR) + file(GLOB globbed *.c *.cpp) add_mlir_library(MLIRIR ${globbed}