+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.
}
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);
}
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)
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;
}
{
*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);
}
&& 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);
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)
{
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%>");
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
}
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)
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");
}
}
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
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);
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);
&& !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);
&& 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");
}
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);
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)
{
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
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;
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");
}
}
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");
}
}
}
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)
{
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);
}
(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
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");
}
}
gcc_unreachable ();
}
if (dupe && !flag_isoc99)
- pedwarn (input_location, OPT_pedantic, "duplicate %qE", qual);
+ pedwarn (input_location, OPT_Wpedantic, "duplicate %qE", qual);
return 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,
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)
{
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)
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:
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:
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%>");
}
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);
}
: 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);
}
: 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);
}
+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
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;
}
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;
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);
{
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;
/* 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);
{
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;
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
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);
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)
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;
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 ())
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)
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"))
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
; Documented in common.opt
pedantic
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Alias(Wpedantic)
; Documented in common.opt
pedantic-errors
{
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
}
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;
/* 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))
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);
{
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)
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;
}
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;
/* 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;
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;
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 %<(%>"))
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
{
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);
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
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
{
}
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))
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;
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;
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)
&& 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);
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;
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);
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
}
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);
/* 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;
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");
}
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;
{
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;
}
{
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;
}
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,
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");
}
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
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);
{
tree real, imag;
- pedwarn (location, OPT_pedantic,
+ pedwarn (location, OPT_Wpedantic,
"ISO C does not support %<++%> and %<--%> on complex types");
arg = stabilize_reference (arg);
|| 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");
}
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;
}
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),
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),
{
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)
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)
&& 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
&& 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;
}
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);
(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 *%>"),
&& 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");
}
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)),
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
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;
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
{
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");
}
{
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");
}
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);
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
{
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");
}
{
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");
}
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
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))
{
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,
{
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,
Driver Alias(pass-exit-codes)
-pedantic
-Common Alias(pedantic)
+Common Alias(Wpedantic)
-pedantic-errors
Common Alias(pedantic-errors)
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
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)
+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.
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. */
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
"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;
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)
/* 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,
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,
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);
}
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)
&& 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);
}
}
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;
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
"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;
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;
}
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. */
&& 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
{
/* 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
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");
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;
{
/* 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,
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);
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);
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. */
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;
}
{
/* 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. */
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;
}
&& 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;
&& 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);
{
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
{
/* 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:
/* 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
{
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;
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;
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);
}
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;
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;
}
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
/* 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);
{
/* 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;
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)
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. */
@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{}]
@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
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}
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
@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
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
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
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
@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
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
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
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
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
@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
@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
@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
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)}