diagnostic.c (pedwarn_at): Rename as pedwarn.
2008-08-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * diagnostic.c (pedwarn_at): Rename as pedwarn. (pedwarn): Delete. * toplev.h (pedwarn_at): Likewise. * builtins.c: Update all calls to pedwarn. * c-lex.c: Likewise. * toplev.c: Likewise. * c-tree.h: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-typeck.c: Likewise. * c-common.c: Likewise. * c-parser.c: Likewise. cp/ * typeck.c: Update all calls to pedwarn. * decl.c: Likewise. * call.c: Likewise. * error.c: Likewise. * pt.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. fortran/ * f95-lang.c: Update all calls to pedwarn. From-SVN: r139373
This commit is contained in:
parent
2fb63453bd
commit
509c9d60e4
22 changed files with 336 additions and 295 deletions
|
@ -1,3 +1,18 @@
|
|||
2008-08-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
* diagnostic.c (pedwarn_at): Rename as pedwarn.
|
||||
(pedwarn): Delete.
|
||||
* toplev.h (pedwarn_at): Likewise.
|
||||
* builtins.c: Update all calls to pedwarn.
|
||||
* c-lex.c: Likewise.
|
||||
* toplev.c: Likewise.
|
||||
* c-tree.h: Likewise.
|
||||
* c-decl.c: Likewise.
|
||||
* c-errors.c: Likewise.
|
||||
* c-typeck.c: Likewise.
|
||||
* c-common.c: Likewise.
|
||||
* c-parser.c: Likewise.
|
||||
|
||||
2008-08-20 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
PR target/31070
|
||||
|
|
|
@ -7279,7 +7279,7 @@ fold_builtin_inf (tree type, int warn)
|
|||
Thus we pedwarn to ensure this constraint violation is
|
||||
diagnosed. */
|
||||
if (!MODE_HAS_INFINITIES (TYPE_MODE (type)) && warn)
|
||||
pedwarn (0, "target format does not support infinity");
|
||||
pedwarn (input_location, 0, "target format does not support infinity");
|
||||
|
||||
real_inf (&real);
|
||||
return build_real (type, real);
|
||||
|
|
|
@ -1044,7 +1044,7 @@ fname_decl (unsigned int rid, tree id)
|
|||
input_location = saved_location;
|
||||
}
|
||||
if (!ix && !current_function_decl)
|
||||
pedwarn (0, "%qD is not defined outside of function scope", decl);
|
||||
pedwarn (input_location, 0, "%qD is not defined outside of function scope", decl);
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
@ -1093,7 +1093,7 @@ fix_string_type (tree value)
|
|||
separate the %d from the 'C'. 'ISO' should not be
|
||||
translated, but it may be moved after 'C%d' in languages
|
||||
where modifiers follow nouns. */
|
||||
pedwarn (OPT_Woverlength_strings,
|
||||
pedwarn (input_location, OPT_Woverlength_strings,
|
||||
"string length %qd is greater than the length %qd "
|
||||
"ISO C%d compilers are required to support",
|
||||
nchars - 1, nchars_max, relevant_std);
|
||||
|
@ -1141,7 +1141,7 @@ constant_expression_warning (tree value)
|
|||
|| TREE_CODE (value) == VECTOR_CST
|
||||
|| TREE_CODE (value) == COMPLEX_CST)
|
||||
&& TREE_OVERFLOW (value))
|
||||
pedwarn (OPT_Woverflow, "overflow in constant expression");
|
||||
pedwarn (input_location, OPT_Woverflow, "overflow in constant expression");
|
||||
}
|
||||
|
||||
/* The same as above but print an unconditional error. */
|
||||
|
@ -1359,7 +1359,7 @@ check_main_parameter_types (tree decl)
|
|||
{
|
||||
case 1:
|
||||
if (TYPE_MAIN_VARIANT (type) != integer_type_node)
|
||||
pedwarn (OPT_Wmain, "first argument of %q+D should be %<int%>",
|
||||
pedwarn (input_location, OPT_Wmain, "first argument of %q+D should be %<int%>",
|
||||
decl);
|
||||
break;
|
||||
|
||||
|
@ -1368,7 +1368,7 @@ check_main_parameter_types (tree decl)
|
|||
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|
||||
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
|
||||
!= char_type_node))
|
||||
pedwarn (OPT_Wmain, "second argument of %q+D should be %<char **%>",
|
||||
pedwarn (input_location, OPT_Wmain, "second argument of %q+D should be %<char **%>",
|
||||
decl);
|
||||
break;
|
||||
|
||||
|
@ -1377,7 +1377,7 @@ check_main_parameter_types (tree decl)
|
|||
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|
||||
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
|
||||
!= char_type_node))
|
||||
pedwarn (OPT_Wmain, "third argument of %q+D should probably be "
|
||||
pedwarn (input_location, OPT_Wmain, "third argument of %q+D should probably be "
|
||||
"%<char **%>", decl);
|
||||
break;
|
||||
}
|
||||
|
@ -1387,7 +1387,7 @@ check_main_parameter_types (tree decl)
|
|||
argument because it's only mentioned in an appendix of the
|
||||
standard. */
|
||||
if (argct > 0 && (argct < 2 || argct > 3))
|
||||
pedwarn (OPT_Wmain, "%q+D takes only zero or two arguments", decl);
|
||||
pedwarn (input_location, OPT_Wmain, "%q+D takes only zero or two arguments", decl);
|
||||
}
|
||||
|
||||
/* True if pointers to distinct types T1 and T2 can be converted to
|
||||
|
@ -3285,19 +3285,19 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
|
|||
|
||||
if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
|
||||
{
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
"pointer of type %<void *%> used in arithmetic");
|
||||
size_exp = integer_one_node;
|
||||
}
|
||||
else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE)
|
||||
{
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
"pointer to a function used in arithmetic");
|
||||
size_exp = integer_one_node;
|
||||
}
|
||||
else if (TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE)
|
||||
{
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
"pointer to member function used in arithmetic");
|
||||
size_exp = integer_one_node;
|
||||
}
|
||||
|
@ -3806,7 +3806,7 @@ c_sizeof_or_alignof_type (tree type, bool is_sizeof, int complain)
|
|||
if (is_sizeof)
|
||||
{
|
||||
if (complain && (pedantic || warn_pointer_arith))
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
"invalid application of %<sizeof%> to a function type");
|
||||
else if (!complain)
|
||||
return error_mark_node;
|
||||
|
@ -3819,7 +3819,7 @@ c_sizeof_or_alignof_type (tree type, bool is_sizeof, int complain)
|
|||
{
|
||||
if (type_code == VOID_TYPE
|
||||
&& complain && (pedantic || warn_pointer_arith))
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
"invalid application of %qs to a void type", op_name);
|
||||
else if (!complain)
|
||||
return error_mark_node;
|
||||
|
@ -4687,7 +4687,7 @@ c_add_case_label (splay_tree cases, tree cond, tree orig_type,
|
|||
|
||||
/* Case ranges are a GNU extension. */
|
||||
if (high_value)
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"range expressions in switch statements are non-standard");
|
||||
|
||||
type = TREE_TYPE (cond);
|
||||
|
@ -5001,7 +5001,7 @@ finish_label_address_expr (tree label)
|
|||
{
|
||||
tree result;
|
||||
|
||||
pedwarn (OPT_pedantic, "taking the address of a label is non-standard");
|
||||
pedwarn (input_location, OPT_pedantic, "taking the address of a label is non-standard");
|
||||
|
||||
if (label == error_mark_node)
|
||||
return error_mark_node;
|
||||
|
|
161
gcc/c-decl.c
161
gcc/c-decl.c
|
@ -788,7 +788,7 @@ pop_scope (void)
|
|||
&& TREE_PUBLIC (p)
|
||||
&& !DECL_INITIAL (p)
|
||||
&& !flag_gnu89_inline)
|
||||
pedwarn (0, "inline function %q+D declared but never defined", p);
|
||||
pedwarn (input_location, 0, "inline function %q+D declared but never defined", p);
|
||||
|
||||
goto common_symbol;
|
||||
|
||||
|
@ -1225,7 +1225,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
|
|||
&& TYPE_MAIN_VARIANT (TREE_TYPE (newtype)) == integer_type_node
|
||||
&& C_FUNCTION_IMPLICIT_INT (newdecl) && !DECL_INITIAL (olddecl))
|
||||
{
|
||||
pedwarned = pedwarn (0, "conflicting types for %q+D", newdecl);
|
||||
pedwarned = pedwarn (input_location, 0,
|
||||
"conflicting types for %q+D", newdecl);
|
||||
/* Make sure we keep void as the return type. */
|
||||
TREE_TYPE (newdecl) = *newtypep = newtype = oldtype;
|
||||
C_FUNCTION_IMPLICIT_INT (newdecl) = 0;
|
||||
|
@ -1237,7 +1238,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
|
|||
&& TYPE_MAIN_VARIANT (TREE_TYPE (oldtype)) == integer_type_node
|
||||
&& C_DECL_IMPLICIT (olddecl) && !DECL_INITIAL (olddecl))
|
||||
{
|
||||
pedwarned = pedwarn (0, "conflicting types for %q+D", newdecl);
|
||||
pedwarned = pedwarn (input_location, 0,
|
||||
"conflicting types for %q+D", newdecl);
|
||||
/* Make sure we keep void as the return type. */
|
||||
TREE_TYPE (olddecl) = *oldtypep = oldtype = newtype;
|
||||
}
|
||||
|
@ -2329,8 +2331,8 @@ implicit_decl_warning (tree id, tree olddecl)
|
|||
bool warned;
|
||||
|
||||
if (flag_isoc99)
|
||||
warned = pedwarn (OPT_Wimplicit_function_declaration,
|
||||
G_("implicit declaration of function %qE"), id);
|
||||
warned = pedwarn (input_location, OPT_Wimplicit_function_declaration,
|
||||
"implicit declaration of function %qE", id);
|
||||
else
|
||||
warned = warning (OPT_Wimplicit_function_declaration,
|
||||
G_("implicit declaration of function %qE"), id);
|
||||
|
@ -2882,7 +2884,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
|
|||
if (warned != 1 && code != ENUMERAL_TYPE)
|
||||
/* Empty unnamed enum OK */
|
||||
{
|
||||
pedwarn (0, "unnamed struct/union that defines no instances");
|
||||
pedwarn (input_location, 0,
|
||||
"unnamed struct/union that defines no instances");
|
||||
warned = 1;
|
||||
}
|
||||
}
|
||||
|
@ -2890,8 +2893,9 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
|
|||
&& declspecs->storage_class != csc_none)
|
||||
{
|
||||
if (warned != 1)
|
||||
pedwarn (0, "empty declaration with storage class specifier "
|
||||
"does not redeclare tag");
|
||||
pedwarn (input_location, 0,
|
||||
"empty declaration with storage class specifier "
|
||||
"does not redeclare tag");
|
||||
warned = 1;
|
||||
pending_xref_error ();
|
||||
}
|
||||
|
@ -2901,7 +2905,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
|
|||
|| declspecs->restrict_p))
|
||||
{
|
||||
if (warned != 1)
|
||||
pedwarn (0, "empty declaration with type qualifier "
|
||||
pedwarn (input_location, 0,
|
||||
"empty declaration with type qualifier "
|
||||
"does not redeclare tag");
|
||||
warned = 1;
|
||||
pending_xref_error ();
|
||||
|
@ -2922,14 +2927,15 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
|
|||
{
|
||||
if (warned != 1 && !in_system_header)
|
||||
{
|
||||
pedwarn (0, "useless type name in empty declaration");
|
||||
pedwarn (input_location, 0,
|
||||
"useless type name in empty declaration");
|
||||
warned = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (warned != 1 && !in_system_header && declspecs->typedef_p)
|
||||
{
|
||||
pedwarn (0, "useless type name in empty declaration");
|
||||
pedwarn (input_location, 0, "useless type name in empty declaration");
|
||||
warned = 1;
|
||||
}
|
||||
|
||||
|
@ -2976,7 +2982,7 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
|
|||
if (warned != 1)
|
||||
{
|
||||
if (!found_tag)
|
||||
pedwarn (0, "empty declaration");
|
||||
pedwarn (input_location, 0, "empty declaration");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3042,10 +3048,12 @@ build_array_declarator (tree expr, struct c_declspecs *quals, bool static_p,
|
|||
if (!flag_isoc99)
|
||||
{
|
||||
if (static_p || quals != NULL)
|
||||
pedwarn (OPT_pedantic, "ISO C90 does not support %<static%> or type "
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C90 does not support %<static%> or type "
|
||||
"qualifiers in parameter array declarators");
|
||||
if (vla_unspec_p)
|
||||
pedwarn (OPT_pedantic, "ISO C90 does not support %<[*]%> array declarators");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C90 does not support %<[*]%> array declarators");
|
||||
}
|
||||
if (vla_unspec_p)
|
||||
{
|
||||
|
@ -3300,8 +3308,9 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
|
|||
&& !TREE_READONLY (decl)
|
||||
&& DECL_DECLARED_INLINE_P (current_function_decl)
|
||||
&& DECL_EXTERNAL (current_function_decl))
|
||||
pedwarn (0, "%q+D is static but declared in inline function %qD "
|
||||
"which is not static", decl, current_function_decl);
|
||||
pedwarn (input_location, 0,
|
||||
"%q+D is static but declared in inline function %qD "
|
||||
"which is not static", decl, current_function_decl);
|
||||
|
||||
/* Add this decl to the current scope.
|
||||
TEM may equal DECL or it may be a previous decl of the same name. */
|
||||
|
@ -3674,7 +3683,8 @@ mark_forward_parm_decls (void)
|
|||
|
||||
if (pedantic && !current_scope->warned_forward_parm_decls)
|
||||
{
|
||||
pedwarn (OPT_pedantic, "ISO C forbids forward parameter declarations");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids forward parameter declarations");
|
||||
current_scope->warned_forward_parm_decls = true;
|
||||
}
|
||||
|
||||
|
@ -3825,7 +3835,8 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
|
|||
&& type_mv != integer_type_node
|
||||
&& type_mv != unsigned_type_node
|
||||
&& type_mv != boolean_type_node)
|
||||
pedwarn (OPT_pedantic, "type of bit-field %qs is a GCC extension", name);
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"type of bit-field %qs is a GCC extension", name);
|
||||
|
||||
max_width = TYPE_PRECISION (*type);
|
||||
|
||||
|
@ -3862,20 +3873,20 @@ warn_variable_length_array (const char *name, tree size)
|
|||
if (const_size)
|
||||
{
|
||||
if (name)
|
||||
pedwarn (OPT_Wvla, "ISO C90 forbids array %qs whose size "
|
||||
pedwarn (input_location, OPT_Wvla, "ISO C90 forbids array %qs whose size "
|
||||
"can%'t be evaluated",
|
||||
name);
|
||||
else
|
||||
pedwarn (OPT_Wvla, "ISO C90 forbids array whose size "
|
||||
pedwarn (input_location, OPT_Wvla, "ISO C90 forbids array whose size "
|
||||
"can%'t be evaluated");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (name)
|
||||
pedwarn (OPT_Wvla, "ISO C90 forbids variable length array %qs",
|
||||
pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array %qs",
|
||||
name);
|
||||
else
|
||||
pedwarn (OPT_Wvla, "ISO C90 forbids variable length array");
|
||||
pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array");
|
||||
}
|
||||
}
|
||||
else if (warn_vla > 0)
|
||||
|
@ -4037,7 +4048,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
&& funcdef_flag)
|
||||
warn_about_return_type = 1;
|
||||
else
|
||||
pedwarn_c99 (flag_isoc99 ? 0 : OPT_Wimplicit_int,
|
||||
pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int,
|
||||
"type defaults to %<int%> in declaration of %qs", name);
|
||||
}
|
||||
|
||||
|
@ -4066,11 +4077,11 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
if (pedantic && !flag_isoc99)
|
||||
{
|
||||
if (constp > 1)
|
||||
pedwarn (OPT_pedantic, "duplicate %<const%>");
|
||||
pedwarn (input_location, OPT_pedantic, "duplicate %<const%>");
|
||||
if (restrictp > 1)
|
||||
pedwarn (OPT_pedantic, "duplicate %<restrict%>");
|
||||
pedwarn (input_location, OPT_pedantic, "duplicate %<restrict%>");
|
||||
if (volatilep > 1)
|
||||
pedwarn (OPT_pedantic, "duplicate %<volatile%>");
|
||||
pedwarn (input_location, OPT_pedantic, "duplicate %<volatile%>");
|
||||
}
|
||||
if (!flag_gen_aux_info && (TYPE_QUALS (element_type)))
|
||||
type = TYPE_MAIN_VARIANT (type);
|
||||
|
@ -4088,7 +4099,8 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
|| storage_class == csc_typedef))
|
||||
{
|
||||
if (storage_class == csc_auto)
|
||||
pedwarn ((current_scope == file_scope) ? 0 : OPT_pedantic,
|
||||
pedwarn (input_location,
|
||||
(current_scope == file_scope) ? 0 : OPT_pedantic,
|
||||
"function definition declared %<auto%>");
|
||||
if (storage_class == csc_register)
|
||||
error ("function definition declared %<register%>");
|
||||
|
@ -4145,7 +4157,8 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
if (storage_class == csc_auto)
|
||||
error ("file-scope declaration of %qs specifies %<auto%>", name);
|
||||
if (pedantic && storage_class == csc_register)
|
||||
pedwarn (OPT_pedantic, "file-scope declaration of %qs specifies %<register%>", name);
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"file-scope declaration of %qs specifies %<register%>", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4258,7 +4271,8 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
}
|
||||
|
||||
if (pedantic && !in_system_header && flexible_array_type_p (type))
|
||||
pedwarn (OPT_pedantic, "invalid use of structure with flexible array member");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"invalid use of structure with flexible array member");
|
||||
|
||||
if (size == error_mark_node)
|
||||
type = error_mark_node;
|
||||
|
@ -4283,7 +4297,8 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
}
|
||||
|
||||
if (pedantic && integer_zerop (size))
|
||||
pedwarn (OPT_pedantic, "ISO C forbids zero-size array %qs", name);
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids zero-size array %qs", name);
|
||||
|
||||
if (TREE_CODE (size) == INTEGER_CST)
|
||||
{
|
||||
|
@ -4355,7 +4370,8 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
else if (decl_context == FIELD)
|
||||
{
|
||||
if (pedantic && !flag_isoc99 && !in_system_header)
|
||||
pedwarn (OPT_pedantic, "ISO C90 does not support flexible array members");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C90 does not support flexible array members");
|
||||
|
||||
/* ISO C99 Flexible array members are effectively
|
||||
identical to GCC's zero-length array extension. */
|
||||
|
@ -4500,7 +4516,8 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
function definitions in ISO C; GCC used to used
|
||||
them for noreturn functions. */
|
||||
if (VOID_TYPE_P (type) && really_funcdef)
|
||||
pedwarn (0, "function definition has qualified void return type");
|
||||
pedwarn (input_location, 0,
|
||||
"function definition has qualified void return type");
|
||||
else
|
||||
warning (OPT_Wignored_qualifiers,
|
||||
"type qualifiers ignored on function return type");
|
||||
|
@ -4532,7 +4549,8 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
|
||||
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
|
||||
&& type_quals)
|
||||
pedwarn (OPT_pedantic, "ISO C forbids qualified function types");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids qualified function types");
|
||||
if (type_quals)
|
||||
type = c_build_qualified_type (type, type_quals);
|
||||
size_varies = 0;
|
||||
|
@ -4613,7 +4631,8 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
tree decl;
|
||||
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
|
||||
&& type_quals)
|
||||
pedwarn (OPT_pedantic, "ISO C forbids qualified function types");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids qualified function types");
|
||||
if (type_quals)
|
||||
type = c_build_qualified_type (type, type_quals);
|
||||
decl = build_decl (TYPE_DECL, declarator->u.id, type);
|
||||
|
@ -4621,7 +4640,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
if (declspecs->explicit_signed_p)
|
||||
C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
|
||||
if (declspecs->inline_p)
|
||||
pedwarn (0, "typedef %q+D declared %<inline%>", decl);
|
||||
pedwarn (input_location, 0,"typedef %q+D declared %<inline%>", decl);
|
||||
return decl;
|
||||
}
|
||||
|
||||
|
@ -4636,7 +4655,8 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
&& !declspecs->inline_p);
|
||||
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
|
||||
&& type_quals)
|
||||
pedwarn (OPT_pedantic, "ISO C forbids const or volatile function types");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids const or volatile function types");
|
||||
if (type_quals)
|
||||
type = c_build_qualified_type (type, type_quals);
|
||||
return type;
|
||||
|
@ -4646,7 +4666,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
&& variably_modified_type_p (type, NULL_TREE))
|
||||
{
|
||||
/* C99 6.7.2.1p8 */
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"a member of a structure or union cannot have a variably modified type");
|
||||
}
|
||||
|
||||
|
@ -4701,7 +4721,8 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
else if (TREE_CODE (type) == FUNCTION_TYPE)
|
||||
{
|
||||
if (type_quals)
|
||||
pedwarn (OPT_pedantic, "ISO C forbids qualified function types");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids qualified function types");
|
||||
if (type_quals)
|
||||
type = c_build_qualified_type (type, type_quals);
|
||||
type = build_pointer_type (type);
|
||||
|
@ -4727,7 +4748,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
|
||||
DECL_ARG_TYPE (decl) = promoted_type;
|
||||
if (declspecs->inline_p)
|
||||
pedwarn (0, "parameter %q+D declared %<inline%>", decl);
|
||||
pedwarn (input_location, 0, "parameter %q+D declared %<inline%>", decl);
|
||||
}
|
||||
else if (decl_context == FIELD)
|
||||
{
|
||||
|
@ -4773,7 +4794,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
GCC allows 'auto', perhaps with 'inline', to support
|
||||
nested functions. */
|
||||
if (storage_class == csc_auto)
|
||||
pedwarn (OPT_pedantic, "invalid storage class for function %qs", name);
|
||||
pedwarn (input_location, OPT_pedantic, "invalid storage class for function %qs", name);
|
||||
else if (storage_class == csc_static)
|
||||
{
|
||||
error ("invalid storage class for function %qs", name);
|
||||
|
@ -4789,7 +4810,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
decl = build_decl_attribute_variant (decl, decl_attr);
|
||||
|
||||
if (pedantic && type_quals && !DECL_IN_SYSTEM_HEADER (decl))
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids qualified function types");
|
||||
|
||||
/* GNU C interprets a volatile-qualified function type to indicate
|
||||
|
@ -4832,7 +4853,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
if (flag_hosted && MAIN_NAME_P (declarator->u.id))
|
||||
{
|
||||
if (declspecs->inline_p)
|
||||
pedwarn (0, "cannot inline function %<main%>");
|
||||
pedwarn (input_location, 0, "cannot inline function %<main%>");
|
||||
}
|
||||
else if (declspecs->inline_p)
|
||||
/* Record that the function is declared `inline'. */
|
||||
|
@ -4871,7 +4892,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
C_DECL_VARIABLE_SIZE (decl) = 1;
|
||||
|
||||
if (declspecs->inline_p)
|
||||
pedwarn (0, "variable %q+D declared %<inline%>", decl);
|
||||
pedwarn (input_location, 0, "variable %q+D declared %<inline%>", decl);
|
||||
|
||||
/* At file scope, an initialized extern declaration may follow
|
||||
a static declaration. In that case, DECL_EXTERNAL will be
|
||||
|
@ -4979,7 +5000,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
|
|||
else if (arg_types && TREE_CODE (TREE_VALUE (arg_types)) == IDENTIFIER_NODE)
|
||||
{
|
||||
if (!funcdef_flag)
|
||||
pedwarn (0, "parameter names (without types) in function declaration");
|
||||
pedwarn (input_location, 0, "parameter names (without types) in function declaration");
|
||||
|
||||
arg_info->parms = arg_info->types;
|
||||
arg_info->types = 0;
|
||||
|
@ -5393,10 +5414,10 @@ grokfield (struct c_declarator *declarator, struct c_declspecs *declspecs,
|
|||
}
|
||||
if (!ok)
|
||||
{
|
||||
pedwarn (0, "declaration does not declare anything");
|
||||
pedwarn (input_location, 0, "declaration does not declare anything");
|
||||
return NULL_TREE;
|
||||
}
|
||||
pedwarn (OPT_pedantic, "ISO C doesn%'t support unnamed structs/unions");
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C doesn%'t support unnamed structs/unions");
|
||||
}
|
||||
|
||||
value = grokdeclarator (declarator, declspecs, FIELD, false,
|
||||
|
@ -5495,16 +5516,16 @@ finish_struct (tree t, tree fieldlist, tree attributes)
|
|||
if (TREE_CODE (t) == UNION_TYPE)
|
||||
{
|
||||
if (fieldlist)
|
||||
pedwarn (OPT_pedantic, "union has no named members");
|
||||
pedwarn (input_location, OPT_pedantic, "union has no named members");
|
||||
else
|
||||
pedwarn (OPT_pedantic, "union has no members");
|
||||
pedwarn (input_location, OPT_pedantic, "union has no members");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fieldlist)
|
||||
pedwarn (OPT_pedantic, "struct has no named members");
|
||||
pedwarn (input_location, OPT_pedantic, "struct has no named members");
|
||||
else
|
||||
pedwarn (OPT_pedantic, "struct has no members");
|
||||
pedwarn (input_location, OPT_pedantic, "struct has no members");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5583,7 +5604,7 @@ finish_struct (tree t, tree fieldlist, tree attributes)
|
|||
|
||||
if (pedantic && !in_system_header && TREE_CODE (t) == RECORD_TYPE
|
||||
&& flexible_array_type_p (TREE_TYPE (x)))
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"%Jinvalid use of structure with flexible array member", x);
|
||||
|
||||
if (DECL_NAME (x))
|
||||
|
@ -5974,8 +5995,8 @@ build_enumerator (struct c_enum_contents *the_enum, tree name, tree value,
|
|||
(6.4.4.3/2 in the C99 Standard). GCC allows any integer type as
|
||||
an extension. */
|
||||
else if (!int_fits_type_p (value, integer_type_node))
|
||||
pedwarn_at (value_loc, OPT_pedantic,
|
||||
"ISO C restricts enumerator values to range of %<int%>");
|
||||
pedwarn (value_loc, OPT_pedantic,
|
||||
"ISO C restricts enumerator values to range of %<int%>");
|
||||
|
||||
/* Set basis for default for next value. */
|
||||
the_enum->enum_next_value = build_binary_op (PLUS_EXPR, value,
|
||||
|
@ -6087,7 +6108,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
|
|||
}
|
||||
|
||||
if (warn_about_return_type)
|
||||
pedwarn_c99 (flag_isoc99 ? 0
|
||||
pedwarn_c99 (input_location, flag_isoc99 ? 0
|
||||
: (warn_return_type ? OPT_Wreturn_type : OPT_Wimplicit_int),
|
||||
"return type defaults to %<int%>");
|
||||
|
||||
|
@ -6210,12 +6231,12 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
|
|||
{
|
||||
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
|
||||
!= integer_type_node)
|
||||
pedwarn (OPT_Wmain, "return type of %q+D is not %<int%>", decl1);
|
||||
pedwarn (input_location, OPT_Wmain, "return type of %q+D is not %<int%>", decl1);
|
||||
|
||||
check_main_parameter_types (decl1);
|
||||
|
||||
if (!TREE_PUBLIC (decl1))
|
||||
pedwarn (OPT_Wmain, "%q+D is normally a non-static function", decl1);
|
||||
pedwarn (input_location, OPT_Wmain, "%q+D is normally a non-static function", decl1);
|
||||
}
|
||||
|
||||
/* Record the decl so that the function name is defined.
|
||||
|
@ -6363,7 +6384,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
|
|||
warn_if_shadowing (decl);
|
||||
|
||||
if (flag_isoc99)
|
||||
pedwarn (0, "type of %q+D defaults to %<int%>", decl);
|
||||
pedwarn (input_location, 0, "type of %q+D defaults to %<int%>", decl);
|
||||
else
|
||||
warning (OPT_Wmissing_parameter_type, "type of %q+D defaults to %<int%>", decl);
|
||||
}
|
||||
|
@ -6483,10 +6504,10 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
|
|||
"doesn%'t match built-in prototype", parm);
|
||||
else
|
||||
{
|
||||
pedwarn (OPT_pedantic, "promoted argument %qD "
|
||||
pedwarn (input_location, OPT_pedantic, "promoted argument %qD "
|
||||
"doesn%'t match prototype", parm);
|
||||
pedwarn (OPT_pedantic, "%Hprototype declaration",
|
||||
¤t_function_prototype_locus);
|
||||
pedwarn (current_function_prototype_locus, OPT_pedantic,
|
||||
"prototype declaration");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -7119,7 +7140,7 @@ declspecs_add_qual (struct c_declspecs *specs, tree qual)
|
|||
gcc_unreachable ();
|
||||
}
|
||||
if (dupe && !flag_isoc99)
|
||||
pedwarn (OPT_pedantic, "duplicate %qE", qual);
|
||||
pedwarn (input_location, OPT_pedantic, "duplicate %qE", qual);
|
||||
return specs;
|
||||
}
|
||||
|
||||
|
@ -7168,7 +7189,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
|
|||
break;
|
||||
}
|
||||
if (pedantic && !flag_isoc99 && !in_system_header)
|
||||
pedwarn (OPT_Wlong_long, "ISO C90 does not support %<long long%>");
|
||||
pedwarn (input_location, OPT_Wlong_long, "ISO C90 does not support %<long long%>");
|
||||
specs->long_long_p = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -7292,7 +7313,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
|
|||
case RID_COMPLEX:
|
||||
dupe = specs->complex_p;
|
||||
if (!flag_isoc99 && !in_system_header)
|
||||
pedwarn (OPT_pedantic, "ISO C90 does not support complex types");
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C90 does not support complex types");
|
||||
if (specs->typespec_word == cts_void)
|
||||
error ("both %<complex%> and %<void%> in "
|
||||
"declaration specifiers");
|
||||
|
@ -7322,7 +7343,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
|
|||
break;
|
||||
case RID_SAT:
|
||||
dupe = specs->saturating_p;
|
||||
pedwarn (OPT_pedantic, "ISO C does not support saturating types");
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C does not support saturating types");
|
||||
if (specs->typespec_word == cts_void)
|
||||
error ("both %<_Sat%> and %<void%> in "
|
||||
"declaration specifiers");
|
||||
|
@ -7519,7 +7540,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
|
|||
}
|
||||
if (!targetm.decimal_float_supported_p ())
|
||||
error ("decimal floating point not supported for this target");
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C does not support decimal floating point");
|
||||
return specs;
|
||||
case RID_FRACT:
|
||||
|
@ -7540,7 +7561,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
|
|||
}
|
||||
if (!targetm.fixed_point_supported_p ())
|
||||
error ("fixed-point types not supported for this target");
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C does not support fixed-point types");
|
||||
return specs;
|
||||
default:
|
||||
|
@ -7727,7 +7748,7 @@ finish_declspecs (struct c_declspecs *specs)
|
|||
else if (specs->complex_p)
|
||||
{
|
||||
specs->typespec_word = cts_double;
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C does not support plain %<complex%> meaning "
|
||||
"%<double complex%>");
|
||||
}
|
||||
|
@ -7772,7 +7793,7 @@ finish_declspecs (struct c_declspecs *specs)
|
|||
specs->type = char_type_node;
|
||||
if (specs->complex_p)
|
||||
{
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C does not support complex integer types");
|
||||
specs->type = build_complex_type (specs->type);
|
||||
}
|
||||
|
@ -7798,7 +7819,7 @@ finish_declspecs (struct c_declspecs *specs)
|
|||
: integer_type_node);
|
||||
if (specs->complex_p)
|
||||
{
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C does not support complex integer types");
|
||||
specs->type = build_complex_type (specs->type);
|
||||
}
|
||||
|
@ -7949,7 +7970,7 @@ c_write_global_declarations_1 (tree globals)
|
|||
&& !TREE_PUBLIC (decl)
|
||||
&& C_DECL_USED (decl))
|
||||
{
|
||||
pedwarn (0, "%q+F used but never defined", decl);
|
||||
pedwarn (input_location, 0, "%q+F used but never defined", decl);
|
||||
TREE_NO_WARNING (decl) = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,13 +31,13 @@ along with GCC; see the file COPYING3. If not see
|
|||
/* Issue an ISO C99 pedantic warning MSGID. */
|
||||
|
||||
void
|
||||
pedwarn_c99 (int opt, const char *gmsgid, ...)
|
||||
pedwarn_c99 (location_t location, int opt, const char *gmsgid, ...)
|
||||
{
|
||||
diagnostic_info diagnostic;
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, gmsgid);
|
||||
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
|
||||
diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
|
||||
flag_isoc99 ? DK_PEDWARN : DK_WARNING);
|
||||
diagnostic.option_index = opt;
|
||||
report_diagnostic (&diagnostic);
|
||||
|
@ -50,13 +50,13 @@ pedwarn_c99 (int opt, const char *gmsgid, ...)
|
|||
(There is no flag_c90.) */
|
||||
|
||||
void
|
||||
pedwarn_c90 (int opt, const char *gmsgid, ...)
|
||||
pedwarn_c90 (location_t location, int opt, const char *gmsgid, ...)
|
||||
{
|
||||
diagnostic_info diagnostic;
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, gmsgid);
|
||||
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
|
||||
diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
|
||||
flag_isoc99 ? DK_WARNING : DK_PEDWARN);
|
||||
diagnostic.option_index = opt;
|
||||
report_diagnostic (&diagnostic);
|
||||
|
|
|
@ -587,8 +587,8 @@ interpret_integer (const cpp_token *token, unsigned int flags)
|
|||
if (itk > itk_unsigned_long
|
||||
&& (flags & CPP_N_WIDTH) != CPP_N_LARGE
|
||||
&& !in_system_header && !flag_isoc99)
|
||||
pedwarn (0, "integer constant is too large for %qs type",
|
||||
(flags & CPP_N_UNSIGNED) ? "unsigned long" : "long");
|
||||
pedwarn (input_location, 0, "integer constant is too large for %qs type",
|
||||
(flags & CPP_N_UNSIGNED) ? "unsigned long" : "long");
|
||||
|
||||
value = build_int_cst_wide (type, integer.low, integer.high);
|
||||
|
||||
|
@ -642,7 +642,7 @@ interpret_float (const cpp_token *token, unsigned int flags)
|
|||
return error_mark_node;
|
||||
}
|
||||
else
|
||||
pedwarn (OPT_pedantic, "non-standard suffix on floating constant");
|
||||
pedwarn (input_location, OPT_pedantic, "non-standard suffix on floating constant");
|
||||
|
||||
type = c_common_type_for_mode (mode, 0);
|
||||
gcc_assert (type);
|
||||
|
@ -684,7 +684,7 @@ interpret_float (const cpp_token *token, unsigned int flags)
|
|||
if (REAL_VALUE_ISINF (real))
|
||||
{
|
||||
if (!MODE_HAS_INFINITIES (TYPE_MODE (type)))
|
||||
pedwarn (0, "floating constant exceeds range of %qT", type);
|
||||
pedwarn (input_location, 0, "floating constant exceeds range of %qT", type);
|
||||
else
|
||||
warning (OPT_Woverflow, "floating constant exceeds range of %qT", type);
|
||||
}
|
||||
|
|
104
gcc/c-parser.c
104
gcc/c-parser.c
|
@ -967,8 +967,8 @@ c_parser_translation_unit (c_parser *parser)
|
|||
{
|
||||
if (c_parser_next_token_is (parser, CPP_EOF))
|
||||
{
|
||||
pedwarn (OPT_pedantic, "%HISO C forbids an empty translation unit",
|
||||
&c_parser_peek_token (parser)->location);
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
"ISO C forbids an empty translation unit");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1052,9 +1052,8 @@ c_parser_external_declaration (c_parser *parser)
|
|||
}
|
||||
break;
|
||||
case CPP_SEMICOLON:
|
||||
pedwarn (OPT_pedantic,
|
||||
"%HISO C does not allow extra %<;%> outside of a function",
|
||||
&c_parser_peek_token (parser)->location);
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
"ISO C does not allow extra %<;%> outside of a function");
|
||||
c_parser_consume_token (parser);
|
||||
break;
|
||||
case CPP_PRAGMA:
|
||||
|
@ -1168,7 +1167,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok,
|
|||
else
|
||||
{
|
||||
shadow_tag_warned (specs, 1);
|
||||
pedwarn (0, "%Hempty declaration", &here);
|
||||
pedwarn (here, 0, "empty declaration");
|
||||
}
|
||||
c_parser_consume_token (parser);
|
||||
return;
|
||||
|
@ -1204,8 +1203,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok,
|
|||
if (!diagnosed_no_specs && !specs->declspecs_seen_p)
|
||||
{
|
||||
diagnosed_no_specs = true;
|
||||
pedwarn (0, "%Hdata definition has no type or storage class",
|
||||
&here);
|
||||
pedwarn (here, 0, "data definition has no type or storage class");
|
||||
}
|
||||
/* Having seen a data definition, there cannot now be a
|
||||
function definition. */
|
||||
|
@ -1274,7 +1272,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok,
|
|||
/* Function definition (nested or otherwise). */
|
||||
if (nested)
|
||||
{
|
||||
pedwarn (OPT_pedantic, "%HISO C forbids nested functions", &here);
|
||||
pedwarn (here, OPT_pedantic, "ISO C forbids nested functions");
|
||||
c_push_function_context ();
|
||||
}
|
||||
if (!start_function (specs, declarator, all_prefix_attrs))
|
||||
|
@ -1674,8 +1672,7 @@ c_parser_enum_specifier (c_parser *parser)
|
|||
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
|
||||
{
|
||||
if (seen_comma && !flag_isoc99)
|
||||
pedwarn (OPT_pedantic, "%Hcomma at end of enumerator list",
|
||||
&comma_loc);
|
||||
pedwarn (comma_loc, OPT_pedantic, "comma at end of enumerator list");
|
||||
c_parser_consume_token (parser);
|
||||
break;
|
||||
}
|
||||
|
@ -1706,9 +1703,8 @@ c_parser_enum_specifier (c_parser *parser)
|
|||
if (pedantic && !COMPLETE_TYPE_P (ret.spec))
|
||||
{
|
||||
gcc_assert (ident);
|
||||
pedwarn (OPT_pedantic,
|
||||
"%HISO C forbids forward references to %<enum%> types",
|
||||
&ident_loc);
|
||||
pedwarn (ident_loc, OPT_pedantic,
|
||||
"ISO C forbids forward references to %<enum%> types");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1832,9 +1828,8 @@ c_parser_struct_or_union_specifier (c_parser *parser)
|
|||
/* Parse any stray semicolon. */
|
||||
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
|
||||
{
|
||||
pedwarn (OPT_pedantic,
|
||||
"%Hextra semicolon in struct or union specified",
|
||||
&c_parser_peek_token (parser)->location);
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
"extra semicolon in struct or union specified");
|
||||
c_parser_consume_token (parser);
|
||||
continue;
|
||||
}
|
||||
|
@ -1862,8 +1857,8 @@ c_parser_struct_or_union_specifier (c_parser *parser)
|
|||
else
|
||||
{
|
||||
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
|
||||
pedwarn (0, "%Hno semicolon at end of struct or union",
|
||||
&c_parser_peek_token (parser)->location);
|
||||
pedwarn (c_parser_peek_token (parser)->location, 0,
|
||||
"no semicolon at end of struct or union");
|
||||
else
|
||||
{
|
||||
c_parser_error (parser, "expected %<;%>");
|
||||
|
@ -1954,9 +1949,8 @@ c_parser_struct_declaration (c_parser *parser)
|
|||
tree ret;
|
||||
if (!specs->type_seen_p)
|
||||
{
|
||||
pedwarn (OPT_pedantic,
|
||||
"%HISO C forbids member declarations with no members",
|
||||
&decl_loc);
|
||||
pedwarn (decl_loc, OPT_pedantic,
|
||||
"ISO C forbids member declarations with no members");
|
||||
shadow_tag_warned (specs, pedantic);
|
||||
ret = NULL_TREE;
|
||||
}
|
||||
|
@ -3014,8 +3008,7 @@ c_parser_braced_init (c_parser *parser, tree type, bool nested_p)
|
|||
really_start_incremental_init (type);
|
||||
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
|
||||
{
|
||||
pedwarn (OPT_pedantic, "%HISO C forbids empty initializer braces",
|
||||
&brace_loc);
|
||||
pedwarn (brace_loc, OPT_pedantic, "ISO C forbids empty initializer braces");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3060,9 +3053,8 @@ c_parser_initelt (c_parser *parser)
|
|||
/* Old-style structure member designator. */
|
||||
set_init_label (c_parser_peek_token (parser)->value);
|
||||
/* Use the colon as the error location. */
|
||||
pedwarn (OPT_pedantic,
|
||||
"%Hobsolete use of designated initializer with %<:%>",
|
||||
&c_parser_peek_2nd_token (parser)->location);
|
||||
pedwarn (c_parser_peek_2nd_token (parser)->location, OPT_pedantic,
|
||||
"obsolete use of designated initializer with %<:%>");
|
||||
c_parser_consume_token (parser);
|
||||
c_parser_consume_token (parser);
|
||||
}
|
||||
|
@ -3191,9 +3183,8 @@ c_parser_initelt (c_parser *parser)
|
|||
c_parser_consume_token (parser);
|
||||
set_init_index (first, second);
|
||||
if (second)
|
||||
pedwarn (OPT_pedantic,
|
||||
"%HISO C forbids specifying range of "
|
||||
"elements to initialize", &ellipsis_loc);
|
||||
pedwarn (ellipsis_loc, OPT_pedantic,
|
||||
"ISO C forbids specifying range of elements to initialize");
|
||||
}
|
||||
else
|
||||
c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE,
|
||||
|
@ -3205,20 +3196,15 @@ c_parser_initelt (c_parser *parser)
|
|||
if (c_parser_next_token_is (parser, CPP_EQ))
|
||||
{
|
||||
if (!flag_isoc99)
|
||||
pedwarn (OPT_pedantic,
|
||||
"%HISO C90 forbids specifying subobject "
|
||||
"to initialize", &des_loc);
|
||||
pedwarn (des_loc, OPT_pedantic,
|
||||
"ISO C90 forbids specifying subobject to initialize");
|
||||
c_parser_consume_token (parser);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (des_seen == 1)
|
||||
{
|
||||
pedwarn (OPT_pedantic,
|
||||
"%Hobsolete use of designated initializer "
|
||||
"without %<=%>",
|
||||
&c_parser_peek_token (parser)->location);
|
||||
}
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
"obsolete use of designated initializer without %<=%>");
|
||||
else
|
||||
{
|
||||
struct c_expr init;
|
||||
|
@ -3368,7 +3354,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
|
|||
}
|
||||
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
|
||||
}
|
||||
pedwarn (OPT_pedantic, "%HISO C forbids label declarations", &err_loc);
|
||||
pedwarn (err_loc, OPT_pedantic, "ISO C forbids label declarations");
|
||||
}
|
||||
/* We must now have at least one statement, label or declaration. */
|
||||
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
|
||||
|
@ -3399,11 +3385,11 @@ c_parser_compound_statement_nostart (c_parser *parser)
|
|||
last_label = false;
|
||||
c_parser_declaration_or_fndef (parser, true, true, true, true);
|
||||
if (last_stmt)
|
||||
pedwarn_c90 ((pedantic && !flag_isoc99)
|
||||
pedwarn_c90 (loc,
|
||||
(pedantic && !flag_isoc99)
|
||||
? OPT_pedantic
|
||||
: OPT_Wdeclaration_after_statement,
|
||||
"%HISO C90 forbids mixed declarations and code",
|
||||
&loc);
|
||||
"ISO C90 forbids mixed declarations and code");
|
||||
last_stmt = false;
|
||||
}
|
||||
else if (!last_label
|
||||
|
@ -3428,11 +3414,10 @@ c_parser_compound_statement_nostart (c_parser *parser)
|
|||
disable this diagnostic. */
|
||||
restore_extension_diagnostics (ext);
|
||||
if (last_stmt)
|
||||
pedwarn_c90 ((pedantic && !flag_isoc99)
|
||||
pedwarn_c90 (loc, (pedantic && !flag_isoc99)
|
||||
? OPT_pedantic
|
||||
: OPT_Wdeclaration_after_statement,
|
||||
"%HISO C90 forbids mixed declarations and code",
|
||||
&loc);
|
||||
"ISO C90 forbids mixed declarations and code");
|
||||
last_stmt = false;
|
||||
}
|
||||
else
|
||||
|
@ -4446,9 +4431,8 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after)
|
|||
c_parser_consume_token (parser);
|
||||
if (c_parser_next_token_is (parser, CPP_COLON))
|
||||
{
|
||||
pedwarn (OPT_pedantic,
|
||||
"%HISO C forbids omitting the middle term of a ?: expression",
|
||||
&c_parser_peek_token (parser)->location);
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
"ISO C forbids omitting the middle term of a ?: expression");
|
||||
/* Make sure first operand is calculated only once. */
|
||||
exp1.value = save_expr (default_conversion (cond.value));
|
||||
cond.value = c_objc_common_truthvalue_conversion (exp1.value);
|
||||
|
@ -5150,8 +5134,8 @@ c_parser_postfix_expression (c_parser *parser)
|
|||
c_parser_compound_statement_nostart (parser);
|
||||
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
|
||||
"expected %<)%>");
|
||||
pedwarn (OPT_pedantic,
|
||||
"%HISO C forbids braced-groups within expressions", &here);
|
||||
pedwarn (here, OPT_pedantic,
|
||||
"ISO C forbids braced-groups within expressions");
|
||||
expr.value = c_finish_stmt_expr (stmt);
|
||||
expr.original_code = ERROR_MARK;
|
||||
}
|
||||
|
@ -5512,8 +5496,7 @@ c_parser_postfix_expression_after_paren_type (c_parser *parser,
|
|||
maybe_warn_string_init (type, init);
|
||||
|
||||
if (!flag_isoc99)
|
||||
pedwarn (OPT_pedantic, "%HISO C90 forbids compound literals",
|
||||
&start_loc);
|
||||
pedwarn (start_loc, OPT_pedantic, "ISO C90 forbids compound literals");
|
||||
expr.value = build_compound_literal (type, init.value);
|
||||
expr.original_code = ERROR_MARK;
|
||||
return c_parser_postfix_expression_after_primary (parser, expr);
|
||||
|
@ -5814,9 +5797,8 @@ c_parser_objc_class_instance_variables (c_parser *parser)
|
|||
/* Parse any stray semicolon. */
|
||||
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
|
||||
{
|
||||
pedwarn (OPT_pedantic,
|
||||
"%Hextra semicolon in struct or union specified",
|
||||
&c_parser_peek_token (parser)->location);
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
"extra semicolon in struct or union specified");
|
||||
c_parser_consume_token (parser);
|
||||
continue;
|
||||
}
|
||||
|
@ -6032,9 +6014,8 @@ c_parser_objc_method_definition (c_parser *parser)
|
|||
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
|
||||
{
|
||||
c_parser_consume_token (parser);
|
||||
pedwarn (OPT_pedantic,
|
||||
"%Hextra semicolon in method definition specified",
|
||||
&c_parser_peek_token (parser)->location);
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
"extra semicolon in method definition specified");
|
||||
}
|
||||
if (!c_parser_next_token_is (parser, CPP_OPEN_BRACE))
|
||||
{
|
||||
|
@ -6070,9 +6051,8 @@ c_parser_objc_methodprotolist (c_parser *parser)
|
|||
switch (c_parser_peek_token (parser)->type)
|
||||
{
|
||||
case CPP_SEMICOLON:
|
||||
pedwarn (OPT_pedantic, "%HISO C does not allow extra %<;%> "
|
||||
"outside of a function",
|
||||
&c_parser_peek_token (parser)->location);
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
"ISO C does not allow extra %<;%> outside of a function");
|
||||
c_parser_consume_token (parser);
|
||||
break;
|
||||
case CPP_PLUS:
|
||||
|
|
|
@ -563,7 +563,7 @@ extern tree c_cast_expr (struct c_type_name *, tree);
|
|||
extern tree build_c_cast (tree, tree);
|
||||
extern void store_init_value (tree, tree);
|
||||
extern void error_init (const char *);
|
||||
extern void pedwarn_init (int opt, const char *);
|
||||
extern void pedwarn_init (location_t, int opt, const char *);
|
||||
extern void maybe_warn_string_init (tree, struct c_expr);
|
||||
extern void start_init (tree, tree, int);
|
||||
extern void finish_init (void);
|
||||
|
@ -640,7 +640,7 @@ extern void c_write_global_declarations (void);
|
|||
#define ATTRIBUTE_GCC_CDIAG(m, n) ATTRIBUTE_NONNULL(m)
|
||||
#endif
|
||||
|
||||
extern void pedwarn_c90 (int opt, const char *, ...) ATTRIBUTE_GCC_CDIAG(2,3);
|
||||
extern void pedwarn_c99 (int opt, const char *, ...) ATTRIBUTE_GCC_CDIAG(2,3);
|
||||
extern void pedwarn_c90 (location_t, int opt, const char *, ...) ATTRIBUTE_GCC_CDIAG(3,4);
|
||||
extern void pedwarn_c99 (location_t, int opt, const char *, ...) ATTRIBUTE_GCC_CDIAG(3,4);
|
||||
|
||||
#endif /* ! GCC_C_TREE_H */
|
||||
|
|
170
gcc/c-typeck.c
170
gcc/c-typeck.c
|
@ -470,7 +470,7 @@ composite_type (tree t1, tree t2)
|
|||
{
|
||||
TREE_VALUE (n) = composite_type (TREE_TYPE (memb),
|
||||
TREE_VALUE (p2));
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"function types not truly compatible in ISO C");
|
||||
goto parm_done;
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ composite_type (tree t1, tree t2)
|
|||
{
|
||||
TREE_VALUE (n) = composite_type (TREE_TYPE (memb),
|
||||
TREE_VALUE (p1));
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"function types not truly compatible in ISO C");
|
||||
goto parm_done;
|
||||
}
|
||||
|
@ -1040,7 +1040,7 @@ comp_target_types (tree ttl, tree ttr)
|
|||
val = comptypes (mvl, mvr);
|
||||
|
||||
if (val == 2)
|
||||
pedwarn (OPT_pedantic, "types are not quite compatible");
|
||||
pedwarn (input_location, OPT_pedantic, "types are not quite compatible");
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ function_types_compatible_p (const_tree f1, const_tree f2)
|
|||
/* 'volatile' qualifiers on a function's return type used to mean
|
||||
the function is noreturn. */
|
||||
if (TYPE_VOLATILE (ret1) != TYPE_VOLATILE (ret2))
|
||||
pedwarn (0, "function return types not compatible due to %<volatile%>");
|
||||
pedwarn (input_location, 0, "function return types not compatible due to %<volatile%>");
|
||||
if (TYPE_VOLATILE (ret1))
|
||||
ret1 = build_qualified_type (TYPE_MAIN_VARIANT (ret1),
|
||||
TYPE_QUALS (ret1) & ~TYPE_QUAL_VOLATILE);
|
||||
|
@ -2115,10 +2115,10 @@ build_array_ref (tree array, tree index)
|
|||
while (TREE_CODE (foo) == COMPONENT_REF)
|
||||
foo = TREE_OPERAND (foo, 0);
|
||||
if (TREE_CODE (foo) == VAR_DECL && C_DECL_REGISTER (foo))
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids subscripting %<register%> array");
|
||||
else if (!flag_isoc99 && !lvalue_p (foo))
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C90 forbids subscripting non-lvalue array");
|
||||
}
|
||||
|
||||
|
@ -2233,8 +2233,8 @@ build_external_ref (tree id, int fun, location_t loc)
|
|||
&& (TREE_CODE (ref) != VAR_DECL || TREE_STATIC (ref))
|
||||
&& ! TREE_PUBLIC (ref)
|
||||
&& DECL_CONTEXT (ref) != current_function_decl)
|
||||
pedwarn (0, "%H%qD is static but used in inline function %qD "
|
||||
"which is not static", &loc, ref, current_function_decl);
|
||||
pedwarn (loc, 0, "%qD is static but used in inline function %qD "
|
||||
"which is not static", ref, current_function_decl);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
@ -2457,7 +2457,7 @@ build_function_call (tree function, tree params)
|
|||
if (TREE_CONSTANT (result)
|
||||
&& (name == NULL_TREE
|
||||
|| strncmp (IDENTIFIER_POINTER (name), "__builtin_", 10) != 0))
|
||||
pedwarn_init (0, "initializer element is not constant");
|
||||
pedwarn_init (input_location, 0, "initializer element is not constant");
|
||||
}
|
||||
else
|
||||
result = fold_build_call_array (TREE_TYPE (fntype),
|
||||
|
@ -2802,10 +2802,10 @@ pointer_diff (tree op0, tree op1)
|
|||
tree orig_op1 = op1;
|
||||
|
||||
if (TREE_CODE (target_type) == VOID_TYPE)
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
"pointer of type %<void *%> used in subtraction");
|
||||
if (TREE_CODE (target_type) == FUNCTION_TYPE)
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
"pointer to a function used in subtraction");
|
||||
|
||||
/* If the conversion to ptrdiff_type does anything like widening or
|
||||
|
@ -2948,7 +2948,7 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
|
|||
else if (typecode == COMPLEX_TYPE)
|
||||
{
|
||||
code = CONJ_EXPR;
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C does not support %<~%> for complex conjugation");
|
||||
if (!noconvert)
|
||||
arg = default_conversion (arg);
|
||||
|
@ -3020,8 +3020,8 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
|
|||
{
|
||||
tree real, imag;
|
||||
|
||||
pedwarn (OPT_pedantic, "ISO C does not support %<++%> and %<--%>"
|
||||
" on complex types");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C does not support %<++%> and %<--%> on complex types");
|
||||
|
||||
arg = stabilize_reference (arg);
|
||||
real = build_unary_op (REALPART_EXPR, arg, 1);
|
||||
|
@ -3070,10 +3070,10 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
|
|||
|| TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
|
||||
{
|
||||
if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
"wrong type argument to increment");
|
||||
else
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
"wrong type argument to decrement");
|
||||
}
|
||||
|
||||
|
@ -3349,7 +3349,7 @@ c_mark_addressable (tree exp)
|
|||
("global register variable %qD used in nested function", x);
|
||||
return false;
|
||||
}
|
||||
pedwarn (0, "register variable %qD used in nested function", x);
|
||||
pedwarn (input_location, 0, "register variable %qD used in nested function", x);
|
||||
}
|
||||
else if (C_DECL_REGISTER (x))
|
||||
{
|
||||
|
@ -3457,7 +3457,7 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
|
|||
else if (code1 == VOID_TYPE || code2 == VOID_TYPE)
|
||||
{
|
||||
if (code1 != VOID_TYPE || code2 != VOID_TYPE)
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids conditional expr with only one void side");
|
||||
result_type = void_type_node;
|
||||
}
|
||||
|
@ -3472,7 +3472,8 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
|
|||
else if (VOID_TYPE_P (TREE_TYPE (type1)))
|
||||
{
|
||||
if (TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE)
|
||||
pedwarn (OPT_pedantic, "ISO C forbids conditional expr between "
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids conditional expr between "
|
||||
"%<void *%> and function pointer");
|
||||
result_type = build_pointer_type (qualify_type (TREE_TYPE (type1),
|
||||
TREE_TYPE (type2)));
|
||||
|
@ -3480,21 +3481,24 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
|
|||
else if (VOID_TYPE_P (TREE_TYPE (type2)))
|
||||
{
|
||||
if (TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE)
|
||||
pedwarn (OPT_pedantic, "ISO C forbids conditional expr between "
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids conditional expr between "
|
||||
"%<void *%> and function pointer");
|
||||
result_type = build_pointer_type (qualify_type (TREE_TYPE (type2),
|
||||
TREE_TYPE (type1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
pedwarn (0, "pointer type mismatch in conditional expression");
|
||||
pedwarn (input_location, 0,
|
||||
"pointer type mismatch in conditional expression");
|
||||
result_type = build_pointer_type (void_type_node);
|
||||
}
|
||||
}
|
||||
else if (code1 == POINTER_TYPE && code2 == INTEGER_TYPE)
|
||||
{
|
||||
if (!null_pointer_constant_p (orig_op2))
|
||||
pedwarn (0, "pointer/integer type mismatch in conditional expression");
|
||||
pedwarn (input_location, 0,
|
||||
"pointer/integer type mismatch in conditional expression");
|
||||
else
|
||||
{
|
||||
op2 = null_pointer_node;
|
||||
|
@ -3504,7 +3508,8 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
|
|||
else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE)
|
||||
{
|
||||
if (!null_pointer_constant_p (orig_op1))
|
||||
pedwarn (0, "pointer/integer type mismatch in conditional expression");
|
||||
pedwarn (input_location, 0,
|
||||
"pointer/integer type mismatch in conditional expression");
|
||||
else
|
||||
{
|
||||
op1 = null_pointer_node;
|
||||
|
@ -3617,7 +3622,7 @@ build_c_cast (tree type, tree expr)
|
|||
{
|
||||
if (TREE_CODE (type) == RECORD_TYPE
|
||||
|| TREE_CODE (type) == UNION_TYPE)
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids casting nonscalar to the same type");
|
||||
}
|
||||
else if (TREE_CODE (type) == UNION_TYPE)
|
||||
|
@ -3634,7 +3639,8 @@ build_c_cast (tree type, tree expr)
|
|||
{
|
||||
tree t;
|
||||
|
||||
pedwarn (OPT_pedantic, "ISO C forbids casts to union type");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C forbids casts to union type");
|
||||
t = digest_init (type,
|
||||
build_constructor_single (type, field, value),
|
||||
true, 0);
|
||||
|
@ -3745,7 +3751,7 @@ build_c_cast (tree type, tree expr)
|
|||
&& TREE_CODE (otype) == POINTER_TYPE
|
||||
&& TREE_CODE (TREE_TYPE (otype)) == FUNCTION_TYPE
|
||||
&& TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE)
|
||||
pedwarn (OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C forbids "
|
||||
"conversion of function pointer to object pointer type");
|
||||
|
||||
if (pedantic
|
||||
|
@ -3754,7 +3760,7 @@ build_c_cast (tree type, tree expr)
|
|||
&& TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
|
||||
&& TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
|
||||
&& !null_pointer_constant_p (value))
|
||||
pedwarn (OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C forbids "
|
||||
"conversion of object pointer to function pointer type");
|
||||
|
||||
ovalue = value;
|
||||
|
@ -3946,24 +3952,24 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
/* This macro is used to emit diagnostics to ensure that all format
|
||||
strings are complete sentences, visible to gettext and checked at
|
||||
compile time. */
|
||||
#define WARN_FOR_ASSIGNMENT(AR, AS, IN, RE) \
|
||||
#define WARN_FOR_ASSIGNMENT(LOCATION, AR, AS, IN, RE) \
|
||||
do { \
|
||||
switch (errtype) \
|
||||
{ \
|
||||
case ic_argpass: \
|
||||
pedwarn (0, AR, parmnum, rname); \
|
||||
pedwarn (LOCATION, 0, AR, parmnum, rname); \
|
||||
break; \
|
||||
case ic_argpass_nonproto: \
|
||||
warning (0, AR, parmnum, rname); \
|
||||
break; \
|
||||
case ic_assign: \
|
||||
pedwarn (0, AS); \
|
||||
pedwarn (LOCATION, 0, AS); \
|
||||
break; \
|
||||
case ic_init: \
|
||||
pedwarn (0, IN); \
|
||||
pedwarn (LOCATION, 0, IN); \
|
||||
break; \
|
||||
case ic_return: \
|
||||
pedwarn (0, RE); \
|
||||
pedwarn (LOCATION, 0, RE); \
|
||||
break; \
|
||||
default: \
|
||||
gcc_unreachable (); \
|
||||
|
@ -4145,7 +4151,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
function where an ordinary one is wanted, but not
|
||||
vice-versa. */
|
||||
if (TYPE_QUALS (ttl) & ~TYPE_QUALS (ttr))
|
||||
WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE "
|
||||
WARN_FOR_ASSIGNMENT (input_location,
|
||||
G_("passing argument %d of %qE "
|
||||
"makes qualified function "
|
||||
"pointer from unqualified"),
|
||||
G_("assignment makes qualified "
|
||||
|
@ -4158,7 +4165,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
"pointer from unqualified"));
|
||||
}
|
||||
else if (TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl))
|
||||
WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE discards "
|
||||
WARN_FOR_ASSIGNMENT (input_location,
|
||||
G_("passing argument %d of %qE discards "
|
||||
"qualifiers from pointer target type"),
|
||||
G_("assignment discards qualifiers "
|
||||
"from pointer target type"),
|
||||
|
@ -4171,7 +4179,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
}
|
||||
|
||||
if (!fundecl || !DECL_IN_SYSTEM_HEADER (fundecl))
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C prohibits argument conversion to union type");
|
||||
|
||||
rhs = fold_convert (TREE_TYPE (memb), rhs);
|
||||
|
@ -4257,7 +4265,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
(VOID_TYPE_P (ttr)
|
||||
&& !null_pointer_constant_p (rhs)
|
||||
&& TREE_CODE (ttl) == FUNCTION_TYPE)))
|
||||
WARN_FOR_ASSIGNMENT (G_("ISO C forbids passing argument %d of "
|
||||
WARN_FOR_ASSIGNMENT (input_location,
|
||||
G_("ISO C forbids passing argument %d of "
|
||||
"%qE between function pointer "
|
||||
"and %<void *%>"),
|
||||
G_("ISO C forbids assignment between "
|
||||
|
@ -4277,7 +4286,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
qualifier are acceptable if the 'volatile' has been added
|
||||
in by the Objective-C EH machinery. */
|
||||
if (!objc_type_quals_match (ttl, ttr))
|
||||
WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE discards "
|
||||
WARN_FOR_ASSIGNMENT (input_location,
|
||||
G_("passing argument %d of %qE discards "
|
||||
"qualifiers from pointer target type"),
|
||||
G_("assignment discards qualifiers "
|
||||
"from pointer target type"),
|
||||
|
@ -4293,7 +4303,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
;
|
||||
/* If there is a mismatch, do warn. */
|
||||
else if (warn_pointer_sign)
|
||||
WARN_FOR_ASSIGNMENT (G_("pointer targets in passing argument "
|
||||
WARN_FOR_ASSIGNMENT (input_location,
|
||||
G_("pointer targets in passing argument "
|
||||
"%d of %qE differ in signedness"),
|
||||
G_("pointer targets in assignment "
|
||||
"differ in signedness"),
|
||||
|
@ -4310,7 +4321,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
it is okay to use a const or volatile function
|
||||
where an ordinary one is wanted, but not vice-versa. */
|
||||
if (TYPE_QUALS (ttl) & ~TYPE_QUALS (ttr))
|
||||
WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE makes "
|
||||
WARN_FOR_ASSIGNMENT (input_location,
|
||||
G_("passing argument %d of %qE makes "
|
||||
"qualified function pointer "
|
||||
"from unqualified"),
|
||||
G_("assignment makes qualified function "
|
||||
|
@ -4324,7 +4336,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
else
|
||||
/* Avoid warning about the volatile ObjC EH puts on decls. */
|
||||
if (!objc_ok)
|
||||
WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE from "
|
||||
WARN_FOR_ASSIGNMENT (input_location,
|
||||
G_("passing argument %d of %qE from "
|
||||
"incompatible pointer type"),
|
||||
G_("assignment from incompatible pointer type"),
|
||||
G_("initialization from incompatible "
|
||||
|
@ -4346,7 +4359,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
or one that results from arithmetic, even including
|
||||
a cast to integer type. */
|
||||
if (!null_pointer_constant_p (rhs))
|
||||
WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE makes "
|
||||
WARN_FOR_ASSIGNMENT (input_location,
|
||||
G_("passing argument %d of %qE makes "
|
||||
"pointer from integer without a cast"),
|
||||
G_("assignment makes pointer from integer "
|
||||
"without a cast"),
|
||||
|
@ -4359,7 +4373,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
|
|||
}
|
||||
else if (codel == INTEGER_TYPE && coder == POINTER_TYPE)
|
||||
{
|
||||
WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE makes integer "
|
||||
WARN_FOR_ASSIGNMENT (input_location,
|
||||
G_("passing argument %d of %qE makes integer "
|
||||
"from pointer without a cast"),
|
||||
G_("assignment makes integer from pointer "
|
||||
"without a cast"),
|
||||
|
@ -4623,14 +4638,14 @@ error_init (const char *msgid)
|
|||
component name is taken from the spelling stack. */
|
||||
|
||||
void
|
||||
pedwarn_init (int opt, const char *msgid)
|
||||
pedwarn_init (location_t location, int opt, const char *msgid)
|
||||
{
|
||||
char *ofwhat;
|
||||
|
||||
pedwarn (opt, "%s", _(msgid));
|
||||
pedwarn (location, opt, "%s", _(msgid));
|
||||
ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
|
||||
if (*ofwhat)
|
||||
pedwarn (opt, "(near initialization for %qs)", ofwhat);
|
||||
pedwarn (location, opt, "(near initialization for %qs)", ofwhat);
|
||||
}
|
||||
|
||||
/* Issue a warning for a bad initializer component.
|
||||
|
@ -4661,7 +4676,7 @@ maybe_warn_string_init (tree type, struct c_expr expr)
|
|||
&& TREE_CODE (type) == ARRAY_TYPE
|
||||
&& TREE_CODE (expr.value) == STRING_CST
|
||||
&& expr.original_code != STRING_CST)
|
||||
pedwarn_init (OPT_pedantic,
|
||||
pedwarn_init (input_location, OPT_pedantic,
|
||||
"array initialized from parenthesized string constant");
|
||||
}
|
||||
|
||||
|
@ -4755,7 +4770,8 @@ digest_init (tree type, tree init, bool strict_string, int require_constant)
|
|||
TREE_STRING_LENGTH (inside_init)
|
||||
- (TYPE_PRECISION (typ1)
|
||||
/ BITS_PER_UNIT)))
|
||||
pedwarn_init (0, "initializer-string for array of chars is too long");
|
||||
pedwarn_init (input_location, 0,
|
||||
"initializer-string for array of chars is too long");
|
||||
|
||||
return inside_init;
|
||||
}
|
||||
|
@ -4873,7 +4889,8 @@ digest_init (tree type, tree init, bool strict_string, int require_constant)
|
|||
if (inside_init == error_mark_node)
|
||||
error_init ("initializer element is not constant");
|
||||
else
|
||||
pedwarn_init (OPT_pedantic, "initializer element is not constant");
|
||||
pedwarn_init (input_location, OPT_pedantic,
|
||||
"initializer element is not constant");
|
||||
if (flag_pedantic_errors)
|
||||
inside_init = error_mark_node;
|
||||
}
|
||||
|
@ -5547,7 +5564,8 @@ pop_init_level (int implicit)
|
|||
if (constructor_depth > 2)
|
||||
error_init ("initialization of flexible array member in a nested context");
|
||||
else
|
||||
pedwarn_init (OPT_pedantic, "initialization of a flexible array member");
|
||||
pedwarn_init (input_location, OPT_pedantic,
|
||||
"initialization of a flexible array member");
|
||||
|
||||
/* We have already issued an error message for the existence
|
||||
of a flexible array member not at the end of the structure.
|
||||
|
@ -6284,7 +6302,8 @@ output_init_element (tree value, bool strict_string, tree type, tree field,
|
|||
value = error_mark_node;
|
||||
}
|
||||
else if (require_constant_elements)
|
||||
pedwarn (0, "initializer element is not computable at load time");
|
||||
pedwarn (input_location, 0,
|
||||
"initializer element is not computable at load time");
|
||||
}
|
||||
|
||||
/* If this field is empty (and not at the end of structure),
|
||||
|
@ -6611,7 +6630,8 @@ process_init_element (struct c_expr value)
|
|||
|
||||
if (constructor_fields == 0)
|
||||
{
|
||||
pedwarn_init (0, "excess elements in struct initializer");
|
||||
pedwarn_init (input_location, 0,
|
||||
"excess elements in struct initializer");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6694,7 +6714,8 @@ process_init_element (struct c_expr value)
|
|||
|
||||
if (constructor_fields == 0)
|
||||
{
|
||||
pedwarn_init (0, "excess elements in union initializer");
|
||||
pedwarn_init (input_location, 0,
|
||||
"excess elements in union initializer");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6781,7 +6802,8 @@ process_init_element (struct c_expr value)
|
|||
&& (tree_int_cst_lt (constructor_max_index, constructor_index)
|
||||
|| integer_all_onesp (constructor_max_index)))
|
||||
{
|
||||
pedwarn_init (0, "excess elements in array initializer");
|
||||
pedwarn_init (input_location, 0,
|
||||
"excess elements in array initializer");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6811,7 +6833,8 @@ process_init_element (struct c_expr value)
|
|||
always have a fixed size derived from their type. */
|
||||
if (tree_int_cst_lt (constructor_max_index, constructor_index))
|
||||
{
|
||||
pedwarn_init (0, "excess elements in vector initializer");
|
||||
pedwarn_init (input_location, 0,
|
||||
"excess elements in vector initializer");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6835,7 +6858,8 @@ process_init_element (struct c_expr value)
|
|||
else if (constructor_type != error_mark_node
|
||||
&& constructor_fields == 0)
|
||||
{
|
||||
pedwarn_init (0, "excess elements in scalar initializer");
|
||||
pedwarn_init (input_location, 0,
|
||||
"excess elements in scalar initializer");
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
@ -7066,7 +7090,7 @@ c_finish_goto_label (tree label)
|
|||
tree
|
||||
c_finish_goto_ptr (tree expr)
|
||||
{
|
||||
pedwarn (OPT_pedantic, "ISO C forbids %<goto *expr;%>");
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C forbids %<goto *expr;%>");
|
||||
expr = convert (ptr_type_node, expr);
|
||||
return add_stmt (build1 (GOTO_EXPR, void_type_node, expr));
|
||||
}
|
||||
|
@ -7089,7 +7113,7 @@ c_finish_return (tree retval)
|
|||
if ((warn_return_type || flag_isoc99)
|
||||
&& valtype != 0 && TREE_CODE (valtype) != VOID_TYPE)
|
||||
{
|
||||
pedwarn_c99 (flag_isoc99 ? 0 : OPT_Wreturn_type,
|
||||
pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wreturn_type,
|
||||
"%<return%> with no value, in "
|
||||
"function returning non-void");
|
||||
no_warning = true;
|
||||
|
@ -7099,9 +7123,10 @@ c_finish_return (tree retval)
|
|||
{
|
||||
current_function_returns_null = 1;
|
||||
if (TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE)
|
||||
pedwarn (0, "%<return%> with a value, in function returning void");
|
||||
pedwarn (input_location, 0,
|
||||
"%<return%> with a value, in function returning void");
|
||||
else
|
||||
pedwarn (OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C forbids "
|
||||
"%<return%> with expression, in function returning void");
|
||||
}
|
||||
else
|
||||
|
@ -8178,20 +8203,21 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
|
|||
whose value is 0 but which isn't a valid null ptr const. */
|
||||
if (pedantic && !null_pointer_constant_p (orig_op0)
|
||||
&& TREE_CODE (tt1) == FUNCTION_TYPE)
|
||||
pedwarn (OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C forbids "
|
||||
"comparison of %<void *%> with function pointer");
|
||||
}
|
||||
else if (VOID_TYPE_P (tt1))
|
||||
{
|
||||
if (pedantic && !null_pointer_constant_p (orig_op1)
|
||||
&& TREE_CODE (tt0) == FUNCTION_TYPE)
|
||||
pedwarn (OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C forbids "
|
||||
"comparison of %<void *%> with function pointer");
|
||||
}
|
||||
else
|
||||
/* Avoid warning about the volatile ObjC EH puts on decls. */
|
||||
if (!objc_ok)
|
||||
pedwarn (0, "comparison of distinct pointer types lacks a cast");
|
||||
pedwarn (input_location, 0,
|
||||
"comparison of distinct pointer types lacks a cast");
|
||||
|
||||
if (result_type == NULL_TREE)
|
||||
result_type = ptr_type_node;
|
||||
|
@ -8215,12 +8241,12 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
|
|||
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
|
||||
{
|
||||
result_type = type0;
|
||||
pedwarn (0, "comparison between pointer and integer");
|
||||
pedwarn (input_location, 0, "comparison between pointer and integer");
|
||||
}
|
||||
else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
|
||||
{
|
||||
result_type = type1;
|
||||
pedwarn (0, "comparison between pointer and integer");
|
||||
pedwarn (input_location, 0, "comparison between pointer and integer");
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -8241,22 +8267,24 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
|
|||
result_type = common_pointer_type (type0, type1);
|
||||
if (!COMPLETE_TYPE_P (TREE_TYPE (type0))
|
||||
!= !COMPLETE_TYPE_P (TREE_TYPE (type1)))
|
||||
pedwarn (0, "comparison of complete and incomplete pointers");
|
||||
pedwarn (input_location, 0,
|
||||
"comparison of complete and incomplete pointers");
|
||||
else if (TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE)
|
||||
pedwarn (OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C forbids "
|
||||
"ordered comparisons of pointers to functions");
|
||||
}
|
||||
else
|
||||
{
|
||||
result_type = ptr_type_node;
|
||||
pedwarn (0, "comparison of distinct pointer types lacks a cast");
|
||||
pedwarn (input_location, 0,
|
||||
"comparison of distinct pointer types lacks a cast");
|
||||
}
|
||||
}
|
||||
else if (code0 == POINTER_TYPE && null_pointer_constant_p (orig_op1))
|
||||
{
|
||||
result_type = type0;
|
||||
if (pedantic)
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ordered comparison of pointer with integer zero");
|
||||
else if (extra_warnings)
|
||||
warning (OPT_Wextra,
|
||||
|
@ -8265,18 +8293,18 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
|
|||
else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_op0))
|
||||
{
|
||||
result_type = type1;
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ordered comparison of pointer with integer zero");
|
||||
}
|
||||
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
|
||||
{
|
||||
result_type = type0;
|
||||
pedwarn (0, "comparison between pointer and integer");
|
||||
pedwarn (input_location, 0, "comparison between pointer and integer");
|
||||
}
|
||||
else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
|
||||
{
|
||||
result_type = type1;
|
||||
pedwarn (0, "comparison between pointer and integer");
|
||||
pedwarn (input_location, 0, "comparison between pointer and integer");
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
2008-08-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
* typeck.c: Update all calls to pedwarn.
|
||||
* decl.c: Likewise.
|
||||
* call.c: Likewise.
|
||||
* error.c: Likewise.
|
||||
* pt.c: Likewise.
|
||||
* name-lookup.c: Likewise.
|
||||
* parser.c: Likewise.
|
||||
|
||||
2008-08-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR c++/35158
|
||||
|
|
|
@ -3404,7 +3404,7 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
|
|||
if (!arg2)
|
||||
{
|
||||
if (complain & tf_error)
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C++ forbids omitting the middle term of a ?: expression");
|
||||
|
||||
/* Make sure that lvalues remain lvalues. See g++.oliva/ext1.C. */
|
||||
|
@ -6766,7 +6766,7 @@ tweak:
|
|||
{
|
||||
if (warn)
|
||||
{
|
||||
pedwarn (0,
|
||||
pedwarn (input_location, 0,
|
||||
"ISO C++ says that these are ambiguous, even "
|
||||
"though the worst conversion for the first is better than "
|
||||
"the worst conversion for the second:");
|
||||
|
|
|
@ -3810,7 +3810,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
|
|||
SET_ANON_AGGR_TYPE_P (declared_type);
|
||||
|
||||
if (TREE_CODE (declared_type) != UNION_TYPE && !in_system_header)
|
||||
pedwarn (OPT_pedantic, "ISO C++ prohibits anonymous structs");
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C++ prohibits anonymous structs");
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -7033,7 +7033,7 @@ check_static_variable_definition (tree decl, tree type)
|
|||
"static member %qD",
|
||||
decl);
|
||||
else if (!INTEGRAL_TYPE_P (type))
|
||||
pedwarn (OPT_pedantic, "ISO C++ forbids initialization of member constant "
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C++ forbids initialization of member constant "
|
||||
"%qD of non-integral type %qT", decl, type);
|
||||
|
||||
return 0;
|
||||
|
@ -7113,9 +7113,9 @@ compute_array_index_type (tree name, tree size)
|
|||
else if (integer_zerop (size) && !in_system_header)
|
||||
{
|
||||
if (name)
|
||||
pedwarn (OPT_pedantic, "ISO C++ forbids zero-size array %qD", name);
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C++ forbids zero-size array %qD", name);
|
||||
else
|
||||
pedwarn (OPT_pedantic, "ISO C++ forbids zero-size array");
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C++ forbids zero-size array");
|
||||
}
|
||||
}
|
||||
else if (TREE_CONSTANT (size))
|
||||
|
@ -7131,9 +7131,9 @@ compute_array_index_type (tree name, tree size)
|
|||
else if (pedantic && warn_vla != 0)
|
||||
{
|
||||
if (name)
|
||||
pedwarn (OPT_Wvla, "ISO C++ forbids variable length array %qD", name);
|
||||
pedwarn (input_location, OPT_Wvla, "ISO C++ forbids variable length array %qD", name);
|
||||
else
|
||||
pedwarn (OPT_Wvla, "ISO C++ forbids variable length array");
|
||||
pedwarn (input_location, OPT_Wvla, "ISO C++ forbids variable length array");
|
||||
}
|
||||
else if (warn_vla > 0)
|
||||
{
|
||||
|
@ -7767,7 +7767,7 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
else if (! is_main)
|
||||
permerror (input_location, "ISO C++ forbids declaration of %qs with no type", name);
|
||||
else if (pedantic)
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C++ forbids declaration of %qs with no type", name);
|
||||
else
|
||||
warning (OPT_Wreturn_type,
|
||||
|
@ -7823,7 +7823,7 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
ok = 1;
|
||||
if (!explicit_int && !defaulted_int && !explicit_char && pedantic)
|
||||
{
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"long, short, signed or unsigned used invalidly for %qs",
|
||||
name);
|
||||
if (flag_pedantic_errors)
|
||||
|
@ -7929,7 +7929,7 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
if (pedantic)
|
||||
{
|
||||
tree bad_type = build_qualified_type (type, type_quals);
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ignoring %qV qualifiers added to function type %qT",
|
||||
bad_type, type);
|
||||
}
|
||||
|
@ -9159,11 +9159,11 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
&& pedantic)
|
||||
{
|
||||
if (storage_class == sc_static)
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"%<static%> specified invalid for function %qs "
|
||||
"declared out of global scope", name);
|
||||
else
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"%<inline%> specifier invalid for function %qs "
|
||||
"declared out of global scope", name);
|
||||
}
|
||||
|
@ -9252,7 +9252,7 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
}
|
||||
if (storage_class == sc_extern && pedantic)
|
||||
{
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"cannot explicitly declare member %q#D to have "
|
||||
"extern linkage", decl);
|
||||
storage_class = sc_none;
|
||||
|
@ -10148,7 +10148,7 @@ grok_op_properties (tree decl, bool complain)
|
|||
if (operator_code == POSTINCREMENT_EXPR
|
||||
|| operator_code == POSTDECREMENT_EXPR)
|
||||
{
|
||||
pedwarn (OPT_pedantic, "%qD cannot have default arguments",
|
||||
pedwarn (input_location, OPT_pedantic, "%qD cannot have default arguments",
|
||||
decl);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2687,7 +2687,7 @@ maybe_warn_cpp0x (const char* str)
|
|||
/* We really want to suppress this warning in system headers,
|
||||
because libstdc++ uses variadic templates even when we aren't
|
||||
in C++0x mode. */
|
||||
pedwarn (0, "%s only available with -std=c++0x or -std=gnu++0x", str);
|
||||
pedwarn (input_location, 0, "%s only available with -std=c++0x or -std=gnu++0x", str);
|
||||
}
|
||||
|
||||
/* Warn about the use of variadic templates when appropriate. */
|
||||
|
|
|
@ -725,7 +725,7 @@ pushdecl_maybe_friend (tree x, bool is_friend)
|
|||
else if (t == wchar_decl_node)
|
||||
{
|
||||
if (! DECL_IN_SYSTEM_HEADER (x))
|
||||
pedwarn (OPT_pedantic, "redeclaration of %<wchar_t%> as %qT",
|
||||
pedwarn (input_location, OPT_pedantic, "redeclaration of %<wchar_t%> as %qT",
|
||||
TREE_TYPE (x));
|
||||
|
||||
/* Throw away the redeclaration. */
|
||||
|
@ -796,11 +796,11 @@ pushdecl_maybe_friend (tree x, bool is_friend)
|
|||
x_exception_spec,
|
||||
true))
|
||||
{
|
||||
pedwarn (0, "declaration of %q#D with C language linkage",
|
||||
pedwarn (input_location, 0, "declaration of %q#D with C language linkage",
|
||||
x);
|
||||
pedwarn (0, "conflicts with previous declaration %q+#D",
|
||||
pedwarn (input_location, 0, "conflicts with previous declaration %q+#D",
|
||||
previous);
|
||||
pedwarn (0, "due to different exception specifications");
|
||||
pedwarn (input_location, 0, "due to different exception specifications");
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2162,9 +2162,8 @@ cp_parser_check_decl_spec (cp_decl_specifier_seq *decl_specs,
|
|||
error ("%H%<long long long%> is too long for GCC", &location);
|
||||
else if (pedantic && !in_system_header && warn_long_long
|
||||
&& cxx_dialect == cxx98)
|
||||
pedwarn (OPT_Wlong_long,
|
||||
"%HISO C++ 1998 does not support %<long long%>",
|
||||
&location);
|
||||
pedwarn (location, OPT_Wlong_long,
|
||||
"ISO C++ 1998 does not support %<long long%>");
|
||||
}
|
||||
else if (count > 1)
|
||||
{
|
||||
|
@ -3217,9 +3216,8 @@ cp_parser_primary_expression (cp_parser *parser,
|
|||
&& cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
|
||||
{
|
||||
/* Statement-expressions are not allowed by the standard. */
|
||||
pedwarn (OPT_pedantic,
|
||||
"%HISO C++ forbids braced-groups within expressions",
|
||||
&token->location);
|
||||
pedwarn (token->location, OPT_pedantic,
|
||||
"ISO C++ forbids braced-groups within expressions");
|
||||
|
||||
/* And they're not allowed outside of a function-body; you
|
||||
cannot, for example, write:
|
||||
|
@ -4548,7 +4546,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
|
|||
{
|
||||
/* Warn the user that a compound literal is not
|
||||
allowed in standard C++. */
|
||||
pedwarn (OPT_pedantic, "ISO C++ forbids compound-literals");
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C++ forbids compound-literals");
|
||||
/* For simplicity, we disallow compound literals in
|
||||
constant-expressions. We could
|
||||
allow compound literals of integer type, whose
|
||||
|
@ -7612,7 +7610,7 @@ cp_parser_jump_statement (cp_parser* parser)
|
|||
if (cp_lexer_next_token_is (parser->lexer, CPP_MULT))
|
||||
{
|
||||
/* Issue a warning about this use of a GNU extension. */
|
||||
pedwarn (OPT_pedantic, "%HISO C++ forbids computed gotos", &token->location);
|
||||
pedwarn (token->location, OPT_pedantic, "ISO C++ forbids computed gotos");
|
||||
/* Consume the '*' token. */
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
/* Parse the dependent expression. */
|
||||
|
@ -7752,7 +7750,7 @@ cp_parser_declaration_seq_opt (cp_parser* parser)
|
|||
invalid. Allow it unless we're being pedantic. */
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
if (!in_system_header)
|
||||
pedwarn (OPT_pedantic, "extra %<;%>");
|
||||
pedwarn (input_location, OPT_pedantic, "extra %<;%>");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -11740,7 +11738,7 @@ cp_parser_enumerator_list (cp_parser* parser, tree type)
|
|||
if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
|
||||
{
|
||||
if (!in_system_header)
|
||||
pedwarn (OPT_pedantic, "comma at end of enumerator list");
|
||||
pedwarn (input_location, OPT_pedantic, "comma at end of enumerator list");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -14384,7 +14382,7 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p)
|
|||
&& cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_COLON)
|
||||
{
|
||||
/* Warn the user that they are using an extension. */
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C++ does not allow designated initializers");
|
||||
/* Consume the identifier. */
|
||||
identifier = cp_lexer_consume_token (parser->lexer)->u.value;
|
||||
|
@ -15408,7 +15406,7 @@ cp_parser_member_declaration (cp_parser* parser)
|
|||
{
|
||||
cp_token *token = cp_lexer_peek_token (parser->lexer);
|
||||
if (!in_system_header_at (token->location))
|
||||
pedwarn (OPT_pedantic, "%Hextra %<;%>", &token->location);
|
||||
pedwarn (token->location, OPT_pedantic, "extra %<;%>");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
13
gcc/cp/pt.c
13
gcc/cp/pt.c
|
@ -14613,7 +14613,7 @@ do_decl_instantiation (tree decl, tree storage)
|
|||
else if (storage == ridpointers[(int) RID_EXTERN])
|
||||
{
|
||||
if (!in_system_header && (cxx_dialect == cxx98))
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C++ 1998 forbids the use of %<extern%> on explicit "
|
||||
"instantiations");
|
||||
extern_p = 1;
|
||||
|
@ -14705,13 +14705,14 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
|
|||
if (storage == ridpointers[(int) RID_EXTERN])
|
||||
{
|
||||
if (cxx_dialect == cxx98)
|
||||
pedwarn(OPT_pedantic,
|
||||
"ISO C++ 1998 forbids the use of %<extern%> on "
|
||||
"explicit instantiations");
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C++ 1998 forbids the use of %<extern%> on "
|
||||
"explicit instantiations");
|
||||
}
|
||||
else
|
||||
pedwarn(OPT_pedantic, "ISO C++ forbids the use of %qE on explicit "
|
||||
"instantiations", storage);
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C++ forbids the use of %qE"
|
||||
" on explicit instantiations", storage);
|
||||
}
|
||||
|
||||
if (storage == ridpointers[(int) RID_INLINE])
|
||||
|
|
|
@ -512,7 +512,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
|
|||
tree result_type;
|
||||
|
||||
if (TYPE_PTRFN_P (t2) && (complain & tf_error))
|
||||
pedwarn (OPT_pedantic, "ISO C++ forbids %s "
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C++ forbids %s "
|
||||
"between pointer of type %<void *%> and pointer-to-function",
|
||||
location);
|
||||
result_type
|
||||
|
@ -1280,7 +1280,7 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain)
|
|||
if (TREE_CODE (type) == METHOD_TYPE)
|
||||
{
|
||||
if (complain)
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
"invalid application of %qs to a member function",
|
||||
operator_name_info[(int) op].name);
|
||||
value = size_one_node;
|
||||
|
@ -2587,7 +2587,7 @@ build_array_ref (tree array, tree idx)
|
|||
}
|
||||
|
||||
if (!lvalue_p (array))
|
||||
pedwarn (OPT_pedantic, "ISO C++ forbids subscripting non-lvalue array");
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C++ forbids subscripting non-lvalue array");
|
||||
|
||||
/* Note in C++ it is valid to subscript a `register' array, since
|
||||
it is valid to take the address of something with that
|
||||
|
@ -2813,7 +2813,7 @@ cp_build_function_call (tree function, tree params, tsubst_flags_t complain)
|
|||
|
||||
/* Convert anything with function type to a pointer-to-function. */
|
||||
if (DECL_MAIN_P (function) && (complain & tf_error))
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ISO C++ forbids calling %<::main%> from within program");
|
||||
|
||||
function = build_addr_func (function);
|
||||
|
@ -5260,7 +5260,7 @@ convert_member_func_to_ptr (tree type, tree expr)
|
|||
|| TREE_CODE (intype) == METHOD_TYPE);
|
||||
|
||||
if (pedantic || warn_pmf2ptr)
|
||||
pedwarn (pedantic ? OPT_pedantic : OPT_Wpmf_conversions,
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpmf_conversions,
|
||||
"converting from %qT to %qT", intype, type);
|
||||
|
||||
if (TREE_CODE (intype) == METHOD_TYPE)
|
||||
|
@ -7164,7 +7164,7 @@ cp_apply_type_quals_to_decl (int type_quals, tree decl)
|
|||
if (pedantic)
|
||||
{
|
||||
tree bad_type = build_qualified_type (type, type_quals);
|
||||
pedwarn (OPT_pedantic,
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"ignoring %qV qualifiers added to function type %qT",
|
||||
bad_type, type);
|
||||
}
|
||||
|
|
|
@ -551,7 +551,7 @@ warning_at (location_t location, int opt, const char *gmsgid, ...)
|
|||
Returns true if the warning was printed, false if it was inhibited. */
|
||||
|
||||
bool
|
||||
pedwarn_at (location_t location, int opt, const char *gmsgid, ...)
|
||||
pedwarn (location_t location, int opt, const char *gmsgid, ...)
|
||||
{
|
||||
diagnostic_info diagnostic;
|
||||
va_list ap;
|
||||
|
@ -563,21 +563,6 @@ pedwarn_at (location_t location, int opt, const char *gmsgid, ...)
|
|||
return report_diagnostic (&diagnostic);
|
||||
}
|
||||
|
||||
/* Equivalent to pedwarn_at using INPUT_LOCATION. */
|
||||
|
||||
bool
|
||||
pedwarn (int opt, const char *gmsgid, ...)
|
||||
{
|
||||
diagnostic_info diagnostic;
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, gmsgid);
|
||||
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_PEDWARN);
|
||||
diagnostic.option_index = opt;
|
||||
va_end (ap);
|
||||
return report_diagnostic (&diagnostic);
|
||||
}
|
||||
|
||||
/* A "permissive" error at LOCATION: issues an error unless
|
||||
-fpermissive was given on the command line, in which case it issues
|
||||
a warning. Use this for things that really should be errors but we
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2008-08-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
* f95-lang.c: Update all calls to pedwarn.
|
||||
|
||||
2008-08-18 Daniel Franke <franke.daniel@gmail.com>
|
||||
|
||||
PR fortran/37032
|
||||
|
|
|
@ -604,7 +604,7 @@ gfc_mark_addressable (tree exp)
|
|||
IDENTIFIER_POINTER (DECL_NAME (x)));
|
||||
return false;
|
||||
}
|
||||
pedwarn (0, "register variable %qs used in nested function",
|
||||
pedwarn (input_location, 0, "register variable %qs used in nested function",
|
||||
IDENTIFIER_POINTER (DECL_NAME (x)));
|
||||
}
|
||||
else if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x))
|
||||
|
@ -629,7 +629,7 @@ gfc_mark_addressable (tree exp)
|
|||
}
|
||||
#endif
|
||||
|
||||
pedwarn (0, "address of register variable %qs requested",
|
||||
pedwarn (input_location, 0, "address of register variable %qs requested",
|
||||
IDENTIFIER_POINTER (DECL_NAME (x)));
|
||||
}
|
||||
|
||||
|
|
|
@ -824,7 +824,7 @@ check_global_declaration_1 (tree decl)
|
|||
|| TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
|
||||
{
|
||||
if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
|
||||
pedwarn (0, "%q+F used but never defined", decl);
|
||||
pedwarn (input_location, 0, "%q+F used but never defined", decl);
|
||||
else
|
||||
warning (OPT_Wunused_function, "%q+F declared %<static%> but never defined", decl);
|
||||
/* This symbol is effectively an "extern" declaration now. */
|
||||
|
|
|
@ -63,9 +63,8 @@ extern bool warning_at (location_t, int, const char *, ...)
|
|||
extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
|
||||
extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
|
||||
ATTRIBUTE_NORETURN;
|
||||
/* Pass one of the OPT_W* from options.h as the first parameter. */
|
||||
extern bool pedwarn (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
|
||||
extern bool pedwarn_at (location_t, int, const char *, ...)
|
||||
/* Pass one of the OPT_W* from options.h as the second parameter. */
|
||||
extern bool pedwarn (location_t, int, const char *, ...)
|
||||
ATTRIBUTE_GCC_DIAG(3,4);
|
||||
extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
|
||||
extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
|
||||
|
|
Loading…
Add table
Reference in a new issue