sarif-sink.cc printed a size_t with %li, which -Wformat rejects on
LLP64 hosts. Use %zu.
digraphs-to-dot-from-cfg.cc uses pp_printf to build dot labels, not
diagnostics, so -Wformat-diag's style rules do not apply. Disable the
warning for the file, as other dumping code does.
gcc/ChangeLog:
* diagnostics/sarif-sink.cc: Print content_length with %zu.
* diagnostics/digraphs-to-dot-from-cfg.cc: Disable -Wformat-diag.
Signed-off-by: Oleg Tolmatcev <[email protected]>
---
gcc/diagnostics/digraphs-to-dot-from-cfg.cc | 10 ++++++++++
gcc/diagnostics/sarif-sink.cc | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/gcc/diagnostics/digraphs-to-dot-from-cfg.cc
b/gcc/diagnostics/digraphs-to-dot-from-cfg.cc
index 35090d71dc..68d1089a7e 100644
--- a/gcc/diagnostics/digraphs-to-dot-from-cfg.cc
+++ b/gcc/diagnostics/digraphs-to-dot-from-cfg.cc
@@ -37,6 +37,12 @@ along with GCC; see the file COPYING3. If not see
#include "selftest.h"
+/* Disable -Wformat-diag; pp_printf here builds dot labels, not diagnostics.
*/
+#if __GNUC__ >= 10
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
namespace diagnostics {
namespace digraphs {
namespace to_dot {
@@ -321,3 +327,7 @@ make_converter_from_cfg ()
} // namespace to_dot
} // namespace digraphs
} // namespace diagnostics
+
+#if __GNUC__ >= 10
+# pragma GCC diagnostic pop
+#endif
diff --git a/gcc/diagnostics/sarif-sink.cc b/gcc/diagnostics/sarif-sink.cc
index fad4e5cde8..7129f03010 100644
--- a/gcc/diagnostics/sarif-sink.cc
+++ b/gcc/diagnostics/sarif-sink.cc
@@ -4274,7 +4274,7 @@ private:
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wformat-diag"
#endif
- pp_printf (&pp_header, "Content-Length: %li\n\n", content_length);
+ pp_printf (&pp_header, "Content-Length: %zu\n\n", content_length);
#if __GNUC__ >= 10
# pragma GCC diagnostic pop
#endif
--
2.56.0.windows.4