summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.9
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/gcc-4.9
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/gcc-4.9')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch107
1 files changed, 107 insertions, 0 deletions
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