Commit 3c3fa147 by Richard Stallman

(digest_init): Use TYPE_MAIN_VARIANT comparing type of inside_init.

(process_init_constructor): Warn about partly bracketed initializers.

From-SVN: r1875
parent b5b6ad46
...@@ -4603,15 +4603,16 @@ digest_init (type, init, tail, require_constant, constructor_constant, ofwhat) ...@@ -4603,15 +4603,16 @@ digest_init (type, init, tail, require_constant, constructor_constant, ofwhat)
from an expression of the same type, optionally with braces. from an expression of the same type, optionally with braces.
For an array, this is allowed only for a string constant. */ For an array, this is allowed only for a string constant. */
if (inside_init && (TREE_TYPE (inside_init) == type if (inside_init
|| (code == ARRAY_TYPE && TREE_TYPE (inside_init) && (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)) == TYPE_MAIN_VARIANT (type)
&& comptypes (TREE_TYPE (inside_init), type)) || (code == ARRAY_TYPE && TREE_TYPE (inside_init)
|| (code == POINTER_TYPE && comptypes (TREE_TYPE (inside_init), type))
&& TREE_TYPE (inside_init) != 0 || (code == POINTER_TYPE
&& (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE && TREE_TYPE (inside_init) != 0
|| TREE_CODE (TREE_TYPE (inside_init)) == FUNCTION_TYPE) && (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE
&& comptypes (TREE_TYPE (TREE_TYPE (inside_init)), || TREE_CODE (TREE_TYPE (inside_init)) == FUNCTION_TYPE)
TREE_TYPE (type))))) && comptypes (TREE_TYPE (TREE_TYPE (inside_init)),
TREE_TYPE (type)))))
{ {
if (code == POINTER_TYPE if (code == POINTER_TYPE
&& (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE && (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE
...@@ -4867,7 +4868,11 @@ process_init_constructor (type, init, elts, constant_value, constant_element, ...@@ -4867,7 +4868,11 @@ process_init_constructor (type, init, elts, constant_value, constant_element,
no matter how the data was given to us. */ no matter how the data was given to us. */
if (elts) if (elts)
tail = *elts; {
if (extra_warnings)
warning ("aggregate has a partly bracketed initializer");
tail = *elts;
}
else else
tail = CONSTRUCTOR_ELTS (init); tail = CONSTRUCTOR_ELTS (init);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment