aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 4a804389ce1..d400f3969b6 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1493,7 +1493,8 @@ build_external_ref (id, fun)
if (TREE_TYPE (ref) == error_mark_node)
return error_mark_node;
- assemble_external (ref);
+ if (!skip_evaluation)
+ assemble_external (ref);
TREE_USED (ref) = 1;
if (TREE_CODE (ref) == CONST_DECL)
@@ -4280,6 +4281,30 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
return error_mark_node;
}
+/* Convert VALUE for assignment into inlined parameter PARM. */
+
+tree
+c_convert_parm_for_inlining (parm, value, fn)
+ tree parm, value, fn;
+{
+ tree ret, type;
+
+ /* If FN was prototyped, the value has been converted already
+ in convert_arguments. */
+ if (! value || TYPE_ARG_TYPES (TREE_TYPE (fn)))
+ return value;
+
+ type = TREE_TYPE (parm);
+ ret = convert_for_assignment (type, value,
+ (char *) 0 /* arg passing */, fn,
+ DECL_NAME (fn), 0);
+ if (PROMOTE_PROTOTYPES
+ && INTEGRAL_TYPE_P (type)
+ && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
+ ret = default_conversion (ret);
+ return ret;
+}
+
/* Print a warning using MSGID.
It gets OPNAME as its one parameter.
If OPNAME is null, it is replaced by "passing arg ARGNUM of `FUNCTION'".
@@ -6575,6 +6600,16 @@ process_init_element (value)
fieldtype = TYPE_MAIN_VARIANT (fieldtype);
fieldcode = TREE_CODE (fieldtype);
+ /* Error for non-static initialization of a flexible array member. */
+ if (fieldcode == ARRAY_TYPE
+ && !require_constant_value
+ && TYPE_SIZE (fieldtype) == NULL_TREE
+ && TREE_CHAIN (constructor_fields) == NULL_TREE)
+ {
+ error_init ("non-static initialization of a flexible array member");
+ break;
+ }
+
/* Accept a string constant to initialize a subarray. */
if (value != 0
&& fieldcode == ARRAY_TYPE