+2003-09-20 Richard Henderson <rth@redhat.com>
+
+ * c-format.c (gcc_diag_char_table): Add %J.
+ (gcc_cdiag_char_table, gcc_cxxdiag_char_table): Likewise.
+ (check_format_types): Fix wanted_type name lookup.
+ (init_dynamic_diag_info): Setup %J.
+ * diagnostic.c (text_specifies_location): Implement %J.
+ * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, calls.c,
+ dwarfout.c, expr.c, function.c, stmt.c, stor-layout.c, toplev.c,
+ tree-inline.c, tree-optimize.c, varasm.c, config/arm/pe.c,
+ config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c,
+ config/v850/v850.c, objc/objc-act.c: Use %J in diagnostics.
+
+ * tree-inline.c: Include intl.h
+ (inline_forbidden_p_1): Fix i18n of inline_forbidden_reason.
+ * Makefile.in (tree-inline.o): Update.
+
2003-09-20 Roger Sayle <roger@eyesopen.com>
* config/i386/i386.c (ix86_expand_carry_flag_compare): Fix
tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(RTL_H) $(EXPR_H) flags.h $(PARAMS_H) input.h insn-config.h \
$(INTEGRATE_H) $(VARRAY_H) $(HASHTAB_H) $(SPLAY_TREE_H) toplev.h \
- langhooks.h $(C_COMMON_H) tree-inline.h cgraph.h
+ langhooks.h $(C_COMMON_H) tree-inline.h cgraph.h intl.h
tree-optimize.o : tree-optimize.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) toplev.h langhooks.h cgraph.h $(TIMEVAR_H) function.h $(GGC_H)
input_line = saved_lineno;
}
if (!ix && !current_function_decl)
- pedwarn ("%H'%D' is not defined outside of function scope",
- &DECL_SOURCE_LOCATION (decl), decl);
+ pedwarn ("%J'%D' is not defined outside of function scope", decl, decl);
return decl;
}
if (high_value)
{
error ("duplicate (or overlapping) case value");
- error ("%Hthis is the first entry overlapping that value",
- &DECL_SOURCE_LOCATION (duplicate));
+ error ("%Jthis is the first entry overlapping that value", duplicate);
}
else if (low_value)
{
error ("duplicate case value") ;
- error ("%Hpreviously used here", &DECL_SOURCE_LOCATION (duplicate));
+ error ("%Jpreviously used here", duplicate);
}
else
{
error ("multiple default labels in one switch");
- error ("%Hthis is the first default label",
- &DECL_SOURCE_LOCATION (duplicate));
+ error ("%Jthis is the first default label", duplicate);
}
if (!cases->root)
add_stmt (build_case_label (NULL_TREE, NULL_TREE, label));
};
warning (msgs[msgcode], name);
- warning ("%Hshadowed declaration is here", &DECL_SOURCE_LOCATION (decl));
+ warning ("%Jshadowed declaration is here", decl);
}
/* Attribute handlers common to C front ends. */
&& current_function_decl != NULL_TREE
&& ! TREE_STATIC (decl))
{
- error ("%Hsection attribute cannot be specified for "
- "local variables", &DECL_SOURCE_LOCATION (decl));
+ error ("%Jsection attribute cannot be specified for "
+ "local variables", decl);
*no_add_attrs = true;
}
&& strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
TREE_STRING_POINTER (TREE_VALUE (args))) != 0)
{
- error ("%Hsection of '%D' conflicts with previous declaration",
- &DECL_SOURCE_LOCATION (*node), *node);
+ error ("%Jsection of '%D' conflicts with previous declaration",
+ *node, *node);
*no_add_attrs = true;
}
else
}
else
{
- error ("%Hsection attribute not allowed for '%D'",
- &DECL_SOURCE_LOCATION (*node), *node);
+ error ("%Jsection attribute not allowed for '%D'", *node, *node);
*no_add_attrs = true;
}
}
else
{
- error ("%Hsection attributes are not supported for this target",
- &DECL_SOURCE_LOCATION (*node));
+ error ("%Jsection attributes are not supported for this target", *node);
*no_add_attrs = true;
}
else if (TREE_CODE (decl) != VAR_DECL
&& TREE_CODE (decl) != FIELD_DECL)
{
- error ("%Halignment may not be specified for '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jalignment may not be specified for '%D'", decl, decl);
*no_add_attrs = true;
}
else
if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl))
|| (TREE_CODE (decl) != FUNCTION_DECL && ! DECL_EXTERNAL (decl)))
{
- error ("%H'%D' defined both normally and as an alias",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%J'%D' defined both normally and as an alias", decl, decl);
*no_add_attrs = true;
}
else if (decl_function_context (decl) == 0)
if (TREE_CODE (decl) != FUNCTION_DECL)
{
- error ("%H'%E' attribute applies only to functions",
- &DECL_SOURCE_LOCATION (decl), name);
+ error ("%J'%E' attribute applies only to functions", decl, name);
*no_add_attrs = true;
}
else if (DECL_INITIAL (decl))
{
- error ("%Hcan't set '%E' attribute after definition",
- &DECL_SOURCE_LOCATION (decl), name);
+ error ("%Jcan't set '%E' attribute after definition", decl, name);
*no_add_attrs = true;
}
else
if (TREE_CODE (decl) != FUNCTION_DECL)
{
- error ("%H'%E' attribute applies only to functions",
- &DECL_SOURCE_LOCATION (decl), name);
+ error ("%J'%E' attribute applies only to functions", decl, name);
*no_add_attrs = true;
}
else if (DECL_INITIAL (decl))
{
- error ("%Hcan't set '%E' attribute after definition",
- &DECL_SOURCE_LOCATION (decl), name);
+ error ("%Jcan't set '%E' attribute after definition", decl, name);
*no_add_attrs = true;
}
else
&& ! DECL_EXTERNAL (decl)
&& TYPE_DOMAIN (type) == 0)
{
- warning ("%Harray '%D' assumed to have one element",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jarray '%D' assumed to have one element", decl, decl);
complete_array_type (type, NULL_TREE, 1);
for (p = scope->names; p; p = TREE_CHAIN (p))
{
- const location_t *locus = &DECL_SOURCE_LOCATION (p);
-
switch (TREE_CODE (p))
{
case LABEL_DECL:
if (TREE_USED (p) && !DECL_INITIAL (p))
{
- error ("%Hlabel `%D' used but not defined", locus, p);
+ error ("%Jlabel `%D' used but not defined", p, p);
DECL_INITIAL (p) = error_mark_node;
}
else if (!TREE_USED (p) && warn_unused_label)
{
if (DECL_INITIAL (p))
- warning ("%Hlabel `%D' defined but not used", locus, p);
+ warning ("%Jlabel `%D' defined but not used", p, p);
else
- warning ("%Hlabel `%D' declared but not defined", locus, p);
+ warning ("%Jlabel `%D' declared but not defined", p, p);
}
IDENTIFIER_LABEL_VALUE (DECL_NAME (p)) = 0;
&& !DECL_IN_SYSTEM_HEADER (p)
&& DECL_NAME (p)
&& !DECL_ARTIFICIAL (p))
- warning ("%Hunused variable `%D'", locus, p);
+ warning ("%Junused variable `%D'", p, p);
/* fall through */
default:
&& DECL_UNINLINABLE (olddecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
{
- warning ("%Hfunction '%D' redeclared as inline",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
- warning ("%Hprevious declaration of function '%D' "
- "with attribute noinline",
- &DECL_SOURCE_LOCATION (olddecl), olddecl);
+ warning ("%Jfunction '%D' redeclared as inline",
+ newdecl, newdecl);
+ warning ("%Jprevious declaration of function '%D' "
+ "with attribute noinline", olddecl, olddecl);
}
else if (DECL_DECLARED_INLINE_P (olddecl)
&& DECL_UNINLINABLE (newdecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
{
- warning ("%Hfunction '%D' redeclared with attribute noinline",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
- warning ("%Hprevious declaration of function '%D' was inline",
- &DECL_SOURCE_LOCATION (olddecl), olddecl);
+ warning ("%Jfunction '%D' redeclared with attribute noinline",
+ newdecl, newdecl);
+ warning ("%Jprevious declaration of function '%D' was inline",
+ olddecl, olddecl);
}
}
if (!TREE_PUBLIC (newdecl))
{
if (warn_shadow)
- warning ("%Hshadowing built-in function '%D'",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
+ warning ("%Jshadowing built-in function '%D'",
+ newdecl, newdecl);
}
else
- warning ("%Hbuilt-in function '%D' declared as non-function",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
+ warning ("%Jbuilt-in function '%D' declared as non-function",
+ newdecl, newdecl);
}
else
{
- error ("%H'%D' redeclared as different kind of symbol",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
- error ("%Hprevious declaration of '%D'",
- &DECL_SOURCE_LOCATION (olddecl), olddecl);
+ error ("%J'%D' redeclared as different kind of symbol",
+ newdecl, newdecl);
+ error ("%Jprevious declaration of '%D'", olddecl, olddecl);
}
return 0;
built-in definition is overridden,
but optionally warn this was a bad choice of name. */
if (warn_shadow)
- warning ("%Hshadowing built-in function '%D'",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
+ warning ("%Jshadowing built-in function '%D'", newdecl, newdecl);
/* Discard the old built-in function. */
return 0;
}
if (!types_match)
{
/* If types don't match for a built-in, throw away the built-in. */
- warning ("%Hconflicting types for built-in function '%D'",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
+ warning ("%Jconflicting types for built-in function '%D'",
+ newdecl, newdecl);
return 0;
}
}
&& TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (oldtype))) == void_type_node)))
{
if (pedantic)
- pedwarn ("%Hconflicting types for '%D'",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
+ pedwarn ("%Jconflicting types for '%D'", newdecl, newdecl);
/* Make sure we keep void * as ret type, not char *. */
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (oldtype))) == void_type_node)
TREE_TYPE (newdecl) = newtype = oldtype;
&& TYPE_MAIN_VARIANT (TREE_TYPE (newtype)) == integer_type_node
&& C_FUNCTION_IMPLICIT_INT (newdecl))
{
- pedwarn ("%Hconflicting types for '%D'",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
+ pedwarn ("%Jconflicting types for '%D'", newdecl, newdecl);
/* Make sure we keep void as the return type. */
TREE_TYPE (newdecl) = newtype = oldtype;
C_FUNCTION_IMPLICIT_INT (newdecl) = 0;
TREE_TYPE (newtype), COMPARE_STRICT)
&& TYPE_ARG_TYPES (newtype) == 0))
{
- error ("%Hconflicting types for '%D'",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
+ error ("%Jconflicting types for '%D'", newdecl, newdecl);
/* Check for function type mismatch
involving an empty arglist vs a nonempty one. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
}
}
if (C_DECL_IMPLICIT (olddecl))
- error ("%Hprevious implicit declaration of '%D'",
- &DECL_SOURCE_LOCATION (olddecl), olddecl);
+ error ("%Jprevious implicit declaration of '%D'", olddecl, olddecl);
else
- error ("%Hprevious declaration of '%D'",
- &DECL_SOURCE_LOCATION (olddecl), olddecl);
+ error ("%Jprevious declaration of '%D'", olddecl, olddecl);
/* This is safer because the initializer might contain references
to variables that were declared between olddecl and newdecl. This
else if (TREE_CODE (olddecl) == VAR_DECL && TREE_CODE (newdecl) == VAR_DECL
&& !DECL_THREAD_LOCAL (olddecl) && DECL_THREAD_LOCAL (newdecl))
{
- error ("%Hthread-local declaration of '%D' follows non thread-local "
- "declaration", &DECL_SOURCE_LOCATION (newdecl), newdecl);
- error ("%Hprevious declaration of '%D'",
- &DECL_SOURCE_LOCATION (olddecl), olddecl);
+ error ("%Jthread-local declaration of '%D' follows non thread-local "
+ "declaration", newdecl, newdecl);
+ error ("%Jprevious declaration of '%D'", olddecl, olddecl);
}
/* non-TLS declaration cannot follow TLS declaration. */
else if (TREE_CODE (olddecl) == VAR_DECL && TREE_CODE (newdecl) == VAR_DECL
&& DECL_THREAD_LOCAL (olddecl) && !DECL_THREAD_LOCAL (newdecl))
{
- error ("%Hnon thread-local declaration of '%D' follows "
- "thread-local declaration",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
- error ("%Hprevious declaration of '%D'",
- &DECL_SOURCE_LOCATION (olddecl), olddecl);
+ error ("%Jnon thread-local declaration of '%D' follows "
+ "thread-local declaration", newdecl, newdecl);
+ error ("%Jprevious declaration of '%D'", olddecl, olddecl);
}
else
{
errmsg = redeclaration_error_message (newdecl, olddecl);
if (errmsg)
{
- const location_t *locus = &DECL_SOURCE_LOCATION (newdecl);
switch (errmsg)
{
case 1:
- error ("%Hredefinition of '%D'", locus, newdecl);
+ error ("%Jredefinition of '%D'", newdecl, newdecl);
break;
case 2:
- error ("%Hredeclaration of '%D'", locus, newdecl);
+ error ("%Jredeclaration of '%D'", newdecl, newdecl);
break;
case 3:
- error ("%Hconflicting declarations of '%D'", locus, newdecl);
+ error ("%Jconflicting declarations of '%D'", newdecl, newdecl);
break;
default:
abort ();
}
- locus = &DECL_SOURCE_LOCATION (olddecl);
if (DECL_INITIAL (olddecl)
&& current_scope == global_scope)
- error ("%H'%D' previously defined here", locus, olddecl);
+ error ("%J'%D' previously defined here", olddecl, olddecl);
else
- error ("%H'%D' previously declared here", locus, olddecl);
+ error ("%J'%D' previously declared here", olddecl, olddecl);
return 0;
}
else if (TREE_CODE (newdecl) == TYPE_DECL
&& (DECL_IN_SYSTEM_HEADER (olddecl)
|| DECL_IN_SYSTEM_HEADER (newdecl)))
{
- const location_t *locus = &DECL_SOURCE_LOCATION (newdecl);
- warning ("%Hredefinition of '%D'", locus, newdecl);
- locus = &DECL_SOURCE_LOCATION (olddecl);
- if (DECL_INITIAL (olddecl)
- && current_scope == global_scope)
- warning ("%H'%D' previously defined here", locus, olddecl);
+ warning ("%Jredefinition of '%D'", newdecl, newdecl);
+ if (DECL_INITIAL (olddecl) && current_scope == global_scope)
+ warning ("%J'%D' previously defined here", olddecl, olddecl);
else
- warning ("%H'%D' previously declared here", locus, olddecl);
+ warning ("%J'%D' previously declared here", olddecl, olddecl);
}
else if (TREE_CODE (olddecl) == FUNCTION_DECL
&& DECL_INITIAL (olddecl) != 0
if (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == void_type_node
&& TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
{
- const location_t *locus = &DECL_SOURCE_LOCATION (newdecl);
- warning ("%Hprototype for '%D' follows", locus, newdecl);
- locus = &DECL_SOURCE_LOCATION (olddecl);
- warning ("%Hnon-prototype definition here", locus);
+ warning ("%Jprototype for '%D' follows", newdecl, newdecl);
+ warning ("%Jnon-prototype definition here", olddecl);
break;
}
if (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == void_type_node
|| TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
{
- const location_t *locus = &DECL_SOURCE_LOCATION (newdecl);
- error ("%Hprototype for '%D' follows and number of "
- "arguments doesn't match", locus, newdecl);
- locus = &DECL_SOURCE_LOCATION (olddecl);
- error ("%Hnon-prototype definition here", locus);
+ error ("%Jprototype for '%D' follows and number of "
+ "arguments doesn't match", newdecl, newdecl);
+ error ("%Jnon-prototype definition here", olddecl);
errmsg = 1;
break;
}
if (! comptypes (TREE_VALUE (parm), TREE_VALUE (type),
COMPARE_STRICT))
{
- const location_t *locus = &DECL_SOURCE_LOCATION (newdecl);
- error ("%Hprototype for '%D' follows and argument %d "
- "doesn't match", locus, newdecl, nargs);
- locus = &DECL_SOURCE_LOCATION (olddecl);
- error ("%Hnon-prototype definition here", locus);
+ error ("%Jprototype for '%D' follows and argument %d "
+ "doesn't match", newdecl, newdecl, nargs);
+ error ("%Jnon-prototype definition here", olddecl);
errmsg = 1;
break;
}
/* Warn about mismatches in various flags. */
else
{
- const location_t *locus = &DECL_SOURCE_LOCATION (newdecl);
-
/* Warn if function is now inline
but was previously declared not inline and has been called. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
&& ! DECL_DECLARED_INLINE_P (olddecl)
&& DECL_DECLARED_INLINE_P (newdecl)
&& TREE_USED (olddecl))
- warning ("%H'%D' declared inline after being called",
- locus, newdecl);
+ warning ("%J'%D' declared inline after being called",
+ newdecl, newdecl);
if (TREE_CODE (olddecl) == FUNCTION_DECL
&& ! DECL_DECLARED_INLINE_P (olddecl)
&& DECL_DECLARED_INLINE_P (newdecl)
&& DECL_INITIAL (olddecl) != 0)
- warning ("%H'%D' declared inline after its definition",
- locus, newdecl);
+ warning ("%J'%D' declared inline after its definition",
+ newdecl, newdecl);
/* If pedantic, warn when static declaration follows a non-static
declaration. Otherwise, do so only for functions. */
if ((pedantic || TREE_CODE (olddecl) == FUNCTION_DECL)
&& TREE_PUBLIC (olddecl)
&& !TREE_PUBLIC (newdecl))
- warning ("%Hstatic declaration for '%D' follows non-static",
- locus, newdecl);
+ warning ("%Jstatic declaration for '%D' follows non-static",
+ newdecl, newdecl);
/* If warn_traditional, warn when a non-static function
declaration follows a static one. */
&& TREE_CODE (olddecl) == FUNCTION_DECL
&& !TREE_PUBLIC (olddecl)
&& TREE_PUBLIC (newdecl))
- warning ("%Hnon-static declaration for '%D' follows static",
- locus, newdecl);
+ warning ("%Jnon-static declaration for '%D' follows static",
+ newdecl, newdecl);
/* Warn when const declaration follows a non-const
declaration, but not for functions. */
if (TREE_CODE (olddecl) != FUNCTION_DECL
&& !TREE_READONLY (olddecl)
&& TREE_READONLY (newdecl))
- warning ("%Hconst declaration for '%D' follows non-const",
- locus, newdecl);
+ warning ("%Jconst declaration for '%D' follows non-const",
+ newdecl, newdecl);
/* These bits are logically part of the type, for variables.
But not for functions
(where qualifiers are not valid ANSI anyway). */
else if (pedantic && TREE_CODE (olddecl) != FUNCTION_DECL
&& (TREE_READONLY (newdecl) != TREE_READONLY (olddecl)
|| TREE_THIS_VOLATILE (newdecl) != TREE_THIS_VOLATILE (olddecl)))
- pedwarn ("%Htype qualifiers for '%D' conflict with previous "
- "declaration", locus, newdecl);
+ pedwarn ("%Jtype qualifiers for '%D' conflict with previous "
+ "declaration", newdecl, newdecl);
}
}
/* Don't warn about extern decl followed by (tentative) definition. */
&& !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl)))
{
- warning ("%Hredundant redeclaration of '%D' in same scope",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
- warning ("%Hprevious declaration of '%D'",
- &DECL_SOURCE_LOCATION (olddecl), olddecl);
+ warning ("%Jredundant redeclaration of '%D' in same scope",
+ newdecl, newdecl);
+ warning ("%Jprevious declaration of '%D'", olddecl, olddecl);
}
/* Copy all the DECL_... slots specified in the new decl
{
implicit_decl_warning (DECL_NAME (decl));
if (! DECL_FILE_SCOPE_P (decl))
- warning ("%Hprevious declaration of '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jprevious declaration of '%D'", decl, decl);
C_DECL_IMPLICIT (decl) = 1;
}
/* If this function is global, then it must already be in the
if (dup == label)
{
error ("duplicate label declaration `%s'", IDENTIFIER_POINTER (name));
- error ("%Hthis is a previous declaration",
- &DECL_SOURCE_LOCATION (dup));
+ error ("%Jthis is a previous declaration", dup);
/* Just use the previous declaration. */
return dup;
|| (DECL_CONTEXT (label) != current_function_decl
&& C_DECLARED_LABEL_FLAG (label))))
{
- location_t *prev_loc = &DECL_SOURCE_LOCATION (label);
error ("%Hduplicate label `%D'", &location, label);
if (DECL_INITIAL (label))
- error ("%H`%D' previously defined here", prev_loc, label);
+ error ("%J`%D' previously defined here", label, label);
else
- error ("%H`%D' previously declared here", prev_loc, label);
+ error ("%J`%D' previously declared here", label, label);
return 0;
}
else if (label && DECL_CONTEXT (label) == current_function_decl)
if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL
&& MAIN_NAME_P (DECL_NAME (decl)))
- warning ("%H'%D' is usually a function",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%J'%D' is usually a function", decl, decl);
if (initialized)
/* Is it valid for this decl to have an initializer at all?
&& DECL_DECLARED_INLINE_P (decl)
&& DECL_UNINLINABLE (decl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (decl)))
- warning ("%Hinline function '%D' given attribute noinline",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jinline function '%D' given attribute noinline", decl, decl);
/* Add this decl to the current scope.
TEM may equal DECL or it may be a previous decl of the same name. */
type = TREE_TYPE (decl);
if (failure == 1)
- error ("%Hinitializer fails to determine size of '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jinitializer fails to determine size of '%D'", decl, decl);
else if (failure == 2)
{
if (do_default)
- error ("%Harray size missing in '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jarray size missing in '%D'", decl, decl);
/* If a `static' var's size isn't known,
make it extern as well as static, so it does not get
allocated.
warn only if the value is less than zero. */
else if (pedantic && TYPE_DOMAIN (type) != 0
&& tree_int_cst_sgn (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) < 0)
- error ("%Hzero or negative size array '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jzero or negative size array '%D'", decl, decl);
layout_decl (decl, 0);
}
is an error. */
!DECL_EXTERNAL (decl)))
{
- error ("%Hstorage size of '%D' isn't known",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jstorage size of '%D' isn't known", decl, decl);
TREE_TYPE (decl) = error_mark_node;
}
if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
constant_expression_warning (DECL_SIZE (decl));
else
- error ("%Hstorage size of '%D' isn't constant",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jstorage size of '%D' isn't constant", decl, decl);
}
if (TREE_USED (type))
if (TREE_CODE (decl) == VAR_DECL
&& !DECL_REGISTER (decl)
&& !TREE_STATIC (decl))
- warning ("%Hignoring asm-specifier for non-static local "
- "variable '%D'", &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jignoring asm-specifier for non-static local "
+ "variable '%D'", decl, decl);
else
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (asmspec));
}
C_DECL_VARIABLE_SIZE (decl) = 1;
if (inlinep)
- pedwarn ("%Hvariable '%D' declared `inline'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ pedwarn ("%Jvariable '%D' declared `inline'", decl, decl);
DECL_EXTERNAL (decl) = extern_ref;
if (!TREE_ASM_WRITTEN (decl))
abort ();
- error ("%Hparameter \"%D\" has just a forward declaration",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jparameter \"%D\" has just a forward declaration",
+ decl, decl);
}
/* Warn about any struct, union or enum tags defined within this
for (y = fieldlist; y != x; y = TREE_CHAIN (y))
if (DECL_NAME (y) == DECL_NAME (x))
{
- error ("%Hduplicate member '%D'",
- &DECL_SOURCE_LOCATION (x), x);
+ error ("%Jduplicate member '%D'", x, x);
DECL_NAME (x) = NULL_TREE;
}
}
slot = htab_find_slot (htab, y, INSERT);
if (*slot)
{
- error ("%Hduplicate member '%D'",
- &DECL_SOURCE_LOCATION (x), x);
+ error ("%Jduplicate member '%D'", x, x);
DECL_NAME (x) = NULL_TREE;
}
*slot = y;
constant_expression_warning (DECL_INITIAL (x));
else
{
- error ("%Hbit-field '%D' width not an integer constant",
- &DECL_SOURCE_LOCATION (x), x);
+ error ("%Jbit-field '%D' width not an integer constant", x, x);
DECL_INITIAL (x) = NULL;
}
}
&& TREE_CODE (TREE_TYPE (x)) != BOOLEAN_TYPE
&& TREE_CODE (TREE_TYPE (x)) != ENUMERAL_TYPE)
{
- error ("%Hbit-field '%D' has invalid type",
- &DECL_SOURCE_LOCATION (x), x);
+ error ("%Jbit-field '%D' has invalid type", x, x);
DECL_INITIAL (x) = NULL;
}
&& !(TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE
&& (TYPE_PRECISION (TREE_TYPE (x))
== TYPE_PRECISION (integer_type_node))))
- pedwarn ("%Hbit-field '%D' type invalid in ISO C",
- &DECL_SOURCE_LOCATION (x), x);
+ pedwarn ("%Jbit-field '%D' type invalid in ISO C", x, x);
/* Detect and ignore out of range field width and process valid
field widths. */
? CHAR_TYPE_SIZE : TYPE_PRECISION (TREE_TYPE (x)));
if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0)
- error ("%Hnegative width in bit-field '%D'",
- &DECL_SOURCE_LOCATION (x), x);
+ error ("%Jnegative width in bit-field '%D'", x, x);
else if (0 < compare_tree_int (DECL_INITIAL (x), max_width))
- pedwarn ("%Hwidth of '%D' exceeds its type",
- &DECL_SOURCE_LOCATION (x), x);
+ pedwarn ("%Jwidth of '%D' exceeds its type", x, x);
else if (integer_zerop (DECL_INITIAL (x)) && DECL_NAME (x) != 0)
- error ("%Hzero width for bit-field '%D'",
- &DECL_SOURCE_LOCATION (x), x);
+ error ("%Jzero width for bit-field '%D'", x, x);
else
{
/* The test above has assured us that TREE_INT_CST_HIGH is 0. */
|| (width
< min_precision (TYPE_MAX_VALUE (TREE_TYPE (x)),
TREE_UNSIGNED (TREE_TYPE (x))))))
- warning ("%H'%D' is narrower than values of its type",
- &DECL_SOURCE_LOCATION (x), x);
+ warning ("%J'%D' is narrower than values of its type", x, x);
DECL_SIZE (x) = bitsize_int (width);
DECL_BIT_FIELD (x) = 1;
&& TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (x))) == NULL_TREE)
{
if (TREE_CODE (t) == UNION_TYPE)
- error ("%Hflexible array member in union",
- &DECL_SOURCE_LOCATION (x));
+ error ("%Jflexible array member in union", x);
else if (TREE_CHAIN (x) != NULL_TREE)
- error ("%Hflexible array member not at end of struct",
- &DECL_SOURCE_LOCATION (x));
+ error ("%Jflexible array member not at end of struct", x);
else if (! saw_named_field)
- error ("%Hflexible array member in otherwise empty struct",
- &DECL_SOURCE_LOCATION (x));
+ error ("%Jflexible array member in otherwise empty struct", x);
}
if (pedantic && TREE_CODE (t) == RECORD_TYPE
&& flexible_array_type_p (TREE_TYPE (x)))
- pedwarn ("%Hinvalid use of structure with flexible array member",
- &DECL_SOURCE_LOCATION (x));
+ pedwarn ("%Jinvalid use of structure with flexible array member", x);
if (DECL_NAME (x))
saw_named_field = 1;
if (DECL_DECLARED_INLINE_P (decl1)
&& DECL_UNINLINABLE (decl1)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (decl1)))
- warning ("%Hinline function '%D' given attribute noinline",
- &DECL_SOURCE_LOCATION (decl1), decl1);
+ warning ("%Jinline function '%D' given attribute noinline", decl1, decl1);
announce_function (decl1);
&& TREE_PUBLIC (decl1)
&& ! MAIN_NAME_P (DECL_NAME (decl1))
&& C_DECL_ISNT_PROTOTYPE (old_decl))
- warning ("%Hno previous prototype for '%D'",
- &DECL_SOURCE_LOCATION (decl1), decl1);
+ warning ("%Jno previous prototype for '%D'", decl1, decl1);
/* Optionally warn of any def with no previous prototype
if the function has already been used. */
else if (warn_missing_prototypes
&& old_decl != 0 && TREE_USED (old_decl)
&& TYPE_ARG_TYPES (TREE_TYPE (old_decl)) == 0)
- warning ("%H'%D' was used with no prototype before its definition",
- &DECL_SOURCE_LOCATION (decl1), decl1);
+ warning ("%J'%D' was used with no prototype before its definition",
+ decl1, decl1);
/* Optionally warn of any global def with no previous declaration. */
else if (warn_missing_declarations
&& TREE_PUBLIC (decl1)
&& old_decl == 0
&& ! MAIN_NAME_P (DECL_NAME (decl1)))
- warning ("%Hno previous declaration for '%D'",
- &DECL_SOURCE_LOCATION (decl1), decl1);
+ warning ("%Jno previous declaration for '%D'", decl1, decl1);
/* Optionally warn of any def with no previous declaration
if the function has already been used. */
else if (warn_missing_declarations
&& old_decl != 0 && TREE_USED (old_decl)
&& C_DECL_IMPLICIT (old_decl))
- warning ("%H`%D' was used with no declaration before its definition",
- &DECL_SOURCE_LOCATION (decl1), decl1);
+ warning ("%J`%D' was used with no declaration before its definition",
+ decl1, decl1);
/* This is a definition, not a reference.
So normally clear DECL_EXTERNAL.
{
tree args;
int argct = 0;
- const location_t *locus = &DECL_SOURCE_LOCATION (decl1);
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
!= integer_type_node)
- pedwarn ("%Hreturn type of '%D' is not `int'", locus, decl1);
+ pedwarn ("%Jreturn type of '%D' is not `int'", decl1, decl1);
for (args = TYPE_ARG_TYPES (TREE_TYPE (decl1)); args;
args = TREE_CHAIN (args))
{
case 1:
if (TYPE_MAIN_VARIANT (type) != integer_type_node)
- pedwarn ("%Hfirst argument of '%D' should be `int'",
- locus, decl1);
+ pedwarn ("%Jfirst argument of '%D' should be `int'",
+ decl1, decl1);
break;
case 2:
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
!= char_type_node))
- pedwarn ("%Hsecond argument of '%D' should be 'char **'",
- locus, decl1);
+ pedwarn ("%Jsecond argument of '%D' should be 'char **'",
+ decl1, decl1);
break;
case 3:
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
!= char_type_node))
- pedwarn ("%Hthird argument of '%D' should probably be "
- "'char **'", locus, decl1);
+ pedwarn ("%Jthird argument of '%D' should probably be "
+ "'char **'", decl1, decl1);
break;
}
}
argument because it's only mentioned in an appendix of the
standard. */
if (argct > 0 && (argct < 2 || argct > 3))
- pedwarn ("%H'%D' takes only zero or two arguments", locus, decl1);
+ pedwarn ("%J'%D' takes only zero or two arguments", decl1, decl1);
if (! TREE_PUBLIC (decl1))
- pedwarn ("%H'%D' is normally a non-static function", locus, decl1);
+ pedwarn ("%J'%D' is normally a non-static function", decl1, decl1);
}
/* Record the decl so that the function name is defined.
if (current_scope->parms || current_scope->names || current_scope->tags)
{
- error ("%Hold-style parameter declarations in prototyped "
- "function definition", &DECL_SOURCE_LOCATION (fndecl));
+ error ("%Jold-style parameter declarations in prototyped "
+ "function definition", fndecl);
/* Get rid of the old-style declarations. */
poplevel (0, 0, 0);
{
DECL_CONTEXT (decl) = current_function_decl;
if (DECL_NAME (decl) == 0)
- error ("%Hparameter name omitted", &DECL_SOURCE_LOCATION (decl));
+ error ("%Jparameter name omitted", decl);
else
{
if (IDENTIFIER_SYMBOL_VALUE (DECL_NAME (decl)))
{
if (TREE_VALUE (parm) == 0)
{
- error ("%Hparameter name missing from parameter list",
- &DECL_SOURCE_LOCATION (fndecl));
+ error ("%Jparameter name missing from parameter list", fndecl);
TREE_PURPOSE (parm) = 0;
continue;
}
decl = IDENTIFIER_SYMBOL_VALUE (TREE_VALUE (parm));
if (decl && DECL_CONTEXT (decl) == fndecl)
{
- const location_t *locus = &DECL_SOURCE_LOCATION (decl);
/* If we got something other than a PARM_DECL it is an error. */
if (TREE_CODE (decl) != PARM_DECL)
- error ("%H\"%D\" declared as a non-parameter", locus, decl);
+ error ("%J\"%D\" declared as a non-parameter", decl, decl);
/* If the declaration is already marked, we have a duplicate
name. Complain and ignore the duplicate. */
else if (DECL_WEAK (decl))
{
- error ("%Hmultiple parameters named \"%D\"", locus, decl);
+ error ("%Jmultiple parameters named \"%D\"", decl, decl);
TREE_PURPOSE (parm) = 0;
continue;
}
an int. */
else if (VOID_TYPE_P (TREE_TYPE (decl)))
{
- error ("%Hparameter \"%D\" declared void", locus, decl);
+ error ("%Jparameter \"%D\" declared void", decl, decl);
TREE_TYPE (decl) = integer_type_node;
DECL_ARG_TYPE (decl) = integer_type_node;
layout_decl (decl, 0);
/* If no declaration found, default to int. */
else
{
- const location_t *locus = &DECL_SOURCE_LOCATION (fndecl);
decl = build_decl (PARM_DECL, TREE_VALUE (parm), integer_type_node);
DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
- DECL_SOURCE_LOCATION (decl) = *locus;
+ DECL_SOURCE_LOCATION (decl) = DECL_SOURCE_LOCATION (fndecl);
pushdecl (decl);
if (flag_isoc99)
- pedwarn ("%Htype of \"%D\" defaults to \"int\"", locus, decl);
+ pedwarn ("%Jtype of \"%D\" defaults to \"int\"", decl, decl);
else if (extra_warnings)
- warning ("%Htype of \"%D\" defaults to \"int\"", locus, decl);
+ warning ("%Jtype of \"%D\" defaults to \"int\"", decl, decl);
}
TREE_PURPOSE (parm) = decl;
for (parm = current_scope->parms; parm; parm = TREE_CHAIN (parm))
{
- const location_t *locus = &DECL_SOURCE_LOCATION (parm);
-
if (!COMPLETE_TYPE_P (TREE_TYPE (parm)))
{
- error ("%Hparameter \"%D\" has incomplete type", locus, parm);
+ error ("%Jparameter \"%D\" has incomplete type", parm, parm);
TREE_TYPE (parm) = error_mark_node;
}
if (! DECL_WEAK (parm))
{
- error ("%Hdeclaration for parameter \"%D\" but no such parameter",
- locus, parm);
+ error ("%Jdeclaration for parameter \"%D\" but no such parameter",
+ parm, parm);
/* Pretend the parameter was not missing.
This gets us to a standard state and minimizes
/* If warn_main is 1 (-Wmain) or 2 (-Wall), we have already warned.
If warn_main is -1 (-Wno-main) we don't want to be warned. */
if (!warn_main)
- pedwarn ("%Hreturn type of '%D' is not `int'",
- &DECL_SOURCE_LOCATION (fndecl), fndecl);
+ pedwarn ("%Jreturn type of '%D' is not `int'", fndecl, fndecl);
}
else
{
for (t = getdecls (); t; t = TREE_CHAIN (t))
{
- const location_t *locus = &DECL_SOURCE_LOCATION (t);
if (TREE_CODE (t) != VAR_DECL && DECL_NAME (t))
- error ("%Hdeclaration of non-variable '%D' in 'for' loop "
- "initial declaration", locus, t);
+ error ("%Jdeclaration of non-variable '%D' in 'for' loop "
+ "initial declaration", t, t);
else if (TREE_STATIC (t))
- error ("%Hdeclaration of static variable '%D' in 'for' loop "
- "initial declaration", locus, t);
+ error ("%Jdeclaration of static variable '%D' in 'for' loop "
+ "initial declaration", t, t);
else if (DECL_EXTERNAL (t))
- error ("%Hdeclaration of 'extern' variable '%D' in 'for' loop "
- "initial declaration", locus, t);
+ error ("%Jdeclaration of 'extern' variable '%D' in 'for' loop "
+ "initial declaration", t, t);
}
}
\f
}
else
{
- error ("%Hredefinition of global '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
- error ("%H'%D' previously defined here",
- &DECL_SOURCE_LOCATION (old_decl), old_decl);
+ error ("%Jredefinition of global '%D'", decl, decl);
+ error ("%J'%D' previously defined here", old_decl, old_decl);
}
}
else
/* %H will require "location_t" at runtime. */
{ "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
+ /* These will require a "tree" at runtime. */
+ { "J", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
+
{ "m", 0, STD_C89, NOARGUMENTS, "", "" },
{ NULL, 0, 0, NOLENGTHS, NULL, NULL }
};
{ "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
/* These will require a "tree" at runtime. */
- { "DEFT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
+ { "DEFJT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
{ "m", 0, STD_C89, NOARGUMENTS, "", "" },
{ NULL, 0, 0, NOLENGTHS, NULL, NULL }
{ "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
/* These will require a "tree" at runtime. */
- { "ADEFTV",0,STD_C89,{ T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "+#", "" },
+ { "ADEFJTV",0,STD_C89,{ T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "+#", "" },
/* These accept either an `int' or an `enum tree_code' (which is handled as an `int'.) */
{ "CLOPQ",0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
{
const char *this;
const char *that;
+ tree tmp;
+
+ tmp = TYPE_NAME (wanted_type);
+ if (TREE_CODE (tmp) == TYPE_DECL)
+ tmp = DECL_NAME (tmp);
+ this = IDENTIFIER_POINTER (tmp);
- this = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (wanted_type)));
that = 0;
if (TYPE_NAME (orig_cur_type) != 0
&& TREE_CODE (orig_cur_type) != INTEGER_TYPE
&& !(TREE_CODE (orig_cur_type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (orig_cur_type)) == INTEGER_TYPE))
{
- if (TREE_CODE (TYPE_NAME (orig_cur_type)) == TYPE_DECL
- && DECL_NAME (TYPE_NAME (orig_cur_type)) != 0)
- that = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (orig_cur_type)));
- else
- that = IDENTIFIER_POINTER (TYPE_NAME (orig_cur_type));
+ tmp = TYPE_NAME (orig_cur_type);
+ if (TREE_CODE (tmp) == TYPE_DECL)
+ tmp = DECL_NAME (tmp);
+ if (tmp)
+ that = IDENTIFIER_POINTER (tmp);
}
/* A nameless type can't possibly match what the format wants.
/* We shouldn't be looking for a non-existent specifier. */
abort ();
-
}
/* Given a format_length_info array FLI, and a character C, this
diag_fci[i].types[0].type = &loc;
diag_fci[i].pointer_count = 1;
}
+ if (t)
+ {
+ i = find_char_info_specifier_index (diag_fci, 'J');
+ diag_fci[i].types[0].type = &t;
+ diag_fci[i].pointer_count = 1;
+ }
/* Handle the __gcc_cdiag__ format specifics. */
if (! cdiag_fci)
i = find_char_info_specifier_index (cdiag_fci, 'D');
cdiag_fci[i].types[0].type = &t;
cdiag_fci[i].pointer_count = 1;
+ i = find_char_info_specifier_index (cdiag_fci, 'J');
+ cdiag_fci[i].types[0].type = &t;
+ cdiag_fci[i].pointer_count = 1;
}
/* Handle the __gcc_cxxdiag__ format specifics. */
i = find_char_info_specifier_index (cxxdiag_fci, 'D');
cxxdiag_fci[i].types[0].type = &t;
cxxdiag_fci[i].pointer_count = 1;
+ i = find_char_info_specifier_index (cxxdiag_fci, 'J');
+ cxxdiag_fci[i].types[0].type = &t;
+ cxxdiag_fci[i].pointer_count = 1;
}
}
}
&& lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) == NULL)
{
if (do_warning)
- warning ("%Hfunction '%F' can never be inlined because it "
- "is supressed using -fno-inline",
- &DECL_SOURCE_LOCATION (fn), fn);
+ warning ("%Jfunction '%F' can never be inlined because it "
+ "is supressed using -fno-inline", fn, fn);
goto cannot_inline;
}
if (!DECL_DECLARED_INLINE_P (fn) && !(*targetm.binds_local_p) (fn))
{
if (do_warning)
- warning ("%Hfunction '%F' can never be inlined because it might not "
- "be bound within this unit of translation",
- &DECL_SOURCE_LOCATION (fn), fn);
+ warning ("%Jfunction '%F' can never be inlined because it might not "
+ "be bound within this unit of translation", fn, fn);
goto cannot_inline;
}
if (! function_attribute_inlinable_p (fn))
{
if (do_warning)
- warning ("%Hfunction '%F' can never be inlined because it uses "
- "attributes conflicting with inlining",
- &DECL_SOURCE_LOCATION (fn), fn);
+ warning ("%Jfunction '%F' can never be inlined because it uses "
+ "attributes conflicting with inlining", fn, fn);
goto cannot_inline;
}
if (t)
{
if (do_warning)
- warning ("%Hfunction '%F' can never be inlined because it has "
- "pending sizes",
- &DECL_SOURCE_LOCATION (fn), fn);
+ warning ("%Jfunction '%F' can never be inlined because it has "
+ "pending sizes", fn, fn);
goto cannot_inline;
}
}
if (DECL_LANG_SPECIFIC (fn)->pending_sizes)
{
if (do_warning)
- warning ("%Hnested function '%F' can never be inlined because it "
- "has possibly saved pending sizes",
- &DECL_SOURCE_LOCATION (fn), fn);
+ warning ("%Jnested function '%F' can never be inlined because it "
+ "has possibly saved pending sizes", fn, fn);
goto cannot_inline;
}
}
if (SUPPORTS_WEAK && DECL_EXTERNAL (decl) && TREE_USED (decl)
&& !DECL_WEAK (decl) /* don't complain about a redundant #pragma */
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
- warning ("%Happlying #pragma weak '%D' after first use results "
- "in unspecified behavior", &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Japplying #pragma weak '%D' after first use results "
+ "in unspecified behavior", decl, decl);
declare_weak (decl);
}
if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline
&& optimize > 0 && !TREE_ADDRESSABLE (fndecl))
{
- warning ("%Hinlining failed in call to '%F'",
- &DECL_SOURCE_LOCATION (fndecl), fndecl);
+ warning ("%Jinlining failed in call to '%F'", fndecl, fndecl);
warning ("called from here");
}
(*lang_hooks.mark_addressable) (fndecl);
if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline
&& optimize > 0)
{
- warning ("%Hcan't inline call to '%F'",
- &DECL_SOURCE_LOCATION (fndecl), fndecl);
+ warning ("%Jcan't inline call to '%F'", fndecl, fndecl);
warning ("called from here");
}
(*lang_hooks.mark_addressable) (fndecl);
&& !DECL_VIRTUAL_P (decl)
&& DECL_INITIAL (decl))
{
- error ("%Hinitialized variable '%D' is marked dllimport",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jinitialized variable '%D' is marked dllimport", decl, decl);
return;
}
/* Nor can they be static. */
&& !DECL_VIRTUAL_P (decl)
&& 0 /*???*/)
{
- error ("%Hstatic variable '%D' is marked dllimport",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jstatic variable '%D' is marked dllimport", decl, decl);
return;
}
if (TREE_CODE (node) == FUNCTION_DECL && DECL_INITIAL (node)
&& !DECL_INLINE (node))
{
- error ("%Hfunction `%D' definition is marked dllimport.",
- &DECL_SOURCE_LOCATION (node), node);
+ error ("%Jfunction `%D' definition is marked dllimport.", node, node);
*no_add_attrs = true;
}
{
if (DECL_INITIAL (node))
{
- error ("%Hvariable `%D' definition is marked dllimport.",
- &DECL_SOURCE_LOCATION (node), node);
+ error ("%Jvariable `%D' definition is marked dllimport.",
+ node, node);
*no_add_attrs = true;
}
&& (TREE_CODE (node) == VAR_DECL
|| TREE_CODE (node) == FUNCTION_DECL))
{
- error ("%Hexternal linkage required for symbol '%D' because of '%s' attribute.",
- &DECL_SOURCE_LOCATION (node), node, IDENTIFIER_POINTER (name));
+ error ("%Jexternal linkage required for symbol '%D' because of "
+ "'%s' attribute.", node, node, IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
{
/* Don't warn about artificial methods. */
if (!DECL_ARTIFICIAL (decl))
- warning ("%H function '%D' is defined after prior declaration as dllimport: attribute ignored",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jfunction '%D' is defined after prior declaration "
+ "as dllimport: attribute ignored", decl, decl);
return 0;
}
else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
{
if (extra_warnings)
- warning ("%Hinline function '%D' is declared as dllimport: attribute ignored.",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jinline function '%D' is declared as dllimport: "
+ "attribute ignored.", decl, decl);
return 0;
}
&& !DECL_EXTERNAL (decl) && context_imp)
{
if (!DECL_VIRTUAL_P (decl))
- error ("%Hdefinition of static data member '%D' of dllimport'd class.",
- &DECL_SOURCE_LOCATION (decl), decl); return 0;
+ error ("%Jdefinition of static data member '%D' of "
+ "dllimport'd class.", decl, decl);
+ return 0;
}
/* Since we can't treat a pointer to a dllimport'd symbol as a
abort ();
if (i386_pe_dllimport_name_p (oldname))
{
- warning ("%Hinconsistent dll linkage for '%D', dllexport assumed.",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jinconsistent dll linkage for '%D', dllexport assumed.",
+ decl, decl);
/* Remove DLL_IMPORT_PREFIX. */
oldname += strlen (DLL_IMPORT_PREFIX);
DECL_NON_ADDR_CONST_P (decl) = 0;
/* Already done, but do a sanity check to prevent assembler errors. */
if (!DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl))
{
- error ("%Hfailure in redeclaration of '%D': dllimport'd symbol lacks external linkage.",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jfailure in redeclaration of '%D': dllimport'd "
+ "symbol lacks external linkage.", decl, decl);
abort();
}
return;
&& i386_pe_dllimport_name_p (XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0)))
{
const char *oldname = XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0);
+
/* Remove DLL_IMPORT_PREFIX. */
tree idp = get_identifier (oldname + strlen (DLL_IMPORT_PREFIX));
rtx newrtl = gen_rtx (SYMBOL_REF, Pmode, IDENTIFIER_POINTER (idp));
- warning ("%H%s '%D' %s after being referenced with dllimport linkage.",
- &DECL_SOURCE_LOCATION (decl),
- TREE_CODE (decl) == VAR_DECL ? "variable" : "function",
- decl, (DECL_INITIAL (decl) || !DECL_EXTERNAL (decl))
- ? "defined locally" : "redeclared without dllimport attribute");
+ if (DECL_INITIAL (decl) || !DECL_EXTERNAL (decl))
+ warning ("%J'%D' defined locally after being "
+ "referenced with dllimport linkage", decl, decl);
+ else
+ warning ("%J'%D' redeclared without dllimport attribute "
+ "after being referenced with dllimport linkage", decl, decl);
XEXP (DECL_RTL (decl), 0) = newrtl;
else
{
if (decl && **slot != flags)
- error ("%H'%D' causes a section type conflict",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%J'%D' causes a section type conflict", decl, decl);
}
return flags;
== FUNCTION_DECL)
&& !TREE_STATIC (decl))
{
- error ("%Ha an address area attribute cannot be specified for "
- "local variables", &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jan address area attribute cannot be specified for "
+ "local variables", decl, decl);
*no_add_attrs = true;
}
area = ia64_get_addr_area (decl);
if (area != ADDR_AREA_NORMAL && addr_area != area)
{
- error ("%Ha address area of '%s' conflicts with previous "
- "declaration", &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jaddress area of '%s' conflicts with previous "
+ "declaration", decl, decl);
*no_add_attrs = true;
}
break;
case FUNCTION_DECL:
- error ("%Ha address area attribute cannot be specified for functions",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jaddress area attribute cannot be specified for functions",
+ decl, decl);
*no_add_attrs = true;
break;
&& !DECL_VIRTUAL_P (decl)
&& DECL_INITIAL (decl))
{
- error ("%Hinitialized variable '%D' is marked dllimport",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jinitialized variable '%D' is marked dllimport", decl, decl);
return;
}
case VAR_DECL:
if (current_function_decl != NULL_TREE)
{
- error ("%Ha data area attribute cannot be specified for "
- "local variables", &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jdata area attributes cannot be specified for "
+ "local variables", decl, decl);
*no_add_attrs = true;
}
area = v850_get_data_area (decl);
if (area != DATA_AREA_NORMAL && data_area != area)
{
- error ("%Hdata area of '%D' conflicts with previous declaration",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jdata area of '%D' conflicts with previous declaration",
+ decl, decl);
*no_add_attrs = true;
}
break;
+2003-09-20 Richard Henderson <rth@redhat.com>
+
+ * decl.c, decl2.c, pt.c: Use %J in diagnostics.
+
2003-09-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/157
else if (TYPE_P (candidate->fn))
inform ("%s %T <conversion>", msgstr, candidate->fn);
else if (candidate->viable == -1)
- inform ("%H%s %+#D <near match>",
- &DECL_SOURCE_LOCATION (candidate->fn), msgstr, candidate->fn);
+ inform ("%J%s %+#D <near match>", candidate->fn, msgstr, candidate->fn);
else
- inform ("%H%s %+#D",
- &DECL_SOURCE_LOCATION (candidate->fn), msgstr, candidate->fn);
+ inform ("%J%s %+#D", candidate->fn, msgstr, candidate->fn);
}
static void
&& DECL_UNINLINABLE (olddecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
{
- warning ("%Hfunction '%D' redeclared as inline",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
- warning ("%Hprevious declaration of '%D' with attribute noinline",
- &DECL_SOURCE_LOCATION (olddecl), olddecl);
+ warning ("%Jfunction '%D' redeclared as inline", newdecl, newdecl);
+ warning ("%Jprevious declaration of '%D' with attribute noinline",
+ olddecl, olddecl);
}
else if (DECL_DECLARED_INLINE_P (olddecl)
&& DECL_UNINLINABLE (newdecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
{
- warning ("%Hfunction '%D' redeclared with attribute noinline",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
- warning ("%Hprevious declaration of '%D' was inline",
- &DECL_SOURCE_LOCATION (olddecl), olddecl);
+ warning ("%Jfunction '%D' redeclared with attribute noinline",
+ newdecl, newdecl);
+ warning ("%Jprevious declaration of '%D' was inline",
+ olddecl, olddecl);
}
}
{
/* Prototype decl follows defn w/o prototype. */
cp_warning_at ("prototype for `%#D'", newdecl);
- warning ("%Hfollows non-prototype definition here",
- &DECL_SOURCE_LOCATION (olddecl));
+ warning ("%Jfollows non-prototype definition here", olddecl);
}
else if (TREE_CODE (olddecl) == FUNCTION_DECL
&& DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl))
&& ! DECL_DECLARED_INLINE_P (olddecl)
&& TREE_ADDRESSABLE (olddecl) && warn_inline)
{
- warning ("`%#D' was used before it was declared inline",
- newdecl);
- warning ("%Hprevious non-inline declaration here",
- &DECL_SOURCE_LOCATION (olddecl));
+ warning ("`%#D' was used before it was declared inline", newdecl);
+ warning ("%Jprevious non-inline declaration here", olddecl);
}
}
}
if (u > 1 && DECL_ARTIFICIAL (b))
/* Can't skip init of __exception_info. */
- error ("%H enters catch block", &DECL_SOURCE_LOCATION (b));
+ error ("%J enters catch block", b);
else if (u > 1)
cp_error_at (" skips initialization of `%#D'", b);
else
/* ISO C++ 9.5.3. Anonymous unions may not have function members. */
if (TYPE_METHODS (t))
- error ("%Han anonymous union cannot have function members",
- &DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (t)));
+ error ("%Jan anonymous union cannot have function members",
+ TYPE_MAIN_DECL (t));
/* Anonymous aggregates cannot have fields with ctors, dtors or complex
assignment operators (because they cannot have these methods themselves).
&& DECL_DECLARED_INLINE_P (decl)
&& DECL_UNINLINABLE (decl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (decl)))
- warning ("%Hinline function '%D' given attribute noinline",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jinline function '%D' given attribute noinline", decl, decl);
if (context && COMPLETE_TYPE_P (complete_type (context)))
{
TREE_PUBLIC (decl) = 0;
DECL_COMMON (decl) = 0;
cp_warning_at ("sorry: semantics of inline function static data `%#D' are wrong (you'll wind up with multiple copies)", decl);
- warning ("%H you can work around this by removing the initializer",
- &DECL_SOURCE_LOCATION (decl));
+ warning ("%J you can work around this by removing the initializer",
+ decl);
}
}
}
{
decl = build_decl (TYPE_DECL, declarator, type);
if (in_namespace || ctype)
- error ("%Htypedef name may not be a nested-name-specifier",
- &DECL_SOURCE_LOCATION (decl));
+ error ("%Jtypedef name may not be a nested-name-specifier", decl);
if (!current_function_decl)
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
}
if (ctype == NULL_TREE)
{
if (TREE_CODE (type) != METHOD_TYPE)
- error ("%Hinvalid type qualifier for non-member function type",
- &DECL_SOURCE_LOCATION (decl));
+ error ("%Jinvalid type qualifier for non-member function type",
+ decl);
else
ctype = TYPE_METHOD_BASETYPE (type);
}
if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE)
{
error ("multiple definition of `%#T'", enumtype);
- error ("%Hprevious definition here",
- &DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)));
+ error ("%Jprevious definition here", TYPE_MAIN_DECL (enumtype));
/* Clear out TYPE_VALUES, and start again. */
TYPE_VALUES (enumtype) = NULL_TREE;
}
if (DECL_DECLARED_INLINE_P (decl1)
&& lookup_attribute ("noinline", attrs))
- warning ("%Hinline function '%D' given attribute noinline",
- &DECL_SOURCE_LOCATION (decl1), decl1);
+ warning ("%Jinline function '%D' given attribute noinline", decl1, decl1);
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl1))
/* This is a constructor, we must ensure that any default args
if (flags & LOOKUP_COMPLAIN)
{
error ("`%D' denotes an ambiguous type",name);
- error ("%H first type here",
- &DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (BINDING_TYPE (old))));
- error ("%H other type here",
- &DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)));
+ error ("%J first type here", TYPE_MAIN_DECL (BINDING_TYPE (old)));
+ error ("%J other type here", TYPE_MAIN_DECL (type));
}
}
return old;
A template-parameter may not be given default arguments
by two different declarations in the same scope. */
error ("redefinition of default argument for `%#D'", parm);
- error ("%H original definition appeared here",
- &DECL_SOURCE_LOCATION (tmpl_parm));
+ error ("%J original definition appeared here", tmpl_parm);
return;
}
;
/* Extract the location information if any. */
- if (*p == '%' && *++p == 'H')
+ if (p[0] == '%' && p[1] == 'H')
{
*locus = *va_arg (*text->args_ptr, location_t *);
- text->format_spec = p + 1;
+ text->format_spec = p + 2;
+ return true;
+ }
+ else if (p[0] == '%' && p[1] == 'J')
+ {
+ tree t = va_arg (*text->args_ptr, tree);
+ *locus = DECL_SOURCE_LOCATION (t);
+ text->format_spec = p + 2;
return true;
}
if (regno >= DWARF_FRAME_REGISTERS)
{
- warning ("%Hinternal regno botch: '%D' has regno = %d\n",
- &DECL_SOURCE_LOCATION (dwarf_last_decl), dwarf_last_decl,
- regno);
+ warning ("%Jinternal regno botch: '%D' has regno = %d\n",
+ dwarf_last_decl, dwarf_last_decl, regno);
regno = 0;
}
dw2_assemble_integer (4, GEN_INT (DBX_REGISTER_NUMBER (regno)));
case PARM_DECL:
if (!DECL_RTL_SET_P (exp))
{
- error ("%Hprior parameter's size depends on '%D'",
- &DECL_SOURCE_LOCATION (exp), exp);
+ error ("%Jprior parameter's size depends on '%D'", exp, exp);
return CONST0_RTX (mode);
}
if (decl && size == -1
&& TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST)
{
- error ("%Hsize of variable '%D' is too large",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jsize of variable '%D' is too large", decl, decl);
size = 1;
}
if we want to warn. */
&& (DECL_INITIAL (decl) == NULL_TREE || lang_hooks.decl_uninit (decl))
&& regno_uninitialized (REGNO (DECL_RTL (decl))))
- warning ("%H'%D' might be used uninitialized in this function",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%J'%D' might be used uninitialized in this function",
+ decl, decl);
if (extra_warnings
&& TREE_CODE (decl) == VAR_DECL
&& DECL_RTL (decl) != 0
&& GET_CODE (DECL_RTL (decl)) == REG
&& regno_clobbered_at_setjmp (REGNO (DECL_RTL (decl))))
- warning ("%Hvariable '%D' might be clobbered by `longjmp' or `vfork'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jvariable '%D' might be clobbered by `longjmp' or `vfork'",
+ decl, decl);
}
for (sub = BLOCK_SUBBLOCKS (block); sub; sub = TREE_CHAIN (sub))
uninitialized_vars_warning (sub);
if (DECL_RTL (decl) != 0
&& GET_CODE (DECL_RTL (decl)) == REG
&& regno_clobbered_at_setjmp (REGNO (DECL_RTL (decl))))
- warning ("%Hargument '%D' might be clobbered by `longjmp' or `vfork'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jargument '%D' might be clobbered by `longjmp' or `vfork'",
+ decl, decl);
}
/* If this function call setjmp, put all vars into the stack
decl; decl = TREE_CHAIN (decl))
if (! TREE_USED (decl) && TREE_CODE (decl) == PARM_DECL
&& DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
- warning ("%Hunused parameter '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Junused parameter '%D'", decl, decl);
}
/* Delete handlers for nonlocal gotos if nothing uses them. */
+2003-09-20 Richard Henderson <rth@redhat.com>
+
+ * check-init.c, class.c, decl.c, expr.c: Use %J in diagnostics.
+
2003-09-18 Roger Sayle <roger@eyesopen.com>
* expr.c (java_truthvalue_conversion): Remove FFS_EXPR case.
if (index >= 0 && ! ASSIGNED_P (before, index))
{
if (! is_finit_method)
- error ("%Hfinal field '%D' may not have been initialized",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jfinal field '%D' may not have been initialized",
+ decl, decl);
}
else if (is_finit_method)
DECL_FIELD_FINAL_IUD (decl) = 1;
if (METHOD_ABSTRACT (method))
{
if (! abstract_p)
- warning ("%Habstract method in non-abstract class",
- &DECL_SOURCE_FILE (method));
+ warning ("%Jabstract method in non-abstract class", method);
if (TARGET_VTABLE_USES_DESCRIPTORS)
for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; ++j)
DECL_VINDEX (method_decl) = DECL_VINDEX (super_method);
if (DECL_VINDEX (method_decl) == NULL_TREE
&& !CLASS_FROM_SOURCE_P (this_class))
- error ("%Hnon-static method '%D' overrides static method",
- &DECL_SOURCE_LOCATION (method_decl), method_decl);
+ error ("%Jnon-static method '%D' overrides static method",
+ method_decl, method_decl);
}
else if (! METHOD_FINAL (method_decl)
&& ! METHOD_PRIVATE (method_decl)
/* error_mark_node is 0 for a while during initialization! */
{
t = 0;
- error ("%H'%D' used prior to declaration",
- &DECL_SOURCE_LOCATION (x), x);
+ error ("%J'%D' used prior to declaration", x, x);
}
/* If we're naming a hitherto-unnamed type, set its TYPE_NAME
if (DECL_INITIAL (label) == 0)
{
- error ("%Hlabel '%D' used but not defined",
- &DECL_SOURCE_LOCATION (label), label);
+ error ("%Jlabel '%D' used but not defined", label, label);
/* Avoid crashing later. */
define_label (input_location, DECL_NAME (label));
}
else if (warn_unused[UNUSED_LABEL] && !TREE_USED (label))
- warning ("%Hlabel '%D' defined but not used",
- &DECL_SOURCE_LOCATION (label), label);
+ warning ("%Jlabel '%D' defined but not used", label, label);
IDENTIFIER_LABEL_VALUE (DECL_NAME (label)) = 0;
/* Put the labels into the "variables" of the
while (current_binding_level->start_pc > start_pc)
{
if (pedantic && current_binding_level->start_pc > start_pc)
- warning ("%HIn %D: overlapped variable and exception ranges at %d",
- &DECL_SOURCE_LOCATION (current_function_decl),
- current_function_decl, current_binding_level->start_pc);
+ warning ("%JIn %D: overlapped variable and exception ranges at %d",
+ current_function_decl, current_function_decl,
+ current_binding_level->start_pc);
expand_end_bindings (getdecls (), 1, 0);
poplevel (1, 0, 0);
}
tree decl = build_decl (VAR_DECL, name, type);
if (end_pc > DECL_CODE_LENGTH (current_function_decl))
{
- warning ("%Hbad PC range for debug info for local '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jbad PC range for debug info for local '%D'",
+ decl, decl);
end_pc = DECL_CODE_LENGTH (current_function_decl);
}
if (FIELD_FINAL (field_decl))
{
if (DECL_CONTEXT (field_decl) != current_class)
- error ("%Hassignment to final field '%D' not in field's class",
- &DECL_SOURCE_LOCATION (field_decl), field_decl);
+ error ("%Jassignment to final field '%D' not in field's class",
+ field_decl, field_decl);
else if (FIELD_STATIC (field_decl))
{
if (!DECL_CLINIT_P (current_function_decl))
- warning ("assignment to final static field `%s' not in "
- "class initializer",
- &DECL_SOURCE_LOCATION (field_decl), field_decl);
+ warning ("%Jassignment to final static field `%D' not in "
+ "class initializer", field_decl, field_decl);
}
else
{
tree cfndecl_name = DECL_NAME (current_function_decl);
if (! DECL_CONSTRUCTOR_P (current_function_decl)
&& !ID_FINIT_P (cfndecl_name))
- warning ("%Hassignment to final field '%D' not in constructor",
- &DECL_SOURCE_LOCATION (field_decl), field_decl);
+ warning ("%Jassignment to final field '%D' not in constructor",
+ field_decl, field_decl);
}
}
expand_assignment (field_ref, new_value, 0);
if (TREE_CODE (type) == RECORD_TYPE
&& TREE_STATIC_TEMPLATE (type)
&& type != constant_string_type)
- error ("%H'%D' cannot be statically allocated",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%J'%D' cannot be statically allocated", decl, decl);
}
/* Implement static typing. At this point, we know we have an interface. */
if ((decl = lookup_name (ident)))
{
error ("`%s' redeclared as different kind of symbol",
- IDENTIFIER_POINTER (ident));
- error ("%Hprevious declaration of '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ IDENTIFIER_POINTER (ident));
+ error ("%Jprevious declaration of '%D'", decl, decl);
}
if (! is_class_name (ident))
static void
error_with_ivar (const char *message, tree decl, tree rawdecl)
{
- error ("%H%s `%s'", &DECL_SOURCE_LOCATION (decl),
- message, gen_declaration (rawdecl, errbuf));
-
+ error ("%J%s `%s'", decl, message, gen_declaration (rawdecl, errbuf));
}
static void
{
error ("`%s' redeclared as different kind of symbol",
IDENTIFIER_POINTER (class_name));
- error ("%Hprevious declaration of '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jprevious declaration of '%D'", decl, decl);
}
if (code == CLASS_IMPLEMENTATION_TYPE)
warn_with_method (const char *message, int mtype, tree method)
{
/* Add a readable method name to the warning. */
- warning ("%H%s `%c%s'", &DECL_SOURCE_LOCATION (method),
- message, mtype, gen_method_decl (method, errbuf));
+ warning ("%J%s `%c%s'", method, message, mtype,
+ gen_method_decl (method, errbuf));
}
/* Return 1 if METHOD is consistent with PROTO. */
&& INSN_UID (first_insn) > INSN_UID (f->before_jump)
&& ! DECL_ERROR_ISSUED (f->target))
{
- error ("%Hlabel '%D' used before containing binding contour",
- &DECL_SOURCE_LOCATION (f->target), f->target);
+ error ("%Jlabel '%D' used before containing binding contour",
+ f->target, f->target);
/* Prevent multiple errors for one label. */
DECL_ERROR_ISSUED (f->target) = 1;
}
&& ! TREE_USED (decl)
&& ! DECL_IN_SYSTEM_HEADER (decl)
&& DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
- warning ("%Hunused variable '%D'", &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Junused variable '%D'", decl, decl);
}
/* Generate RTL code to terminate a binding contour.
that must be an error, because gotos without fixups
come from outside all saved stack-levels. */
if (TREE_ADDRESSABLE (chain->label))
- error ("%Hlabel '%D' used before containing binding contour",
- &DECL_SOURCE_LOCATION (chain->label), chain->label);
+ error ("%Jlabel '%D' used before containing binding contour",
+ chain->label, chain->label);
}
}
int size_as_int = TREE_INT_CST_LOW (size);
if (compare_tree_int (size, size_as_int) == 0)
- warning ("%Hsize of '%D' is %d bytes",
- &DECL_SOURCE_LOCATION (decl), decl, size_as_int);
+ warning ("%Jsize of '%D' is %d bytes", decl, decl, size_as_int);
else
- warning ("size of '%D' is larger than %d bytes",
- &DECL_SOURCE_LOCATION (decl), decl, larger_than_size);
+ warning ("%Jsize of '%D' is larger than %d bytes",
+ decl, decl, larger_than_size);
}
}
if (TYPE_ALIGN (type) > desired_align)
{
if (STRICT_ALIGNMENT)
- warning ("%Hpacked attribute causes inefficient alignment "
- "for '%D'", &DECL_SOURCE_LOCATION (field), field);
+ warning ("%Jpacked attribute causes inefficient alignment "
+ "for '%D'", field, field);
else
- warning ("%Hpacked attribute is unnecessary for '%D'",
- &DECL_SOURCE_LOCATION (field), field);
+ warning ("%Jpacked attribute is unnecessary for '%D'",
+ field, field);
}
}
else
Bump the cumulative size to multiple of field alignment. */
if (warn_padded)
- warning ("%Hpadding struct to align '%D'",
- &DECL_SOURCE_LOCATION (field), field);
+ warning ("%Jpadding struct to align '%D'", field, field);
/* If the alignment is still within offset_align, just align
the bit position. */
+2003-09-20 Richard Henderson <rth@redhat.com>
+
+ * gcc.dg/format/gcc_diag-1.c: Add tests for %J.
+
2003-09-20 Roger Sayle <roger@eyesopen.com>
* gcc.c-torture/execute/20030920-1.c: New test case.
diag ("%H", loc);
cdiag ("%H", loc);
cxxdiag ("%H", loc);
+ diag ("%J", t1);
+ cdiag ("%J", t1);
+ cxxdiag ("%J", t1);
cdiag ("%D%F%T", t1, t1, t1);
cdiag ("%D%D%D%D", t1, t2, *t3, t4[5]);
diag ("%H"); /* { dg-warning "format" "missing arg" } */
cdiag ("%H"); /* { dg-warning "format" "missing arg" } */
cxxdiag ("%H"); /* { dg-warning "format" "missing arg" } */
+ diag ("%J"); /* { dg-warning "format" "missing arg" } */
+ cdiag ("%J"); /* { dg-warning "format" "missing arg" } */
+ cxxdiag ("%J"); /* { dg-warning "format" "missing arg" } */
diag ("%H", i); /* { dg-warning "format" "wrong arg" } */
cdiag ("%H", i); /* { dg-warning "format" "wrong arg" } */
cxxdiag ("%H", i); /* { dg-warning "format" "wrong arg" } */
diag ("%H", p); /* { dg-warning "format" "wrong arg" } */
cdiag ("%H", p); /* { dg-warning "format" "wrong arg" } */
cxxdiag ("%H", p); /* { dg-warning "format" "wrong arg" } */
+ diag ("%J", loc); /* { dg-warning "format" "wrong arg" } */
+ cdiag ("%J", loc); /* { dg-warning "format" "wrong arg" } */
+ cxxdiag ("%J", loc); /* { dg-warning "format" "wrong arg" } */
diag ("%#H", loc); /* { dg-warning "format" "bogus modifier" } */
cdiag ("%#H", loc); /* { dg-warning "format" "bogus modifier" } */
cxxdiag ("%#H", loc); /* { dg-warning "format" "bogus modifier" } */
&& ! TREE_PUBLIC (decl))
{
if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
- pedwarn ("%H'%F' used but never defined",
- &DECL_SOURCE_LOCATION (decl), decl);
+ pedwarn ("%J'%F' used but never defined", decl, decl);
else
- warning ("%H'%F' declared `static' but never defined",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%J'%F' declared `static' but never defined", decl, decl);
/* This symbol is effectively an "extern" declaration now. */
TREE_PUBLIC (decl) = 1;
assemble_external (decl);
&& ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
/* Otherwise, ask the language. */
&& (*lang_hooks.decls.warn_unused_global) (decl))
- warning ("%H'%D' defined but not used",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%J'%D' defined but not used", decl, decl);
/* Avoid confusing the debug information machinery when there are
errors. */
{
if (warn_inline && lose && DECL_INLINE (decl))
{
- char *msg = xmalloc (2 + strlen (lose) + 1);
- msg[0] = '%';
- msg[1] = 'H';
- strcpy(msg + 2, lose);
- warning (msg, &DECL_SOURCE_LOCATION (decl));
+ char *msg = concat ("%J", lose, NULL);
+ warning (msg, decl);
free (msg);
}
DECL_ABSTRACT_ORIGIN (decl) = 0;
#include "splay-tree.h"
#include "langhooks.h"
#include "cgraph.h"
+#include "intl.h"
+
/* This should be eventually be generalized to other languages, but
this would require a shared function-as-trees infrastructure. */
if (alloca_call_p (node)
&& !lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
{
- inline_forbidden_reason = "%Hfunction '%F' can never be inlined "
- "because it uses alloca (override using "
- "the always_inline attribute)";
+ inline_forbidden_reason
+ = N_("%Jfunction '%F' can never be inlined because it uses "
+ "alloca (override using the always_inline attribute)");
return node;
}
t = get_callee_fndecl (node);
/* We cannot inline functions that call setjmp. */
if (setjmp_call_p (t))
{
- inline_forbidden_reason = "%Hfunction '%F' can never be inlined"
- " because it uses setjmp";
+ inline_forbidden_reason
+ = N_("%Jfunction '%F' can never be inlined because it uses setjmp");
return node;
}
case BUILT_IN_VA_START:
case BUILT_IN_STDARG_START:
{
- inline_forbidden_reason = "%Hfunction '%F' can never be inlined "
- "because it uses variable argument lists";
+ inline_forbidden_reason
+ = N_("%Jfunction '%F' can never be inlined because it "
+ "uses variable argument lists");
return node;
}
case BUILT_IN_LONGJMP:
/* ??? Need front end help to identify "regular" non-local goto. */
if (DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL)
{
- inline_forbidden_reason = "%Hfunction '%F' can never be inlined "
- "because it uses setjmp-longjmp "
- "exception handling";
+ inline_forbidden_reason
+ = N_("%Jfunction '%F' can never be inlined "
+ "because it uses setjmp-longjmp exception handling");
return node;
}
}
if (TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL
&& DECL_INITIAL (TREE_OPERAND (node, 0)))
{
- inline_forbidden_reason = "%Hfunction '%F' can never be inlined "
- "because it contains a nested function";
+ inline_forbidden_reason
+ = N_("%Jfunction '%F' can never be inlined "
+ "because it contains a nested function");
return node;
}
break;
instantiations, which causes unexpected behavior. */
if (TREE_CODE (t) != LABEL_DECL)
{
- inline_forbidden_reason = "%Hfunction '%F' can never be inlined "
- "because it contains a nonlocal label";
+ inline_forbidden_reason
+ = N_("%Jfunction '%F' can never be inlined "
+ "because it contains a computed goto");
return node;
}
label. */
if (TREE_CODE (t) == LABEL_DECL && DECL_CONTEXT (t) != fn)
{
- inline_forbidden_reason = "%Hfunction '%F' can never be inlined "
- "because it contains a nonlocal goto";
+ inline_forbidden_reason
+ = N_("%Jfunction '%F' can never be inlined "
+ "because it contains a nonlocal goto");
return node;
}
for (t = TYPE_FIELDS (node); t; t = TREE_CHAIN (t))
if (variably_modified_type_p (TREE_TYPE (t)))
{
- inline_forbidden_reason = "%Hfunction '%F' can never be inlined "
- "because it uses variable sized variables";
+ inline_forbidden_reason
+ = N_("%Jfunction '%F' can never be inlined "
+ "because it uses variable sized variables");
return node;
}
#endif
&& !DECL_IN_SYSTEM_HEADER (fn));
if (do_warning)
- warning (inline_forbidden_reason,
- &DECL_SOURCE_LOCATION (fn), fn);
+ warning (inline_forbidden_reason, fn, fn);
inlinable = false;
}
if (warn_inline && DECL_INLINE (fn) && DECL_DECLARED_INLINE_P (fn)
&& !DECL_IN_SYSTEM_HEADER (fn))
{
- warning ("%Hinlining failed in call to '%F'",
- &DECL_SOURCE_LOCATION (fn), fn);
+ warning ("%Jinlining failed in call to '%F'", fn, fn);
warning ("called from here");
}
return NULL_TREE;
&& 0 < compare_tree_int (TYPE_SIZE_UNIT (ret_type),
larger_than_size))
{
- const location_t *locus = &DECL_SOURCE_LOCATION (fndecl);
unsigned int size_as_int
= TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type));
if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0)
- warning ("%Hsize of return value of '%D' is %u bytes",
- locus, fndecl, size_as_int);
+ warning ("%Jsize of return value of '%D' is %u bytes",
+ fndecl, fndecl, size_as_int);
else
- warning ("%Hsize of return value of '%D' is larger than %wd bytes",
- locus, fndecl, larger_than_size);
+ warning ("%Jsize of return value of '%D' is larger than %wd bytes",
+ fndecl, fndecl, larger_than_size);
}
}
{
flags = get_named_section_flags (name);
if ((flags & SECTION_OVERRIDE) == 0)
- error ("%H%D causes a section type conflict",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%J%D causes a section type conflict", decl, decl);
}
named_section_flags (name, flags);
{
/* First detect errors in declaring global registers. */
if (reg_number == -1)
- error ("%Hregister name not specified for '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jregister name not specified for '%D'", decl, decl);
else if (reg_number < 0)
- error ("%Hinvalid register name for '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jinvalid register name for '%D'", decl, decl);
else if (TYPE_MODE (TREE_TYPE (decl)) == BLKmode)
- error ("%Hdata type of '%D' isn't suitable for a register",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jdata type of '%D' isn't suitable for a register",
+ decl, decl);
else if (! HARD_REGNO_MODE_OK (reg_number, TYPE_MODE (TREE_TYPE (decl))))
- error ("%Hregister specified for '%D' isn't suitable for data type",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jregister specified for '%D' isn't suitable for data type",
+ decl, decl);
/* Now handle properly declared static register variables. */
else
{
Also handle vars declared register invalidly. */
if (reg_number >= 0 || reg_number == -3)
- error ("%Hregister name given for non-register variable '%D'",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jregister name given for non-register variable '%D'", decl, decl);
/* Specifying a section attribute on a variable forces it into a
non-.bss section, and thus it cannot be common. */
if (!dont_output_data && DECL_SIZE (decl) == 0)
{
- error ("%Hstorage size of `%s' isn't known",
- &DECL_SOURCE_LOCATION (decl),
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("%Jstorage size of `%D' isn't known", decl, decl);
TREE_ASM_WRITTEN (decl) = 1;
return;
}
if (! dont_output_data
&& ! host_integerp (DECL_SIZE_UNIT (decl), 1))
{
- error ("%Hsize of variable '%D' is too large",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jsize of variable '%D' is too large", decl, decl);
return;
}
#endif
if (align > MAX_OFILE_ALIGNMENT)
{
- warning ("%Halignment of '%D' is greater than maximum object "
- "file alignment. Using %d", &DECL_SOURCE_LOCATION (decl),
- decl, MAX_OFILE_ALIGNMENT/BITS_PER_UNIT);
+ warning ("%Jalignment of '%D' is greater than maximum object "
+ "file alignment. Using %d", decl, decl,
+ MAX_OFILE_ALIGNMENT/BITS_PER_UNIT);
align = MAX_OFILE_ALIGNMENT;
}
#if !defined(ASM_OUTPUT_ALIGNED_COMMON) && !defined(ASM_OUTPUT_ALIGNED_DECL_COMMON) && !defined(ASM_OUTPUT_ALIGNED_BSS)
if ((unsigned HOST_WIDE_INT) DECL_ALIGN (decl) / BITS_PER_UNIT > rounded)
- warning ("%Hrequested alignment for '%D' is greater than "
- "implemented alignment of %d", &DECL_SOURCE_LOCATION (decl),
- decl, rounded);
+ warning ("%Jrequested alignment for '%D' is greater than "
+ "implemented alignment of %d", decl, decl, rounded);
#endif
/* If the target cannot output uninitialized but not common global data
declare_weak because the NEWDECL and OLDDECL was not yet
been merged; therefore, TREE_ASM_WRITTEN was not set. */
if (TREE_ASM_WRITTEN (olddecl))
- error ("%Hweak declaration of '%D' must precede definition",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
+ error ("%Jweak declaration of '%D' must precede definition",
+ newdecl, newdecl);
/* If we've already generated rtl referencing OLDDECL, we may
have done so in a way that will not function properly with
a weak symbol. */
else if (TREE_USED (olddecl)
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (olddecl)))
- warning ("%Hweak declaration of '%D' after first use results "
- "in unspecified behavior",
- &DECL_SOURCE_LOCATION (newdecl), newdecl);
+ warning ("%Jweak declaration of '%D' after first use results "
+ "in unspecified behavior", newdecl, newdecl);
if (SUPPORTS_WEAK)
{
declare_weak (tree decl)
{
if (! TREE_PUBLIC (decl))
- error ("%Hweak declaration of '%D' must be public",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jweak declaration of '%D' must be public", decl, decl);
else if (TREE_CODE (decl) == FUNCTION_DECL && TREE_ASM_WRITTEN (decl))
- error ("%Hweak declaration of '%D' must precede definition",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("%Jweak declaration of '%D' must precede definition", decl, decl);
else if (SUPPORTS_WEAK)
{
if (! DECL_WEAK (decl))
weak_decls = tree_cons (NULL, decl, weak_decls);
}
else
- warning ("%Hweak declaration of '%D' not supported",
- &DECL_SOURCE_LOCATION (decl), decl);
+ warning ("%Jweak declaration of '%D' not supported", decl, decl);
mark_weak (decl);
}