aboutsummaryrefslogtreecommitdiffstats
path: root/meta-mentor-staging/meta-java/recipes-core/openjdk/openjdk-8/0001-PR3597-Potential-bogus-Wformat-overflow-warning-with.patch
blob: 6320cdd584a9894005393bd0b2287a7b415cf940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 7efbc09cf4fb6aa9c081974d378d503c8bb0745e Mon Sep 17 00:00:00 2001
From: Christopher Larson <chris_larson@mentor.com>
Date: Mon, 5 Nov 2018 21:01:47 +0500
Subject: [PATCH] PR3597: Potential bogus -Wformat-overflow warning with
 -Wformat enabled

2018-05-29 Andrew John Hughes <gnu_andrew@member.fsf.org>

PR3597: Potential bogus -Wformat-overflow warning
with -Wformat enabled
* Makefile.am:
* (ICEDTEA_PATCHES): Add patch.
* * NEWS: Updated.
* * patches/pr3597.patch:
* Disable -Wformat-overflow on the
* the build_pipe_classes function with GCC >= 7 as it
* produces apparent false positives.

Patch pulled from the icedtea project.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
 hotspot/src/share/vm/adlc/adlc.hpp     | 13 +++++++++++++
 hotspot/src/share/vm/adlc/output_c.cpp |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/hotspot/src/share/vm/adlc/adlc.hpp b/hotspot/src/share/vm/adlc/adlc.hpp
index 8d48ed60..48a226ae 100644
--- a/hotspot/src/share/vm/adlc/adlc.hpp
+++ b/hotspot/src/share/vm/adlc/adlc.hpp
@@ -85,6 +85,19 @@ typedef unsigned int uintptr_t;
 #undef max
 #define max(a, b)   (((a)>(b)) ? (a) : (b))
 
+#if !defined(__clang_major__) && (__GNUC__ >= 7)
+#define PRAGMA_DIAG_PUSH             _Pragma("GCC diagnostic push")
+#define PRAGMA_DIAG_POP              _Pragma("GCC diagnostic pop")
+#define PRAGMA_FORMAT_OVERFLOW_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-overflow\"")
+#define PRAGMA_FORMAT_OVERFLOW_IGNORED_EXTERNAL PRAGMA_FORMAT_OVERFLOW_IGNORED
+#define PRAGMA_FORMAT_OVERFLOW_IGNORED_INTERNAL PRAGMA_FORMAT_OVERFLOW_IGNORED
+#else
+#define PRAGMA_DIAG_PUSH
+#define PRAGMA_DIAG_POP
+#define PRAGMA_FORMAT_OVERFLOW_IGNORED_EXTERNAL
+#define PRAGMA_FORMAT_OVERFLOW_IGNORED_INTERNAL
+#endif
+
 // ADLC components
 #include "arena.hpp"
 #include "opto/adlcVMDeps.hpp"
diff --git a/hotspot/src/share/vm/adlc/output_c.cpp b/hotspot/src/share/vm/adlc/output_c.cpp
index f53dbd58..7a59ec59 100644
--- a/hotspot/src/share/vm/adlc/output_c.cpp
+++ b/hotspot/src/share/vm/adlc/output_c.cpp
@@ -560,6 +560,8 @@ static int pipeline_res_mask_initializer(
   return (ndx);
 }
 
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_OVERFLOW_IGNORED_EXTERNAL
 void ArchDesc::build_pipe_classes(FILE *fp_cpp) {
   const char *classname;
   const char *resourcename;
@@ -1016,6 +1018,7 @@ void ArchDesc::build_pipe_classes(FILE *fp_cpp) {
   fprintf(fp_cpp, "}\n");
   fprintf(fp_cpp, "#endif\n");
 }
+PRAGMA_DIAG_POP
 
 // ---------------------------------------------------------------------------
 //------------------------------Utilities to build Instruction Classes--------