Now with attached commit log/patch.
On 9/23/20 11:12 AM, Tobias Burnus wrote:
Do what most other code does (I think ada/* does not):
Only set this pragma with GCC >= 10. This silences here
228 warnings of the kind:
analyzer.h:305:32: warning: unknown option after '#pragma GCC
diagnostic' kind [-Wpragmas]
Tobias
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander
Walter
commit 5253b3e6deda1caa9432f5ac56e78bd999fb9f85
Author: Tobias Burnus <tob...@codesourcery.com>
Date: Wed Sep 23 11:07:40 2020 +0200
gcc/analyzer: Silence -Wpragma warns with GCC < 10
gcc/analyzer/ChangeLog:
* analyzer-logging.cc: Guard '#pragma ... ignored "-Wformat-diag"'
by '#if __GNUC__ >= 10'
* analyzer.h: Likewise.
* call-string.cc: Likewise.
diff --git a/gcc/analyzer/analyzer-logging.cc b/gcc/analyzer/analyzer-logging.cc
index d2bbd05d323..583840ab25a 100644
--- a/gcc/analyzer/analyzer-logging.cc
+++ b/gcc/analyzer/analyzer-logging.cc
@@ -30,7 +30,9 @@ along with GCC; see the file COPYING3. If not see
#if ENABLE_ANALYZER
+#if __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
namespace ana {
diff --git a/gcc/analyzer/analyzer.h b/gcc/analyzer/analyzer.h
index d234fcf47e7..b85edb15c7c 100644
--- a/gcc/analyzer/analyzer.h
+++ b/gcc/analyzer/analyzer.h
@@ -301,7 +301,8 @@ private:
/* Disable -Wformat-diag; we want to be able to use pp_printf
for logging/dumping without complying with the rules for diagnostics. */
-
+#if __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
#endif /* GCC_ANALYZER_ANALYZER_H */
diff --git a/gcc/analyzer/call-string.cc b/gcc/analyzer/call-string.cc
index 72568c6efa7..8dfd1577585 100644
--- a/gcc/analyzer/call-string.cc
+++ b/gcc/analyzer/call-string.cc
@@ -39,7 +39,9 @@ along with GCC; see the file COPYING3. If not see
#if ENABLE_ANALYZER
+#if __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
/* class call_string. */