[llvm] 8781a43 - [NFC] Check for defined(__GNUC__) before use (#116076)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 05:45:41 PST 2024


Author: David Truby
Date: 2024-11-14T13:45:38Z
New Revision: 8781a4320c9b0ef00d1907341cf347759b9a822d

URL: https://github.com/llvm/llvm-project/commit/8781a4320c9b0ef00d1907341cf347759b9a822d
DIFF: https://github.com/llvm/llvm-project/commit/8781a4320c9b0ef00d1907341cf347759b9a822d.diff

LOG: [NFC] Check for defined(__GNUC__) before use (#116076)

This silences some spurious warnings on Windows builds with clang-cl
that `__GNUC__` is not defined if `-Wundef` is passed, which is the default 
in MLIR. 
These warnings make Windows builds of LLVM very noisy when MLIR is
included.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/iterator_range.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/iterator_range.h b/llvm/include/llvm/ADT/iterator_range.h
index 6c66def0fcd77b..8e9b22f2d4dfa7 100644
--- a/llvm/include/llvm/ADT/iterator_range.h
+++ b/llvm/include/llvm/ADT/iterator_range.h
@@ -43,7 +43,8 @@ class iterator_range {
   IteratorT begin_iterator, end_iterator;
 
 public:
-#if __GNUC__ == 7 || (__GNUC__ == 8 && __GNUC_MINOR__ < 4)
+#if defined(__GNUC__) &&                                                       \
+    (__GNUC__ == 7 || (__GNUC__ == 8 && __GNUC_MINOR__ < 4))
   // Be careful no to break gcc-7 and gcc-8 < 8.4 on the mlir target.
   // See https://github.com/llvm/llvm-project/issues/63843
   template <typename Container>


        


More information about the llvm-commits mailing list