re PR c/44774 (-Werror=edantic)
2012-04-22 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c/44774 gcc/ * doc/invoke.texi (pedantic): Rename to Wpedantic. * common.opt (Wpedantic): New. (pedantic): Alias Wpedantic. * diagnostic.c (warning_at): Likewise. * c-decl.c (diagnose_mismatched_decls): Likewise. (build_array_declarator): Likewise. (mark_forward_parm_decls): (check_bitfield_type_and_width): Likewise. (grokdeclarator): Likewise. (grokfield): Likewise. (finish_struct): Likewise. (build_enumerator): Likewise. (store_parm_decls_oldstyle): Likewise. (declspecs_add_qual): Likewise. (declspecs_add_type): Likewise. (finish_declspecs): Likewise. * c-typeck.c (composite_type): Likewise. (comp_target_types): Likewise. (build_array_ref): Likewise. (pointer_diff): Likewise. (build_unary_op): Likewise. (build_conditional_expr): Likewise. (build_c_cast): Likewise. (convert_for_assignment): Likewise. (maybe_warn_string_init): Likewise. (digest_init): Likewise. (pop_init_level): Likewise. (set_init_index): Likewise. (c_finish_goto_label): Likewise. (c_finish_return): Likewise. (do_case): Likewise. (build_binary_op): Likewise. * c-parser.c (static): Likewise. (c_parser_external_declaration): Likewise. (c_parser_declaration_or_fndef): Likewise. (c_parser_static_assert_declaration_no_se): Likewise. (c_parser_enum_specifier): Likewise. (c_parser_struct_or_union_specifier): Likewise. (c_parser_struct_declaration): Likewise. (c_parser_alignas_specifier): Likewise. (c_parser_braced_init): Likewise. (c_parser_initelt): Likewise. (c_parser_compound_statement_nostart): Likewise. (c_parser_conditional_expression): Likewise. (c_parser_alignof_expression): Likewise. (c_parser_postfix_expression): Likewise. (c_parser_postfix_expression_after_paren_): Likewise. (c_parser_objc_class_instance_variables): Likewise. (c_parser_objc_method_definition): Likewise. (c_parser_objc_methodprotolist): Likewise. c-family/ * c.opt (Wpedantic): New. (pedantic): Alias Wpedantic. * c-opts.c (c_common_handle_option): Replace -pedantic with -Wpedantic. (c_common_post_options): Likewise. (sanitize_cpp_opts): Likewise. * c-lex.c (interpret_float): Likewise. * c-format.c (check_format_types): Likewise. * c-common.c (pointer_int_sum): Likewise. (c_sizeof_or_alignof_type): Likewise. (c_add_case_label): Likewise. (c_do_switch_warnings): Likewise. * c-pragma.c (handle_pragma_float_const_decimal64): Likewise. cp/ * typeck.c (composite_pointer_type): Likewise. (cxx_sizeof_or_alignof_type): Likewise. (cp_build_array_ref): Likewise. (cp_build_function_call_vec): Likewise. (cp_build_addr_expr_1): Likewise. (convert_member_func_to_ptr): Likewise. * decl.c (check_tag_decl): Likewise. (check_static_variable_definition): Likewise. (compute_array_index_type): Likewise. (create_array_type_for_decl): Likewise. (grokdeclarator): Likewise. (grok_op_properties): Likewise. * error.c (maybe_warn_cpp0x): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (convert_template_argument): Likewise. (do_decl_instantiation): Likewise. (do_type_instantiation): Likewise. * parser.c (cp_parser_primary_expression): Likewise. (cp_parser_postfix_expression): Likewise. (cp_parser_unary_expression): Likewise. (cp_parser_question_colon_clause): Likewise. (cp_parser_lambda_introducer): Likewise. (cp_parser_lambda_declarator_opt): Likewise. (cp_parser_compound_statement): Likewise. (cp_parser_jump_statement): Likewise. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_enumerator_list): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_member_declaration): Likewise. * call.c (build_conditional_expr_1): Likewise. * friend.c (make_friend_class): Likewise. * name-lookup.c (pushdecl_maybe_friend_1): Likewise. From-SVN: r186681
This commit is contained in:
parent
f12e8bd5c3
commit
c1771a200a
@ -1,3 +1,57 @@
|
||||
2012-04-22 Manuel López-Ibáñez <manu@gcc.gnu.org>
|
||||
|
||||
PR c/44774
|
||||
* doc/invoke.texi (pedantic): Rename to Wpedantic.
|
||||
* common.opt (Wpedantic): New.
|
||||
(pedantic): Alias Wpedantic.
|
||||
* diagnostic.c (warning_at): Likewise.
|
||||
* c-decl.c (diagnose_mismatched_decls): Likewise.
|
||||
(build_array_declarator): Likewise.
|
||||
(mark_forward_parm_decls):
|
||||
(check_bitfield_type_and_width): Likewise.
|
||||
(grokdeclarator): Likewise.
|
||||
(grokfield): Likewise.
|
||||
(finish_struct): Likewise.
|
||||
(build_enumerator): Likewise.
|
||||
(store_parm_decls_oldstyle): Likewise.
|
||||
(declspecs_add_qual): Likewise.
|
||||
(declspecs_add_type): Likewise.
|
||||
(finish_declspecs): Likewise.
|
||||
* c-typeck.c (composite_type): Likewise.
|
||||
(comp_target_types): Likewise.
|
||||
(build_array_ref): Likewise.
|
||||
(pointer_diff): Likewise.
|
||||
(build_unary_op): Likewise.
|
||||
(build_conditional_expr): Likewise.
|
||||
(build_c_cast): Likewise.
|
||||
(convert_for_assignment): Likewise.
|
||||
(maybe_warn_string_init): Likewise.
|
||||
(digest_init): Likewise.
|
||||
(pop_init_level): Likewise.
|
||||
(set_init_index): Likewise.
|
||||
(c_finish_goto_label): Likewise.
|
||||
(c_finish_return): Likewise.
|
||||
(do_case): Likewise.
|
||||
(build_binary_op): Likewise.
|
||||
* c-parser.c (static): Likewise.
|
||||
(c_parser_external_declaration): Likewise.
|
||||
(c_parser_declaration_or_fndef): Likewise.
|
||||
(c_parser_static_assert_declaration_no_se): Likewise.
|
||||
(c_parser_enum_specifier): Likewise.
|
||||
(c_parser_struct_or_union_specifier): Likewise.
|
||||
(c_parser_struct_declaration): Likewise.
|
||||
(c_parser_alignas_specifier): Likewise.
|
||||
(c_parser_braced_init): Likewise.
|
||||
(c_parser_initelt): Likewise.
|
||||
(c_parser_compound_statement_nostart): Likewise.
|
||||
(c_parser_conditional_expression): Likewise.
|
||||
(c_parser_alignof_expression): Likewise.
|
||||
(c_parser_postfix_expression): Likewise.
|
||||
(c_parser_postfix_expression_after_paren_): Likewise.
|
||||
(c_parser_objc_class_instance_variables): Likewise.
|
||||
(c_parser_objc_method_definition): Likewise.
|
||||
(c_parser_objc_methodprotolist): Likewise.
|
||||
|
||||
2012-04-22 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* godump.c (go_output_typedef): Dump size of structs.
|
||||
|
92
gcc/c-decl.c
92
gcc/c-decl.c
@ -1837,7 +1837,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
|
||||
}
|
||||
else if (pedantic && !flag_isoc11)
|
||||
{
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"redefinition of typedef %q+D", newdecl);
|
||||
locate_old_decl (olddecl);
|
||||
}
|
||||
@ -3897,11 +3897,11 @@ build_array_declarator (location_t loc,
|
||||
if (!flag_isoc99)
|
||||
{
|
||||
if (static_p || quals != NULL)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C90 does not support %<static%> or type "
|
||||
"qualifiers in parameter array declarators");
|
||||
if (vla_unspec_p)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C90 does not support %<[*]%> array declarators");
|
||||
}
|
||||
if (vla_unspec_p)
|
||||
@ -4594,7 +4594,7 @@ mark_forward_parm_decls (void)
|
||||
|
||||
if (pedantic && !current_scope->warned_forward_parm_decls)
|
||||
{
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C forbids forward parameter declarations");
|
||||
current_scope->warned_forward_parm_decls = true;
|
||||
}
|
||||
@ -4746,7 +4746,7 @@ check_bitfield_type_and_width (tree *type, tree *width, tree orig_name)
|
||||
{
|
||||
*width = c_fully_fold (*width, false, NULL);
|
||||
if (TREE_CODE (*width) == INTEGER_CST)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"bit-field %qs width not an integer constant expression",
|
||||
name);
|
||||
}
|
||||
@ -4782,7 +4782,7 @@ check_bitfield_type_and_width (tree *type, tree *width, tree orig_name)
|
||||
&& type_mv != integer_type_node
|
||||
&& type_mv != unsigned_type_node
|
||||
&& type_mv != boolean_type_node)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"type of bit-field %qs is a GCC extension", name);
|
||||
|
||||
max_width = TYPE_PRECISION (*type);
|
||||
@ -5076,11 +5076,11 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
if (pedantic && !flag_isoc99)
|
||||
{
|
||||
if (constp > 1)
|
||||
pedwarn (loc, OPT_pedantic, "duplicate %<const%>");
|
||||
pedwarn (loc, OPT_Wpedantic, "duplicate %<const%>");
|
||||
if (restrictp > 1)
|
||||
pedwarn (loc, OPT_pedantic, "duplicate %<restrict%>");
|
||||
pedwarn (loc, OPT_Wpedantic, "duplicate %<restrict%>");
|
||||
if (volatilep > 1)
|
||||
pedwarn (loc, OPT_pedantic, "duplicate %<volatile%>");
|
||||
pedwarn (loc, OPT_Wpedantic, "duplicate %<volatile%>");
|
||||
}
|
||||
|
||||
if (!ADDR_SPACE_GENERIC_P (as1) && !ADDR_SPACE_GENERIC_P (as2) && as1 != as2)
|
||||
@ -5107,7 +5107,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
{
|
||||
if (storage_class == csc_auto)
|
||||
pedwarn (loc,
|
||||
(current_scope == file_scope) ? 0 : OPT_pedantic,
|
||||
(current_scope == file_scope) ? 0 : OPT_Wpedantic,
|
||||
"function definition declared %<auto%>");
|
||||
if (storage_class == csc_register)
|
||||
error_at (loc, "function definition declared %<register%>");
|
||||
@ -5173,7 +5173,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
error_at (loc, "file-scope declaration of %qE specifies %<auto%>",
|
||||
name);
|
||||
if (pedantic && storage_class == csc_register)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"file-scope declaration of %qE specifies %<register%>", name);
|
||||
}
|
||||
else
|
||||
@ -5295,7 +5295,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
}
|
||||
|
||||
if (pedantic && !in_system_header && flexible_array_type_p (type))
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"invalid use of structure with flexible array member");
|
||||
|
||||
if (size == error_mark_node)
|
||||
@ -5335,10 +5335,10 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
if (pedantic && size_maybe_const && integer_zerop (size))
|
||||
{
|
||||
if (name)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C forbids zero-size array %qE", name);
|
||||
else
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C forbids zero-size array");
|
||||
}
|
||||
|
||||
@ -5463,7 +5463,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
}
|
||||
if (flexible_array_member
|
||||
&& pedantic && !flag_isoc99 && !in_system_header)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C90 does not support flexible array members");
|
||||
|
||||
/* ISO C99 Flexible array members are effectively
|
||||
@ -5664,7 +5664,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
|
||||
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
|
||||
&& type_quals)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C forbids qualified function types");
|
||||
if (type_quals)
|
||||
type = c_build_qualified_type (type, type_quals);
|
||||
@ -5842,7 +5842,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
tree decl;
|
||||
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
|
||||
&& type_quals)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C forbids qualified function types");
|
||||
if (type_quals)
|
||||
type = c_build_qualified_type (type, type_quals);
|
||||
@ -5888,7 +5888,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
&& !declspecs->inline_p && !declspecs->noreturn_p);
|
||||
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
|
||||
&& type_quals)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C forbids const or volatile function types");
|
||||
if (type_quals)
|
||||
type = c_build_qualified_type (type, type_quals);
|
||||
@ -5899,7 +5899,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
&& variably_modified_type_p (type, NULL_TREE))
|
||||
{
|
||||
/* C99 6.7.2.1p8 */
|
||||
pedwarn (loc, OPT_pedantic, "a member of a structure or union cannot "
|
||||
pedwarn (loc, OPT_Wpedantic, "a member of a structure or union cannot "
|
||||
"have a variably modified type");
|
||||
}
|
||||
|
||||
@ -5954,7 +5954,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
else if (TREE_CODE (type) == FUNCTION_TYPE)
|
||||
{
|
||||
if (type_quals)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C forbids qualified function types");
|
||||
if (type_quals)
|
||||
type = c_build_qualified_type (type, type_quals);
|
||||
@ -6032,7 +6032,7 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
GCC allows 'auto', perhaps with 'inline', to support
|
||||
nested functions. */
|
||||
if (storage_class == csc_auto)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"invalid storage class for function %qE", name);
|
||||
else if (storage_class == csc_static)
|
||||
{
|
||||
@ -6049,7 +6049,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 (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C forbids qualified function types");
|
||||
|
||||
/* Every function declaration is an external reference
|
||||
@ -6101,10 +6101,10 @@ grokdeclarator (const struct c_declarator *declarator,
|
||||
if (!flag_isoc11)
|
||||
{
|
||||
if (flag_isoc99)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C99 does not support %<_Noreturn%>");
|
||||
else
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C90 does not support %<_Noreturn%>");
|
||||
}
|
||||
TREE_THIS_VOLATILE (decl) = 1;
|
||||
@ -6816,10 +6816,10 @@ grokfield (location_t loc,
|
||||
if (!flag_isoc11)
|
||||
{
|
||||
if (flag_isoc99)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C99 doesn%'t support unnamed structs/unions");
|
||||
else
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C90 doesn%'t support unnamed structs/unions");
|
||||
}
|
||||
}
|
||||
@ -7104,16 +7104,16 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
|
||||
if (TREE_CODE (t) == UNION_TYPE)
|
||||
{
|
||||
if (fieldlist)
|
||||
pedwarn (loc, OPT_pedantic, "union has no named members");
|
||||
pedwarn (loc, OPT_Wpedantic, "union has no named members");
|
||||
else
|
||||
pedwarn (loc, OPT_pedantic, "union has no members");
|
||||
pedwarn (loc, OPT_Wpedantic, "union has no members");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fieldlist)
|
||||
pedwarn (loc, OPT_pedantic, "struct has no named members");
|
||||
pedwarn (loc, OPT_Wpedantic, "struct has no named members");
|
||||
else
|
||||
pedwarn (loc, OPT_pedantic, "struct has no members");
|
||||
pedwarn (loc, OPT_Wpedantic, "struct has no members");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7195,7 +7195,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
|
||||
|
||||
if (pedantic && TREE_CODE (t) == RECORD_TYPE
|
||||
&& flexible_array_type_p (TREE_TYPE (x)))
|
||||
pedwarn (DECL_SOURCE_LOCATION (x), OPT_pedantic,
|
||||
pedwarn (DECL_SOURCE_LOCATION (x), OPT_Wpedantic,
|
||||
"invalid use of structure with flexible array member");
|
||||
|
||||
if (DECL_NAME (x)
|
||||
@ -7617,7 +7617,7 @@ build_enumerator (location_t decl_loc, location_t loc,
|
||||
{
|
||||
value = c_fully_fold (value, false, NULL);
|
||||
if (TREE_CODE (value) == INTEGER_CST)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"enumerator value for %qE is not an integer "
|
||||
"constant expression", name);
|
||||
}
|
||||
@ -7649,7 +7649,7 @@ build_enumerator (location_t decl_loc, location_t loc,
|
||||
(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 (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C restricts enumerator values to range of %<int%>");
|
||||
|
||||
/* The ISO C Standard mandates enumerators to have type int, even
|
||||
@ -8195,14 +8195,14 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
|
||||
old-style definition and discarded? */
|
||||
if (current_function_prototype_built_in)
|
||||
warning_at (DECL_SOURCE_LOCATION (parm),
|
||||
OPT_pedantic, "promoted argument %qD "
|
||||
OPT_Wpedantic, "promoted argument %qD "
|
||||
"doesn%'t match built-in prototype", parm);
|
||||
else
|
||||
{
|
||||
pedwarn (DECL_SOURCE_LOCATION (parm),
|
||||
OPT_pedantic, "promoted argument %qD "
|
||||
OPT_Wpedantic, "promoted argument %qD "
|
||||
"doesn%'t match prototype", parm);
|
||||
pedwarn (current_function_prototype_locus, OPT_pedantic,
|
||||
pedwarn (current_function_prototype_locus, OPT_Wpedantic,
|
||||
"prototype declaration");
|
||||
}
|
||||
}
|
||||
@ -8878,7 +8878,7 @@ declspecs_add_qual (struct c_declspecs *specs, tree qual)
|
||||
gcc_unreachable ();
|
||||
}
|
||||
if (dupe && !flag_isoc99)
|
||||
pedwarn (input_location, OPT_pedantic, "duplicate %qE", qual);
|
||||
pedwarn (input_location, OPT_Wpedantic, "duplicate %qE", qual);
|
||||
return specs;
|
||||
}
|
||||
|
||||
@ -9094,7 +9094,7 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
|
||||
case RID_COMPLEX:
|
||||
dupe = specs->complex_p;
|
||||
if (!flag_isoc99 && !in_system_header)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C90 does not support complex types");
|
||||
if (specs->typespec_word == cts_void)
|
||||
error_at (loc,
|
||||
@ -9133,7 +9133,7 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
|
||||
break;
|
||||
case RID_SAT:
|
||||
dupe = specs->saturating_p;
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C does not support saturating types");
|
||||
if (specs->typespec_word == cts_int128)
|
||||
{
|
||||
@ -9212,7 +9212,7 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
|
||||
return specs;
|
||||
}
|
||||
if (!in_system_header)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C does not support %<__int128%> type");
|
||||
|
||||
if (specs->long_p)
|
||||
@ -9415,7 +9415,7 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
|
||||
error_at (loc,
|
||||
("decimal floating point not supported "
|
||||
"for this target"));
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C does not support decimal floating point");
|
||||
return specs;
|
||||
case RID_FRACT:
|
||||
@ -9439,7 +9439,7 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
|
||||
if (!targetm.fixed_point_supported_p ())
|
||||
error_at (loc,
|
||||
"fixed-point types not supported for this target");
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C does not support fixed-point types");
|
||||
return specs;
|
||||
default:
|
||||
@ -9675,7 +9675,7 @@ finish_declspecs (struct c_declspecs *specs)
|
||||
else if (specs->complex_p)
|
||||
{
|
||||
specs->typespec_word = cts_double;
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C does not support plain %<complex%> meaning "
|
||||
"%<double complex%>");
|
||||
}
|
||||
@ -9720,7 +9720,7 @@ finish_declspecs (struct c_declspecs *specs)
|
||||
specs->type = char_type_node;
|
||||
if (specs->complex_p)
|
||||
{
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C does not support complex integer types");
|
||||
specs->type = build_complex_type (specs->type);
|
||||
}
|
||||
@ -9733,7 +9733,7 @@ finish_declspecs (struct c_declspecs *specs)
|
||||
: int128_integer_type_node);
|
||||
if (specs->complex_p)
|
||||
{
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C does not support complex integer types");
|
||||
specs->type = build_complex_type (specs->type);
|
||||
}
|
||||
@ -9759,7 +9759,7 @@ finish_declspecs (struct c_declspecs *specs)
|
||||
: integer_type_node);
|
||||
if (specs->complex_p)
|
||||
{
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C does not support complex integer types");
|
||||
specs->type = build_complex_type (specs->type);
|
||||
}
|
||||
|
@ -1,3 +1,19 @@
|
||||
2012-04-22 Manuel López-Ibáñez <manu@gcc.gnu.org>
|
||||
|
||||
PR c/44774
|
||||
* c.opt (Wpedantic): New.
|
||||
(pedantic): Alias Wpedantic.
|
||||
* c-opts.c (c_common_handle_option): Replace -pedantic with -Wpedantic.
|
||||
(c_common_post_options): Likewise.
|
||||
(sanitize_cpp_opts): Likewise.
|
||||
* c-lex.c (interpret_float): Likewise.
|
||||
* c-format.c (check_format_types): Likewise.
|
||||
* c-common.c (pointer_int_sum): Likewise.
|
||||
(c_sizeof_or_alignof_type): Likewise.
|
||||
(c_add_case_label): Likewise.
|
||||
(c_do_switch_warnings): Likewise.
|
||||
* c-pragma.c (handle_pragma_float_const_decimal64): Likewise.
|
||||
|
||||
2012-04-15 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/52818
|
||||
|
@ -3858,19 +3858,19 @@ pointer_int_sum (location_t loc, enum tree_code resultcode,
|
||||
|
||||
if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
|
||||
{
|
||||
pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (loc, pedantic ? OPT_Wpedantic : 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 (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (loc, pedantic ? OPT_Wpedantic : 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 (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (loc, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith,
|
||||
"pointer to member function used in arithmetic");
|
||||
size_exp = integer_one_node;
|
||||
}
|
||||
@ -4449,7 +4449,7 @@ c_sizeof_or_alignof_type (location_t loc,
|
||||
if (is_sizeof)
|
||||
{
|
||||
if (complain && (pedantic || warn_pointer_arith))
|
||||
pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (loc, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith,
|
||||
"invalid application of %<sizeof%> to a function type");
|
||||
else if (!complain)
|
||||
return error_mark_node;
|
||||
@ -4460,10 +4460,10 @@ c_sizeof_or_alignof_type (location_t loc,
|
||||
if (complain)
|
||||
{
|
||||
if (c_dialect_cxx ())
|
||||
pedwarn (loc, OPT_pedantic, "ISO C++ does not permit "
|
||||
pedwarn (loc, OPT_Wpedantic, "ISO C++ does not permit "
|
||||
"%<alignof%> applied to a function type");
|
||||
else
|
||||
pedwarn (loc, OPT_pedantic, "ISO C does not permit "
|
||||
pedwarn (loc, OPT_Wpedantic, "ISO C does not permit "
|
||||
"%<_Alignof%> applied to a function type");
|
||||
}
|
||||
value = size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT);
|
||||
@ -4473,7 +4473,7 @@ c_sizeof_or_alignof_type (location_t loc,
|
||||
{
|
||||
if (type_code == VOID_TYPE
|
||||
&& complain && (pedantic || warn_pointer_arith))
|
||||
pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (loc, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith,
|
||||
"invalid application of %qs to a void type", op_name);
|
||||
else if (!complain)
|
||||
return error_mark_node;
|
||||
@ -5441,7 +5441,7 @@ c_add_case_label (location_t loc, splay_tree cases, tree cond, tree orig_type,
|
||||
|
||||
/* Case ranges are a GNU extension. */
|
||||
if (high_value)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"range expressions in switch statements are non-standard");
|
||||
|
||||
type = TREE_TYPE (cond);
|
||||
@ -5755,7 +5755,7 @@ finish_label_address_expr (tree label, location_t loc)
|
||||
{
|
||||
tree result;
|
||||
|
||||
pedwarn (input_location, OPT_pedantic, "taking the address of a label is non-standard");
|
||||
pedwarn (input_location, OPT_Wpedantic, "taking the address of a label is non-standard");
|
||||
|
||||
if (label == error_mark_node)
|
||||
return error_mark_node;
|
||||
|
@ -2424,13 +2424,13 @@ check_format_types (format_wanted_type *types)
|
||||
continue;
|
||||
/* If we want 'void *', allow any pointer type.
|
||||
(Anything else would already have got a warning.)
|
||||
With -pedantic, only allow pointers to void and to character
|
||||
With -Wpedantic, only allow pointers to void and to character
|
||||
types. */
|
||||
if (wanted_type == void_type_node
|
||||
&& (!pedantic || (i == 1 && char_type_flag)))
|
||||
continue;
|
||||
/* Don't warn about differences merely in signedness, unless
|
||||
-pedantic. With -pedantic, warn if the type is a pointer
|
||||
-Wpedantic. With -Wpedantic, warn if the type is a pointer
|
||||
target and not a character type, and for character types at
|
||||
a second level of indirection. */
|
||||
if (TREE_CODE (wanted_type) == INTEGER_TYPE
|
||||
|
@ -734,7 +734,7 @@ interpret_float (const cpp_token *token, unsigned int flags,
|
||||
return error_mark_node;
|
||||
}
|
||||
else
|
||||
pedwarn (input_location, OPT_pedantic, "non-standard suffix on floating constant");
|
||||
pedwarn (input_location, OPT_Wpedantic, "non-standard suffix on floating constant");
|
||||
|
||||
type = c_common_type_for_mode (mode, 0);
|
||||
gcc_assert (type);
|
||||
|
@ -740,11 +740,11 @@ c_common_handle_option (size_t scode, const char *arg, int value,
|
||||
error ("output filename specified twice");
|
||||
break;
|
||||
|
||||
/* We need to handle the -pedantic switches here, rather than in
|
||||
/* We need to handle the -Wpedantic switches here, rather than in
|
||||
c_common_post_options, so that a subsequent -Wno-endif-labels
|
||||
is not overridden. */
|
||||
case OPT_pedantic_errors:
|
||||
case OPT_pedantic:
|
||||
case OPT_Wpedantic:
|
||||
cpp_opts->cpp_pedantic = 1;
|
||||
cpp_opts->warn_endif_labels = 1;
|
||||
if (warn_pointer_sign == -1)
|
||||
@ -925,7 +925,7 @@ c_common_post_options (const char **pfilename)
|
||||
warn_ignored_qualifiers = extra_warnings;
|
||||
|
||||
/* -Wpointer-sign is disabled by default, but it is enabled if any
|
||||
of -Wall or -pedantic are given. */
|
||||
of -Wall or -Wpedantic are given. */
|
||||
if (warn_pointer_sign == -1)
|
||||
warn_pointer_sign = 0;
|
||||
|
||||
@ -936,7 +936,7 @@ c_common_post_options (const char **pfilename)
|
||||
if (warn_jump_misses_init == -1)
|
||||
warn_jump_misses_init = 0;
|
||||
|
||||
/* -Woverlength-strings is off by default, but is enabled by -pedantic.
|
||||
/* -Woverlength-strings is off by default, but is enabled by -Wpedantic.
|
||||
It is never enabled in C++, as the minimum limit is not normative
|
||||
in that standard. */
|
||||
if (warn_overlength_strings == -1 || c_dialect_cxx ())
|
||||
@ -1278,8 +1278,8 @@ sanitize_cpp_opts (void)
|
||||
cpp_opts->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS;
|
||||
|
||||
/* Wlong-long is disabled by default. It is enabled by:
|
||||
[-pedantic | -Wtraditional] -std=[gnu|c]++98 ; or
|
||||
[-pedantic | -Wtraditional] -std=non-c99 .
|
||||
[-Wpedantic | -Wtraditional] -std=[gnu|c]++98 ; or
|
||||
[-Wpedantic | -Wtraditional] -std=non-c99 .
|
||||
|
||||
Either -Wlong-long or -Wno-long-long override any other settings. */
|
||||
if (warn_long_long == -1)
|
||||
|
@ -1127,7 +1127,7 @@ handle_pragma_float_const_decimal64 (cpp_reader *ARG_UNUSED (dummy))
|
||||
return;
|
||||
}
|
||||
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C does not support %<#pragma STDC FLOAT_CONST_DECIMAL64%>");
|
||||
|
||||
switch (handle_stdc_pragma ("STDC FLOAT_CONST_DECIMAL64"))
|
||||
|
@ -557,6 +557,10 @@ Wparentheses
|
||||
C ObjC C++ ObjC++ Var(warn_parentheses) Warning
|
||||
Warn about possibly missing parentheses
|
||||
|
||||
Wpedantic
|
||||
C ObjC C++ ObjC++ Warning
|
||||
; Documented in common.opt
|
||||
|
||||
Wpmf-conversions
|
||||
C++ ObjC++ Var(warn_pmf2ptr) Init(1) Warning
|
||||
Warn when converting the type of pointers to member functions
|
||||
@ -1184,7 +1188,7 @@ C ObjC C++ ObjC++ Joined Separate
|
||||
; Documented in common.opt
|
||||
|
||||
pedantic
|
||||
C ObjC C++ ObjC++
|
||||
C ObjC C++ ObjC++ Alias(Wpedantic)
|
||||
; Documented in common.opt
|
||||
|
||||
pedantic-errors
|
||||
|
@ -1238,7 +1238,7 @@ c_parser_translation_unit (c_parser *parser)
|
||||
{
|
||||
if (c_parser_next_token_is (parser, CPP_EOF))
|
||||
{
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_Wpedantic,
|
||||
"ISO C forbids an empty translation unit");
|
||||
}
|
||||
else
|
||||
@ -1336,7 +1336,7 @@ c_parser_external_declaration (c_parser *parser)
|
||||
}
|
||||
break;
|
||||
case CPP_SEMICOLON:
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_Wpedantic,
|
||||
"ISO C does not allow extra %<;%> outside of a function");
|
||||
c_parser_consume_token (parser);
|
||||
break;
|
||||
@ -1715,7 +1715,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
|
||||
/* Function definition (nested or otherwise). */
|
||||
if (nested)
|
||||
{
|
||||
pedwarn (here, OPT_pedantic, "ISO C forbids nested functions");
|
||||
pedwarn (here, OPT_Wpedantic, "ISO C forbids nested functions");
|
||||
c_push_function_context ();
|
||||
}
|
||||
if (!start_function (specs, declarator, all_prefix_attrs))
|
||||
@ -1830,10 +1830,10 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser)
|
||||
if (!flag_isoc11)
|
||||
{
|
||||
if (flag_isoc99)
|
||||
pedwarn (assert_loc, OPT_pedantic,
|
||||
pedwarn (assert_loc, OPT_Wpedantic,
|
||||
"ISO C99 does not support %<_Static_assert%>");
|
||||
else
|
||||
pedwarn (assert_loc, OPT_pedantic,
|
||||
pedwarn (assert_loc, OPT_Wpedantic,
|
||||
"ISO C90 does not support %<_Static_assert%>");
|
||||
}
|
||||
c_parser_consume_token (parser);
|
||||
@ -1874,7 +1874,7 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser)
|
||||
{
|
||||
value = c_fully_fold (value, false, NULL);
|
||||
if (TREE_CODE (value) == INTEGER_CST)
|
||||
pedwarn (value_loc, OPT_pedantic, "expression in static assertion "
|
||||
pedwarn (value_loc, OPT_Wpedantic, "expression in static assertion "
|
||||
"is not an integer constant expression");
|
||||
}
|
||||
if (TREE_CODE (value) != INTEGER_CST)
|
||||
@ -2292,7 +2292,7 @@ c_parser_enum_specifier (c_parser *parser)
|
||||
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
|
||||
{
|
||||
if (seen_comma && !flag_isoc99)
|
||||
pedwarn (comma_loc, OPT_pedantic, "comma at end of enumerator list");
|
||||
pedwarn (comma_loc, OPT_Wpedantic, "comma at end of enumerator list");
|
||||
c_parser_consume_token (parser);
|
||||
break;
|
||||
}
|
||||
@ -2328,7 +2328,7 @@ c_parser_enum_specifier (c_parser *parser)
|
||||
if (pedantic && !COMPLETE_TYPE_P (ret.spec))
|
||||
{
|
||||
gcc_assert (ident);
|
||||
pedwarn (enum_loc, OPT_pedantic,
|
||||
pedwarn (enum_loc, OPT_Wpedantic,
|
||||
"ISO C forbids forward references to %<enum%> types");
|
||||
}
|
||||
return ret;
|
||||
@ -2463,7 +2463,7 @@ c_parser_struct_or_union_specifier (c_parser *parser)
|
||||
/* Parse any stray semicolon. */
|
||||
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
|
||||
{
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_Wpedantic,
|
||||
"extra semicolon in struct or union specified");
|
||||
c_parser_consume_token (parser);
|
||||
continue;
|
||||
@ -2601,7 +2601,7 @@ c_parser_struct_declaration (c_parser *parser)
|
||||
tree ret;
|
||||
if (specs->typespec_kind == ctsk_none)
|
||||
{
|
||||
pedwarn (decl_loc, OPT_pedantic,
|
||||
pedwarn (decl_loc, OPT_Wpedantic,
|
||||
"ISO C forbids member declarations with no members");
|
||||
shadow_tag_warned (specs, pedantic);
|
||||
ret = NULL_TREE;
|
||||
@ -2785,10 +2785,10 @@ c_parser_alignas_specifier (c_parser * parser)
|
||||
if (!flag_isoc11)
|
||||
{
|
||||
if (flag_isoc99)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C99 does not support %<_Alignas%>");
|
||||
else
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C90 does not support %<_Alignas%>");
|
||||
}
|
||||
if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
|
||||
@ -3745,7 +3745,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 (brace_loc, OPT_pedantic, "ISO C forbids empty initializer braces");
|
||||
pedwarn (brace_loc, OPT_Wpedantic, "ISO C forbids empty initializer braces");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3795,7 +3795,7 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack)
|
||||
set_init_label (c_parser_peek_token (parser)->value,
|
||||
braced_init_obstack);
|
||||
/* Use the colon as the error location. */
|
||||
pedwarn (c_parser_peek_2nd_token (parser)->location, OPT_pedantic,
|
||||
pedwarn (c_parser_peek_2nd_token (parser)->location, OPT_Wpedantic,
|
||||
"obsolete use of designated initializer with %<:%>");
|
||||
c_parser_consume_token (parser);
|
||||
c_parser_consume_token (parser);
|
||||
@ -3935,7 +3935,7 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack)
|
||||
c_parser_consume_token (parser);
|
||||
set_init_index (first, second, braced_init_obstack);
|
||||
if (second)
|
||||
pedwarn (ellipsis_loc, OPT_pedantic,
|
||||
pedwarn (ellipsis_loc, OPT_Wpedantic,
|
||||
"ISO C forbids specifying range of elements to initialize");
|
||||
}
|
||||
else
|
||||
@ -3948,14 +3948,14 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack)
|
||||
if (c_parser_next_token_is (parser, CPP_EQ))
|
||||
{
|
||||
if (!flag_isoc99)
|
||||
pedwarn (des_loc, OPT_pedantic,
|
||||
pedwarn (des_loc, OPT_Wpedantic,
|
||||
"ISO C90 forbids specifying subobject to initialize");
|
||||
c_parser_consume_token (parser);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (des_seen == 1)
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_Wpedantic,
|
||||
"obsolete use of designated initializer without %<=%>");
|
||||
else
|
||||
{
|
||||
@ -4120,7 +4120,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
|
||||
}
|
||||
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
|
||||
}
|
||||
pedwarn (label_loc, OPT_pedantic, "ISO C forbids label declarations");
|
||||
pedwarn (label_loc, OPT_Wpedantic, "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))
|
||||
@ -4156,7 +4156,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
|
||||
if (last_stmt)
|
||||
pedwarn_c90 (loc,
|
||||
(pedantic && !flag_isoc99)
|
||||
? OPT_pedantic
|
||||
? OPT_Wpedantic
|
||||
: OPT_Wdeclaration_after_statement,
|
||||
"ISO C90 forbids mixed declarations and code");
|
||||
last_stmt = false;
|
||||
@ -4186,7 +4186,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
|
||||
restore_extension_diagnostics (ext);
|
||||
if (last_stmt)
|
||||
pedwarn_c90 (loc, (pedantic && !flag_isoc99)
|
||||
? OPT_pedantic
|
||||
? OPT_Wpedantic
|
||||
: OPT_Wdeclaration_after_statement,
|
||||
"ISO C90 forbids mixed declarations and code");
|
||||
last_stmt = false;
|
||||
@ -5441,7 +5441,7 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after)
|
||||
tree eptype = NULL_TREE;
|
||||
|
||||
middle_loc = c_parser_peek_token (parser)->location;
|
||||
pedwarn (middle_loc, OPT_pedantic,
|
||||
pedwarn (middle_loc, OPT_Wpedantic,
|
||||
"ISO C forbids omitting the middle term of a ?: expression");
|
||||
warn_for_omitted_condop (middle_loc, cond.value);
|
||||
if (TREE_CODE (cond.value) == EXCESS_PRECISION_EXPR)
|
||||
@ -6049,10 +6049,10 @@ c_parser_alignof_expression (c_parser *parser)
|
||||
&& strcmp (IDENTIFIER_POINTER (alignof_spelling), "_Alignof") == 0)
|
||||
{
|
||||
if (flag_isoc99)
|
||||
pedwarn (loc, OPT_pedantic, "ISO C99 does not support %qE",
|
||||
pedwarn (loc, OPT_Wpedantic, "ISO C99 does not support %qE",
|
||||
alignof_spelling);
|
||||
else
|
||||
pedwarn (loc, OPT_pedantic, "ISO C90 does not support %qE",
|
||||
pedwarn (loc, OPT_Wpedantic, "ISO C90 does not support %qE",
|
||||
alignof_spelling);
|
||||
}
|
||||
c_parser_consume_token (parser);
|
||||
@ -6103,7 +6103,7 @@ c_parser_alignof_expression (c_parser *parser)
|
||||
mark_exp_read (expr.value);
|
||||
c_inhibit_evaluation_warnings--;
|
||||
in_alignof--;
|
||||
pedwarn (loc, OPT_pedantic, "ISO C does not allow %<%E (expression)%>",
|
||||
pedwarn (loc, OPT_Wpedantic, "ISO C does not allow %<%E (expression)%>",
|
||||
alignof_spelling);
|
||||
ret.value = c_alignof_expr (loc, expr.value);
|
||||
ret.original_code = ERROR_MARK;
|
||||
@ -6329,7 +6329,7 @@ c_parser_postfix_expression (c_parser *parser)
|
||||
c_parser_compound_statement_nostart (parser);
|
||||
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
|
||||
"expected %<)%>");
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C forbids braced-groups within expressions");
|
||||
expr.value = c_finish_stmt_expr (brace_loc, stmt);
|
||||
mark_exp_read (expr.value);
|
||||
@ -6640,7 +6640,7 @@ c_parser_postfix_expression (c_parser *parser)
|
||||
break;
|
||||
}
|
||||
if (!flag_isoc99)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C90 does not support complex types");
|
||||
expr.value = build2 (COMPLEX_EXPR,
|
||||
build_complex_type
|
||||
@ -6819,7 +6819,7 @@ c_parser_postfix_expression_after_paren_type (c_parser *parser,
|
||||
}
|
||||
|
||||
if (!flag_isoc99)
|
||||
pedwarn (start_loc, OPT_pedantic, "ISO C90 forbids compound literals");
|
||||
pedwarn (start_loc, OPT_Wpedantic, "ISO C90 forbids compound literals");
|
||||
non_const = ((init.value && TREE_CODE (init.value) == CONSTRUCTOR)
|
||||
? CONSTRUCTOR_NON_CONST (init.value)
|
||||
: init.original_code == C_MAYBE_CONST_EXPR);
|
||||
@ -7238,7 +7238,7 @@ c_parser_objc_class_instance_variables (c_parser *parser)
|
||||
/* Parse any stray semicolon. */
|
||||
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
|
||||
{
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_Wpedantic,
|
||||
"extra semicolon");
|
||||
c_parser_consume_token (parser);
|
||||
continue;
|
||||
@ -7486,7 +7486,7 @@ c_parser_objc_method_definition (c_parser *parser)
|
||||
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
|
||||
{
|
||||
c_parser_consume_token (parser);
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_Wpedantic,
|
||||
"extra semicolon in method definition specified");
|
||||
}
|
||||
|
||||
@ -7538,7 +7538,7 @@ c_parser_objc_methodprotolist (c_parser *parser)
|
||||
switch (c_parser_peek_token (parser)->type)
|
||||
{
|
||||
case CPP_SEMICOLON:
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_pedantic,
|
||||
pedwarn (c_parser_peek_token (parser)->location, OPT_Wpedantic,
|
||||
"ISO C does not allow extra %<;%> outside of a function");
|
||||
c_parser_consume_token (parser);
|
||||
break;
|
||||
|
@ -562,7 +562,7 @@ composite_type (tree t1, tree t2)
|
||||
{
|
||||
TREE_VALUE (n) = composite_type (TREE_TYPE (memb),
|
||||
TREE_VALUE (p2));
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"function types not truly compatible in ISO C");
|
||||
goto parm_done;
|
||||
}
|
||||
@ -587,7 +587,7 @@ composite_type (tree t1, tree t2)
|
||||
{
|
||||
TREE_VALUE (n) = composite_type (TREE_TYPE (memb),
|
||||
TREE_VALUE (p1));
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"function types not truly compatible in ISO C");
|
||||
goto parm_done;
|
||||
}
|
||||
@ -1217,7 +1217,7 @@ comp_target_types (location_t location, tree ttl, tree ttr)
|
||||
val = comptypes_check_enum_int (mvl, mvr, &enum_and_int_p);
|
||||
|
||||
if (val == 2)
|
||||
pedwarn (location, OPT_pedantic, "types are not quite compatible");
|
||||
pedwarn (location, OPT_Wpedantic, "types are not quite compatible");
|
||||
|
||||
if (val == 1 && enum_and_int_p && warn_cxx_compat)
|
||||
warning_at (location, OPT_Wc___compat,
|
||||
@ -2394,10 +2394,10 @@ build_array_ref (location_t loc, 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 (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C forbids subscripting %<register%> array");
|
||||
else if (!flag_isoc99 && !lvalue_p (foo))
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C90 forbids subscripting non-lvalue array");
|
||||
}
|
||||
|
||||
@ -3437,10 +3437,10 @@ pointer_diff (location_t loc, tree op0, tree op1)
|
||||
|
||||
|
||||
if (TREE_CODE (target_type) == VOID_TYPE)
|
||||
pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (loc, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith,
|
||||
"pointer of type %<void *%> used in subtraction");
|
||||
if (TREE_CODE (target_type) == FUNCTION_TYPE)
|
||||
pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (loc, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith,
|
||||
"pointer to a function used in subtraction");
|
||||
|
||||
/* If the conversion to ptrdiff_type does anything like widening or
|
||||
@ -3604,7 +3604,7 @@ build_unary_op (location_t location,
|
||||
else if (typecode == COMPLEX_TYPE)
|
||||
{
|
||||
code = CONJ_EXPR;
|
||||
pedwarn (location, OPT_pedantic,
|
||||
pedwarn (location, OPT_Wpedantic,
|
||||
"ISO C does not support %<~%> for complex conjugation");
|
||||
if (!noconvert)
|
||||
arg = default_conversion (arg);
|
||||
@ -3710,7 +3710,7 @@ build_unary_op (location_t location,
|
||||
{
|
||||
tree real, imag;
|
||||
|
||||
pedwarn (location, OPT_pedantic,
|
||||
pedwarn (location, OPT_Wpedantic,
|
||||
"ISO C does not support %<++%> and %<--%> on complex types");
|
||||
|
||||
arg = stabilize_reference (arg);
|
||||
@ -3761,10 +3761,10 @@ build_unary_op (location_t location,
|
||||
|| TREE_CODE (TREE_TYPE (argtype)) == VOID_TYPE)
|
||||
{
|
||||
if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
|
||||
pedwarn (location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (location, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith,
|
||||
"wrong type argument to increment");
|
||||
else
|
||||
pedwarn (location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (location, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith,
|
||||
"wrong type argument to decrement");
|
||||
}
|
||||
|
||||
@ -4305,7 +4305,7 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
|
||||
else if (code1 == VOID_TYPE || code2 == VOID_TYPE)
|
||||
{
|
||||
if (code1 != VOID_TYPE || code2 != VOID_TYPE)
|
||||
pedwarn (colon_loc, OPT_pedantic,
|
||||
pedwarn (colon_loc, OPT_Wpedantic,
|
||||
"ISO C forbids conditional expr with only one void side");
|
||||
result_type = void_type_node;
|
||||
}
|
||||
@ -4330,7 +4330,7 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
|
||||
else if (VOID_TYPE_P (TREE_TYPE (type1)))
|
||||
{
|
||||
if (TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE)
|
||||
pedwarn (colon_loc, OPT_pedantic,
|
||||
pedwarn (colon_loc, OPT_Wpedantic,
|
||||
"ISO C forbids conditional expr between "
|
||||
"%<void *%> and function pointer");
|
||||
result_type = build_pointer_type (qualify_type (TREE_TYPE (type1),
|
||||
@ -4339,7 +4339,7 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
|
||||
else if (VOID_TYPE_P (TREE_TYPE (type2)))
|
||||
{
|
||||
if (TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE)
|
||||
pedwarn (colon_loc, OPT_pedantic,
|
||||
pedwarn (colon_loc, OPT_Wpedantic,
|
||||
"ISO C forbids conditional expr between "
|
||||
"%<void *%> and function pointer");
|
||||
result_type = build_pointer_type (qualify_type (TREE_TYPE (type2),
|
||||
@ -4650,7 +4650,7 @@ build_c_cast (location_t loc, tree type, tree expr)
|
||||
{
|
||||
if (TREE_CODE (type) == RECORD_TYPE
|
||||
|| TREE_CODE (type) == UNION_TYPE)
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C forbids casting nonscalar to the same type");
|
||||
}
|
||||
else if (TREE_CODE (type) == UNION_TYPE)
|
||||
@ -4668,7 +4668,7 @@ build_c_cast (location_t loc, tree type, tree expr)
|
||||
tree t;
|
||||
bool maybe_const = true;
|
||||
|
||||
pedwarn (loc, OPT_pedantic, "ISO C forbids casts to union type");
|
||||
pedwarn (loc, OPT_Wpedantic, "ISO C forbids casts to union type");
|
||||
t = c_fully_fold (value, false, &maybe_const);
|
||||
t = build_constructor_single (type, field, t);
|
||||
if (!maybe_const)
|
||||
@ -4782,7 +4782,7 @@ build_c_cast (location_t loc, tree type, tree expr)
|
||||
&& TREE_CODE (otype) == POINTER_TYPE
|
||||
&& TREE_CODE (TREE_TYPE (otype)) == FUNCTION_TYPE
|
||||
&& TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE)
|
||||
pedwarn (loc, OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (loc, OPT_Wpedantic, "ISO C forbids "
|
||||
"conversion of function pointer to object pointer type");
|
||||
|
||||
if (pedantic
|
||||
@ -4791,7 +4791,7 @@ build_c_cast (location_t loc, tree type, tree expr)
|
||||
&& TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
|
||||
&& TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
|
||||
&& !null_pointer_constant_p (value))
|
||||
pedwarn (loc, OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (loc, OPT_Wpedantic, "ISO C forbids "
|
||||
"conversion of object pointer to function pointer type");
|
||||
|
||||
ovalue = value;
|
||||
@ -5503,7 +5503,7 @@ convert_for_assignment (location_t location, tree type, tree rhs,
|
||||
}
|
||||
|
||||
if (!fundecl || !DECL_IN_SYSTEM_HEADER (fundecl))
|
||||
pedwarn (location, OPT_pedantic,
|
||||
pedwarn (location, OPT_Wpedantic,
|
||||
"ISO C prohibits argument conversion to union type");
|
||||
|
||||
rhs = fold_convert_loc (location, TREE_TYPE (memb), rhs);
|
||||
@ -5640,7 +5640,7 @@ convert_for_assignment (location_t location, tree type, tree rhs,
|
||||
(VOID_TYPE_P (ttr)
|
||||
&& !null_pointer_constant
|
||||
&& TREE_CODE (ttl) == FUNCTION_TYPE)))
|
||||
WARN_FOR_ASSIGNMENT (location, OPT_pedantic,
|
||||
WARN_FOR_ASSIGNMENT (location, OPT_Wpedantic,
|
||||
G_("ISO C forbids passing argument %d of "
|
||||
"%qE between function pointer "
|
||||
"and %<void *%>"),
|
||||
@ -6077,7 +6077,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 (input_location, OPT_pedantic,
|
||||
pedwarn_init (input_location, OPT_Wpedantic,
|
||||
"array initialized from parenthesized string constant");
|
||||
}
|
||||
|
||||
@ -6150,7 +6150,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
|
||||
maybe_warn_string_init (type, expr);
|
||||
|
||||
if (TYPE_DOMAIN (type) && !TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
|
||||
pedwarn_init (init_loc, OPT_pedantic,
|
||||
pedwarn_init (init_loc, OPT_Wpedantic,
|
||||
"initialization of a flexible array member");
|
||||
|
||||
if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
|
||||
@ -6307,7 +6307,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
/* Compound expressions can only occur here if -pedantic or
|
||||
/* Compound expressions can only occur here if -Wpedantic or
|
||||
-pedantic-errors is specified. In the later case, we always want
|
||||
an error. In the former case, we simply want a warning. */
|
||||
if (require_constant && pedantic
|
||||
@ -6319,7 +6319,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
|
||||
if (inside_init == error_mark_node)
|
||||
error_init ("initializer element is not constant");
|
||||
else
|
||||
pedwarn_init (init_loc, OPT_pedantic,
|
||||
pedwarn_init (init_loc, OPT_Wpedantic,
|
||||
"initializer element is not constant");
|
||||
if (flag_pedantic_errors)
|
||||
inside_init = error_mark_node;
|
||||
@ -7025,7 +7025,7 @@ pop_init_level (int implicit, struct obstack * braced_init_obstack)
|
||||
if (constructor_depth > 2)
|
||||
error_init ("initialization of flexible array member in a nested context");
|
||||
else
|
||||
pedwarn_init (input_location, OPT_pedantic,
|
||||
pedwarn_init (input_location, OPT_Wpedantic,
|
||||
"initialization of a flexible array member");
|
||||
|
||||
/* We have already issued an error message for the existence
|
||||
@ -7262,7 +7262,7 @@ set_init_index (tree first, tree last,
|
||||
{
|
||||
first = c_fully_fold (first, false, NULL);
|
||||
if (TREE_CODE (first) == INTEGER_CST)
|
||||
pedwarn_init (input_location, OPT_pedantic,
|
||||
pedwarn_init (input_location, OPT_Wpedantic,
|
||||
"array index in initializer is not "
|
||||
"an integer constant expression");
|
||||
}
|
||||
@ -7271,7 +7271,7 @@ set_init_index (tree first, tree last,
|
||||
{
|
||||
last = c_fully_fold (last, false, NULL);
|
||||
if (TREE_CODE (last) == INTEGER_CST)
|
||||
pedwarn_init (input_location, OPT_pedantic,
|
||||
pedwarn_init (input_location, OPT_Wpedantic,
|
||||
"array index in initializer is not "
|
||||
"an integer constant expression");
|
||||
}
|
||||
@ -8704,7 +8704,7 @@ tree
|
||||
c_finish_goto_ptr (location_t loc, tree expr)
|
||||
{
|
||||
tree t;
|
||||
pedwarn (loc, OPT_pedantic, "ISO C forbids %<goto *expr;%>");
|
||||
pedwarn (loc, OPT_Wpedantic, "ISO C forbids %<goto *expr;%>");
|
||||
expr = c_fully_fold (expr, false, NULL);
|
||||
expr = convert (ptr_type_node, expr);
|
||||
t = build1 (GOTO_EXPR, void_type_node, expr);
|
||||
@ -8761,7 +8761,7 @@ c_finish_return (location_t loc, tree retval, tree origtype)
|
||||
pedwarn (loc, 0,
|
||||
"%<return%> with a value, in function returning void");
|
||||
else
|
||||
pedwarn (loc, OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (loc, OPT_Wpedantic, "ISO C forbids "
|
||||
"%<return%> with expression, in function returning void");
|
||||
}
|
||||
else
|
||||
@ -8943,7 +8943,7 @@ do_case (location_t loc, tree low_value, tree high_value)
|
||||
{
|
||||
low_value = c_fully_fold (low_value, false, NULL);
|
||||
if (TREE_CODE (low_value) == INTEGER_CST)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"case label is not an integer constant expression");
|
||||
}
|
||||
|
||||
@ -8951,7 +8951,7 @@ do_case (location_t loc, tree low_value, tree high_value)
|
||||
{
|
||||
high_value = c_fully_fold (high_value, false, NULL);
|
||||
if (TREE_CODE (high_value) == INTEGER_CST)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"case label is not an integer constant expression");
|
||||
}
|
||||
|
||||
@ -10123,13 +10123,13 @@ build_binary_op (location_t location, enum tree_code code,
|
||||
else if (VOID_TYPE_P (tt0))
|
||||
{
|
||||
if (pedantic && TREE_CODE (tt1) == FUNCTION_TYPE)
|
||||
pedwarn (location, OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (location, OPT_Wpedantic, "ISO C forbids "
|
||||
"comparison of %<void *%> with function pointer");
|
||||
}
|
||||
else if (VOID_TYPE_P (tt1))
|
||||
{
|
||||
if (pedantic && TREE_CODE (tt0) == FUNCTION_TYPE)
|
||||
pedwarn (location, OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (location, OPT_Wpedantic, "ISO C forbids "
|
||||
"comparison of %<void *%> with function pointer");
|
||||
}
|
||||
else
|
||||
@ -10206,7 +10206,7 @@ build_binary_op (location_t location, enum tree_code code,
|
||||
pedwarn (location, 0,
|
||||
"comparison of complete and incomplete pointers");
|
||||
else if (TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE)
|
||||
pedwarn (location, OPT_pedantic, "ISO C forbids "
|
||||
pedwarn (location, OPT_Wpedantic, "ISO C forbids "
|
||||
"ordered comparisons of pointers to functions");
|
||||
else if (null_pointer_constant_p (orig_op0)
|
||||
|| null_pointer_constant_p (orig_op1))
|
||||
@ -10233,7 +10233,7 @@ build_binary_op (location_t location, enum tree_code code,
|
||||
{
|
||||
result_type = type0;
|
||||
if (pedantic)
|
||||
pedwarn (location, OPT_pedantic,
|
||||
pedwarn (location, OPT_Wpedantic,
|
||||
"ordered comparison of pointer with integer zero");
|
||||
else if (extra_warnings)
|
||||
warning_at (location, OPT_Wextra,
|
||||
@ -10243,7 +10243,7 @@ build_binary_op (location_t location, enum tree_code code,
|
||||
{
|
||||
result_type = type1;
|
||||
if (pedantic)
|
||||
pedwarn (location, OPT_pedantic,
|
||||
pedwarn (location, OPT_Wpedantic,
|
||||
"ordered comparison of pointer with integer zero");
|
||||
else if (extra_warnings)
|
||||
warning_at (location, OPT_Wextra,
|
||||
|
@ -307,7 +307,7 @@ Common Driver Joined Alias(o) MissingArgError(missing filename after %qs)
|
||||
Driver Alias(pass-exit-codes)
|
||||
|
||||
-pedantic
|
||||
Common Alias(pedantic)
|
||||
Common Alias(Wpedantic)
|
||||
|
||||
-pedantic-errors
|
||||
Common Alias(pedantic-errors)
|
||||
@ -582,6 +582,10 @@ Wpadded
|
||||
Common Var(warn_padded) Warning
|
||||
Warn when padding is required to align structure members
|
||||
|
||||
Wpedantic
|
||||
Common Var(pedantic) Warning
|
||||
Issue warnings needed for strict compliance to the standard
|
||||
|
||||
Wshadow
|
||||
Common Var(warn_shadow) Warning
|
||||
Warn when one local variable shadows another
|
||||
@ -2292,8 +2296,7 @@ pass-exit-codes
|
||||
Driver Var(pass_exit_codes)
|
||||
|
||||
pedantic
|
||||
Common Var(pedantic)
|
||||
Issue warnings needed for strict compliance to the standard
|
||||
Common Alias(Wpedantic)
|
||||
|
||||
pedantic-errors
|
||||
Common Var(flag_pedantic_errors)
|
||||
|
@ -1,3 +1,40 @@
|
||||
2012-04-22 Manuel López-Ibáñez <manu@gcc.gnu.org>
|
||||
|
||||
PR c/44774
|
||||
* typeck.c (composite_pointer_type): Likewise.
|
||||
(cxx_sizeof_or_alignof_type): Likewise.
|
||||
(cp_build_array_ref): Likewise.
|
||||
(cp_build_function_call_vec): Likewise.
|
||||
(cp_build_addr_expr_1): Likewise.
|
||||
(convert_member_func_to_ptr): Likewise.
|
||||
* decl.c (check_tag_decl): Likewise.
|
||||
(check_static_variable_definition): Likewise.
|
||||
(compute_array_index_type): Likewise.
|
||||
(create_array_type_for_decl): Likewise.
|
||||
(grokdeclarator): Likewise.
|
||||
(grok_op_properties): Likewise.
|
||||
* error.c (maybe_warn_cpp0x): Likewise.
|
||||
* pt.c (maybe_process_partial_specialization): Likewise.
|
||||
(convert_template_argument): Likewise.
|
||||
(do_decl_instantiation): Likewise.
|
||||
(do_type_instantiation): Likewise.
|
||||
* parser.c (cp_parser_primary_expression): Likewise.
|
||||
(cp_parser_postfix_expression): Likewise.
|
||||
(cp_parser_unary_expression): Likewise.
|
||||
(cp_parser_question_colon_clause): Likewise.
|
||||
(cp_parser_lambda_introducer): Likewise.
|
||||
(cp_parser_lambda_declarator_opt): Likewise.
|
||||
(cp_parser_compound_statement): Likewise.
|
||||
(cp_parser_jump_statement): Likewise.
|
||||
(cp_parser_declaration_seq_opt): Likewise.
|
||||
(cp_parser_enum_specifier): Likewise.
|
||||
(cp_parser_enumerator_list): Likewise.
|
||||
(cp_parser_initializer_list): Likewise.
|
||||
(cp_parser_member_declaration): Likewise.
|
||||
* call.c (build_conditional_expr_1): Likewise.
|
||||
* friend.c (make_friend_class): Likewise.
|
||||
* name-lookup.c (pushdecl_maybe_friend_1): Likewise.
|
||||
|
||||
2012-04-21 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* method.c (make_alias_for): Do not set TREE_SYMBOL_REFERENCED.
|
||||
|
@ -4335,7 +4335,7 @@ build_conditional_expr_1 (tree arg1, tree arg2, tree arg3,
|
||||
if (!arg2)
|
||||
{
|
||||
if (complain & tf_error)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ forbids omitting the middle term of a ?: expression");
|
||||
|
||||
/* Make sure that lvalues remain lvalues. See g++.oliva/ext1.C. */
|
||||
|
@ -4193,7 +4193,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 (input_location, OPT_pedantic, "ISO C++ prohibits anonymous structs");
|
||||
pedwarn (input_location, OPT_Wpedantic, "ISO C++ prohibits anonymous structs");
|
||||
}
|
||||
|
||||
else
|
||||
@ -7877,7 +7877,7 @@ check_static_variable_definition (tree decl, tree type)
|
||||
"static member %qD",
|
||||
decl);
|
||||
else if (!INTEGRAL_OR_ENUMERATION_TYPE_P (type))
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C++ forbids initialization of member constant "
|
||||
pedwarn (input_location, OPT_Wpedantic, "ISO C++ forbids initialization of member constant "
|
||||
"%qD of non-integral type %qT", decl, type);
|
||||
|
||||
return 0;
|
||||
@ -8050,9 +8050,9 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
|
||||
else if (in_system_header)
|
||||
/* Allow them in system headers because glibc uses them. */;
|
||||
else if (name)
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C++ forbids zero-size array %qD", name);
|
||||
pedwarn (input_location, OPT_Wpedantic, "ISO C++ forbids zero-size array %qD", name);
|
||||
else
|
||||
pedwarn (input_location, OPT_pedantic, "ISO C++ forbids zero-size array");
|
||||
pedwarn (input_location, OPT_Wpedantic, "ISO C++ forbids zero-size array");
|
||||
}
|
||||
}
|
||||
else if (TREE_CONSTANT (size)
|
||||
@ -8178,7 +8178,7 @@ create_array_type_for_decl (tree name, tree type, tree size)
|
||||
/* 8.3.4/1: If the type of the identifier of D contains the auto
|
||||
type-specifier, the program is ill-formed. */
|
||||
if (pedantic && type_uses_auto (type))
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"declaration of %qD as array of %<auto%>", name);
|
||||
|
||||
/* If there are some types which cannot be array elements,
|
||||
@ -8773,7 +8773,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 (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ forbids declaration of %qs with no type", name);
|
||||
else
|
||||
warning (OPT_Wreturn_type,
|
||||
@ -8792,7 +8792,7 @@ grokdeclarator (const cp_declarator *declarator,
|
||||
explicit_int128 = false;
|
||||
}
|
||||
else if (pedantic && ! in_system_header)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ does not support %<__int128%> for %qs", name);
|
||||
}
|
||||
|
||||
@ -8843,7 +8843,7 @@ grokdeclarator (const cp_declarator *declarator,
|
||||
ok = 1;
|
||||
if (!explicit_int && !defaulted_int && !explicit_char && !explicit_int128 && pedantic)
|
||||
{
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"long, short, signed or unsigned used invalidly for %qs",
|
||||
name);
|
||||
if (flag_pedantic_errors)
|
||||
@ -10354,11 +10354,11 @@ grokdeclarator (const cp_declarator *declarator,
|
||||
&& pedantic)
|
||||
{
|
||||
if (storage_class == sc_static)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"%<static%> specified invalid for function %qs "
|
||||
"declared out of global scope", name);
|
||||
else
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"%<inline%> specifier invalid for function %qs "
|
||||
"declared out of global scope", name);
|
||||
}
|
||||
@ -10452,7 +10452,7 @@ grokdeclarator (const cp_declarator *declarator,
|
||||
}
|
||||
if (storage_class == sc_extern && pedantic)
|
||||
{
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"cannot explicitly declare member %q#D to have "
|
||||
"extern linkage", decl);
|
||||
storage_class = sc_none;
|
||||
@ -11418,7 +11418,7 @@ grok_op_properties (tree decl, bool complain)
|
||||
if (operator_code == POSTINCREMENT_EXPR
|
||||
|| operator_code == POSTDECREMENT_EXPR)
|
||||
{
|
||||
pedwarn (input_location, OPT_pedantic, "%qD cannot have default arguments",
|
||||
pedwarn (input_location, OPT_Wpedantic, "%qD cannot have default arguments",
|
||||
decl);
|
||||
}
|
||||
else
|
||||
|
@ -3306,7 +3306,7 @@ maybe_warn_cpp0x (cpp0x_warn_str str)
|
||||
"only available with -std=c++11 or -std=gnu++11");
|
||||
break;
|
||||
case CPP0X_INLINE_NAMESPACES:
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"inline namespaces "
|
||||
"only available with -std=c++11 or -std=gnu++11");
|
||||
break;
|
||||
|
@ -232,7 +232,7 @@ make_friend_class (tree type, tree friend_type, bool complain)
|
||||
|
||||
So don't complain in C++0x mode. */
|
||||
if (cxx_dialect < cxx0x)
|
||||
pedwarn (input_location, complain ? 0 : OPT_pedantic,
|
||||
pedwarn (input_location, complain ? 0 : OPT_Wpedantic,
|
||||
"invalid type %qT declared %<friend%>", friend_type);
|
||||
return;
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
|
||||
else if (t == wchar_decl_node)
|
||||
{
|
||||
if (! DECL_IN_SYSTEM_HEADER (x))
|
||||
pedwarn (input_location, OPT_pedantic, "redeclaration of %<wchar_t%> as %qT",
|
||||
pedwarn (input_location, OPT_Wpedantic, "redeclaration of %<wchar_t%> as %qT",
|
||||
TREE_TYPE (x));
|
||||
|
||||
/* Throw away the redeclaration. */
|
||||
|
@ -4011,7 +4011,7 @@ 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 (token->location, OPT_pedantic,
|
||||
pedwarn (token->location, OPT_Wpedantic,
|
||||
"ISO C++ forbids braced-groups within expressions");
|
||||
|
||||
/* And they're not allowed outside of a function-body; you
|
||||
@ -5550,7 +5550,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 (input_location, OPT_pedantic, "ISO C++ forbids compound-literals");
|
||||
pedwarn (input_location, OPT_Wpedantic, "ISO C++ forbids compound-literals");
|
||||
/* For simplicity, we disallow compound literals in
|
||||
constant-expressions. We could
|
||||
allow compound literals of integer type, whose
|
||||
@ -6393,7 +6393,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p,
|
||||
expressions. So pedwarn if alignof is used with a non-
|
||||
type expression. However, __alignof__ is ok. */
|
||||
if (!strcmp (IDENTIFIER_POINTER (token->u.value), "alignof"))
|
||||
pedwarn (token->location, OPT_pedantic,
|
||||
pedwarn (token->location, OPT_Wpedantic,
|
||||
"ISO C++ does not allow %<alignof%> "
|
||||
"with a non-type");
|
||||
|
||||
@ -7434,7 +7434,7 @@ cp_parser_question_colon_clause (cp_parser* parser, tree logical_or_expr)
|
||||
if (cp_parser_allow_gnu_extensions_p (parser)
|
||||
&& token->type == CPP_COLON)
|
||||
{
|
||||
pedwarn (token->location, OPT_pedantic,
|
||||
pedwarn (token->location, OPT_Wpedantic,
|
||||
"ISO C++ does not allow ?: with omitted middle operand");
|
||||
/* Implicit true clause. */
|
||||
expr = NULL_TREE;
|
||||
@ -8238,7 +8238,7 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
|
||||
{
|
||||
/* An explicit expression exists. */
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ does not allow initializers "
|
||||
"in lambda expression capture lists");
|
||||
capture_init_expr = cp_parser_assignment_expression (parser,
|
||||
@ -8368,7 +8368,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
|
||||
parameter-declaration-clause of a lambda-declarator. */
|
||||
for (t = param_list; t; t = TREE_CHAIN (t))
|
||||
if (TREE_PURPOSE (t))
|
||||
pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)), OPT_pedantic,
|
||||
pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)), OPT_Wpedantic,
|
||||
"default argument specified for lambda parameter");
|
||||
|
||||
cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
|
||||
@ -8939,7 +8939,7 @@ cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr,
|
||||
return error_mark_node;
|
||||
if (DECL_DECLARED_CONSTEXPR_P (current_function_decl)
|
||||
&& !function_body)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"compound-statement in constexpr function");
|
||||
/* Begin the compound-statement. */
|
||||
compound_stmt = begin_compound_stmt (in_try ? BCS_TRY_BLOCK : 0);
|
||||
@ -9910,7 +9910,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 (token->location, OPT_pedantic, "ISO C++ forbids computed gotos");
|
||||
pedwarn (token->location, OPT_Wpedantic, "ISO C++ forbids computed gotos");
|
||||
/* Consume the '*' token. */
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
/* Parse the dependent expression. */
|
||||
@ -10055,7 +10055,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 (input_location, OPT_pedantic, "extra %<;%>");
|
||||
pedwarn (input_location, OPT_Wpedantic, "extra %<;%>");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -14362,7 +14362,7 @@ cp_parser_enum_specifier (cp_parser* parser)
|
||||
{
|
||||
/* Are template enums allowed in ISO? */
|
||||
if (template_parm_scope_p ())
|
||||
pedwarn (type_start_token->location, OPT_pedantic,
|
||||
pedwarn (type_start_token->location, OPT_Wpedantic,
|
||||
"%qD is an enumeration template", name);
|
||||
/* ignore a typename reference, for it will be solved by name
|
||||
in start_enum. */
|
||||
@ -14615,7 +14615,7 @@ cp_parser_enumerator_list (cp_parser* parser, tree type)
|
||||
if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
|
||||
{
|
||||
if (cxx_dialect < cxx0x && !in_system_header)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"comma at end of enumerator list");
|
||||
break;
|
||||
}
|
||||
@ -17634,7 +17634,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 (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ does not allow designated initializers");
|
||||
/* Consume the identifier. */
|
||||
designator = cp_lexer_consume_token (parser->lexer)->u.value;
|
||||
@ -17648,7 +17648,7 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p)
|
||||
&& cp_lexer_peek_nth_token (parser->lexer, 3)->type == CPP_EQ)
|
||||
{
|
||||
/* Warn the user that they are using an extension. */
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ does not allow C99 designated initializers");
|
||||
/* Consume the `.'. */
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
@ -18864,7 +18864,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 (token->location, OPT_pedantic, "extra %<;%>");
|
||||
pedwarn (token->location, OPT_Wpedantic, "extra %<;%>");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -18882,7 +18882,7 @@ cp_parser_member_declaration (cp_parser* parser)
|
||||
/* If the `friend' keyword was present, the friend must
|
||||
be introduced with a class-key. */
|
||||
if (!declares_class_or_enum && cxx_dialect < cxx0x)
|
||||
pedwarn (decl_spec_token_start->location, OPT_pedantic,
|
||||
pedwarn (decl_spec_token_start->location, OPT_Wpedantic,
|
||||
"in C++03 a class-key must be used "
|
||||
"when declaring a friend");
|
||||
/* In this case:
|
||||
|
10
gcc/cp/pt.c
10
gcc/cp/pt.c
@ -943,7 +943,7 @@ maybe_process_partial_specialization (tree type)
|
||||
/* Someday C++0x may allow for enum template specialization. */
|
||||
if (cxx_dialect > cxx98 && TREE_CODE (type) == ENUMERAL_TYPE
|
||||
&& CLASS_TYPE_P (context) && CLASSTYPE_USE_TEMPLATE (context))
|
||||
pedwarn (input_location, OPT_pedantic, "template specialization "
|
||||
pedwarn (input_location, OPT_Wpedantic, "template specialization "
|
||||
"of %qD not allowed by ISO C++", type);
|
||||
else
|
||||
{
|
||||
@ -6433,7 +6433,7 @@ convert_template_argument (tree parm,
|
||||
if (cxx_dialect >= cxx0x)
|
||||
/* OK under DR 1004. */;
|
||||
else if (complain & tf_warning_or_error)
|
||||
pedwarn (input_location, OPT_pedantic, "injected-class-name %qD"
|
||||
pedwarn (input_location, OPT_Wpedantic, "injected-class-name %qD"
|
||||
" used as template template argument", TYPE_NAME (arg));
|
||||
else if (flag_pedantic_errors)
|
||||
t = arg;
|
||||
@ -17909,7 +17909,7 @@ do_decl_instantiation (tree decl, tree storage)
|
||||
else if (storage == ridpointers[(int) RID_EXTERN])
|
||||
{
|
||||
if (!in_system_header && (cxx_dialect == cxx98))
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ 1998 forbids the use of %<extern%> on explicit "
|
||||
"instantiations");
|
||||
extern_p = 1;
|
||||
@ -18006,12 +18006,12 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
|
||||
if (storage == ridpointers[(int) RID_EXTERN])
|
||||
{
|
||||
if (cxx_dialect == cxx98)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ 1998 forbids the use of %<extern%> on "
|
||||
"explicit instantiations");
|
||||
}
|
||||
else
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ forbids the use of %qE"
|
||||
" on explicit instantiations", storage);
|
||||
}
|
||||
|
@ -605,17 +605,17 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
|
||||
switch (operation)
|
||||
{
|
||||
case CPO_COMPARISON:
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ forbids comparison between "
|
||||
"pointer of type %<void *%> and pointer-to-function");
|
||||
break;
|
||||
case CPO_CONVERSION:
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ forbids conversion between "
|
||||
"pointer of type %<void *%> and pointer-to-function");
|
||||
break;
|
||||
case CPO_CONDITIONAL_EXPR:
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ forbids conditional expression between "
|
||||
"pointer of type %<void *%> and pointer-to-function");
|
||||
break;
|
||||
@ -1526,7 +1526,7 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain)
|
||||
if (TREE_CODE (type) == METHOD_TYPE)
|
||||
{
|
||||
if (complain)
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
|
||||
pedwarn (input_location, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith,
|
||||
"invalid application of %qs to a member function",
|
||||
operator_name_info[(int) op].name);
|
||||
value = size_one_node;
|
||||
@ -2961,7 +2961,7 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
|
||||
}
|
||||
|
||||
if (!lvalue_p (array) && (complain & tf_error))
|
||||
pedwarn (loc, OPT_pedantic,
|
||||
pedwarn (loc, OPT_Wpedantic,
|
||||
"ISO C++ forbids subscripting non-lvalue array");
|
||||
|
||||
/* Note in C++ it is valid to subscript a `register' array, since
|
||||
@ -3287,7 +3287,7 @@ cp_build_function_call_vec (tree function, VEC(tree,gc) **params,
|
||||
|
||||
/* Convert anything with function type to a pointer-to-function. */
|
||||
if (DECL_MAIN_P (function) && (complain & tf_error))
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ forbids calling %<::main%> from within program");
|
||||
|
||||
function = build_addr_func (function, complain);
|
||||
@ -4935,9 +4935,9 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain)
|
||||
{
|
||||
/* ARM $3.4 */
|
||||
/* Apparently a lot of autoconf scripts for C++ packages do this,
|
||||
so only complain if -pedantic. */
|
||||
so only complain if -Wpedantic. */
|
||||
if (complain & (flag_pedantic_errors ? tf_error : tf_warning))
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
pedwarn (input_location, OPT_Wpedantic,
|
||||
"ISO C++ forbids taking address of function %<::main%>");
|
||||
else if (flag_pedantic_errors)
|
||||
return error_mark_node;
|
||||
@ -6194,7 +6194,7 @@ convert_member_func_to_ptr (tree type, tree expr, tsubst_flags_t complain)
|
||||
return error_mark_node;
|
||||
|
||||
if (pedantic || warn_pmf2ptr)
|
||||
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpmf_conversions,
|
||||
pedwarn (input_location, pedantic ? OPT_Wpedantic : OPT_Wpmf_conversions,
|
||||
"converting from %qT to %qT", intype, type);
|
||||
|
||||
if (TREE_CODE (intype) == METHOD_TYPE)
|
||||
|
@ -809,10 +809,10 @@ warning_at (location_t location, int opt, const char *gmsgid, ...)
|
||||
language standard, if you have chosen not to make them errors.
|
||||
|
||||
Note that these diagnostics are issued independent of the setting
|
||||
of the -pedantic command-line switch. To get a warning enabled
|
||||
of the -Wpedantic command-line switch. To get a warning enabled
|
||||
only with that switch, use either "if (pedantic) pedwarn
|
||||
(OPT_pedantic,...)" or just "pedwarn (OPT_pedantic,..)". To get a
|
||||
pedwarn independently of the -pedantic switch use "pedwarn (0,...)".
|
||||
(OPT_Wpedantic,...)" or just "pedwarn (OPT_Wpedantic,..)". To get a
|
||||
pedwarn independently of the -Wpedantic switch use "pedwarn (0,...)".
|
||||
|
||||
Returns true if the warning was printed, false if it was inhibited. */
|
||||
|
||||
|
@ -39,7 +39,7 @@ included in the gfdl(7) man page.
|
||||
@c man begin SYNOPSIS
|
||||
gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
|
||||
[@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
|
||||
[@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
|
||||
[@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
|
||||
[@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
|
||||
[@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
|
||||
[@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
|
||||
@ -234,7 +234,7 @@ Objective-C and Objective-C++ Dialects}.
|
||||
|
||||
@item Warning Options
|
||||
@xref{Warning Options,,Options to Request or Suppress Warnings}.
|
||||
@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -pedantic @gol
|
||||
@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
|
||||
-pedantic-errors @gol
|
||||
-w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
|
||||
-Wno-attributes -Wno-builtin-macro-redefined @gol
|
||||
@ -1516,7 +1516,7 @@ such as @code{__unix__} and @code{__vax__} are also available, with or
|
||||
without @option{-ansi}.
|
||||
|
||||
The @option{-ansi} option does not cause non-ISO programs to be
|
||||
rejected gratuitously. For that, @option{-pedantic} is required in
|
||||
rejected gratuitously. For that, @option{-Wpedantic} is required in
|
||||
addition to @option{-ansi}. @xref{Warning Options}.
|
||||
|
||||
The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
|
||||
@ -1550,10 +1550,10 @@ expression. On the other hand, by specifying a GNU dialect of a
|
||||
standard, all features the compiler support are enabled, even when
|
||||
those features change the meaning of the base standard and some
|
||||
strict-conforming programs may be rejected. The particular standard
|
||||
is used by @option{-pedantic} to identify which features are GNU
|
||||
is used by @option{-Wpedantic} to identify which features are GNU
|
||||
extensions given that version of the standard. For example
|
||||
@option{-std=gnu90 -pedantic} warns about C++ style @samp{//}
|
||||
comments, while @option{-std=gnu99 -pedantic} does not.
|
||||
@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
|
||||
comments, while @option{-std=gnu99 -Wpedantic} does not.
|
||||
|
||||
A value for this option must be provided; possible values are
|
||||
|
||||
@ -2059,7 +2059,7 @@ errors if these functions are not inlined everywhere they are called.
|
||||
|
||||
@item -fms-extensions
|
||||
@opindex fms-extensions
|
||||
Disable pedantic warnings about constructs used in MFC, such as implicit
|
||||
Disable Wpedantic warnings about constructs used in MFC, such as implicit
|
||||
int and getting a pointer to member function via non-standard syntax.
|
||||
|
||||
@item -fno-nonansi-builtins
|
||||
@ -2994,8 +2994,10 @@ with old compilers, but if something goes wrong, the compiler
|
||||
warns that an unrecognized option is present.
|
||||
|
||||
@table @gcctabopt
|
||||
@item -pedantic
|
||||
@item -Wpedantic
|
||||
@itemx -pedantic
|
||||
@opindex pedantic
|
||||
@opindex Wpedantic
|
||||
Issue all the warnings demanded by strict ISO C and ISO C++;
|
||||
reject all programs that use forbidden extensions, and some other
|
||||
programs that do not follow ISO C and ISO C++. For ISO C, follows the
|
||||
@ -3007,14 +3009,14 @@ this option (though a rare few require @option{-ansi} or a
|
||||
without this option, certain GNU extensions and traditional C and C++
|
||||
features are supported as well. With this option, they are rejected.
|
||||
|
||||
@option{-pedantic} does not cause warning messages for use of the
|
||||
@option{-Wpedantic} does not cause warning messages for use of the
|
||||
alternate keywords whose names begin and end with @samp{__}. Pedantic
|
||||
warnings are also disabled in the expression that follows
|
||||
@code{__extension__}. However, only system header files should use
|
||||
these escape routes; application programs should avoid them.
|
||||
@xref{Alternate Keywords}.
|
||||
|
||||
Some users try to use @option{-pedantic} to check programs for strict ISO
|
||||
Some users try to use @option{-Wpedantic} to check programs for strict ISO
|
||||
C conformance. They soon find that it does not do quite what they want:
|
||||
it finds some non-ISO practices, but not all---only those for which
|
||||
ISO C @emph{requires} a diagnostic, and some others for which
|
||||
@ -3022,13 +3024,13 @@ diagnostics have been added.
|
||||
|
||||
A feature to report any failure to conform to ISO C might be useful in
|
||||
some instances, but would require considerable additional work and would
|
||||
be quite different from @option{-pedantic}. We don't have plans to
|
||||
be quite different from @option{-Wpedantic}. We don't have plans to
|
||||
support such a feature in the near future.
|
||||
|
||||
Where the standard specified with @option{-std} represents a GNU
|
||||
extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
|
||||
corresponding @dfn{base standard}, the version of ISO C on which the GNU
|
||||
extended dialect is based. Warnings from @option{-pedantic} are given
|
||||
extended dialect is based. Warnings from @option{-Wpedantic} are given
|
||||
where they are required by the base standard. (It does not make sense
|
||||
for such warnings to be given only for features not in the specified GNU
|
||||
C dialect, since by definition the GNU dialects of C include all
|
||||
@ -3037,7 +3039,7 @@ nothing to warn about.)
|
||||
|
||||
@item -pedantic-errors
|
||||
@opindex pedantic-errors
|
||||
Like @option{-pedantic}, except that errors are produced rather than
|
||||
Like @option{-Wpedantic}, except that errors are produced rather than
|
||||
warnings.
|
||||
|
||||
@item -Wall
|
||||
@ -3223,7 +3225,7 @@ libc version 2.2. These include all ISO C90 and C99 features, as well
|
||||
as features from the Single Unix Specification and some BSD and GNU
|
||||
extensions. Other library implementations may not support all these
|
||||
features; GCC does not support warning about features that go beyond a
|
||||
particular library's limitations. However, if @option{-pedantic} is used
|
||||
particular library's limitations. However, if @option{-Wpedantic} is used
|
||||
with @option{-Wformat}, warnings are given about format features not
|
||||
in the selected standard version (but not for @code{strfmon} formats,
|
||||
since those are not in any version of the C standard). @xref{C Dialect
|
||||
@ -3366,7 +3368,7 @@ Warn if the type of @samp{main} is suspicious. @samp{main} should be
|
||||
a function with external linkage, returning int, taking either zero
|
||||
arguments, two, or three arguments of appropriate types. This warning
|
||||
is enabled by default in C++ and is enabled by either @option{-Wall}
|
||||
or @option{-pedantic}.
|
||||
or @option{-Wpedantic}.
|
||||
|
||||
@item -Wmissing-braces
|
||||
@opindex Wmissing-braces
|
||||
@ -4107,7 +4109,7 @@ such assumptions.
|
||||
Disables the warnings about non-ISO @code{printf} / @code{scanf} format
|
||||
width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets
|
||||
depending on the MS runtime, when you are using the options @option{-Wformat}
|
||||
and @option{-pedantic} without gnu-extensions.
|
||||
and @option{-Wpedantic} without gnu-extensions.
|
||||
|
||||
@item -Wpointer-arith
|
||||
@opindex Wpointer-arith
|
||||
@ -4116,7 +4118,7 @@ Warn about anything that depends on the ``size of'' a function type or
|
||||
of @code{void}. GNU C assigns these types a size of 1, for
|
||||
convenience in calculations with @code{void *} pointers and pointers
|
||||
to functions. In C++, warn also when an arithmetic operation involves
|
||||
@code{NULL}. This warning is also enabled by @option{-pedantic}.
|
||||
@code{NULL}. This warning is also enabled by @option{-Wpedantic}.
|
||||
|
||||
@item -Wtype-limits
|
||||
@opindex Wtype-limits
|
||||
@ -4621,7 +4623,7 @@ the search path but can't be used.
|
||||
@opindex Wlong-long
|
||||
@opindex Wno-long-long
|
||||
Warn if @samp{long long} type is used. This is enabled by either
|
||||
@option{-pedantic} or @option{-Wtraditional} in ISO C90 and C++98
|
||||
@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
|
||||
modes. To inhibit the warning messages, use @option{-Wno-long-long}.
|
||||
|
||||
@item -Wvariadic-macros
|
||||
@ -4647,7 +4649,7 @@ scalar type.
|
||||
@opindex Wvla
|
||||
@opindex Wno-vla
|
||||
Warn if variable length array is used in the code.
|
||||
@option{-Wno-vla} prevents the @option{-pedantic} warning of
|
||||
@option{-Wno-vla} prevents the @option{-Wpedantic} warning of
|
||||
the variable length array.
|
||||
|
||||
@item -Wvolatile-register-var
|
||||
@ -4673,7 +4675,7 @@ itself is likely to take inordinate amounts of time.
|
||||
@opindex Wno-pointer-sign
|
||||
Warn for pointer argument passing or assignment with different signedness.
|
||||
This option is only supported for C and Objective-C@. It is implied by
|
||||
@option{-Wall} and by @option{-pedantic}, which can be disabled with
|
||||
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
|
||||
@option{-Wno-pointer-sign}.
|
||||
|
||||
@item -Wstack-protector
|
||||
@ -4701,7 +4703,7 @@ not count the trailing NUL@. In C90, the limit was 509 characters; in
|
||||
C99, it was raised to 4095. C++98 does not specify a normative
|
||||
minimum maximum, so we do not diagnose overlength strings in C++@.
|
||||
|
||||
This option is implied by @option{-pedantic}, and can be disabled with
|
||||
This option is implied by @option{-Wpedantic}, and can be disabled with
|
||||
@option{-Wno-overlength-strings}.
|
||||
|
||||
@item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
|
||||
|
Loading…
Reference in New Issue
Block a user