[llvm] [NFC] Check for defined(__GNUC__) before use (PR #116076)

David Truby via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 08:08:20 PST 2024


https://github.com/DavidTruby created https://github.com/llvm/llvm-project/pull/116076

This silences some spurious warnings on Windows builds that __GNUC__ is
not defined. These warnings make Windows builds very noisy.


>From c60741fb8eadd0d5462c34ffa7670faa995caf24 Mon Sep 17 00:00:00 2001
From: David Truby <david.truby at arm.com>
Date: Wed, 13 Nov 2024 16:06:31 +0000
Subject: [PATCH] [NFC] Check for defined(__GNUC__) before use

This silences some spurious warnings on Windows builds that __GNUC__ is
not defined. These warnings make Windows builds very noisy.
---
 llvm/include/llvm/ADT/iterator_range.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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