static void push_member_name (tree);
static int spelling_length (void);
static char *print_spelling (char *);
-static void warning_init (int, const char *);
+static void warning_init (location_t, int, const char *);
static tree digest_init (location_t, tree, tree, tree, bool, bool, int);
static void output_init_element (location_t, tree, tree, bool, tree, tree, int,
bool, struct obstack *);
static void output_pending_init_elements (int, struct obstack *);
static int set_designator (int, struct obstack *);
static void push_range_stack (tree, struct obstack *);
-static void add_pending_init (tree, tree, tree, bool, struct obstack *);
+static void add_pending_init (location_t, tree, tree, tree, bool,
+ struct obstack *);
static void set_nonincremental_init (struct obstack *);
static void set_nonincremental_init_from_string (tree, struct obstack *);
static tree find_init_member (tree, struct obstack *);
component name is taken from the spelling stack. */
static void
-warning_init (int opt, const char *gmsgid)
+warning_init (location_t loc, int opt, const char *gmsgid)
{
char *ofwhat;
/* The gmsgid may be a format string with %< and %>. */
- warning (opt, gmsgid);
+ warning_at (loc, opt, gmsgid);
ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
if (*ofwhat)
- warning (opt, "(near initialization for %qs)", ofwhat);
+ warning_at (loc, opt, "(near initialization for %qs)", ofwhat);
}
\f
/* If TYPE is an array type and EXPR is a parenthesized string
if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
{
missing_braces_mentioned = 1;
- warning_init (OPT_Wmissing_braces, "missing braces around initializer");
+ warning_init (input_location, OPT_Wmissing_braces,
+ "missing braces around initializer");
}
if (TREE_CODE (constructor_type) == RECORD_TYPE
else
{
if (constructor_type != error_mark_node)
- warning_init (0, "braces around scalar initializer");
+ warning_init (input_location, 0, "braces around scalar initializer");
constructor_fields = constructor_type;
constructor_unfilled_fields = constructor_type;
}
existing initializer. */
static void
-add_pending_init (tree purpose, tree value, tree origtype, bool implicit,
- struct obstack * braced_init_obstack)
+add_pending_init (location_t loc, tree purpose, tree value, tree origtype,
+ bool implicit, struct obstack *braced_init_obstack)
{
struct init_node *p, **q, *r;
if (!implicit)
{
if (TREE_SIDE_EFFECTS (p->value))
- warning_init (0, "initialized field with side-effects overwritten");
+ warning_init (loc, 0,
+ "initialized field with side-effects "
+ "overwritten");
else if (warn_override_init)
- warning_init (OPT_Woverride_init, "initialized field overwritten");
+ warning_init (loc, OPT_Woverride_init,
+ "initialized field overwritten");
}
p->value = value;
p->origtype = origtype;
if (!implicit)
{
if (TREE_SIDE_EFFECTS (p->value))
- warning_init (0, "initialized field with side-effects overwritten");
+ warning_init (loc, 0,
+ "initialized field with side-effects "
+ "overwritten");
else if (warn_override_init)
- warning_init (OPT_Woverride_init, "initialized field overwritten");
+ warning_init (loc, OPT_Woverride_init,
+ "initialized field overwritten");
}
p->value = value;
p->origtype = origtype;
return;
FOR_EACH_CONSTRUCTOR_ELT (constructor_elements, ix, index, value)
- {
- add_pending_init (index, value, NULL_TREE, true,
- braced_init_obstack);
- }
+ add_pending_init (input_location, index, value, NULL_TREE, true,
+ braced_init_obstack);
constructor_elements = NULL;
if (TREE_CODE (constructor_type) == RECORD_TYPE)
{
}
value = build_int_cst_wide (type, val[1], val[0]);
- add_pending_init (purpose, value, NULL_TREE, true,
+ add_pending_init (input_location, purpose, value, NULL_TREE, true,
braced_init_obstack);
}
if (checktype != error_mark_node
&& (TYPE_MAIN_VARIANT (checktype)
!= TYPE_MAIN_VARIANT (DECL_BIT_FIELD_TYPE (field))))
- warning_init (OPT_Wc___compat,
+ warning_init (loc, OPT_Wc___compat,
"enum conversion in initialization is invalid in C++");
}
&& tree_int_cst_lt (field, constructor_unfilled_index))
set_nonincremental_init (braced_init_obstack);
- add_pending_init (field, value, origtype, implicit,
+ add_pending_init (loc, field, value, origtype, implicit,
braced_init_obstack);
return;
}
}
}
- add_pending_init (field, value, origtype, implicit,
+ add_pending_init (loc, field, value, origtype, implicit,
braced_init_obstack);
return;
}
if (!implicit)
{
if (TREE_SIDE_EFFECTS (constructor_elements->last ().value))
- warning_init (0,
+ warning_init (loc, 0,
"initialized field with side-effects overwritten");
else if (warn_override_init)
- warning_init (OPT_Woverride_init, "initialized field overwritten");
+ warning_init (loc, OPT_Woverride_init,
+ "initialized field overwritten");
}
/* We can have just one union field set. */