[c/c++/fortran] PR35058: -Werror= works only with some warnin
Manuel López-Ibáñez
lopezibanez@gmail.com
Fri Jun 13 16:34:00 GMT 2008
The following patch implements pedwarn (OPT_*, ...) and pedwarn0() as
discussed here:
http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00972.html
It also fixes PR 35058.
Bootstrapped with --enable-languages=all and regression tested on
x86_64-unknown-linux-gnu.
OK for 4.4?
Cheers,
Manuel.
(Writing this Changelog entry was a horrible horrible experience! And
I find it totally uninformative. I think there is something wrong with
our approach.)
2008-06-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 35058
* diagnostic.c (pedwarn): Add opt parameter.
(pedwarn0): New. Equivalent to pedwarn(0,...).
* c-tree.h (pedwarn_init): Add opt parameter.
(pedwarn_c90): Likewise.
(pedwarn_c99): Likewise.
* c-errors.c (pedwarn_c99): Likewise.
(pedwarn_c90): Likewise.
* toplev.h (pedwarn): Update declaration.
(pedwarn0): Declare.
* toplev.c (check_global_declaration_1): Use OPT_pedantic for
pedwarn conditional on -pedantic. Use pedwarn0 for unconditional
pedwarn.
* c-lex.c (interpret_integer): Likewise.
(interpret_float): Likewise.
* c-decl.c (pop_scope): Likewise.
(diagnose_mismatched_decls): Likewise.
(implicit_decl_warning): Use OPT_Wimplicit_function_declaration.
(shadow_tag_warned): Use OPT_pedantic for pedwarn conditional on
-pedantic. Use pedwarn0 for unconditional pedwarn.
(build_array_declarator): Likewise.
(start_decl): Likewise.
(mark_forward_parm_decls): Likewise.
(check_bitfield_type_and_width): Likewise. Use OPT_Wvla.
(grokdeclarator): Use either 0 or OPT_Wimplicit_int.
Use OPT_pedantic for pedwarn conditional on -pedantic. Use
pedwarn0 for unconditional pedwarn.
(grokparms): Likewise.
(grokfield): Likewise.
(finish_struct): Likewise.
(build_enumerator): Likewise.
(start_function): Use either 0, OPT_Wreturn_type or
OPT_Wimplicit_int.
Use OPT_Wmain.
(store_parm_decls_oldstyle): Use OPT_pedantic for pedwarn
conditional on -pedantic. Use pedwarn0 for unconditional pedwarn.
(finish_function): Likewise.
(declspecs_add_qual): Likewise.
(declspecs_add_type): Use OPT_Wlong_long. Use OPT_pedantic for pedwarn
conditional on -pedantic. Use pedwarn0 for unconditional pedwarn.
(finish_declspecs): Likewise.
(c_write_global_declarations_1): Likewise.
* c-typeck.c (composite_type): Likewise.
(function_types_compatible_p): Likewise.
(build_array_ref): Likewise.
(build_external_ref): Likewise.
(build_function_call): Use 0 for unconditional pedwarn_init.
(pointer_diff): Use either OPT_pedantic or OPT_Wpointer_arith.
(build_unary_op): Use either OPT_pedantic or
OPT_Wpointer_arith. Use OPT_pedantic for pedwarn conditional on
-pedantic. Use pedwarn0 for unconditional pedwarn.
(c_mark_addressable): Likewise.
(build_conditional_expr): Likewise.
(build_c_cast): Likewise.
(convert_for_assignment): Likewise.
(pedwarn_init): Add opt parameter.
(maybe_warn_string_init): Use OPT_pedantic for pedwarn conditional on
-pedantic. Use pedwarn0 for unconditional pedwarn.
(digest_init): Likewise.
(pop_init_level): Likewise.
(output_init_element): Likewise.
(process_init_element): Likewise.
(c_finish_goto_label): Likewise.
(c_finish_return): Use either 0 or OPT_Wreturn_type.
(build_binary_op): Use OPT_pedantic for pedwarn conditional on
-pedantic. Use pedwarn0 for unconditional pedwarn.
* c-common.c (fname_decl): Likewise.
(fix_string_type): Use OPT_Woverlenght_strings.
(constant_expression_warning): Use OPT_Woverflow.
(check_main_parameter_types): Use OPT_pedantic for pedwarn
conditional on -pedantic. Use pedwarn0 for unconditional pedwarn.
(pointer_int_sum): Likewise. Use either OPT_pedantic or
OPT_Wpointer_arith.
(c_sizeof_or_alignof_type): Likewise.
(finish_label_address_expr): Likewise.
* c-parser.c (c_parser_translation_unit): Likewise.
(c_parser_external_declaration): Likewise.
(c_parser_declaration_or_fndef): Likewise.
(c_parser_enum_specifier): Likewise.
(c_parser_struct_or_union_specifier): Likewise.
(c_parser_struct_declaration): Likewise.
(c_parser_braced_init): Likewise.
(c_parser_initelt): Likewise.
(c_parser_compound_statement_nostart): Likewise. Use either
OPT_pedantic or OPT_Wdeclaration_after_statement.
(c_parser_conditional_expression): Use OPT_pedantic for pedwarn
conditional on -pedantic. Use pedwarn0 for unconditional pedwarn.
(c_parser_postfix_expression): Likewise.
(c_parser_objc_class_instance_variables): Likewise.
(c_parser_objc_method_definition): Likewise.
(c_parser_objc_methodprotolist): Likewise.
fortran/
* f95-lang.c (gfc_mark_addressable): Likewise.
cp/
* typeck.c (composite_pointer_type_r): Likewise.
(composite_pointer_type): Likewise.
(cxx_sizeof_or_alignof_type): Likewise. Use either OPT_pedantic or
OPT_Wpointer_arith.
(cxx_sizeof_expr): Likewise.
(cxx_alignof_expr): Likewise.
(check_template_keyword): Likewise.
(build_array_ref): Likewise.
(cp_build_function_call): Likewise.
(cp_build_binary_op): Likewise.
(pointer_diff): Likewise. Use either OPT_pedantic or
OPT_Wpointer_arith.
(cp_build_unary_op): Likewise.
(build_x_compound_expr_from_list): Likewise.
(convert_member_func_to_ptr): Likewise. Use either OPT_pedantic or
OPT_Wpmf_conversions.
(build_reinterpret_cast_1): Likewise.
(cp_build_c_cast): Likewise.
(check_return_expr): Likewise.
(cp_apply_type_quals_to_decl): Likewise.
* init.c (perform_member_init): Likewise.
(build_new_1): Likewise.
* decl.c (warn_extern_redeclared_static): Likewise.
(duplicate_decls): Likewise.
(decl_jump_unsafe): Likewise.
(check_previous_goto_1): Likewise.
(check_goto): Likewise.
(define_label): Likewise.
(check_tag_decl): Likewise.
(start_decl): Likewise.
(check_class_member_definition_namespace): Likewise.
(grokfndecl): Likewise.
(check_static_variable_definition): Likewise.
(compute_array_index_type): Likewise. Use OPT_Wvla for pedwarn
conditional on -Wvla.
(grokdeclarator): Likewise. Use either 0 or OPT_pedantic.
(grok_op_properties): Likewise.
* call.c (build_conditional_expr): Likewise.
* except.c (check_handlers): Likewise.
* error.c (maybe_warn_variadic_templates): Likewise.
* friend.c (make_friend_class): Likewise.
* typeck2.c (cxx_incomplete_type_diagnostic): Likewise.
(digest_init): Likewise.
* pt.c (check_specialization_namespace): Likewise.
(check_explicit_instantiation_namespace): Likewise.
(maybe_process_partial_specialization): Likewise.
(check_explicit_specialization): Likewise.
(convert_template_argument): Likewise.
(do_decl_instantiation): Likewise.
(do_type_instantiation): Likewise.
(instantiate_decl): Likewise.
* semantics.c (finish_translation_unit): Likewise.
* name-lookup.c (pushdecl_maybe_friend): Likewise.
(check_for_out_of_scope_variable): Likewise.
(finish_static_data_member_decl): Likewise.
(build_anon_union_vars): Likewise.
(coerce_new_type): Likewise.
* parser.c (cp_parser_check_decl_spec): Use OPT_Wlong_long.
(cp_parser_primary_expression): Likewise.
(cp_parser_nested_name_specifier_opt): Likewise.
(cp_parser_postfix_expression): Likewise.
(cp_parser_jump_statement): Likewise.
(cp_parser_declaration_seq_opt): Likewise.
(cp_parser_mem_initializer): Likewise.
(cp_parser_elaborated_type_specifier): Likewise.
(cp_parser_enumerator_list): Likewise.
(cp_parser_initializer_list): Likewise.
(cp_parser_class_head): Likewise.
(cp_parser_member_declaration): Likewise.
(cp_parser_token_is_class_key): Likewise.
testsuite/
* gcc.dg/Wdeclaration-after-statement-3.c: New.
* gcc/testsuite/gcc.dg/Wpointer-arith.c: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-pedwarn0-4.diff
Type: text/x-diff
Size: 146436 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080613/38523e50/attachment.bin>
More information about the Gcc-patches
mailing list