summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc
diff options
context:
space:
mode:
authorKai Kang <kai.kang@windriver.com>2015-10-10 15:27:07 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-19 17:57:57 +0100
commitb1a740568864762cef5d2427cf65103448bbcf42 (patch)
tree304d010a619e8e4a7ebcc4d9f574fc6f6be40005 /meta/recipes-devtools/gcc
parent402723ead0b07255497bc137327f2aac0f6c74b0 (diff)
downloadpoky-b1a740568864762cef5d2427cf65103448bbcf42.tar.gz
gcc-4.x: fix wrong warning when using the universal zero initializer {0}
When I upgrade efivar to 0.21, it fails to compile with error messages: | linux.c:850:9: error: missing braces around initializer [-Werror=missing-braces] | struct ifreq ifr = { 0, }; | ^ It is a known issue of gcc. Backport patch from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119 to fix wrong warning when using the universal zero initializer {0}. (From OE-Core rev: ef16c20e6936218ff96c599cce0200c34f5017dd) Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0051-gcc-483-universal-initializer-no-warning.patch107
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch107
4 files changed, 216 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.8.inc b/meta/recipes-devtools/gcc/gcc-4.8.inc
index 6a2454d868..b3e1c332ee 100644
--- a/meta/recipes-devtools/gcc/gcc-4.8.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.8.inc
@@ -69,6 +69,7 @@ SRC_URI = "\
69 file://0047-repomembug.patch \ 69 file://0047-repomembug.patch \
70 file://0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch \ 70 file://0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch \
71 file://target-gcc-includedir.patch \ 71 file://target-gcc-includedir.patch \
72 file://0051-gcc-483-universal-initializer-no-warning.patch \
72" 73"
73SRC_URI[md5sum] = "5a84a30839b2aca22a2d723de2a626ec" 74SRC_URI[md5sum] = "5a84a30839b2aca22a2d723de2a626ec"
74SRC_URI[sha256sum] = "4a80aa23798b8e9b5793494b8c976b39b8d9aa2e53cd5ed5534aff662a7f8695" 75SRC_URI[sha256sum] = "4a80aa23798b8e9b5793494b8c976b39b8d9aa2e53cd5ed5534aff662a7f8695"
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0051-gcc-483-universal-initializer-no-warning.patch b/meta/recipes-devtools/gcc/gcc-4.8/0051-gcc-483-universal-initializer-no-warning.patch
new file mode 100644
index 0000000000..fde227b8ad
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0051-gcc-483-universal-initializer-no-warning.patch
@@ -0,0 +1,107 @@
1Upstream-Status: Backport
2
3Signed-off-by: Kai Kang <kai.kang@windriver.com>
4---
5Fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
6wrong warning when using the universal zero initializer {0}
7
8Backported to GCC 4.8.3
9
10Subject: 2014-06-05 S. Gilles <sgilles@terpmail.umd.edu>
11X-Git-Url: http://repo.or.cz/w/official-gcc.git/commitdiff_plain/95cdf3fdf2d440eb7775def8e35ab970651c33d9?hp=14a3093e9943937cbc63dfbf4d51ca60f8325b29
12git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211289 138bc75d-0d04-0410-961f-82ee72b054a4
13
14--- gcc-4.8.3.org/gcc/c/c-typeck.c 2014-08-03 20:52:09.257042137 +0200
15+++ gcc-4.8.3/gcc/c/c-typeck.c 2014-08-03 20:57:10.645042614 +0200
16@@ -62,9 +62,9 @@
17 if expr.original_code == SIZEOF_EXPR. */
18 tree c_last_sizeof_arg;
19
20-/* Nonzero if we've already printed a "missing braces around initializer"
21- message within this initializer. */
22-static int missing_braces_mentioned;
23+/* Nonzero if we might need to print a "missing braces around
24+ initializer" message within this initializer. */
25+static int found_missing_braces;
26
27 static int require_constant_value;
28 static int require_constant_elements;
29@@ -6379,6 +6379,9 @@
30 /* 1 if this constructor is erroneous so far. */
31 static int constructor_erroneous;
32
33+/* 1 if this constructor is the universal zero initializer { 0 }. */
34+static int constructor_zeroinit;
35+
36 /* Structure for managing pending initializer elements, organized as an
37 AVL tree. */
38
39@@ -6540,7 +6543,7 @@
40 constructor_stack = 0;
41 constructor_range_stack = 0;
42
43- missing_braces_mentioned = 0;
44+ found_missing_braces = 0;
45
46 spelling_base = 0;
47 spelling_size = 0;
48@@ -6635,6 +6638,7 @@
49 constructor_type = type;
50 constructor_incremental = 1;
51 constructor_designated = 0;
52+ constructor_zeroinit = 1;
53 designator_depth = 0;
54 designator_erroneous = 0;
55
56@@ -6832,11 +6836,8 @@
57 set_nonincremental_init (braced_init_obstack);
58 }
59
60- if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
61- {
62- missing_braces_mentioned = 1;
63- warning_init (OPT_Wmissing_braces, "missing braces around initializer");
64- }
65+ if (implicit == 1)
66+ found_missing_braces = 1;
67
68 if (TREE_CODE (constructor_type) == RECORD_TYPE
69 || TREE_CODE (constructor_type) == UNION_TYPE)
70@@ -6969,16 +6970,23 @@
71 }
72 }
73
74+ if (vec_safe_length (constructor_elements) != 1)
75+ constructor_zeroinit = 0;
76+
77+ /* Warn when some structs are initialized with direct aggregation. */
78+ if (!implicit && found_missing_braces && warn_missing_braces
79+ && !constructor_zeroinit)
80+ {
81+ warning_init (OPT_Wmissing_braces,
82+ "missing braces around initializer");
83+ }
84+
85 /* Warn when some struct elements are implicitly initialized to zero. */
86 if (warn_missing_field_initializers
87 && constructor_type
88 && TREE_CODE (constructor_type) == RECORD_TYPE
89 && constructor_unfilled_fields)
90 {
91- bool constructor_zeroinit =
92- (vec_safe_length (constructor_elements) == 1
93- && integer_zerop ((*constructor_elements)[0].value));
94-
95 /* Do not warn for flexible array members or zero-length arrays. */
96 while (constructor_unfilled_fields
97 && (!DECL_SIZE (constructor_unfilled_fields)
98@@ -8093,6 +8101,9 @@
99 designator_depth = 0;
100 designator_erroneous = 0;
101
102+ if (!implicit && value.value && !integer_zerop (value.value))
103+ constructor_zeroinit = 0;
104+
105 /* Handle superfluous braces around string cst as in
106 char x[] = {"foo"}; */
107 if (string_flag
diff --git a/meta/recipes-devtools/gcc/gcc-4.9.inc b/meta/recipes-devtools/gcc/gcc-4.9.inc
index 691ba5fbc2..95b553cb87 100644
--- a/meta/recipes-devtools/gcc/gcc-4.9.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.9.inc
@@ -80,6 +80,7 @@ SRC_URI = "\
80 file://0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \ 80 file://0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
81 file://0063-nativesdk-gcc-support.patch \ 81 file://0063-nativesdk-gcc-support.patch \
82 file://0064-handle-target-sysroot-multilib.patch \ 82 file://0064-handle-target-sysroot-multilib.patch \
83 file://0065-gcc-483-universal-initializer-no-warning.patch \
83" 84"
84SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327" 85SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327"
85SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e" 86SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e"
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch b/meta/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch
new file mode 100644
index 0000000000..fde227b8ad
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch
@@ -0,0 +1,107 @@
1Upstream-Status: Backport
2
3Signed-off-by: Kai Kang <kai.kang@windriver.com>
4---
5Fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
6wrong warning when using the universal zero initializer {0}
7
8Backported to GCC 4.8.3
9
10Subject: 2014-06-05 S. Gilles <sgilles@terpmail.umd.edu>
11X-Git-Url: http://repo.or.cz/w/official-gcc.git/commitdiff_plain/95cdf3fdf2d440eb7775def8e35ab970651c33d9?hp=14a3093e9943937cbc63dfbf4d51ca60f8325b29
12git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211289 138bc75d-0d04-0410-961f-82ee72b054a4
13
14--- gcc-4.8.3.org/gcc/c/c-typeck.c 2014-08-03 20:52:09.257042137 +0200
15+++ gcc-4.8.3/gcc/c/c-typeck.c 2014-08-03 20:57:10.645042614 +0200
16@@ -62,9 +62,9 @@
17 if expr.original_code == SIZEOF_EXPR. */
18 tree c_last_sizeof_arg;
19
20-/* Nonzero if we've already printed a "missing braces around initializer"
21- message within this initializer. */
22-static int missing_braces_mentioned;
23+/* Nonzero if we might need to print a "missing braces around
24+ initializer" message within this initializer. */
25+static int found_missing_braces;
26
27 static int require_constant_value;
28 static int require_constant_elements;
29@@ -6379,6 +6379,9 @@
30 /* 1 if this constructor is erroneous so far. */
31 static int constructor_erroneous;
32
33+/* 1 if this constructor is the universal zero initializer { 0 }. */
34+static int constructor_zeroinit;
35+
36 /* Structure for managing pending initializer elements, organized as an
37 AVL tree. */
38
39@@ -6540,7 +6543,7 @@
40 constructor_stack = 0;
41 constructor_range_stack = 0;
42
43- missing_braces_mentioned = 0;
44+ found_missing_braces = 0;
45
46 spelling_base = 0;
47 spelling_size = 0;
48@@ -6635,6 +6638,7 @@
49 constructor_type = type;
50 constructor_incremental = 1;
51 constructor_designated = 0;
52+ constructor_zeroinit = 1;
53 designator_depth = 0;
54 designator_erroneous = 0;
55
56@@ -6832,11 +6836,8 @@
57 set_nonincremental_init (braced_init_obstack);
58 }
59
60- if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
61- {
62- missing_braces_mentioned = 1;
63- warning_init (OPT_Wmissing_braces, "missing braces around initializer");
64- }
65+ if (implicit == 1)
66+ found_missing_braces = 1;
67
68 if (TREE_CODE (constructor_type) == RECORD_TYPE
69 || TREE_CODE (constructor_type) == UNION_TYPE)
70@@ -6969,16 +6970,23 @@
71 }
72 }
73
74+ if (vec_safe_length (constructor_elements) != 1)
75+ constructor_zeroinit = 0;
76+
77+ /* Warn when some structs are initialized with direct aggregation. */
78+ if (!implicit && found_missing_braces && warn_missing_braces
79+ && !constructor_zeroinit)
80+ {
81+ warning_init (OPT_Wmissing_braces,
82+ "missing braces around initializer");
83+ }
84+
85 /* Warn when some struct elements are implicitly initialized to zero. */
86 if (warn_missing_field_initializers
87 && constructor_type
88 && TREE_CODE (constructor_type) == RECORD_TYPE
89 && constructor_unfilled_fields)
90 {
91- bool constructor_zeroinit =
92- (vec_safe_length (constructor_elements) == 1
93- && integer_zerop ((*constructor_elements)[0].value));
94-
95 /* Do not warn for flexible array members or zero-length arrays. */
96 while (constructor_unfilled_fields
97 && (!DECL_SIZE (constructor_unfilled_fields)
98@@ -8093,6 +8101,9 @@
99 designator_depth = 0;
100 designator_erroneous = 0;
101
102+ if (!implicit && value.value && !integer_zerop (value.value))
103+ constructor_zeroinit = 0;
104+
105 /* Handle superfluous braces around string cst as in
106 char x[] = {"foo"}; */
107 if (string_flag