[Mlir-commits] [mlir] [mlir] Silence warnings on unit tests on Windows (PR #191559)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Apr 10 15:52:31 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Alexandre Ganea (aganea)
<details>
<summary>Changes</summary>
MLIR unit tests use `-Wundef`; gtest headers reference macros that may be unset:
```
warning: 'GTEST_LINKED_AS_SHARED_LIBRARY' is not defined, evaluates to 0 [-Wundef]
```
---
Full diff: https://github.com/llvm/llvm-project/pull/191559.diff
1 Files Affected:
- (modified) mlir/unittests/CMakeLists.txt (+5-2)
``````````diff
diff --git a/mlir/unittests/CMakeLists.txt b/mlir/unittests/CMakeLists.txt
index 89332bce5fe05..0a18dc36b923a 100644
--- a/mlir/unittests/CMakeLists.txt
+++ b/mlir/unittests/CMakeLists.txt
@@ -1,5 +1,8 @@
-# To silence warning caused by Wundef.
-add_definitions(-DGTEST_NO_LLVM_SUPPORT=0)
+# To silence warnings caused by -Wundef in gtest/gmock headers.
+add_definitions(
+ -DGTEST_NO_LLVM_SUPPORT=0
+ -DGTEST_LINKED_AS_SHARED_LIBRARY=0
+ -DGTEST_CREATE_SHARED_LIBRARY=0)
function(add_mlir_unittest test_dirname)
add_unittest(MLIRUnitTests ${test_dirname} ${ARGN})
``````````
</details>
https://github.com/llvm/llvm-project/pull/191559
More information about the Mlir-commits
mailing list