From 0ecf545c6e542cc5eee78eac97d200b55e11001f Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 5 Jun 2019 18:30:48 +0000 Subject: [PATCH] c-decl.c (start_decl): Adjust quoting and hyphenation in diagnostics. gcc/c/ChangeLog: * c-decl.c (start_decl): Adjust quoting and hyphenation in diagnostics. (finish_decl): Same. (finish_enum): Same. (start_function): Same. (declspecs_add_type): Same. * c-parser.c (warn_for_abs): Same. * c-typeck.c (build_binary_op): Same. gcc/c-family/ChangeLog: * c-attribs.c (handle_mode_attribute): Adjust quoting and hyphenation. (handle_alias_ifunc_attribute): Same. (handle_copy_attribute): Same. (handle_weakref_attribute): Same. (handle_nonnull_attribute): Same. * c-warn.c (warn_for_sign_compare): Same. (warn_for_restrict): Same. * c.opt: Same. gcc/cp/ChangeLog: * call.c (build_conditional_expr_1): Adjust quoting and hyphenation. (convert_like_real): Same. (convert_arg_to_ellipsis): Same. * constexpr.c (diag_array_subscript): Same. * constraint.cc (diagnose_trait_expression): Same. * cvt.c (ocp_convert): Same. * decl.c (start_decl): Same. (check_for_uninitialized_const_var): Same. (grokfndecl): Same. (check_special_function_return_type): Same. (finish_enum_value_list): Same. (start_preparsed_function): Same. * parser.c (cp_parser_decl_specifier_seq): Same. * typeck.c (cp_build_binary_op): Same. (build_static_cast_1): Same. gcc/lto/ChangeLog: * lto-common.c (lto_file_finalize): Adjust quoting and hyphenation. gcc/objc/ChangeLog: * objc-act.c (objc_build_setter_call): Adjust quoting and hyphenation. * objc-encoding.c (encode_gnu_bitfield): Same. gcc/ChangeLog: * config/i386/i386-features.c (ix86_get_function_versions_dispatcher): Adjust quoting and hyphenation. * convert.c (convert_to_real_1): Same. * gcc.c (driver_wrong_lang_callback): Same. (driver::handle_unrecognized_options): Same. * gimple-ssa-nonnull-compare.c (do_warn_nonnull_compare): Same. * opts-common.c (cmdline_handle_error): Same. (read_cmdline_option): Same. * opts-global.c (complain_wrong_lang): Same. (print_ignored_options): Same. (handle_common_deferred_options): Same. * pretty-print.h: Same. * print-rtl.c (debug_bb_n_slim): Same. * sched-rgn.c (make_pass_sched_fusion): Same. * tree-cfg.c (verify_gimple_assign_unary): Same. (verify_gimple_label): Same. * tree-ssa-operands.c (verify_ssa_operands): Same. * varasm.c (do_assemble_alias): Same. (assemble_alias): Same. From-SVN: r271971 --- gcc/ChangeLog | 22 + gcc/c-family/ChangeLog | 11 + gcc/c-family/c-attribs.c | 23 +- gcc/c-family/c-warn.c | 15 +- gcc/c/ChangeLog | 11 + gcc/c/c-decl.c | 16 +- gcc/c/c-parser.c | 20 +- gcc/cfghooks.c | 10 + gcc/cfgloop.c | 15 +- gcc/cfgrtl.c | 10 + gcc/cgraph.c | 13 + gcc/config/i386/i386-features.c | 2 +- gcc/configure | 4 +- gcc/configure.ac | 7 +- gcc/convert.c | 6 +- gcc/cp/ChangeLog | 18 + gcc/cp/call.c | 16 +- gcc/cp/constexpr.c | 4 +- gcc/cp/constraint.cc | 6 +- gcc/cp/cvt.c | 2 +- gcc/cp/decl.c | 12 +- gcc/cp/parser.c | 2 +- gcc/cp/typeck.c | 8 +- gcc/diagnostic-show-locus.c | 11 + gcc/diagnostic.c | 11 + gcc/gcc.c | 6 +- gcc/gimple-pretty-print.c | 11 + gcc/gimple-ssa-nonnull-compare.c | 2 +- gcc/graph.c | 13 +- gcc/lto/ChangeLog | 4 + gcc/lto/lto-common.c | 3 +- gcc/objc/ChangeLog | 5 + gcc/objc/objc-act.c | 2 +- gcc/objc/objc-encoding.c | 2 +- gcc/opts-common.c | 6 +- gcc/opts-global.c | 10 +- gcc/print-rtl.c | 11 + gcc/sched-rgn.c | 11 + gcc/symtab.c | 13 + gcc/testsuite/c-c++-common/nonnull-1.c | 12 +- gcc/testsuite/c-c++-common/nonnull-2.c | 8 +- gcc/testsuite/c-c++-common/nonnull-3.c | 2 +- gcc/testsuite/c-c++-common/pr35503-1.c | 2 +- gcc/testsuite/c-c++-common/pr35503-2.c | 2 +- gcc/testsuite/c-c++-common/pr35503-3.c | 2 +- gcc/testsuite/g++.dg/abi/empty12.C | 2 +- gcc/testsuite/g++.dg/abi/empty13.C | 2 +- gcc/testsuite/g++.dg/abi/empty14.C | 2 +- gcc/testsuite/g++.dg/abi/empty15.C | 2 +- gcc/testsuite/g++.dg/abi/empty16.C | 2 +- gcc/testsuite/g++.dg/abi/empty17.C | 2 +- gcc/testsuite/g++.dg/abi/empty18.C | 2 +- gcc/testsuite/g++.dg/abi/empty19.C | 2 +- gcc/testsuite/g++.dg/abi/empty22.C | 2 +- gcc/testsuite/g++.dg/abi/empty25.C | 2 +- gcc/testsuite/g++.dg/abi/empty26.C | 2 +- gcc/testsuite/g++.dg/concepts/decl-diagnose.C | 2 +- gcc/testsuite/g++.dg/conversion/bitfield7.C | 2 +- gcc/testsuite/g++.dg/cpp0x/addressof2.C | 2 +- .../g++.dg/cpp0x/constexpr-condition.C | 2 +- gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C | 2 +- .../g++.dg/cpp0x/constexpr-object1.C | 2 +- gcc/testsuite/g++.dg/cpp0x/defaulted2.C | 2 +- .../g++.dg/cpp0x/gnu_fext-numeric-literals.C | 24 +- gcc/testsuite/g++.dg/cpp0x/pr42844-2.C | 8 +- gcc/testsuite/g++.dg/cpp0x/pr83993.C | 6 +- .../g++.dg/cpp0x/std_fext-numeric-literals.C | 24 +- gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C | 4 +- gcc/testsuite/g++.dg/cpp1z/inline-var2.C | 4 +- gcc/testsuite/g++.dg/cpp2a/decomp3.C | 6 +- gcc/testsuite/g++.dg/init/pr42844.C | 12 +- gcc/testsuite/g++.dg/tree-ssa/pr20280.C | 6 +- gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C | 8 +- gcc/testsuite/g++.dg/warn/Wrestrict-1.C | 2 +- gcc/testsuite/g++.dg/warn/Wrestrict-2.C | 8 +- gcc/testsuite/g++.dg/warn/nonnull3.C | 2 +- gcc/testsuite/g++.dg/warn/pr8715.C | 2 +- gcc/testsuite/g++.old-deja/g++.other/cond5.C | 4 +- gcc/testsuite/gcc.dg/attr-noinline.c | 6 +- gcc/testsuite/gcc.dg/attr-noipa.c | 2 +- gcc/testsuite/gcc.dg/attr-weakref-2.c | 2 +- gcc/testsuite/gcc.dg/cast-1.c | 4 +- gcc/testsuite/gcc.dg/cast-2.c | 4 +- gcc/testsuite/gcc.dg/cast-3.c | 4 +- gcc/testsuite/gcc.dg/dfp/cast-bad.c | 12 +- gcc/testsuite/gcc.dg/dfp/warn-abs-2.c | 10 +- gcc/testsuite/gcc.dg/enum-mode-1.c | 12 +- gcc/testsuite/gcc.dg/format/gcc_diag-1.c | 2 +- gcc/testsuite/gcc.dg/format/gcc_diag-11.c | 455 ++++++++++++++++++ gcc/testsuite/gcc.dg/funroll-loops-all.c | 2 +- gcc/testsuite/gcc.dg/opts-5.c | 2 +- gcc/testsuite/gcc.dg/pr28322-2.c | 2 +- gcc/testsuite/gcc.dg/pr28322-3.c | 4 +- gcc/testsuite/gcc.dg/pr60087.c | 6 +- gcc/testsuite/gcc.dg/pr78957.c | 2 +- gcc/testsuite/gcc.dg/pr8715.c | 2 +- gcc/testsuite/gcc.dg/simd-2.c | 4 +- gcc/testsuite/gcc.dg/spellcheck-options-1.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-10.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-12.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-13.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-18.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-19.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-2.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-20.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-3.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-4.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-5.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-6.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-7.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-8.c | 2 +- gcc/testsuite/gcc.dg/spellcheck-options-9.c | 2 +- gcc/testsuite/gcc.dg/warn-abs-1.c | 6 +- .../gcc.target/i386/spellcheck-options-5.c | 2 +- .../obj-c++.dg/property/dotsyntax-17.mm | 10 +- .../obj-c++.dg/property/property-neg-7.mm | 8 +- gcc/testsuite/objc.dg/property/dotsyntax-17.m | 10 +- .../objc.dg/property/property-neg-7.m | 8 +- gcc/tree-cfg.c | 4 +- gcc/tree-eh.c | 12 + gcc/tree-pretty-print.c | 11 + gcc/tree-ssa-operands.c | 14 +- gcc/tree-ssa.c | 12 + gcc/varasm.c | 8 +- 124 files changed, 960 insertions(+), 270 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/format/gcc_diag-11.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 00ab0d9ecd70..f7bf3b20305c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2019-06-05 Martin Sebor + + * config/i386/i386-features.c (ix86_get_function_versions_dispatcher): + Adjust quoting and hyphenation. + * convert.c (convert_to_real_1): Same. + * gcc.c (driver_wrong_lang_callback): Same. + (driver::handle_unrecognized_options): Same. + * gimple-ssa-nonnull-compare.c (do_warn_nonnull_compare): Same. + * opts-common.c (cmdline_handle_error): Same. + (read_cmdline_option): Same. + * opts-global.c (complain_wrong_lang): Same. + (print_ignored_options): Same. + (handle_common_deferred_options): Same. + * pretty-print.h: Same. + * print-rtl.c (debug_bb_n_slim): Same. + * sched-rgn.c (make_pass_sched_fusion): Same. + * tree-cfg.c (verify_gimple_assign_unary): Same. + (verify_gimple_label): Same. + * tree-ssa-operands.c (verify_ssa_operands): Same. + * varasm.c (do_assemble_alias): Same. + (assemble_alias): Same. + 2019-06-05 Richard Henderson * config/alpha/alpha.c (direct_return): Move down after diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index e74e9258a1c1..179e376fb910 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,14 @@ +2019-06-05 Martin Sebor + + * c-attribs.c (handle_mode_attribute): Adjust quoting and hyphenation. + (handle_alias_ifunc_attribute): Same. + (handle_copy_attribute): Same. + (handle_weakref_attribute): Same. + (handle_nonnull_attribute): Same. + * c-warn.c (warn_for_sign_compare): Same. + (warn_for_restrict): Same. + * c.opt: Same. + 2019-06-05 Martin Sebor * c-pragma.c (handle_pragma_weak): Adjust quoting in a diagnostic. diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index 517b7e0dd01e..7a8d3935d799 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -1821,7 +1821,7 @@ handle_mode_attribute (tree *node, tree name, tree args, this mode for this type. */ if (TREE_CODE (typefm) != INTEGER_TYPE) { - error ("cannot use mode %qs for enumeral types", p); + error ("cannot use mode %qs for enumerated types", p); return NULL_TREE; } @@ -2326,12 +2326,8 @@ handle_alias_ifunc_attribute (bool is_alias, tree *node, tree name, tree args, { struct symtab_node *n = symtab_node::get (decl); if (n && n->refuse_visibility_changes) - { - if (is_alias) - error ("%+qD declared alias after being used", decl); - else - error ("%+qD declared ifunc after being used", decl); - } + error ("%+qD declared %qs after being used", + decl, is_alias ? "alias" : "ifunc"); } @@ -2548,7 +2544,7 @@ handle_copy_attribute (tree *node, tree name, tree args, attribute_spec.handler. */ static tree -handle_weakref_attribute (tree *node, tree ARG_UNUSED (name), tree args, +handle_weakref_attribute (tree *node, tree name, tree args, int flags, bool *no_add_attrs) { tree attr = NULL_TREE; @@ -2567,7 +2563,8 @@ handle_weakref_attribute (tree *node, tree ARG_UNUSED (name), tree args, if (lookup_attribute ("ifunc", DECL_ATTRIBUTES (*node))) { - error ("indirect function %q+D cannot be declared weakref", *node); + error ("indirect function %q+D cannot be declared %qE", + *node, name); *no_add_attrs = true; return NULL_TREE; } @@ -2589,7 +2586,8 @@ handle_weakref_attribute (tree *node, tree ARG_UNUSED (name), tree args, { if (lookup_attribute ("alias", DECL_ATTRIBUTES (*node))) error_at (DECL_SOURCE_LOCATION (*node), - "weakref attribute must appear before alias attribute"); + "%qE attribute must appear before %qs attribute", + name, "alias"); /* Can't call declare_weak because it wants this to be TREE_PUBLIC, and that isn't supported; and because it wants to add it to @@ -2601,7 +2599,7 @@ handle_weakref_attribute (tree *node, tree ARG_UNUSED (name), tree args, { struct symtab_node *n = symtab_node::get (*node); if (n && n->refuse_visibility_changes) - error ("%+qD declared weakref after being used", *node); + error ("%+qD declared %qE after being used", *node, name); } return NULL_TREE; @@ -3625,7 +3623,8 @@ handle_nonnull_attribute (tree *node, tree name, && (!TYPE_ATTRIBUTES (type) || !lookup_attribute ("type generic", TYPE_ATTRIBUTES (type)))) { - error ("nonnull attribute without arguments on a non-prototype"); + error ("%qE attribute without arguments on a non-prototype", + name); *no_add_attrs = true; } return NULL_TREE; diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c index fa7b6ddea555..5941c10cddb6 100644 --- a/gcc/c-family/c-warn.c +++ b/gcc/c-family/c-warn.c @@ -2232,10 +2232,12 @@ warn_for_sign_compare (location_t location, { if (constant == 0) warning_at (location, OPT_Wsign_compare, - "promoted ~unsigned is always non-zero"); + "promoted bitwise complement of an unsigned " + "value is always nonzero"); else warning_at (location, OPT_Wsign_compare, - "comparison of promoted ~unsigned with constant"); + "comparison of promoted bitwise complement " + "of an unsigned value with constant"); } } } @@ -2245,7 +2247,8 @@ warn_for_sign_compare (location_t location, && (TYPE_PRECISION (TREE_TYPE (op1)) < TYPE_PRECISION (result_type))) warning_at (location, OPT_Wsign_compare, - "comparison of promoted ~unsigned with unsigned"); + "comparison of promoted bitwise complement " + "of an unsigned value with unsigned"); } } @@ -2597,11 +2600,11 @@ warn_for_restrict (unsigned param_pos, tree *argarray, unsigned nargs) } return warning_n (&richloc, OPT_Wrestrict, arg_positions.length (), - "passing argument %i to restrict-qualified parameter" + "passing argument %i to %qs-qualified parameter" " aliases with argument %Z", - "passing argument %i to restrict-qualified parameter" + "passing argument %i to %qs-qualified parameter" " aliases with arguments %Z", - param_pos + 1, arg_positions.address (), + param_pos + 1, "restrict", arg_positions.address (), arg_positions.length ()); } diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index cfbd164fdc3c..05f3866185b3 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,14 @@ +2019-06-05 Martin Sebor + + * c-decl.c (start_decl): Adjust quoting and hyphenation + in diagnostics. + (finish_decl): Same. + (finish_enum): Same. + (start_function): Same. + (declspecs_add_type): Same. + * c-parser.c (warn_for_abs): Same. + * c-typeck.c (build_binary_op): Same. + 2019-05-17 Thomas Schwinge PR c/89433 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 181a8c2e9aa0..87ce853d4b7d 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5013,8 +5013,8 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, && DECL_DECLARED_INLINE_P (decl) && DECL_UNINLINABLE (decl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl))) - warning (OPT_Wattributes, "inline function %q+D given attribute noinline", - decl); + warning (OPT_Wattributes, "inline function %q+D given attribute %qs", + decl, "noinline"); /* C99 6.7.4p3: An inline definition of a function with external linkage shall not contain a definition of a modifiable object @@ -5399,7 +5399,7 @@ finish_decl (tree decl, location_t init_loc, tree init, type = strip_array_types (type); if (TREE_READONLY (decl)) warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat, - "uninitialized const %qD is invalid in C++", decl); + "uninitialized % is invalid in C++", decl); else if (RECORD_OR_UNION_TYPE_P (type) && C_TYPE_FIELDS_READONLY (type)) diagnose_uninitialized_cst_member (decl, type); @@ -8674,7 +8674,7 @@ finish_enum (tree enumtype, tree values, tree attributes) if (precision > TYPE_PRECISION (enumtype)) { TYPE_PRECISION (enumtype) = 0; - error ("specified mode too small for enumeral values"); + error ("specified mode too small for enumerated values"); } else precision = TYPE_PRECISION (enumtype); @@ -8935,8 +8935,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, && DECL_UNINLINABLE (decl1) && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl1))) warning_at (loc, OPT_Wattributes, - "inline function %qD given attribute noinline", - decl1); + "inline function %qD given attribute %qs", + decl1, "noinline"); /* Handle gnu_inline attribute. */ if (declspecs->inline_p @@ -10941,10 +10941,10 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, } if (!targetm.decimal_float_supported_p ()) error_at (loc, - ("decimal floating point not supported " + ("decimal floating-point not supported " "for this target")); pedwarn (loc, OPT_Wpedantic, - "ISO C does not support decimal floating point"); + "ISO C does not support decimal floating-point"); return specs; case RID_FRACT: case RID_ACCUM: diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 8f610242435f..84ee576866e6 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -9420,7 +9420,7 @@ warn_for_abs (location_t loc, tree fndecl, tree arg) if (SCALAR_FLOAT_TYPE_P (atype)) warning_at (loc, OPT_Wabsolute_value, "using integer absolute value function %qD when " - "argument is of floating point type %qT", + "argument is of floating-point type %qT", fndecl, atype); else if (TREE_CODE (atype) == COMPLEX_TYPE) warning_at (loc, OPT_Wabsolute_value, @@ -9443,16 +9443,16 @@ warn_for_abs (location_t loc, tree fndecl, tree arg) { if (INTEGRAL_TYPE_P (atype)) warning_at (loc, OPT_Wabsolute_value, - "using floating point absolute value function %qD " + "using floating-point absolute value function %qD " "when argument is of integer type %qT", fndecl, atype); else if (DECIMAL_FLOAT_TYPE_P (atype)) warning_at (loc, OPT_Wabsolute_value, - "using floating point absolute value function %qD " - "when argument is of decimal floating point type %qT", + "using floating-point absolute value function %qD " + "when argument is of decimal floating-point type %qT", fndecl, atype); else if (TREE_CODE (atype) == COMPLEX_TYPE) warning_at (loc, OPT_Wabsolute_value, - "using floating point absolute value function %qD when " + "using floating-point absolute value function %qD when " "argument is of complex type %qT", fndecl, atype); else gcc_unreachable (); @@ -9470,7 +9470,7 @@ warn_for_abs (location_t loc, tree fndecl, tree arg) else if (SCALAR_FLOAT_TYPE_P (atype)) warning_at (loc, OPT_Wabsolute_value, "using complex absolute value function %qD when " - "argument is of floating point type %qT", + "argument is of floating-point type %qT", fndecl, atype); else gcc_unreachable (); @@ -9486,17 +9486,17 @@ warn_for_abs (location_t loc, tree fndecl, tree arg) { if (INTEGRAL_TYPE_P (atype)) warning_at (loc, OPT_Wabsolute_value, - "using decimal floating point absolute value " + "using decimal floating-point absolute value " "function %qD when argument is of integer type %qT", fndecl, atype); else if (SCALAR_FLOAT_TYPE_P (atype)) warning_at (loc, OPT_Wabsolute_value, - "using decimal floating point absolute value " - "function %qD when argument is of floating point " + "using decimal floating-point absolute value " + "function %qD when argument is of floating-point " "type %qT", fndecl, atype); else if (TREE_CODE (atype) == COMPLEX_TYPE) warning_at (loc, OPT_Wabsolute_value, - "using decimal floating point absolute value " + "using decimal floating-point absolute value " "function %qD when argument is of complex type %qT", fndecl, atype); else diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index a1d603a207ec..a25441b26401 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -32,6 +32,12 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa.h" #include "cfgloop.h" +/* Disable warnings about missing quoting in GCC diagnostics. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* A pointer to one of the hooks containers. */ static struct cfg_hooks *cfg_hooks; @@ -1491,3 +1497,7 @@ profile_record_account_profile (profile_record *record) cfg_hooks->account_profile_record (bb, record); } } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index e115de6aae2d..f64326b944e6 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -1363,6 +1363,15 @@ cancel_loop_tree (struct loop *loop) cancel_loop (loop); } +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow GCC + diagnostic conventions and the calls are ultimately followed by + a deliberate ICE triggered by a failed assertion. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Checks that information about loops is correct -- sizes of loops are all right -- results of get_loop_body really belong to the loop @@ -1677,7 +1686,7 @@ verify_loop_structure (void) if (eloops != 0) { - error ("wrong list of exited loops for edge %d->%d", + error ("wrong list of exited loops for edge %d->%d", e->src->index, e->dest->index); err = 1; } @@ -1712,6 +1721,10 @@ verify_loop_structure (void) free_dominance_info (CDI_DOMINATORS); } +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + /* Returns latch edge of LOOP. */ edge loop_latch_edge (const struct loop *loop) diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index e06fb8d5a408..a1ca5992c414 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -62,6 +62,12 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "print-rtl.h" +/* Disable warnings about missing quoting in GCC diagnostics. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Holds the interesting leading and trailing notes for the function. Only applicable if the CFG is in cfglayout mode. */ static GTY(()) rtx_insn *cfg_layout_function_footer; @@ -5191,3 +5197,7 @@ struct cfg_hooks cfg_layout_rtl_cfg_hooks = { }; #include "gt-cfgrtl.h" + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/cgraph.c b/gcc/cgraph.c index b1b0b4c42d5c..28019aba4347 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3095,6 +3095,15 @@ cgraph_edge::verify_corresponds_to_fndecl (tree decl) return false; } +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow GCC + diagnostic conventions and the calls are ultimately followed by + one to internal_error. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Verify cgraph nodes of given cgraph node. */ DEBUG_FUNCTION void cgraph_node::verify_node (void) @@ -3470,6 +3479,10 @@ cgraph_node::verify_cgraph_nodes (void) node->verify (); } +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + /* Walk the alias chain to return the function cgraph_node is alias of. Walk through thunks, too. When AVAILABILITY is non-NULL, get minimal availability in the chain. diff --git a/gcc/config/i386/i386-features.c b/gcc/config/i386/i386-features.c index c8de5261240c..51f88ae4d8a4 100644 --- a/gcc/config/i386/i386-features.c +++ b/gcc/config/i386/i386-features.c @@ -2581,7 +2581,7 @@ ix86_get_function_versions_dispatcher (void *decl) #endif { error_at (DECL_SOURCE_LOCATION (default_node->decl), - "multiversioning needs ifunc which is not supported " + "multiversioning needs % which is not supported " "on this target"); } diff --git a/gcc/configure b/gcc/configure index 4a3d5eefcb88..c9062cca9d68 100755 --- a/gcc/configure +++ b/gcc/configure @@ -6739,7 +6739,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu loose_warn= save_CXXFLAGS="$CXXFLAGS" -for real_option in -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual $wf_opt; do +for real_option in -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag $wf_opt; do # Do the check with the no- prefix removed since gcc silently # accepts any -Wno-* option on purpose case $real_option in @@ -6797,7 +6797,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu c_loose_warn= save_CFLAGS="$CFLAGS" -for real_option in -Wstrict-prototypes -Wmissing-prototypes; do +for real_option in -Wstrict-prototypes -Wmissing-prototypes-Wno-error=format-diag; do # Do the check with the no- prefix removed since gcc silently # accepts any -Wno-* option on purpose case $real_option in diff --git a/gcc/configure.ac b/gcc/configure.ac index 35982fdc9ed5..cbc0c25fa2b5 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -483,10 +483,11 @@ AS_IF([test $enable_build_format_warnings = no], [wf_opt=-Wno-format],[wf_opt=]) ACX_PROG_CXX_WARNING_OPTS( m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ], - [-Wcast-qual $wf_opt])), [loose_warn]) + [-Wcast-qual -Wno-error=format-diag $wf_opt])), + [loose_warn]) ACX_PROG_CC_WARNING_OPTS( - m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])), - [c_loose_warn]) + m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes ], + [-Wno-error=format-diag])), [c_loose_warn]) ACX_PROG_CXX_WARNING_OPTS( m4_quote(m4_do([-Wmissing-format-attribute ], [-Woverloaded-virtual])), [strict_warn]) diff --git a/gcc/convert.c b/gcc/convert.c index d5aa07b510e0..a8f2bd049ba0 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -235,7 +235,7 @@ convert_to_real_1 (tree type, tree expr, bool fold_p) (T1) sqrtT4 ((T4) exprT3) , where T1 is TYPE, T2 is ITYPE, T3 is TREE_TYPE (ARG0), - and T4 is NEWTYPE. All those types are of floating point types. + and T4 is NEWTYPE. All those types are of floating-point types. T4 (NEWTYPE) should be narrower than T2 (ITYPE). This conversion is safe only if P1 >= P2*2+2, where P1 and P2 are precisions of T2 and T4. See the following URL for a reference: @@ -415,11 +415,11 @@ convert_to_real_1 (tree type, tree expr, bool fold_p) case POINTER_TYPE: case REFERENCE_TYPE: - error ("pointer value used where a floating point was expected"); + error ("pointer value used where a floating-point was expected"); return convert_to_real_1 (type, integer_zero_node, fold_p); default: - error ("aggregate value used where a floating point was expected"); + error ("aggregate value used where a floating-point was expected"); return convert_to_real_1 (type, integer_zero_node, fold_p); } } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 31d987144e91..0056cc265255 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,21 @@ +2019-06-05 Martin Sebor + + * call.c (build_conditional_expr_1): Adjust quoting and hyphenation. + (convert_like_real): Same. + (convert_arg_to_ellipsis): Same. + * constexpr.c (diag_array_subscript): Same. + * constraint.cc (diagnose_trait_expression): Same. + * cvt.c (ocp_convert): Same. + * decl.c (start_decl): Same. + (check_for_uninitialized_const_var): Same. + (grokfndecl): Same. + (check_special_function_return_type): Same. + (finish_enum_value_list): Same. + (start_preparsed_function): Same. + * parser.c (cp_parser_decl_specifier_seq): Same. + * typeck.c (cp_build_binary_op): Same. + (build_static_cast_1): Same. + 2019-06-04 Nina Dinka Ranns PR c++/63149 - Wrong auto deduction from braced-init-list. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4d9331f98c2b..c04ca2ee7ce6 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5067,7 +5067,7 @@ build_conditional_expr_1 (const op_location_t &loc, { if (complain & tf_error) error_at (loc, "inferred scalar type %qT is not an integer or " - "floating point type of the same size as %qT", stype, + "floating-point type of the same size as %qT", stype, COMPARISON_CLASS_P (arg1) ? TREE_TYPE (TREE_TYPE (TREE_OPERAND (arg1, 0))) : ctype); @@ -5486,8 +5486,8 @@ build_conditional_expr_1 (const op_location_t &loc, /* Two enumerators from the same enumeration can have different types when the enumeration is still being defined. */; else if (complain & tf_warning) - warning_at (loc, OPT_Wenum_compare, "enumeral mismatch in " - "conditional expression: %qT vs %qT", + warning_at (loc, OPT_Wenum_compare, "enumerated mismatch " + "in conditional expression: %qT vs %qT", arg2_type, arg3_type); } else if (extra_warnings @@ -5498,8 +5498,8 @@ build_conditional_expr_1 (const op_location_t &loc, type_promotes_to (arg3_type))))) { if (complain & tf_warning) - warning_at (loc, OPT_Wextra, "enumeral and non-enumeral type in " - "conditional expression"); + warning_at (loc, OPT_Wextra, "enumerated and non-enumerated " + "type in conditional expression"); } arg2 = perform_implicit_conversion (result_type, arg2, complain); @@ -7380,7 +7380,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, /* If the reference is volatile or non-const, we cannot create a temporary. */ if (lvalue & clk_bitfield) - error_at (loc, "cannot bind bitfield %qE to %qT", + error_at (loc, "cannot bind bit-field %qE to %qT", expr, ref_type); else if (lvalue & clk_packed) error_at (loc, "cannot bind packed field %qE to %qT", @@ -7487,8 +7487,8 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain) /* [expr.call] If the argument has integral or enumeration type that is subject - to the integral promotions (_conv.prom_), or a floating point - type that is subject to the floating point promotion + to the integral promotions (_conv.prom_), or a floating-point + type that is subject to the floating-point promotion (_conv.fpprom_), the value of the argument is converted to the promoted type before the call. */ if (TREE_CODE (arg_type) == REAL_TYPE diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 84c983428357..15bfb6d81484 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -2483,7 +2483,7 @@ diag_array_subscript (const constexpr_ctx *ctx, tree array, tree index) error ("array subscript value %qE is outside the bounds " "of array %qD of type %qT", sidx, array, arraytype); else - error ("non-zero array subscript %qE is used with array %qD of " + error ("nonzero array subscript %qE is used with array %qD of " "type %qT with unknown bounds", sidx, array, arraytype); inform (DECL_SOURCE_LOCATION (array), "declared here"); } @@ -2491,7 +2491,7 @@ diag_array_subscript (const constexpr_ctx *ctx, tree array, tree index) error ("array subscript value %qE is outside the bounds " "of array type %qT", sidx, arraytype); else - error ("non-zero array subscript %qE is used with array of type %qT " + error ("nonzero array subscript %qE is used with array of type %qT " "with unknown bounds", sidx, arraytype); } } diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 9884eb0db50e..ed39ecce7179 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -2693,13 +2693,13 @@ diagnose_trait_expression (location_t loc, tree, tree cur, tree args) switch (TRAIT_EXPR_KIND (expr)) { case CPTK_HAS_NOTHROW_ASSIGN: - inform (loc, " %qT is not nothrow copy assignable", t1); + inform (loc, " %qT is not % copy assignable", t1); break; case CPTK_HAS_NOTHROW_CONSTRUCTOR: - inform (loc, " %qT is not nothrow default constructible", t1); + inform (loc, " %qT is not % default constructible", t1); break; case CPTK_HAS_NOTHROW_COPY: - inform (loc, " %qT is not nothrow copy constructible", t1); + inform (loc, " %qT is not % copy constructible", t1); break; case CPTK_HAS_TRIVIAL_ASSIGN: inform (loc, " %qT is not trivially copy assignable", t1); diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 7ebbf3c80c49..1c405ecd7b62 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -883,7 +883,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags, return rval; else if (complain & tf_error) error_at (loc, - "%q#T used where a floating point value was expected", + "%q#T used where a floating-point value was expected", TREE_TYPE (e)); } if (code == REAL_TYPE) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 23b2a4c2831c..f342f8b1c651 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5131,7 +5131,7 @@ start_decl (const cp_declarator *declarator, && DECL_UNINLINABLE (decl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl))) warning_at (DECL_SOURCE_LOCATION (decl), 0, - "inline function %qD given attribute noinline", decl); + "inline function %qD given attribute %qs", decl, "noinline"); if (TYPE_P (context) && COMPLETE_TYPE_P (complete_type (context))) { @@ -5703,7 +5703,7 @@ check_for_uninitialized_const_var (tree decl, bool constexpr_context_p, { if (complain & tf_error) show_notes = permerror (DECL_SOURCE_LOCATION (decl), - "uninitialized const %qD", decl); + "uninitialized %", decl); } else { @@ -9148,7 +9148,7 @@ grokfndecl (tree ctype, else if (long_double_p) { if (cpp_interpret_float_suffix (parse_in, suffix, strlen (suffix))) - warning_at (location, 0, "floating point suffix %qs" + warning_at (location, 0, "floating-point suffix %qs" " shadowed by implementation", suffix); } /* 17.6.3.3.5 */ @@ -10184,7 +10184,7 @@ check_special_function_return_type (special_function_kind sfk, for (int i = 0; i < ds_last; ++i) if (i != ds_explicit && locations[i]) error_at (locations[i], - "decl-specifier in declaration of deduction guide"); + "% in declaration of deduction guide"); break; default: @@ -14747,7 +14747,7 @@ finish_enum_value_list (tree enumtype) if (TYPE_PRECISION (enumtype)) { if (precision > TYPE_PRECISION (enumtype)) - error ("specified mode too small for enumeral values"); + error ("specified mode too small for enumerated values"); else { use_short_enum = true; @@ -15276,7 +15276,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) if (DECL_DECLARED_INLINE_P (decl1) && lookup_attribute ("noinline", attrs)) warning_at (DECL_SOURCE_LOCATION (decl1), 0, - "inline function %qD given attribute noinline", decl1); + "inline function %qD given attribute %qs", decl1, "noinline"); /* Handle gnu_inline attribute. */ if (GNU_INLINE_P (decl1)) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 94411447e1dd..308b2d4ad700 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -14075,7 +14075,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser, if (found_decl_spec && (flags & CP_PARSER_FLAGS_ONLY_TYPE_OR_CONSTEXPR) && token->keyword != RID_CONSTEXPR) - error ("decl-specifier invalid in condition"); + error ("% invalid in condition"); if (found_decl_spec && (flags & CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index b9fa6f1d2732..eab800305ec1 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4887,7 +4887,7 @@ cp_build_binary_op (const op_location_t &location, && c_inhibit_evaluation_warnings == 0 && (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1))) warning (OPT_Wfloat_equal, - "comparing floating point with %<==%> or % is unsafe"); + "comparing floating-point with %<==%> or % is unsafe"); if (complain & tf_warning) { tree stripped_orig_op0 = tree_strip_any_location_wrapper (orig_op0); @@ -5288,7 +5288,7 @@ cp_build_binary_op (const op_location_t &location, if (code0 != REAL_TYPE || code1 != REAL_TYPE) { if (complain & tf_error) - error ("unordered comparison on non-floating point argument"); + error ("unordered comparison on non-floating-point argument"); return error_mark_node; } common = 1; @@ -7239,8 +7239,8 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p, conversion does not cast away constness (_expr.const.cast_), and the following additional rules for specific cases: */ /* For reference, the conversions not excluded are: integral - promotions, floating point promotion, integral conversions, - floating point conversions, floating-integral conversions, + promotions, floating-point promotion, integral conversions, + floating-point conversions, floating-integral conversions, pointer conversions, and pointer to member conversions. */ /* DR 128 diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c index 205ee56f4099..89074beb6d10 100644 --- a/gcc/diagnostic-show-locus.c +++ b/gcc/diagnostic-show-locus.c @@ -39,6 +39,13 @@ along with GCC; see the file COPYING3. If not see # include #endif +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Classes for rendering source code and diagnostics, within an anonymous namespace. The work is done by "class layout", which embeds and uses @@ -3740,3 +3747,7 @@ diagnostic_show_locus_c_tests () } // namespace selftest #endif /* #if CHECKING_P */ + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index be6b65722cd5..4761b4349d39 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -43,6 +43,13 @@ along with GCC; see the file COPYING3. If not see # include #endif +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + #define pedantic_warning_kind(DC) \ ((DC)->pedantic_errors ? DK_ERROR : DK_WARNING) #define permissive_error_kind(DC) ((DC)->permissive ? DK_WARNING : DK_ERROR) @@ -1861,3 +1868,7 @@ diagnostic_c_tests () } // namespace selftest #endif /* #if CHECKING_P */ + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/gcc.c b/gcc/gcc.c index 7ebdf1f225b4..9bd65508b004 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -3769,7 +3769,7 @@ driver_wrong_lang_callback (const struct cl_decoded_option *decoded, const struct cl_option *option = &cl_options[decoded->opt_index]; if (option->cl_reject_driver) - error ("unrecognized command line option %qs", + error ("unrecognized command-line option %qs", decoded->orig_option_with_args_text); else save_switch (decoded->canonical_option[0], @@ -7846,11 +7846,11 @@ driver::handle_unrecognized_options () { const char *hint = m_option_proposer.suggest_option (switches[i].part1); if (hint) - error ("unrecognized command line option %<-%s%>;" + error ("unrecognized command-line option %<-%s%>;" " did you mean %<-%s%>?", switches[i].part1, hint); else - error ("unrecognized command line option %<-%s%>", + error ("unrecognized command-line option %<-%s%>", switches[i].part1); } } diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 10f79ea619e3..4243eb74d48c 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -43,6 +43,13 @@ along with GCC; see the file COPYING3. If not see #include "asan.h" #include "cfgloop.h" +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + #define INDENT(SPACE) \ do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0) @@ -2978,3 +2985,7 @@ percent_G_format (text_info *text) tree block = gimple_block (stmt); percent_K_format (text, gimple_location (stmt), block); } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/gimple-ssa-nonnull-compare.c b/gcc/gimple-ssa-nonnull-compare.c index e6e9ffa90843..a9449916de9a 100644 --- a/gcc/gimple-ssa-nonnull-compare.c +++ b/gcc/gimple-ssa-nonnull-compare.c @@ -99,7 +99,7 @@ do_warn_nonnull_compare (function *fun, tree arg) ? integer_zerop (op) : integer_minus_onep (op)) && !gimple_no_warning_p (stmt)) warning_at (loc, OPT_Wnonnull_compare, - "nonnull argument %qD compared to NULL", arg); + "% argument %qD compared to NULL", arg); } } diff --git a/gcc/graph.c b/gcc/graph.c index 89b203129689..33e4c0356eec 100644 --- a/gcc/graph.c +++ b/gcc/graph.c @@ -52,11 +52,18 @@ open_graph_file (const char *base, const char *mode) fp = fopen (buf, mode); if (fp == NULL) - fatal_error (input_location, "can%'t open %s: %m", buf); + fatal_error (input_location, "cannot open %s: %m", buf); return fp; } +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Draw a basic block BB belonging to the function with FUNCDEF_NO as its unique number. */ static void @@ -381,3 +388,7 @@ finish_graph_dump_file (const char *base) end_graph_dump (fp); fclose (fp); } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index a3b3c69c4912..71a849b2e1de 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2019-06-05 Martin Sebor + + * lto-common.c (lto_file_finalize): Adjust quoting and hyphenation. + 2019-05-16 Martin Sebor * lto-dump.c (lto_main): Same. diff --git a/gcc/lto/lto-common.c b/gcc/lto/lto-common.c index 078075ccd489..9d2f9c57780a 100644 --- a/gcc/lto/lto-common.c +++ b/gcc/lto/lto-common.c @@ -2061,7 +2061,8 @@ lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file) data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len); if (data == NULL) { - internal_error ("cannot read LTO decls from %s", file_data->file_name); + internal_error ("cannot read % from %s", + file_data->file_name); return; } /* Frees resolutions. */ diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index be06df7c339e..d001a508908a 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2019-06-05 Martin Sebor + + * objc-act.c (objc_build_setter_call): Adjust quoting and hyphenation. + * objc-encoding.c (encode_gnu_bitfield): Same. + 2019-05-18 Iain Sandoe * objc/objc-act.h (OCTI_INSTANCE_TYPE, OCTI_INSTANCETYPE_NAME): New. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 2173092ae264..6c188041291f 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -1747,7 +1747,7 @@ objc_build_setter_call (tree lhs, tree rhs) if (PROPERTY_READONLY (property_decl)) { - error ("readonly property cannot be set"); + error ("%qs property cannot be set", "readonly"); return error_mark_node; } else diff --git a/gcc/objc/objc-encoding.c b/gcc/objc/objc-encoding.c index 2db7c098f30c..91ad7d9547ef 100644 --- a/gcc/objc/objc-encoding.c +++ b/gcc/objc/objc-encoding.c @@ -801,7 +801,7 @@ encode_gnu_bitfield (int position, tree type, int size) else { /* Do not do any encoding, produce an error and keep going. */ - error ("trying to encode non-integer type as a bitfield"); + error ("trying to encode non-integer type as a bit-field"); return; } diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 8456dcc697bb..660dfe63858c 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -1234,7 +1234,7 @@ cmdline_handle_error (location_t loc, const struct cl_option *option, { if (errors & CL_ERR_DISABLED) { - error_at (loc, "command line option %qs" + error_at (loc, "command-line option %qs" " is not supported by this configuration", opt); return true; } @@ -1323,7 +1323,7 @@ read_cmdline_option (struct gcc_options *opts, if (decoded->opt_index == OPT_SPECIAL_unknown) { if (handlers->unknown_option_callback (decoded)) - error_at (loc, "unrecognized command line option %qs", decoded->arg); + error_at (loc, "unrecognized command-line option %qs", decoded->arg); return; } @@ -1355,7 +1355,7 @@ read_cmdline_option (struct gcc_options *opts, if (!handle_option (opts, opts_set, decoded, lang_mask, DK_UNSPECIFIED, loc, handlers, false, dc)) - error_at (loc, "unrecognized command line option %qs", opt); + error_at (loc, "unrecognized command-line option %qs", opt); } /* Set any field in OPTS, and OPTS_SET if not NULL, for option diff --git a/gcc/opts-global.c b/gcc/opts-global.c index 4aca400b815f..bf4db7759283 100644 --- a/gcc/opts-global.c +++ b/gcc/opts-global.c @@ -99,13 +99,13 @@ complain_wrong_lang (const struct cl_decoded_option *decoded, bad_lang = write_langs (lang_mask); if (opt_flags == CL_DRIVER) - error ("command line option %qs is valid for the driver but not for %s", + error ("command-line option %qs is valid for the driver but not for %s", text, bad_lang); else if (lang_mask == CL_DRIVER) gcc_unreachable (); else /* Eventually this should become a hard error IMO. */ - warning (0, "command line option %qs is valid for %s but not for %s", + warning (0, "command-line option %qs is valid for %s but not for %s", text, ok_langs, bad_lang); free (ok_langs); @@ -136,7 +136,7 @@ print_ignored_options (void) opt = ignored_options.pop (); warning_at (UNKNOWN_LOCATION, 0, - "unrecognized command line option %qs", opt); + "unrecognized command-line option %qs", opt); } } @@ -379,12 +379,12 @@ handle_common_deferred_options (void) case OPT_fdump_: if (!g->get_dumps ()->dump_switch_p (opt->arg)) - error ("unrecognized command line option %<-fdump-%s%>", opt->arg); + error ("unrecognized command-line option %<-fdump-%s%>", opt->arg); break; case OPT_fopt_info_: if (!opt_info_switch_p (opt->arg)) - error ("unrecognized command line option %<-fopt-info-%s%>", + error ("unrecognized command-line option %<-fopt-info-%s%>", opt->arg); break; diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index fbb108568b3f..10948efddd91 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -54,6 +54,13 @@ along with GCC; see the file COPYING3. If not see #include "print-rtl.h" #include "rtl-iter.h" +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* String printed at beginning of each RTL when it is dumped. This string is set to ASM_COMMENT_START when the RTL is dumped in the assembly output file. */ @@ -2142,3 +2149,7 @@ debug_bb_n_slim (int n) } #endif + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index 83688b3c9c42..d4001300a4b2 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -67,6 +67,13 @@ along with GCC; see the file COPYING3. If not see #include "pretty-print.h" #include "print-rtl.h" +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + #ifdef INSN_SCHEDULING /* Some accessor macros for h_i_d members only used within this file. */ @@ -3947,3 +3954,7 @@ make_pass_sched_fusion (gcc::context *ctxt) { return new pass_sched_fusion (ctxt); } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/symtab.c b/gcc/symtab.c index 4bf37a181714..905ca05e578b 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1002,6 +1002,15 @@ symtab_node::debug (void) /* Verify common part of symtab nodes. */ +#if __GNUC__ >= 10 +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow GCC + diagnostic conventions and the calls are ultimately followed by + one to internal_error. */ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + DEBUG_FUNCTION bool symtab_node::verify_base (void) { @@ -1288,6 +1297,10 @@ symtab_node::verify_symtab_nodes (void) } } +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + /* Make DECL local. FIXME: We shouldn't need to mess with rtl this early, but other code such as notice_global_symbol generates rtl. */ diff --git a/gcc/testsuite/c-c++-common/nonnull-1.c b/gcc/testsuite/c-c++-common/nonnull-1.c index 2446d6fbcfa6..ea987365302e 100644 --- a/gcc/testsuite/c-c++-common/nonnull-1.c +++ b/gcc/testsuite/c-c++-common/nonnull-1.c @@ -8,27 +8,27 @@ void foo(void *bar) __attribute__((nonnull(1))); -void foo(void *bar) { if (!bar) abort(); } /* { dg-warning "nonnull argument" "bar compared to NULL" } */ +void foo(void *bar) { if (!bar) abort(); } /* { dg-warning "'nonnull' argument" "bar compared to NULL" } */ extern int func (char *, char *, char *, char *) __attribute__((nonnull)); int func (char *cp1, char *cp2, char *cp3, char *cp4) { - if (cp1) /* { dg-warning "nonnull argument" "cp1 compared to NULL" } */ + if (cp1) /* { dg-warning "'nonnull' argument" "cp1 compared to NULL" } */ return 1; - if (cp2 == NULL) /* { dg-warning "nonnull argument" "cp2 compared to NULL" } */ + if (cp2 == NULL) /* { dg-warning "'nonnull' argument" "cp2 compared to NULL" } */ return 2; - if (NULL != cp3) /* { dg-warning "nonnull argument" "cp3 compared to NULL" } */ + if (NULL != cp3) /* { dg-warning "'nonnull' argument" "cp3 compared to NULL" } */ return 3; - return cp4 != 0 ? 0 : 1; /* { dg-warning "nonnull argument" "cp4 compared to NULL" } */ + return cp4 != 0 ? 0 : 1; /* { dg-warning "'nonnull' argument" "cp4 compared to NULL" } */ } __attribute__((nonnull (1))) int func2 (char *cp) { - return (cp != NULL) ? 1 : 0; /* { dg-warning "nonnull argument" "cp compared to NULL" { xfail c++ } } */ + return (cp != NULL) ? 1 : 0; /* { dg-warning "'nonnull' argument" "cp compared to NULL" { xfail c++ } } */ } diff --git a/gcc/testsuite/c-c++-common/nonnull-2.c b/gcc/testsuite/c-c++-common/nonnull-2.c index ebd17a21f030..19574cd11046 100644 --- a/gcc/testsuite/c-c++-common/nonnull-2.c +++ b/gcc/testsuite/c-c++-common/nonnull-2.c @@ -7,19 +7,19 @@ void bar (char **); __attribute__((nonnull (1, 3))) int foo (char *cp1, char *cp2, char *cp3, char *cp4) { - if (cp1 == (char *) 0) /* { dg-warning "nonnull argument" "cp1 compared to NULL" } */ + if (cp1 == (char *) 0) /* { dg-warning "'nonnull' argument" "cp1 compared to NULL" } */ return 1; cp1 = cp2; - if (cp1 == (char *) 0) /* { dg-bogus "nonnull argument" } */ + if (cp1 == (char *) 0) /* { dg-bogus "'nonnull' argument" } */ return 2; - if (!cp4) /* { dg-bogus "nonnull argument" } */ + if (!cp4) /* { dg-bogus "'nonnull' argument" } */ return 3; char **p = &cp3; bar (p); - if (cp3 == (char *) 0) /* { dg-bogus "nonnull argument" } */ + if (cp3 == (char *) 0) /* { dg-bogus "'nonnull' argument" } */ return 4; return 5; diff --git a/gcc/testsuite/c-c++-common/nonnull-3.c b/gcc/testsuite/c-c++-common/nonnull-3.c index d2ccb24f4fdb..42081c889f26 100644 --- a/gcc/testsuite/c-c++-common/nonnull-3.c +++ b/gcc/testsuite/c-c++-common/nonnull-3.c @@ -7,5 +7,5 @@ enum { r = 1 }; __attribute__ ((nonnull (r))) int f (int *p) { - return p == 0; /* { dg-warning "nonnull argument 'p' compared to NULL" } */ + return p == 0; /* { dg-warning "'nonnull' argument 'p' compared to NULL" } */ } diff --git a/gcc/testsuite/c-c++-common/pr35503-1.c b/gcc/testsuite/c-c++-common/pr35503-1.c index 25e3721df939..11075dd0e061 100644 --- a/gcc/testsuite/c-c++-common/pr35503-1.c +++ b/gcc/testsuite/c-c++-common/pr35503-1.c @@ -6,5 +6,5 @@ int foo (char *__restrict buf, const char *__restrict fmt, ...); void f(void) { char buf[100] = "hello"; - foo (buf, "%s-%s", buf, "world"); /* { dg-warning "passing argument 1 to restrict-qualified parameter aliases with argument 3" } */ + foo (buf, "%s-%s", buf, "world"); /* { dg-warning "passing argument 1 to 'restrict'-qualified parameter aliases with argument 3" } */ } diff --git a/gcc/testsuite/c-c++-common/pr35503-2.c b/gcc/testsuite/c-c++-common/pr35503-2.c index bfcd9448e03e..887576c39761 100644 --- a/gcc/testsuite/c-c++-common/pr35503-2.c +++ b/gcc/testsuite/c-c++-common/pr35503-2.c @@ -5,7 +5,7 @@ void f(int *__restrict x, int *y, int *__restrict z, int *w); void foo(int alpha, int beta) { - f (&alpha, &beta, &alpha, &alpha); /* { dg-warning "passing argument 1 to restrict-qualified parameter aliases with arguments 3, 4" } */ + f (&alpha, &beta, &alpha, &alpha); /* { dg-warning "passing argument 1 to 'restrict'-qualified parameter aliases with arguments 3, 4" } */ /* { dg-begin-multiline-output "" } f (&alpha, &beta, &alpha, &alpha); diff --git a/gcc/testsuite/c-c++-common/pr35503-3.c b/gcc/testsuite/c-c++-common/pr35503-3.c index 8cbacabba624..8d4b1fc03ee5 100644 --- a/gcc/testsuite/c-c++-common/pr35503-3.c +++ b/gcc/testsuite/c-c++-common/pr35503-3.c @@ -5,5 +5,5 @@ void f(int *x, int *__restrict y); void foo(int a) { - f (&a, &a); /* { dg-warning "passing argument 2 to restrict-qualified parameter aliases with argument 1" } */ + f (&a, &a); /* { dg-warning "passing argument 2 to 'restrict'-qualified parameter aliases with argument 1" } */ } diff --git a/gcc/testsuite/g++.dg/abi/empty12.C b/gcc/testsuite/g++.dg/abi/empty12.C index 20d85ff873ec..6568fc6202c7 100644 --- a/gcc/testsuite/g++.dg/abi/empty12.C +++ b/gcc/testsuite/g++.dg/abi/empty12.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-Wabi=11 -x c" } // { dg-additional-sources "empty12a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty12.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/abi/empty13.C b/gcc/testsuite/g++.dg/abi/empty13.C index 0cb9a373e358..9ec188760c72 100644 --- a/gcc/testsuite/g++.dg/abi/empty13.C +++ b/gcc/testsuite/g++.dg/abi/empty13.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-x c -fabi-version=11" } // { dg-additional-sources "empty13a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty13.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/abi/empty14.C b/gcc/testsuite/g++.dg/abi/empty14.C index 2868d8ad3f31..7deb463f5e48 100644 --- a/gcc/testsuite/g++.dg/abi/empty14.C +++ b/gcc/testsuite/g++.dg/abi/empty14.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-Wabi=11 -x c" } // { dg-additional-sources "empty14a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty14.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/abi/empty15.C b/gcc/testsuite/g++.dg/abi/empty15.C index 12385f78c789..fd36194b459e 100644 --- a/gcc/testsuite/g++.dg/abi/empty15.C +++ b/gcc/testsuite/g++.dg/abi/empty15.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-Wabi=11 -x c" } // { dg-additional-sources "empty15a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty15.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/abi/empty16.C b/gcc/testsuite/g++.dg/abi/empty16.C index 1ca52f9011e6..024b00e74327 100644 --- a/gcc/testsuite/g++.dg/abi/empty16.C +++ b/gcc/testsuite/g++.dg/abi/empty16.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-Wabi=11 -x c" } // { dg-additional-sources "empty16a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty16.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/abi/empty17.C b/gcc/testsuite/g++.dg/abi/empty17.C index d386e5481afc..a6e58fa4d5f8 100644 --- a/gcc/testsuite/g++.dg/abi/empty17.C +++ b/gcc/testsuite/g++.dg/abi/empty17.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-Wabi=11 -x c" } // { dg-additional-sources "empty17a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty17.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/abi/empty18.C b/gcc/testsuite/g++.dg/abi/empty18.C index be69c6a2115b..6e64dae8d47e 100644 --- a/gcc/testsuite/g++.dg/abi/empty18.C +++ b/gcc/testsuite/g++.dg/abi/empty18.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-Wabi=11 -x c" } // { dg-additional-sources "empty18a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty18.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/abi/empty19.C b/gcc/testsuite/g++.dg/abi/empty19.C index 84f5b75558bf..8707db86be66 100644 --- a/gcc/testsuite/g++.dg/abi/empty19.C +++ b/gcc/testsuite/g++.dg/abi/empty19.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-Wabi=11 -x c" } // { dg-additional-sources "empty19a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty19.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/abi/empty22.C b/gcc/testsuite/g++.dg/abi/empty22.C index f4f4a02bf31f..d3720f86fdeb 100644 --- a/gcc/testsuite/g++.dg/abi/empty22.C +++ b/gcc/testsuite/g++.dg/abi/empty22.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-Wabi=11 -x c" } // { dg-additional-sources "empty22a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty22.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/abi/empty25.C b/gcc/testsuite/g++.dg/abi/empty25.C index da6ef51ff0db..50a4c266ca00 100644 --- a/gcc/testsuite/g++.dg/abi/empty25.C +++ b/gcc/testsuite/g++.dg/abi/empty25.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-Wabi=11 -x c" } // { dg-additional-sources "empty25a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty25.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/abi/empty26.C b/gcc/testsuite/g++.dg/abi/empty26.C index ab2f54d8dab4..785cdc7d9743 100644 --- a/gcc/testsuite/g++.dg/abi/empty26.C +++ b/gcc/testsuite/g++.dg/abi/empty26.C @@ -2,7 +2,7 @@ // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } // { dg-options "-Wabi=11 -x c" } // { dg-additional-sources "empty26a.c" } -// { dg-prune-output "command line option" } +// { dg-prune-output "command-line option" } #include "empty26.h" extern "C" void fun(struct dummy, struct foo); diff --git a/gcc/testsuite/g++.dg/concepts/decl-diagnose.C b/gcc/testsuite/g++.dg/concepts/decl-diagnose.C index 7ac7872efb58..019a8ce1130e 100644 --- a/gcc/testsuite/g++.dg/concepts/decl-diagnose.C +++ b/gcc/testsuite/g++.dg/concepts/decl-diagnose.C @@ -17,7 +17,7 @@ struct X template static concept bool f6() { return true; } // { dg-error "a concept cannot be a member function" } static concept bool x; // { dg-error "declared 'concept'" } - // { dg-error "uninitialized const" "" { target *-*-* } .-1 } + // { dg-error "uninitialized 'const" "" { target *-*-* } .-1 } concept int x2; // { dg-error "declared 'concept'" } concept ~X(); // { dg-error "a destructor cannot be 'concept'" } concept X(); // { dg-error "a constructor cannot be 'concept'" } diff --git a/gcc/testsuite/g++.dg/conversion/bitfield7.C b/gcc/testsuite/g++.dg/conversion/bitfield7.C index 1080168dce19..d1b1b096c1e5 100644 --- a/gcc/testsuite/g++.dg/conversion/bitfield7.C +++ b/gcc/testsuite/g++.dg/conversion/bitfield7.C @@ -12,5 +12,5 @@ int foo (double); int main () { - return foo (s.bar); // { dg-error "cannot bind bitfield" } + return foo (s.bar); // { dg-error "cannot bind bit-field" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/addressof2.C b/gcc/testsuite/g++.dg/cpp0x/addressof2.C index a38dce003a74..73942c5f0a51 100644 --- a/gcc/testsuite/g++.dg/cpp0x/addressof2.C +++ b/gcc/testsuite/g++.dg/cpp0x/addressof2.C @@ -16,7 +16,7 @@ struct S { int s : 5; int t; void foo (); } s; auto c = __builtin_addressof (s); auto d = addressof (s); auto e = __builtin_addressof (s.s); // { dg-error "attempt to take address of bit-field" } -auto f = addressof (s.s); // { dg-error "cannot bind bitfield" } +auto f = addressof (s.s); // { dg-error "cannot bind bit-field" } auto g = __builtin_addressof (S{}); // { dg-error "taking address of rvalue" } auto h = addressof (S{}); // { dg-error "cannot bind non-const lvalue reference of type" } auto i = __builtin_addressof (S::t); // { dg-error "invalid use of non-static data member" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C index 388a73488e7a..733d494c4d71 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C @@ -5,5 +5,5 @@ constexpr int something() { return 3; } int main() { if (constexpr long v = something()) {} - if (static long v = something()) { } // { dg-error "decl-specifier invalid" } + if (static long v = something()) { } // { dg-error "'decl-specifier' invalid" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C index 336699292a2e..9b52a6e00ef9 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C @@ -61,7 +61,7 @@ struct pixel2 { // { dg-message "no user-provided default constructor" } int x, y; }; constexpr pixel2 ur = { 1294, 1024 };// OK -constexpr pixel2 origin; // { dg-error "uninitialized const" } +constexpr pixel2 origin; // { dg-error "uninitialized 'const" } constexpr const int* addr(const int& ir) { return &ir; } // OK diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-object1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-object1.C index 1861d4047826..5f54c635e643 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-object1.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-object1.C @@ -15,7 +15,7 @@ constexpr A1 a1 = A1(); extern constexpr int i2; // { dg-error "definition" } // error: missing initializer -constexpr A1 a2; // { dg-error "uninitialized const" } +constexpr A1 a2; // { dg-error "uninitialized 'const" } const constexpr A1 a3 = A1(); diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted2.C b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C index 45b09c178120..b7b31438491c 100644 --- a/gcc/testsuite/g++.dg/cpp0x/defaulted2.C +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C @@ -21,7 +21,7 @@ struct B // { dg-message "user-provided default constructor" } B() = default; // { dg-message "not user-provided" } }; -const B b; // { dg-error "uninitialized const" } +const B b; // { dg-error "uninitialized 'const" } struct C { diff --git a/gcc/testsuite/g++.dg/cpp0x/gnu_fext-numeric-literals.C b/gcc/testsuite/g++.dg/cpp0x/gnu_fext-numeric-literals.C index 816077d54014..7a467a154b0b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/gnu_fext-numeric-literals.C +++ b/gcc/testsuite/g++.dg/cpp0x/gnu_fext-numeric-literals.C @@ -22,55 +22,55 @@ operator"" J(unsigned long long n) // { dg-warning "1:integer suffix .J. shadowe // Floating-point imaginary... constexpr long double -operator"" i(long double n) // { dg-warning "1:floating point suffix .i. shadowed by implementation" "" { target c++11_only } } +operator"" i(long double n) // { dg-warning "1:floating-point suffix .i. shadowed by implementation" "" { target c++11_only } } { return 4.0L * n + 0.0L; } constexpr long double -operator"" I(long double n) // { dg-warning "1:floating point suffix .I. shadowed by implementation" } +operator"" I(long double n) // { dg-warning "1:floating-point suffix .I. shadowed by implementation" } { return 4.0L * n + 1.0L; } constexpr long double -operator"" j(long double n) // { dg-warning "1:floating point suffix .j. shadowed by implementation" } +operator"" j(long double n) // { dg-warning "1:floating-point suffix .j. shadowed by implementation" } { return 4.0L * n + 2.0L; } constexpr long double -operator"" J(long double n) // { dg-warning "1:floating point suffix .J. shadowed by implementation" } +operator"" J(long double n) // { dg-warning "1:floating-point suffix .J. shadowed by implementation" } { return 4.0L * n + 3.0L; } // Fixed-point... constexpr long double -operator"" k(long double n) // { dg-warning "1:floating point suffix .k. shadowed by implementation" } +operator"" k(long double n) // { dg-warning "1:floating-point suffix .k. shadowed by implementation" } { return 4 * (n + 1) + 0; } constexpr long double -operator"" K(long double n) // { dg-warning "1:floating point suffix .K. shadowed by implementation" } +operator"" K(long double n) // { dg-warning "1:floating-point suffix .K. shadowed by implementation" } { return 4 * (n + 1) + 1; } constexpr long double -operator"" r(long double n) // { dg-warning "1:floating point suffix .r. shadowed by implementation" } +operator"" r(long double n) // { dg-warning "1:floating-point suffix .r. shadowed by implementation" } { return 4 * (n + 1) + 2; } constexpr long double -operator"" R(long double n) // { dg-warning "1:floating point suffix .R. shadowed by implementation" } +operator"" R(long double n) // { dg-warning "1:floating-point suffix .R. shadowed by implementation" } { return 4 * (n + 1) + 3; } // Machine-defined... constexpr long double -operator"" w(long double n) // { dg-warning "1:floating point suffix .w. shadowed by implementation" } +operator"" w(long double n) // { dg-warning "1:floating-point suffix .w. shadowed by implementation" } { return 4 * (n + 2) + 0; } constexpr long double -operator"" W(long double n) // { dg-warning "1:floating point suffix .W. shadowed by implementation" } +operator"" W(long double n) // { dg-warning "1:floating-point suffix .W. shadowed by implementation" } { return 4 * (n + 2) + 1; } constexpr long double -operator"" q(long double n) // { dg-warning "1:floating point suffix .q. shadowed by implementation" } +operator"" q(long double n) // { dg-warning "1:floating-point suffix .q. shadowed by implementation" } { return 4 * (n + 2) + 2; } constexpr long double -operator"" Q(long double n) // { dg-warning "1:floating point suffix .Q. shadowed by implementation" } +operator"" Q(long double n) // { dg-warning "1:floating-point suffix .Q. shadowed by implementation" } { return 4 * (n + 2) + 3; } int diff --git a/gcc/testsuite/g++.dg/cpp0x/pr42844-2.C b/gcc/testsuite/g++.dg/cpp0x/pr42844-2.C index ff23966051c7..75117c717cfc 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr42844-2.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr42844-2.C @@ -34,8 +34,8 @@ struct Derived3 : Base // { dg-message "user-provided default constructor" } void f() { - const A a; // { dg-error "uninitialized const" } - const Derived d; // { dg-error "uninitialized const" } - const Derived2 d2; // { dg-error "uninitialized const" } - const Derived3 d3; // { dg-error "uninitialized const" } + const A a; // { dg-error "uninitialized 'const" } + const Derived d; // { dg-error "uninitialized 'const" } + const Derived2 d2; // { dg-error "uninitialized 'const" } + const Derived3 d3; // { dg-error "uninitialized 'const" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr83993.C b/gcc/testsuite/g++.dg/cpp0x/pr83993.C index 17b7a6419578..c256257a5c11 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr83993.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr83993.C @@ -7,7 +7,7 @@ const int b[5] = { 1, 2, 3, 4, 5 }; extern const int c[4]; constexpr const int *d = &a[0]; constexpr const int *d2 = a; -constexpr const int *e = &a[1]; // { dg-error "non-zero array subscript '1' is used with array 'a' of type 'const int \\\[\\\]' with unknown bounds" } +constexpr const int *e = &a[1]; // { dg-error "nonzero array subscript '1' is used with array 'a' of type 'const int \\\[\\\]' with unknown bounds" } constexpr const int *f = &b[0]; constexpr const int *f2 = b; constexpr const int *g = &b[5]; @@ -30,7 +30,7 @@ foo () constexpr const int *m = &l[0]; constexpr const int *m2 = l; -constexpr const int *n = &l[1]; // { dg-error "non-zero array subscript '1' is used with array 'l' of type 'const int \\\[\\\]' with unknown bounds" } +constexpr const int *n = &l[1]; // { dg-error "nonzero array subscript '1' is used with array 'l' of type 'const int \\\[\\\]' with unknown bounds" } static_assert (d == d2 && f == f2 && i == i2 && m == m2, ""); const int o[] = { 1, 2 }; constexpr const int *p = &o[0]; @@ -40,7 +40,7 @@ constexpr const int *r = &o[3]; // { dg-error "array subscript value '3' is out struct S { char a; char b[]; } s; constexpr const char *t = &s.b[0]; constexpr const char *t2 = s.b; -constexpr const char *u = &s.b[1]; // { dg-error "non-zero array subscript '1' is used with array of type 'char \\\[\\\]' with unknown bounds" } +constexpr const char *u = &s.b[1]; // { dg-error "nonzero array subscript '1' is used with array of type 'char \\\[\\\]' with unknown bounds" } struct V { int a; }; extern V v[]; constexpr V *w = &v[0]; diff --git a/gcc/testsuite/g++.dg/cpp0x/std_fext-numeric-literals.C b/gcc/testsuite/g++.dg/cpp0x/std_fext-numeric-literals.C index 72b8546ae58e..d251c7449991 100644 --- a/gcc/testsuite/g++.dg/cpp0x/std_fext-numeric-literals.C +++ b/gcc/testsuite/g++.dg/cpp0x/std_fext-numeric-literals.C @@ -22,55 +22,55 @@ operator"" J(unsigned long long n) // { dg-warning "1:integer suffix .J. shadowe // Floating-point imaginary... constexpr long double -operator"" i(long double n) // { dg-warning "1:floating point suffix .i. shadowed by implementation" "" { target c++11_only } } +operator"" i(long double n) // { dg-warning "1:floating-point suffix .i. shadowed by implementation" "" { target c++11_only } } { return 4.0L * n + 0.0L; } constexpr long double -operator"" I(long double n) // { dg-warning "1:floating point suffix .I. shadowed by implementation" } +operator"" I(long double n) // { dg-warning "1:floating-point suffix .I. shadowed by implementation" } { return 4.0L * n + 1.0L; } constexpr long double -operator"" j(long double n) // { dg-warning "1:floating point suffix .j. shadowed by implementation" } +operator"" j(long double n) // { dg-warning "1:floating-point suffix .j. shadowed by implementation" } { return 4.0L * n + 2.0L; } constexpr long double -operator"" J(long double n) // { dg-warning "1:floating point suffix .J. shadowed by implementation" } +operator"" J(long double n) // { dg-warning "1:floating-point suffix .J. shadowed by implementation" } { return 4.0L * n + 3.0L; } // Fixed-point... constexpr long double -operator"" k(long double n) // { dg-warning "1:floating point suffix .k. shadowed by implementation" } +operator"" k(long double n) // { dg-warning "1:floating-point suffix .k. shadowed by implementation" } { return 4 * (n + 1) + 0; } constexpr long double -operator"" K(long double n) // { dg-warning "1:floating point suffix .K. shadowed by implementation" } +operator"" K(long double n) // { dg-warning "1:floating-point suffix .K. shadowed by implementation" } { return 4 * (n + 1) + 1; } constexpr long double -operator"" r(long double n) // { dg-warning "1:floating point suffix .r. shadowed by implementation" } +operator"" r(long double n) // { dg-warning "1:floating-point suffix .r. shadowed by implementation" } { return 4 * (n + 1) + 2; } constexpr long double -operator"" R(long double n) // { dg-warning "1:floating point suffix .R. shadowed by implementation" } +operator"" R(long double n) // { dg-warning "1:floating-point suffix .R. shadowed by implementation" } { return 4 * (n + 1) + 3; } // Machine-defined... constexpr long double -operator"" w(long double n) // { dg-warning "1:floating point suffix .w. shadowed by implementation" } +operator"" w(long double n) // { dg-warning "1:floating-point suffix .w. shadowed by implementation" } { return 4 * (n + 2) + 0; } constexpr long double -operator"" W(long double n) // { dg-warning "1:floating point suffix .W. shadowed by implementation" } +operator"" W(long double n) // { dg-warning "1:floating-point suffix .W. shadowed by implementation" } { return 4 * (n + 2) + 1; } constexpr long double -operator"" q(long double n) // { dg-warning "1:floating point suffix .q. shadowed by implementation" } +operator"" q(long double n) // { dg-warning "1:floating-point suffix .q. shadowed by implementation" } { return 4 * (n + 2) + 2; } constexpr long double -operator"" Q(long double n) // { dg-warning "1:floating point suffix .Q. shadowed by implementation" } +operator"" Q(long double n) // { dg-warning "1:floating-point suffix .Q. shadowed by implementation" } { return 4 * (n + 2) + 3; } int diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C index c63559060e9b..fdddd8d84ed0 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C @@ -2,7 +2,7 @@ // Test that the standard suffixes shadow any user-defined suffixes of the same name. long double -operator"" L(long double x) // { dg-warning "floating point suffix|shadowed by implementation" } +operator"" L(long double x) // { dg-warning "floating-point suffix|shadowed by implementation" } { return x; } unsigned long long int @@ -10,7 +10,7 @@ operator"" ULL(unsigned long long int k) // { dg-warning "integer suffix|shadow { return k; } long double -operator"" l(long double x) // { dg-warning "floating point suffix|shadowed by implementation" } +operator"" l(long double x) // { dg-warning "floating-point suffix|shadowed by implementation" } { return x; } unsigned long long int diff --git a/gcc/testsuite/g++.dg/cpp1z/inline-var2.C b/gcc/testsuite/g++.dg/cpp1z/inline-var2.C index 1a016fa8216b..236f6ecb1332 100644 --- a/gcc/testsuite/g++.dg/cpp1z/inline-var2.C +++ b/gcc/testsuite/g++.dg/cpp1z/inline-var2.C @@ -47,7 +47,7 @@ struct W { static inline int var24; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } } static inline const int var25; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } } - // { dg-error "uninitialized const" "" { target *-*-* } .-1 } + // { dg-error "uninitialized 'const" "" { target *-*-* } .-1 } static inline int var26 = 5; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } } static inline const int var27 = 6; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } } static inline double var28 = { 4.0 }; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } } @@ -90,7 +90,7 @@ struct Z { static inline int var37; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } } static inline const int var38; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } } - // { dg-error "uninitialized const" "" { target *-*-* } .-1 } + // { dg-error "uninitialized 'const" "" { target *-*-* } .-1 } static inline int var39 = 5; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } } static inline const int var40 = 6; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } } static inline double var41 = { 4.0 }; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } } diff --git a/gcc/testsuite/g++.dg/cpp2a/decomp3.C b/gcc/testsuite/g++.dg/cpp2a/decomp3.C index 1afaefd66b1b..5e77973d41f7 100644 --- a/gcc/testsuite/g++.dg/cpp2a/decomp3.C +++ b/gcc/testsuite/g++.dg/cpp2a/decomp3.C @@ -7,10 +7,10 @@ struct Foo { int a : 1; int b; }; int main() { auto[a, b] = Foo(); // { dg-warning "structured bindings only available with" "" { target c++14_down } } - auto f1 = [&] { return a; }; // { dg-error "cannot bind bitfield" } - auto f2 = [&a = a] { return a; }; // { dg-error "cannot bind bitfield" } + auto f1 = [&] { return a; }; // { dg-error "cannot bind bit-field" } + auto f2 = [&a = a] { return a; }; // { dg-error "cannot bind bit-field" } // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 } - auto f3 = [&a] { return a; }; // { dg-error "cannot bind bitfield" } + auto f3 = [&a] { return a; }; // { dg-error "cannot bind bit-field" } auto g1 = [&] { return b; }; auto g2 = [&b = b] { return b; }; // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } } diff --git a/gcc/testsuite/g++.dg/init/pr42844.C b/gcc/testsuite/g++.dg/init/pr42844.C index 299a30a91d2f..9b7ed05de0e3 100644 --- a/gcc/testsuite/g++.dg/init/pr42844.C +++ b/gcc/testsuite/g++.dg/init/pr42844.C @@ -22,22 +22,22 @@ struct G { T t; }; // { dg-message "user-provided default constructor" } void f () { - B const b; // { dg-error "uninitialized const" } + B const b; // { dg-error "uninitialized 'const" } extern B const bext; - C const c[ 1 ]; // { dg-error "uninitialized const" } + C const c[ 1 ]; // { dg-error "uninitialized 'const" } extern C const cext[ 1 ]; D const d; extern D const dext; - E const e; // { dg-error "uninitialized const" } + E const e; // { dg-error "uninitialized 'const" } extern E const eext; - F const f; // { dg-error "uninitialized const" } + F const f; // { dg-error "uninitialized 'const" } extern F const fext; - G const g; // { dg-error "uninitialized const" } + G const g; // { dg-error "uninitialized 'const" } extern G const gext; } @@ -48,7 +48,7 @@ struct I : A { int i; }; // { dg-message "user-provided default constructor" } template void g () { - T const t; // { dg-error "uninitialized const" } + T const t; // { dg-error "uninitialized 'const" } extern T const text; } diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr20280.C b/gcc/testsuite/g++.dg/tree-ssa/pr20280.C index ec4dad70620d..334ed8a75e06 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr20280.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr20280.C @@ -44,9 +44,9 @@ void f(X &x, bool b) (void)(b ? x.i : x.k); (void)(b ? x.j : x.k); - g (b ? x.i : x.j); // { dg-error "cannot bind bitfield" } - g (b ? x.i : x.k); // { dg-error "cannot bind bitfield" } - g (b ? x.j : x.k); // { dg-error "cannot bind bitfield" } + g (b ? x.i : x.j); // { dg-error "cannot bind bit-field" } + g (b ? x.i : x.k); // { dg-error "cannot bind bit-field" } + g (b ? x.j : x.k); // { dg-error "cannot bind bit-field" } // It's not entirely clear whether these should be accepted. The // conditional expressions are lvalues for sure, and 8.5.3/5 exempts diff --git a/gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C b/gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C index 36b3fa53f3f6..1b23611bdc0d 100644 --- a/gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C +++ b/gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C @@ -4,7 +4,7 @@ double a, b; _Complex double c, d; -int f(void) { return a == b; } /* { dg-warning "comparing floating point" } */ -int g(void) { return c == d; } /* { dg-warning "comparing floating point" } */ -int h(void) { return a != b; } /* { dg-warning "comparing floating point" } */ -int i(void) { return c != d; } /* { dg-warning "comparing floating point" } */ +int f(void) { return a == b; } /* { dg-warning "comparing floating-point" } */ +int g(void) { return c == d; } /* { dg-warning "comparing floating-point" } */ +int h(void) { return a != b; } /* { dg-warning "comparing floating-point" } */ +int i(void) { return c != d; } /* { dg-warning "comparing floating-point" } */ diff --git a/gcc/testsuite/g++.dg/warn/Wrestrict-1.C b/gcc/testsuite/g++.dg/warn/Wrestrict-1.C index fe844f18c43f..441ff3482bcc 100644 --- a/gcc/testsuite/g++.dg/warn/Wrestrict-1.C +++ b/gcc/testsuite/g++.dg/warn/Wrestrict-1.C @@ -7,6 +7,6 @@ void foo (char *__restrict, char *__restrict = __null); void bar (char *p) { - foo (p, p); // { dg-warning "to restrict-qualified parameter aliases with" } + foo (p, p); // { dg-warning "to 'restrict'-qualified parameter aliases with" } foo (p); } diff --git a/gcc/testsuite/g++.dg/warn/Wrestrict-2.C b/gcc/testsuite/g++.dg/warn/Wrestrict-2.C index 4bab03bc8506..72957d0f5512 100644 --- a/gcc/testsuite/g++.dg/warn/Wrestrict-2.C +++ b/gcc/testsuite/g++.dg/warn/Wrestrict-2.C @@ -8,8 +8,8 @@ template void bar (char **p) { - foo (p[0], p[0]); // { dg-warning "to restrict-qualified parameter aliases with" } - foo (p[0], p[N]); // { dg-warning "to restrict-qualified parameter aliases with" } + foo (p[0], p[0]); // { dg-warning "to 'restrict'-qualified parameter aliases with" } + foo (p[0], p[N]); // { dg-warning "to 'restrict'-qualified parameter aliases with" } foo (p[0]); } @@ -17,8 +17,8 @@ template void bar2 (char **p) { - foo (p[0], p[0]); // { dg-warning "to restrict-qualified parameter aliases with" } - foo (p[0], p[N]); // { dg-bogus "to restrict-qualified parameter aliases with" } + foo (p[0], p[0]); // { dg-warning "to 'restrict'-qualified parameter aliases with" } + foo (p[0], p[N]); // { dg-bogus "to 'restrict'-qualified parameter aliases with" } foo (p[0]); } diff --git a/gcc/testsuite/g++.dg/warn/nonnull3.C b/gcc/testsuite/g++.dg/warn/nonnull3.C index d82fa31d957d..e869b0f5de94 100644 --- a/gcc/testsuite/g++.dg/warn/nonnull3.C +++ b/gcc/testsuite/g++.dg/warn/nonnull3.C @@ -16,4 +16,4 @@ void A::bar (B *) { foo ((int B::*) nullptr); } -// { dg-warning "nonnull argument" "" {target "*-*-*"} 0 } +// { dg-warning "'nonnull' argument" "" {target "*-*-*"} 0 } diff --git a/gcc/testsuite/g++.dg/warn/pr8715.C b/gcc/testsuite/g++.dg/warn/pr8715.C index 330c148bb59d..fccb25aa7e5d 100644 --- a/gcc/testsuite/g++.dg/warn/pr8715.C +++ b/gcc/testsuite/g++.dg/warn/pr8715.C @@ -5,7 +5,7 @@ int foo() { unsigned char b = '1'; - bool x = ~b; /* { dg-warning "promoted ~unsigned is always non-zero" } */ + bool x = ~b; /* { dg-warning "promoted bitwise complement of an unsigned value is always nonzero" } */ return 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.other/cond5.C b/gcc/testsuite/g++.old-deja/g++.other/cond5.C index 994ea6d95228..f4d16e9760bd 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/cond5.C +++ b/gcc/testsuite/g++.old-deja/g++.other/cond5.C @@ -23,8 +23,8 @@ void fn(int i) int j; j = (i ? e1 : e2); // { dg-warning "mismatch" } - d = (i ? e1 : 1.0); // { dg-warning "non-enumeral" } - d = (i ? 1.0 : e2); // { dg-warning "non-enumeral" } + d = (i ? e1 : 1.0); // { dg-warning "non-enumerated" } + d = (i ? 1.0 : e2); // { dg-warning "non-enumerated" } E1 e = (i ? e1 : e1); // ok j = (i ? 1 : e2); // ok j = (i ? e1 : 1); // ok diff --git a/gcc/testsuite/gcc.dg/attr-noinline.c b/gcc/testsuite/gcc.dg/attr-noinline.c index 13cc6600c28d..b77a34660367 100644 --- a/gcc/testsuite/gcc.dg/attr-noinline.c +++ b/gcc/testsuite/gcc.dg/attr-noinline.c @@ -3,15 +3,15 @@ extern int t(); -static inline void __attribute__((__noinline__)) function_definition(void) {t();} /* { dg-warning "inline function \[^\n\]* given attribute noinline" } */ +static inline void __attribute__((__noinline__)) function_definition(void) {t();} /* { dg-warning "inline function \[^\n\]* given attribute 'noinline'" } */ -static inline void __attribute__((__noinline__)) function_declaration_both_before(void); /* { dg-warning "inline function \[^\n\]* given attribute noinline" } */ +static inline void __attribute__((__noinline__)) function_declaration_both_before(void); /* { dg-warning "inline function \[^\n\]* given attribute 'noinline'" } */ static void function_declaration_both_before(void) {t();} static void function_declaration_both_after(void); -static inline void __attribute__((__noinline__)) function_declaration_both_after(void); /* { dg-warning "(inline function \[^\n\]* given attribute noinline|declared inline after its definition)" } */ +static inline void __attribute__((__noinline__)) function_declaration_both_after(void); /* { dg-warning "(inline function \[^\n\]* given attribute .noinline.|declared inline after its definition)" } */ static void function_declaration_both_after(void) {t();} diff --git a/gcc/testsuite/gcc.dg/attr-noipa.c b/gcc/testsuite/gcc.dg/attr-noipa.c index e2349b6a4181..b2485bb7f0bf 100644 --- a/gcc/testsuite/gcc.dg/attr-noipa.c +++ b/gcc/testsuite/gcc.dg/attr-noipa.c @@ -4,7 +4,7 @@ /* { dg-require-effective-target alloca } */ static inline int __attribute__((noipa)) -fn1 (void) /* { dg-warning "inline function \[^\n\]* given attribute noinline" "" } */ +fn1 (void) /* { dg-warning "inline function \[^\n\]* given attribute 'noinline'" "" } */ { return 1; } diff --git a/gcc/testsuite/gcc.dg/attr-weakref-2.c b/gcc/testsuite/gcc.dg/attr-weakref-2.c index 75cc0779c577..172a4a63e6ad 100644 --- a/gcc/testsuite/gcc.dg/attr-weakref-2.c +++ b/gcc/testsuite/gcc.dg/attr-weakref-2.c @@ -4,4 +4,4 @@ typedef int vtype; extern vtype wv1; -extern vtype Wv1a __attribute__((weakref ("wv1"))); /* { dg-error "weakref 'Wv1a' must have static linkage" } */ +extern vtype Wv1a __attribute__((weakref ("wv1"))); /* { dg-error "'weakref' symbol 'Wv1a' must have static linkage" } */ diff --git a/gcc/testsuite/gcc.dg/cast-1.c b/gcc/testsuite/gcc.dg/cast-1.c index 19ed4f4208d6..335a090d4f97 100644 --- a/gcc/testsuite/gcc.dg/cast-1.c +++ b/gcc/testsuite/gcc.dg/cast-1.c @@ -24,8 +24,8 @@ f (void) (union u) l; /* { dg-error "cast to union type from type not present in union" } */ (int) sv; /* { dg-error "aggregate value used where an integer was expected" } */ (int) uv; /* { dg-error "aggregate value used where an integer was expected" } */ - (float) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ - (float) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (float) sv; /* { dg-error "aggregate value used where a floating-point was expected" } */ + (float) uv; /* { dg-error "aggregate value used where a floating-point was expected" } */ (_Complex double) sv; /* { dg-error "aggregate value used where a complex was expected" } */ (_Complex double) uv; /* { dg-error "aggregate value used where a complex was expected" } */ (void *) sv; /* { dg-error "cannot convert to a pointer type" } */ diff --git a/gcc/testsuite/gcc.dg/cast-2.c b/gcc/testsuite/gcc.dg/cast-2.c index 24f63b2e8d46..2523ac4cbc98 100644 --- a/gcc/testsuite/gcc.dg/cast-2.c +++ b/gcc/testsuite/gcc.dg/cast-2.c @@ -24,8 +24,8 @@ f (void) (union u) l; /* { dg-error "cast to union type from type not present in union" } */ (int) sv; /* { dg-error "aggregate value used where an integer was expected" } */ (int) uv; /* { dg-error "aggregate value used where an integer was expected" } */ - (float) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ - (float) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (float) sv; /* { dg-error "aggregate value used where a floating-point was expected" } */ + (float) uv; /* { dg-error "aggregate value used where a floating-point was expected" } */ (_Complex double) sv; /* { dg-error "aggregate value used where a complex was expected" } */ (_Complex double) uv; /* { dg-error "aggregate value used where a complex was expected" } */ (void *) sv; /* { dg-error "cannot convert to a pointer type" } */ diff --git a/gcc/testsuite/gcc.dg/cast-3.c b/gcc/testsuite/gcc.dg/cast-3.c index d8ae3a0fce27..1e3f5f43c54a 100644 --- a/gcc/testsuite/gcc.dg/cast-3.c +++ b/gcc/testsuite/gcc.dg/cast-3.c @@ -24,8 +24,8 @@ f (void) (union u) l; /* { dg-error "cast to union type from type not present in union" } */ (int) sv; /* { dg-error "aggregate value used where an integer was expected" } */ (int) uv; /* { dg-error "aggregate value used where an integer was expected" } */ - (float) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ - (float) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (float) sv; /* { dg-error "aggregate value used where a floating-point was expected" } */ + (float) uv; /* { dg-error "aggregate value used where a floating-point was expected" } */ (_Complex double) sv; /* { dg-error "aggregate value used where a complex was expected" } */ (_Complex double) uv; /* { dg-error "aggregate value used where a complex was expected" } */ (void *) sv; /* { dg-error "cannot convert to a pointer type" } */ diff --git a/gcc/testsuite/gcc.dg/dfp/cast-bad.c b/gcc/testsuite/gcc.dg/dfp/cast-bad.c index 8d22ba3f8c18..fcaf22db9b90 100644 --- a/gcc/testsuite/gcc.dg/dfp/cast-bad.c +++ b/gcc/testsuite/gcc.dg/dfp/cast-bad.c @@ -31,10 +31,10 @@ f (void) (struct s) d128; /* { dg-error "conversion to non-scalar type requested" } */ (union u) d128; /* { dg-error "cast to union type from type not present in union" } */ - (_Decimal32) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ - (_Decimal32) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ - (_Decimal64) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ - (_Decimal64) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ - (_Decimal128) sv; /* { dg-error "aggregate value used where a floating point was expected" } */ - (_Decimal128) uv; /* { dg-error "aggregate value used where a floating point was expected" } */ + (_Decimal32) sv; /* { dg-error "aggregate value used where a floating-point was expected" } */ + (_Decimal32) uv; /* { dg-error "aggregate value used where a floating-point was expected" } */ + (_Decimal64) sv; /* { dg-error "aggregate value used where a floating-point was expected" } */ + (_Decimal64) uv; /* { dg-error "aggregate value used where a floating-point was expected" } */ + (_Decimal128) sv; /* { dg-error "aggregate value used where a floating-point was expected" } */ + (_Decimal128) uv; /* { dg-error "aggregate value used where a floating-point was expected" } */ } diff --git a/gcc/testsuite/gcc.dg/dfp/warn-abs-2.c b/gcc/testsuite/gcc.dg/dfp/warn-abs-2.c index c1a1994997f0..403b0394298e 100644 --- a/gcc/testsuite/gcc.dg/dfp/warn-abs-2.c +++ b/gcc/testsuite/gcc.dg/dfp/warn-abs-2.c @@ -8,16 +8,16 @@ void tst_decimal (_Decimal32 *p32, _Decimal64 *p64, _Decimal128 *p128) { *p32 = abs(*p32); /* { dg-warning "using integer absolute value function" } */ - *p64 = fabs(*p64); /* { dg-warning "using floating point absolute value function" } */ + *p64 = fabs(*p64); /* { dg-warning "using floating-point absolute value function" } */ *p128 = cabsl(*p128); /* { dg-warning "using complex absolute value function" } */ } void tst_notdecimal (int *pi, double *pd, long double *pld, complex double *pc) { - *pi = __builtin_fabsd32 (*pi); /* { dg-warning "using decimal floating point absolute value function" } */ - *pd = __builtin_fabsd64 (*pd); /* { dg-warning "using decimal floating point absolute value function" } */ - *pld = __builtin_fabsd64 (*pld); /* { dg-warning "using decimal floating point absolute value function" } */ - *pc = __builtin_fabsd128 (*pc); /* { dg-warning "using decimal floating point absolute value function" } */ + *pi = __builtin_fabsd32 (*pi); /* { dg-warning "using decimal floating-point absolute value function" } */ + *pd = __builtin_fabsd64 (*pd); /* { dg-warning "using decimal floating-point absolute value function" } */ + *pld = __builtin_fabsd64 (*pld); /* { dg-warning "using decimal floating-point absolute value function" } */ + *pc = __builtin_fabsd128 (*pc); /* { dg-warning "using decimal floating-point absolute value function" } */ } void diff --git a/gcc/testsuite/gcc.dg/enum-mode-1.c b/gcc/testsuite/gcc.dg/enum-mode-1.c index 09276b7fac00..9d3ea26d6d3e 100644 --- a/gcc/testsuite/gcc.dg/enum-mode-1.c +++ b/gcc/testsuite/gcc.dg/enum-mode-1.c @@ -1,10 +1,10 @@ /* { dg-do compile } */ -enum e1 { A = 256 } __attribute__((__mode__(__byte__))); /* { dg-error "specified mode too small for enumeral values" } */ -enum e2 { B = 256 } __attribute__((__packed__, __mode__(__byte__))); /* { dg-error "specified mode too small for enumeral values" } */ +enum e1 { A = 256 } __attribute__((__mode__(__byte__))); /* { dg-error "specified mode too small for enumerated values" } */ +enum e2 { B = 256 } __attribute__((__packed__, __mode__(__byte__))); /* { dg-error "specified mode too small for enumerated values" } */ -enum e3 { C = __INT_MAX__ } __attribute__((__mode__(__QI__))); /* { dg-error "specified mode too small for enumeral values" } */ -enum e4 { D = __INT_MAX__ } __attribute__((__packed__, __mode__(__QI__))); /* { dg-error "specified mode too small for enumeral values" } */ +enum e3 { C = __INT_MAX__ } __attribute__((__mode__(__QI__))); /* { dg-error "specified mode too small for enumerated values" } */ +enum e4 { D = __INT_MAX__ } __attribute__((__packed__, __mode__(__QI__))); /* { dg-error "specified mode too small for enumerated values" } */ -enum e5 { E = __INT_MAX__ } __attribute__((__mode__(__HI__))); /* { dg-error "specified mode too small for enumeral values" "" { xfail int16 } } */ -enum e6 { F = __INT_MAX__ } __attribute__((__packed__, __mode__(__HI__))); /* { dg-error "specified mode too small for enumeral values" "" { xfail int16 } } */ +enum e5 { E = __INT_MAX__ } __attribute__((__mode__(__HI__))); /* { dg-error "specified mode too small for enumerated values" "" { xfail int16 } } */ +enum e6 { F = __INT_MAX__ } __attribute__((__packed__, __mode__(__HI__))); /* { dg-error "specified mode too small for enumerated values" "" { xfail int16 } } */ diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-1.c b/gcc/testsuite/gcc.dg/format/gcc_diag-1.c index 87614567b912..4a64d5460c6f 100644 --- a/gcc/testsuite/gcc.dg/format/gcc_diag-1.c +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-1.c @@ -1,7 +1,7 @@ /* Test for GCC diagnostic formats. */ /* Origin: Kaveh Ghazi */ /* { dg-do compile } */ -/* { dg-options "-Wformat" } */ +/* { dg-options "-Wformat -Wno-format-diag" } */ #include "format.h" diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-11.c b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c new file mode 100644 index 000000000000..a976c7aa5191 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c @@ -0,0 +1,455 @@ +/* Test warnings for common punctuation, quoting, and spelling issues + in GCC diagnostics. + { dg-do compile } + { dg-options "-Wformat -Wformat-diag" } */ + +/* Magic identifiers must be set before the attribute is used. */ + +typedef long long __gcc_host_wide_int__; + +typedef struct location_s +{ + const char *file; + int line; +} location_t; + +union tree_node; +typedef union tree_node *tree; + +/* Define gimple as a dummy type. The typedef must be provided for + the C test to find the symbol. */ +typedef struct gimple gimple; + +/* Likewise for cgraph_node. */ +typedef struct cgraph_node cgraph_node; + +#define ATTR(...) __attribute__ ((__VA_ARGS__)) +#define FORMAT(kind) ATTR (format (__gcc_## kind ##__, 1, 2)) + +/* Raw formatting function like pp_format. */ +void diag_raw (const char*, ...) ATTR (format (__gcc_diag_raw__, 1, 2)); +void cdiag_raw (const char*, ...) ATTR (format (__gcc_cdiag_raw__, 1, 2)); +void tdiag_raw (const char*, ...) ATTR (format (gcc_tdiag_raw, 1, 2)); +void cxxdiag_raw (const char*, ...) ATTR (format (gcc_cxxdiag_raw, 1, 2)); + +/* Basic formatting function_format. */ +void diag (const char*, ...) FORMAT (diag); + +/* Diagnostic formatting function like error or warning declared + by the C front end. */ +void cdiag (const char*, ...) FORMAT (cdiag); + +/* Diagnostic formatting function like error or warning declared + by the middle-end or back-end. */ +void tdiag (const char*, ...) FORMAT (tdiag); + +/* Diagnostic formatting function like error or warning declared + by the C++ front-end. */ +void cxxdiag (const char*, ...) FORMAT (cxxdiag); + + +/* Verify that functions declared with __gcc_diag_raw__ attribute + are not subject to -Wformat-diag. */ + +void test_diag_raw (tree t, gimple *gc) +{ + diag_raw ("a b"); + diag_raw ("newline\n"); + diag_raw ("lone period."); + diag_raw ("multiple punctuators: !!!"); + diag_raw ("unbalanced paren ("); + diag_raw ("keyword alignas and identifier_with_underscores"); + diag_raw ("disable __builtin_abs with the -fno-builtin-abs option"); + diag_raw ("who says I can't have no stinkin' contractions? "); + + cdiag_raw ("__atomic_sync (%qE) == 7???", t); + tdiag_raw ("__builtin_abs (%E) < 0!?!", t); + cxxdiag_raw ("template <> int f (%E", t); +} + +/* Verify that functions declared with the C front-end __gcc_cdiag__ + attribute detect invalid whitespace in format strings. */ + +void test_cdiag_whitespace (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + /* Verify that strings of leading spaces don't trigger a warning. */ + cdiag (" a"); + cdiag (" b"); + cdiag (" c"); + cdiag ("%< %>a"); + cdiag ("%< %>a"); + cdiag ("a b"); + cdiag ("a b"); /* { dg-warning "unquoted sequence of 2 consecutive space characters" } */ + cdiag ("a "); /* { dg-warning "spurious trailing space" } */ + cdiag ("a "); /* { dg-warning "spurious trailing space" } */ + cdiag ("a%< %>"); + cdiag ("a%< %>%< %>"); + cdiag ("a%< %> "); /* { dg-warning "spurious trailing space" } */ + cdiag ("a%< %> %< %>"); /* { dg-warning "unquoted sequence of 2 consecutive space characters" } */ + + /* It's debatable whether the following two formst strings should + be diagnosed. They aren't only because it's simpler that way. */ + cdiag ("a %< %>"); + cdiag ("a%< %> %< %>"); + + /* Exercise other whitespace characters. */ + cdiag ("a\fb"); /* { dg-warning "unquoted whitespace character '\\\\x0c'" } */ + cdiag ("a\nb"); /* { dg-warning "unquoted whitespace character '\\\\x0a'" } */ + cdiag ("a\rb"); /* { dg-warning "unquoted whitespace character '\\\\x0d'" } */ + cdiag ("a\vb"); /* { dg-warning "unquoted whitespace character '\\\\x0b'" } */ + + cdiag ("First sentence. And a next."); + cdiag ("First sentence. not capitalized sentence"); /* { dg-warning "inconsistent capitalization" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("\ta\b c\vb\n"); + +#pragma GCC diagnostic pop +} + + +void test_cdiag_control (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("\1"); /* { dg-warning "unquoted control character '\\\\x01'" } */ + cdiag ("a\ab"); /* { dg-warning "unquoted control character '\\\\x07'" } */ + cdiag ("a\bb"); /* { dg-warning "unquoted control character '\\\\x08'" } */ +} + + +void test_cdiag_punct (tree t, gimple *gc, int i) +{ + (void)&t; (void)&gc; + + /* Exercise the period. */ + cdiag (".abc"); /* { dg-warning "spurious leading punctuation sequence .\.." } */ + cdiag ("abc;"); /* { dg-warning "spurious trailing punctuation sequence .;." } */ + /* Verify that sentences that start with an uppercase letter and end + in a period are not diagnosed. */ + cdiag ("This is a full sentence."); + cdiag ("Capitalized sentence (with a parethetical note)."); + cdiag ("Not a full sentence;"); /* { dg-warning "spurious trailing punctuation sequence .;." } */ + cdiag ("Neither is this one,"); /* { dg-warning "spurious trailing punctuation sequence .,." } */ + + /* Exercise the ellipsis. */ + cdiag ("this message..."); + cdiag ("...continues here"); + cdiag ("but...not here"); /* { dg-warning "unquoted sequence of 3 consecutive punctuation characters" } */ + + /* Verify that parenthesized sentences are accepted, even the whole + meesage (done in the C++ front end). */ + cdiag ("null argument where non-null required (argument %i)", i); + cdiag ("null (argument %i) where non-null required", i); + cdiag ("(see what comes next)"); + + /* Verify that only a single trailing colon is accepted. */ + cdiag ("candidates are:"); + cdiag ("candidates are::"); /* { dg-warning "spurious trailing punctuation sequence .::." } */ + + /* Exercise C++. */ + cdiag ("C++ is cool"); + cdiag ("this is c++"); + cdiag ("you can do this in C++ but not in C"); + + /* Also verify that G++ is accepted. */ + cdiag ("G++ rocks"); + cdiag ("this is accepted by g++"); + cdiag ("valid in G++ (or g++) but not in gcc"); + + /* Exercise parenthetical note followed by a colon, semicolon, + or a comma. */ + cdiag ("found a bug (here):"); + cdiag ("because of another bug (over there); fix it"); + + cdiag ("found foo (123): go look at it"); + cdiag ("missed bar (abc); will try harder next time"); + + cdiag ("expected this (or that), got something else (or who knows what)"); + + /* Exercise parenthetical note with a question mark. */ + cdiag ("hmmm (did you really mean that?)"); + cdiag ("error (did you mean %?)"); + /* And a question mark after a parenthetical note. */ + cdiag ("did you mean this (or that)?"); + + /* But make sure unbalanced parenthese are diagnosed. */ + cdiag ("or this or the other)?"); /* { dg-warning "unbalanced punctuation character '\\\)'" } */ + + cdiag ("## Heading"); /* { dg-warning "spurious leading punctuation sequence .##." } */ + cdiag ("## %s ##", "1"); /* { dg-warning "spurious (leading|trailing) punctuation sequence .##." } */ + + cdiag ("#1 priority"); /* { dg-warning "spurious leading punctuation sequence .#." } */ + cdiag ("priority #2"); + + /* Quoting. */ + cdiag ("\"quoted\""); + cdiag ("\"quoted\" string"); + cdiag ("this is a \"string in quotes\""); + cdiag ("\"missing closing quote"); /* { dg-warning "unterminated quote character '\"'" } */ + + /* PR translation/90121 - punctuation character after a space. */ + cdiag ("bad version : 1"); /* { dg-warning "space followed by punctuation character ':'" } */ + cdiag ("problem ; fix it"); /* { dg-warning "space followed by punctuation character ';'" } */ + cdiag ("End . not."); /* { dg-warning "space followed by punctuation character '.'" } */ + cdiag ("it is bad , very bad"); /* { dg-warning "space followed by punctuation character ','" } */ + cdiag ("say what ?"); /* { dg-warning "space followed by punctuation character '?'" } */ + + /* But these are okay after a space. But should they be? */ + cdiag ("1 / 2"); + cdiag ("2 + 3"); + cdiag ("2 - 3"); +} + +void test_cdiag_punct_balance (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + /* Less-than and greater than. */ + cdiag ("a < b"); /* { dg-warning "unbalanced punctuation character '<' in format" } */ + cdiag ("must be > 0"); /* { dg-warning "unbalanced punctuation character '>' in format" } */ + + cdiag ("f()"); /* { dg-warning "spurious trailing punctuation sequence .\\\(\\\)." } */ + cdiag ("g(1)"); + cdiag ("("); /* { dg-warning "spurious leading punctuation character|unbalanced" } */ + cdiag ("()"); /* { dg-warning "spurious leading punctuation sequence" } */ + cdiag (")"); /* { dg-warning "unbalanced punctuation character '\\\)'" } */ + cdiag ("f()g"); /* { dg-warning "unquoted sequence of 2 consecutive punctuation characters" } */ + cdiag ("illegal operand (1)"); +} + + +void test_cdiag_nongraph (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("a\376b"); /* { dg-warning "unquoted non-graph character '\\\\xfe'" } */ + cdiag ("a\377b"); /* { dg-warning "unquoted non-graph character '\\\\xff'" } */ +} + + +void test_cdiag_attribute (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("attribute foo"); + cdiag ("this is attribute bar"); + cdiag ("bad __attribute bar"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ (foobar) bad"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ ((foobar))"); /* { dg-warning "unquoted attribute" } */ + cdiag ("__attribute__ (xxx))"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\)'" "xxx" { target *-*-* } .-1 } */ + cdiag ("__attribute__ ((yyy)))"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\)'" "yyy" { target *-*-* } .-1 } */ + cdiag ("__attribute__ ((zzz)"); /* { dg-warning "unquoted attribute" } */ + /* { dg-warning "unbalanced punctuation character '\\\('" "zzz" { target *-*-* } .-1 } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("__attribute__ ((("); + +#pragma GCC diagnostic pop +} + +void test_cdiag_builtin (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("__builtin_abort"); /* { dg-warning "unquoted name of built-in function '__builtin_abort'" } */ + cdiag ("in __builtin_trap"); /* { dg-warning "unquoted name of built-in function '__builtin_trap'" } */ + cdiag ("__builtin_xyz bites");/* { dg-warning "unquoted name of built-in function '__builtin_xyz'" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" + + /* Verify that the warning can be suppressed. */ + cdiag ("__builtin____with____lots__of__underscores"); + +#pragma GCC diagnostic pop +} + + +void test_cdiag_option (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("%<-Wall%>"); + cdiag ("use option %<-Wextra%> to enable additinal warnings"); + + cdiag ("-O2 is fast"); /* { dg-warning "unquoted option name '-O2'" } */ + cdiag ("but -O3 is faster"); /* { dg-warning "unquoted option name '-O3'" } */ + + cdiag ("get --help"); /* { dg-warning "unquoted option name '--help'" } */ + cdiag ("enable -m32"); /* { dg-warning "unquoted option name '-m32'" } */ + cdiag ("value is -12"); + cdiag ("foo-O2"); + cdiag ("a-W"); +} + + +void test_cdiag_keyword (tree t, gimple *gc) +{ + cdiag ("alignasi"); + cdiag ("malignofer or alignofus"); + cdiag ("use alignof"); /* { dg-warning "unquoted keyword 'alignof'" } */ + cdiag ("or _Alignof"); /* { dg-warning " keyword '_Alignof'" } */ + cdiag ("_Pragma too"); /* { dg-warning " keyword '_Pragma'" } */ + + cdiag ("a #error directive"); /* { dg-warning "unquoted preprocessing directive '#error'" } */ + cdiag ("#include file"); /* { dg-warning "unquoted preprocessing directive '#include'" } */ + cdiag ("but #pragma foobar"); /* { dg-warning "unquoted preprocessing directive '#pragma'" } */ + cdiag ("pragma foobar is okay"); + cdiag ("or even # pragma is fine"); + + /* Exercise qualifiers. */ + cdiag ("const function"); + cdiag ("const-qualified variable"); /* { dg-warning "unquoted keyword 'const-qualified'" } */ + /* { dg-message "use '%-qualified' instead" "const-qualified" { target *-*-* } .-1 } */ + cdiag ("a const %qD", t); /* { dg-warning "unquoted keyword 'const'" } */ + cdiag ("restrict %qE", t); /* { dg-warning "unquoted keyword 'restrict'" } */ + cdiag ("volatile %qT", t); /* { dg-warning "unquoted keyword 'volatile'" } */ + cdiag ("const %qD and restrict %qE or volatile %qT", t, t, t); + /* { dg-warning "unquoted keyword 'const'" "" { target *-*-* } .-1 } */ + /* { dg-warning "unquoted keyword 'restrict'" "" { target *-*-* } .-2 } */ + /* { dg-warning "unquoted keyword 'volatile'" "" { target *-*-* } .-3 } */ + + cdiag ("an offsetof here"); /* { dg-warning "unquoted keyword 'offsetof" } */ + cdiag ("sizeof x"); /* { dg-warning "unquoted keyword 'sizeof" } */ + cdiag ("have typeof"); /* { dg-warning "unquoted keyword 'typeof" } */ + + /* Words that are not keywords are so are not expected to be quoted. */ + cdiag ("break rules"); + cdiag ("if we continue by default for a short while else do nothing"); + cdiag ("register a function for unsigned extern to void const reads"); + cdiag ("or volatile access"); +} + + +void test_cdiag_operator (tree t, gimple *gc) +{ + cdiag ("x != 0"); /* { dg-warning "unquoted operator '!='" } */ + cdiag ("logical &&"); /* { dg-warning "unquoted operator '&&" } */ + cdiag ("+= operator"); /* { dg-warning "unquoted operator '\\\+=" } */ + cdiag ("a == b"); /* { dg-warning "unquoted operator '=='" } */ + cdiag ("++a"); /* { dg-warning "unquoted operator '\\\+\\\+'" } */ + cdiag ("b--"); /* { dg-warning "unquoted operator '--'" } */ + cdiag ("1 << 2"); /* { dg-warning "unquoted operator '<<'" } */ + cdiag (">> here <<"); /* { dg-warning "unquoted operator '>>|<<'" } */ +} + + +void test_cdiag_type_name (tree t, gimple *gc) +{ + cdiag ("the word character should not be quoted"); + cdiag ("but char should be"); /* { dg-warning "unquoted keyword 'char'" } */ + + cdiag ("unsigned char should be quoted"); /* { dg-warning "unquoted type name 'unsigned char'" } */ + cdiag ("but unsigned character is fine"); + + cdiag ("as should int"); /* { dg-warning "unquoted keyword 'int'" } */ + cdiag ("and signed int"); /* { dg-warning "unquoted type name 'signed int'" } */ + cdiag ("and also unsigned int"); /* { dg-warning "unquoted type name 'unsigned int'" } */ + cdiag ("very long thing"); + cdiag ("use long long here"); /* { dg-warning "unquoted type name 'long long'" } */ + + cdiag ("have a floating type"); + cdiag ("found float type"); /* { dg-warning "unquoted keyword 'float'" } */ + + cdiag ("wchar_t is wide"); /* { dg-warning "unquoted identifier or keyword 'wchar_t'" } */ +} + + +void test_cdiag_identifier (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("private _x ident"); /* { dg-warning "unquoted identifier or keyword '_x'" } */ + cdiag ("and another __y"); /* { dg-warning "unquoted identifier or keyword '__y'" } */ + cdiag ("ident z_ with trailing underscore"); /* { dg-warning "unquoted identifier or keyword 'z_'" } */ + cdiag ("v_ variable"); /* { dg-warning "unquoted identifier or keyword 'v_'" } */ + cdiag ("call foo_bar"); /* { dg-warning "unquoted identifier or keyword 'foo_bar'" } */ + cdiag ("unqoted x_y ident"); /* { dg-warning "unquoted identifier or keyword 'x_y'" } */ + + cdiag ("size_t type"); /* { dg-warning "unquoted identifier or keyword 'size_t'" } */ + cdiag ("bigger than INT_MAX");/* { dg-warning "unquoted identifier or keyword 'INT_MAX'" } */ + + cdiag ("quoted ident %"); + cdiag ("another quoted identifier % here"); +} + + +void test_cdiag_bad_words (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cdiag ("aren't you dumb?"); /* { dg-warning "bare apostrophe ''' in format" } */ + cdiag ("bitfields suck"); /* { dg-warning "misspelled term 'bitfields' in format; use 'bit-fields' instead" } */ + cdiag ("invalid bitfield"); /* { dg-warning "misspelled term 'bitfield' in format; use 'bit-field' instead" } */ + cdiag ("bad builtin function"); /* { dg-warning "misspelled term 'builtin function' in format; use 'built-in function' instead" } */ + cdiag ("bad builtin function"); /* { dg-warning "misspelled term 'builtin function' in format; use 'built-in function' instead" } */ + cdiag ("builtin function x"); /* { dg-warning "misspelled term 'builtin function' in format; use 'built-in function' instead" } */ + cdiag ("builtin functions disabled"); /* { dg-warning "misspelled term 'builtin functions' in format; use 'built-in functions' instead" } */ + cdiag ("enable builtin functions"); /* { dg-warning "misspelled term 'builtin functions' in format; use 'built-in functions' instead" } */ + cdiag ("you can't do that"); /* { dg-warning "contraction 'can't' in format" } */ + cdiag ("you can%'t do that");/* { dg-warning "contraction 'can%'t' in format" } */ + cdiag ("Can%'t touch this.");/* { dg-warning "contraction 'Can%'t' in format" } */ + cdiag ("on the commandline");/* { dg-warning "misspelled term 'commandline' in format; use 'command line' instead" } */ + cdiag ("command line option");/* { dg-warning "misspelled term 'command line option' in format; use 'command-line option' instead" } */ + cdiag ("it mustn't be"); /* { dg-warning "contraction 'mustn't' in format" } */ + cdiag ("isn't that silly?"); /* { dg-warning "bare apostrophe ''' in format" } */ + + cdiag ("can not do this"); /* { dg-warning "misspelled term 'can not' in format; use 'cannot' instead" } */ + cdiag ("you can not"); /* { dg-warning "misspelled term 'can not' in format; use 'cannot' instead" } */ + + /* See PR target/90157 - aarch64: unnecessary abbreviation in diagnostic */ + cdiag ("Mising arg."); /* { dg-warning "misspelled term 'arg' in format; use 'argument' instead" } */ + cdiag ("2 args: a and b"); /* { dg-warning "misspelled term 'args' in format; use 'arguments' instead" } */ + cdiag ("arg 1"); /* { dg-warning "misspelled term 'arg' in format; use 'argument' instead" } */ + cdiag ("Args are wrong."); /* { dg-warning "misspelled term 'Args' in format; use 'arguments' instead" } */ + cdiag ("bad arg"); /* { dg-warning "misspelled term 'arg' in format; use 'argument' instead" } */ + cdiag ("two args"); /* { dg-warning "misspelled term 'args' in format; use 'arguments' instead" } */ + cdiag ("args 1 and 2"); /* { dg-warning "misspelled term 'args' in format; use 'arguments' instead" } */ + + cdiag ("Reg A"); /* { dg-warning "misspelled term 'Reg' in format; use 'register' instead" } */ + cdiag ("regs A and B"); /* { dg-warning "misspelled term 'regs' in format; use 'registers' instead" } */ + cdiag ("no regs"); /* { dg-warning "misspelled term 'regs' in format; use 'registers' instead" } */ + + /* Verify words that end in "arg" and "args" or "reg" and "regs" are + not diagnosed. */ + cdiag ("gulmarg and balfarg"); + cdiag ("ademargs or toshargs"); + cdiag ("talk to Greg"); + cdiag ("prepreg is a fabric"); + cdiag ("there are dregs in my wine"); +} + + +void test_cdiag_directive (tree t, gimple *gc) +{ + (void)&t; (void)&gc; + + cxxdiag ("%<%s%>", ""); /* { dg-warning "quoted '%s' directive in format" } */ + /* This was asked to be diagnosed in PR #90158 but there, the \"%s\" + is in parenheses which ends up getting diagnosed because of + the two consecutive punctuation characters, ( and ". */ + cdiag ("\"%s\"", ""); /* { dg-warning "quoted '%s' directive in format" } */ + + /* Make sure quoted paired tokens are not diagnosed. */ + cdiag ("%<'%>"); + cdiag ("%<\"%>"); + cdiag ("%<<%>"); + cdiag ("%<>%>"); + cdiag ("%<(%>"); + cdiag ("%<)%>"); + cdiag ("%<[%>"); + cdiag ("%<]%>"); + + cdiag ("%<'%> %<\"%> %<>%> %<<%> %<)%> %<(%> %<]%> %<[%>"); +} diff --git a/gcc/testsuite/gcc.dg/funroll-loops-all.c b/gcc/testsuite/gcc.dg/funroll-loops-all.c index 9cdc90172557..ab12df1c431b 100644 --- a/gcc/testsuite/gcc.dg/funroll-loops-all.c +++ b/gcc/testsuite/gcc.dg/funroll-loops-all.c @@ -1,4 +1,4 @@ /* PR 17594 */ /* { dg-do compile } */ /* { dg-options "-funroll-loops-all" } */ -/* { dg-error "unrecognized command line option '-funroll-loops-all'" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-funroll-loops-all'" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/opts-5.c b/gcc/testsuite/gcc.dg/opts-5.c index ab1e6f91d3c6..80bead848552 100644 --- a/gcc/testsuite/gcc.dg/opts-5.c +++ b/gcc/testsuite/gcc.dg/opts-5.c @@ -2,4 +2,4 @@ /* { dg-do compile } */ /* { dg-options "-fstack-limit" } */ -/* { dg-error "unrecognized command line option" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/pr28322-2.c b/gcc/testsuite/gcc.dg/pr28322-2.c index 89dd15390f87..c9e5e228a7bf 100644 --- a/gcc/testsuite/gcc.dg/pr28322-2.c +++ b/gcc/testsuite/gcc.dg/pr28322-2.c @@ -8,5 +8,5 @@ int foo (void) return i; } -/* { dg-warning "unrecognized command line option .-Wno-foobar." "" { target *-*-* } 0 } */ +/* { dg-warning "unrecognized command-line option .-Wno-foobar." "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/pr28322-3.c b/gcc/testsuite/gcc.dg/pr28322-3.c index e714a3cc6f76..85926ade9e89 100644 --- a/gcc/testsuite/gcc.dg/pr28322-3.c +++ b/gcc/testsuite/gcc.dg/pr28322-3.c @@ -6,5 +6,5 @@ void foo(void) { int i = 1; } -/* { dg-message "unrecognized command line option .-fno-foobar." "f" { target *-*-* } 0 } */ -/* { dg-message "unrecognized command line option .-mno-foobar." "m" { target *-*-* } 0 } */ +/* { dg-message "unrecognized command-line option .-fno-foobar." "f" { target *-*-* } 0 } */ +/* { dg-message "unrecognized command-line option .-mno-foobar." "m" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/pr60087.c b/gcc/testsuite/gcc.dg/pr60087.c index c6cf7aa46075..b3bd811caea6 100644 --- a/gcc/testsuite/gcc.dg/pr60087.c +++ b/gcc/testsuite/gcc.dg/pr60087.c @@ -7,8 +7,8 @@ foo (unsigned int ui, int i) { const unsigned char uc = 0; _Bool b; - b = 0 != ~uc; /* { dg-warning "9:promoted ~unsigned is always non-zero" } */ - b = 2 != ~uc; /* { dg-warning "9:comparison of promoted ~unsigned with constant" } */ - b = uc == ~uc; /* { dg-warning "10:comparison of promoted ~unsigned with unsigned" } */ + b = 0 != ~uc; /* { dg-warning "9:promoted bitwise complement of an unsigned value is always nonzero" } */ + b = 2 != ~uc; /* { dg-warning "9:comparison of promoted bitwise complement of an unsigned value with constant" } */ + b = uc == ~uc; /* { dg-warning "10:comparison of promoted bitwise complement of an unsigned value with unsigned" } */ b = i == ui; /* { dg-warning "9:comparison of integer expressions of different signedness" } */ } diff --git a/gcc/testsuite/gcc.dg/pr78957.c b/gcc/testsuite/gcc.dg/pr78957.c index 305023e1870c..432211935b9a 100644 --- a/gcc/testsuite/gcc.dg/pr78957.c +++ b/gcc/testsuite/gcc.dg/pr78957.c @@ -1,6 +1,6 @@ /* PR driver/78957 */ /* { dg-do compile } */ /* { dg-options "-fno-sso-struct=none" } */ -/* { dg-error "unrecognized command line option" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option" "" { target *-*-* } 0 } */ int i; diff --git a/gcc/testsuite/gcc.dg/pr8715.c b/gcc/testsuite/gcc.dg/pr8715.c index e45e77c09f4c..2878a48a4d3d 100644 --- a/gcc/testsuite/gcc.dg/pr8715.c +++ b/gcc/testsuite/gcc.dg/pr8715.c @@ -7,7 +7,7 @@ int foo() { unsigned char b = '1'; - bool x = ~b; /* { dg-warning "promoted ~unsigned is always non-zero" } */ + bool x = ~b; /* { dg-warning "promoted bitwise complement of an unsigned value is always nonzero" } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/simd-2.c b/gcc/testsuite/gcc.dg/simd-2.c index e5462390effb..d24e076218dd 100644 --- a/gcc/testsuite/gcc.dg/simd-2.c +++ b/gcc/testsuite/gcc.dg/simd-2.c @@ -33,10 +33,10 @@ hanneke () foo = a; /* { dg-error "incompatible types when assigning" } */ /* Casted assignment between scalar and SIMD of same size. */ - foo = (typeof (foo)) foo2; /* { dg-error "aggregate value used where a floating point was expected" } */ + foo = (typeof (foo)) foo2; /* { dg-error "aggregate value used where a floating-point was expected" } */ /* Casted assignment between scalar and SIMD of different size. */ - foo1 = (typeof (foo1)) foo2; /* { dg-error "aggregate value used where a floating point was expected" } */ + foo1 = (typeof (foo1)) foo2; /* { dg-error "aggregate value used where a floating-point was expected" } */ /* Operators on compatible SIMD types. */ a += b + b; diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-1.c b/gcc/testsuite/gcc.dg/spellcheck-options-1.c index cd5fdcacfdb8..bebb494b6afa 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-1.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-1.c @@ -1,4 +1,4 @@ /* { dg-do compile } */ /* { dg-options "-Wcoercion" } */ -/* { dg-error "unrecognized command line option '-Wcoercion'; did you mean '-Wconversion'?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-Wcoercion'; did you mean '-Wconversion'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-10.c b/gcc/testsuite/gcc.dg/spellcheck-options-10.c index 1957205593b4..77c6b5494f57 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-10.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-10.c @@ -3,4 +3,4 @@ /* { dg-do compile } */ /* { dg-options "-fno-if-convert" } */ -/* { dg-error "unrecognized command line option .-fno-if-convert.; did you mean .-fno-if-conversion.?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option .-fno-if-convert.; did you mean .-fno-if-conversion.?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-12.c b/gcc/testsuite/gcc.dg/spellcheck-options-12.c index b5e65e54a395..9fbd944bcafd 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-12.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-12.c @@ -4,4 +4,4 @@ /* { dg-do compile } */ /* { dg-options "-fno-stack-protector-explicit" } */ -/* { dg-error "unrecognized command line option .-fno-stack-protector-explicit.; did you mean .-fstack-protector-explicit.." "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option .-fno-stack-protector-explicit.; did you mean .-fstack-protector-explicit.." "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-13.c b/gcc/testsuite/gcc.dg/spellcheck-options-13.c index 0d00642d87ea..94db0c5a458b 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-13.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-13.c @@ -2,4 +2,4 @@ /* { dg-do compile } */ /* { dg-options "-fsanitize" } */ -/* { dg-error "unrecognized command line option '-fsanitize'; did you mean '-fsanitize='?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-fsanitize'; did you mean '-fsanitize='?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-18.c b/gcc/testsuite/gcc.dg/spellcheck-options-18.c index 387d04e37433..26694f945a8b 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-18.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-18.c @@ -1,3 +1,3 @@ /* { dg-do compile } */ /* { dg-options "-fprofile-update" } */ -/* { dg-error "unrecognized command line option '-fprofile-update'; did you mean '-fprofile-update='?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-fprofile-update'; did you mean '-fprofile-update='?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-19.c b/gcc/testsuite/gcc.dg/spellcheck-options-19.c index 5a1047639936..68e85a71d77a 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-19.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-19.c @@ -1,3 +1,3 @@ /* { dg-do compile } */ /* { dg-options "-fno-sanitize" } */ -/* { dg-error "unrecognized command line option '-fno-sanitize'; did you mean '-fno-sanitize='?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-fno-sanitize'; did you mean '-fno-sanitize='?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-2.c b/gcc/testsuite/gcc.dg/spellcheck-options-2.c index 786266df390c..5156ad3ef175 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-2.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ /* { dg-options "-Wthis-should-not-get-a-hint" } */ /* { dg-bogus "did you mean" "" { target *-*-* } 0 } */ -/* { dg-error "unrecognized command line option '-Wthis-should-not-get-a-hint'" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-Wthis-should-not-get-a-hint'" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-20.c b/gcc/testsuite/gcc.dg/spellcheck-options-20.c index dfc6149e023a..d856d5a08105 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-20.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-20.c @@ -1,3 +1,3 @@ /* { dg-do compile } */ /* { dg-options "-Walloc-size-larger-than" } */ -/* { dg-error "unrecognized command line option '-Walloc-size-larger-than'; did you mean '-Walloc-size-larger-than='?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-Walloc-size-larger-than'; did you mean '-Walloc-size-larger-than='?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-3.c b/gcc/testsuite/gcc.dg/spellcheck-options-3.c index 4133df9555e1..cecc50299bbd 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-3.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-3.c @@ -3,4 +3,4 @@ /* { dg-do compile } */ /* { dg-options "-sanitize=address" } */ -/* { dg-error "unrecognized command line option '-sanitize=address'; did you mean '-fsanitize=address'?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-sanitize=address'; did you mean '-fsanitize=address'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-4.c b/gcc/testsuite/gcc.dg/spellcheck-options-4.c index 252376fd7575..ab730edea939 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-4.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-4.c @@ -3,4 +3,4 @@ /* { dg-do compile } */ /* { dg-options "-sanitize-recover=integer-divide-by-0" } */ -/* { dg-error "unrecognized command line option '-sanitize-recover=integer-divide-by-0'; did you mean '-fsanitize-recover=integer-divide-by-zero'?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-sanitize-recover=integer-divide-by-0'; did you mean '-fsanitize-recover=integer-divide-by-zero'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-5.c b/gcc/testsuite/gcc.dg/spellcheck-options-5.c index 9a02bb7afbb2..097faf0bce13 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-5.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-5.c @@ -3,4 +3,4 @@ /* { dg-do compile } */ /* { dg-options "-no-sanitize=all" } */ -/* { dg-error "unrecognized command line option '-no-sanitize=all'; did you mean '-fno-sanitize=all'?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-no-sanitize=all'; did you mean '-fno-sanitize=all'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-6.c b/gcc/testsuite/gcc.dg/spellcheck-options-6.c index 4d6bf0d945da..591e21461385 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-6.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-6.c @@ -3,4 +3,4 @@ /* { dg-do compile } */ /* { dg-options "-fwarn-no-abi-tag" } */ -/* { dg-error "unrecognized command line option '-fwarn-no-abi-tag'; did you mean '--warn-no-abi-tag'?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-fwarn-no-abi-tag'; did you mean '--warn-no-abi-tag'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-7.c b/gcc/testsuite/gcc.dg/spellcheck-options-7.c index ca8939949837..277d7d46876d 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-7.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-7.c @@ -3,4 +3,4 @@ /* { dg-do compile } */ /* { dg-options "-tls-model=global-dynamic" } */ -/* { dg-error "unrecognized command line option '-tls-model=global-dynamic'; did you mean '-ftls-model=global-dynamic'?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-tls-model=global-dynamic'; did you mean '-ftls-model=global-dynamic'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-8.c b/gcc/testsuite/gcc.dg/spellcheck-options-8.c index 2cc6c1ff1fe1..43cd5ac31fa7 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-8.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-8.c @@ -3,4 +3,4 @@ /* { dg-do compile } */ /* { dg-options "--Wno-narrowing" } */ -/* { dg-error "unrecognized command line option '--Wno-narrowing'; did you mean '-Wno-narrowing'?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '--Wno-narrowing'; did you mean '-Wno-narrowing'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-9.c b/gcc/testsuite/gcc.dg/spellcheck-options-9.c index 768b6f8c2a90..509f9e5936b0 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-options-9.c +++ b/gcc/testsuite/gcc.dg/spellcheck-options-9.c @@ -3,4 +3,4 @@ /* { dg-do compile } */ /* { dg-options "-fmo-unroll-loops" } */ -/* { dg-error "unrecognized command line option '-fmo-unroll-loops'; did you mean '-fno-unroll-loops'?" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-fmo-unroll-loops'; did you mean '-fno-unroll-loops'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/warn-abs-1.c b/gcc/testsuite/gcc.dg/warn-abs-1.c index a7f2ab20014c..ccd61efbe1e1 100644 --- a/gcc/testsuite/gcc.dg/warn-abs-1.c +++ b/gcc/testsuite/gcc.dg/warn-abs-1.c @@ -34,9 +34,9 @@ tst_notint (float *pf, double *pd, _Complex double *pc) void tst_notfloat (int *pi, long *pl, complex double *pc) { - *pi = fabsf (*pi); /* { dg-warning "using floating point absolute value function" } */ - *pl = fabs (*pl); /* { dg-warning "using floating point absolute value function" } */ - *pc = fabs (*pc); /* { dg-warning "using floating point absolute value function" } */ + *pi = fabsf (*pi); /* { dg-warning "using floating-point absolute value function" } */ + *pl = fabs (*pl); /* { dg-warning "using floating-point absolute value function" } */ + *pc = fabs (*pc); /* { dg-warning "using floating-point absolute value function" } */ } void diff --git a/gcc/testsuite/gcc.target/i386/spellcheck-options-5.c b/gcc/testsuite/gcc.target/i386/spellcheck-options-5.c index 61946f6543cb..f5b5d41c9f57 100644 --- a/gcc/testsuite/gcc.target/i386/spellcheck-options-5.c +++ b/gcc/testsuite/gcc.target/i386/spellcheck-options-5.c @@ -2,4 +2,4 @@ /* { dg-do compile { target *-*-linux* *-*-gnu* } } */ /* { dg-options "-mandroidX" } */ -/* { dg-error "unrecognized command line option '-mandroidX'; did you mean '-mandroid'" "" { target *-*-* } 0 } */ +/* { dg-error "unrecognized command-line option '-mandroidX'; did you mean '-mandroid'" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/obj-c++.dg/property/dotsyntax-17.mm b/gcc/testsuite/obj-c++.dg/property/dotsyntax-17.mm index ce0159822014..050d9bf9f1c9 100644 --- a/gcc/testsuite/obj-c++.dg/property/dotsyntax-17.mm +++ b/gcc/testsuite/obj-c++.dg/property/dotsyntax-17.mm @@ -35,19 +35,19 @@ int main (void) { MyRootClass *object = [[MyRootClass alloc] init]; - object.count = 10; /* { dg-error "readonly property cannot be set" } */ + object.count = 10; /* { dg-error "'readonly' property cannot be set" } */ if (object.count != 10) /* Ok */ abort (); /* Test errors when trying to change a readonly property using pre/post increment/decrement operators. */ - object.count++; /* { dg-error "readonly property cannot be set" } */ + object.count++; /* { dg-error "'readonly' property cannot be set" } */ - ++object.count; /* { dg-error "readonly property cannot be set" } */ + ++object.count; /* { dg-error "'readonly' property cannot be set" } */ - object.count--; /* { dg-error "readonly property cannot be set" } */ + object.count--; /* { dg-error "'readonly' property cannot be set" } */ - --object.count; /* { dg-error "readonly property cannot be set" } */ + --object.count; /* { dg-error "'readonly' property cannot be set" } */ /* Test errors when trying to change something using Objective-C 2.0 dot-syntax but there is a setter but no getter. */ diff --git a/gcc/testsuite/obj-c++.dg/property/property-neg-7.mm b/gcc/testsuite/obj-c++.dg/property/property-neg-7.mm index 245a807f4483..d721ed1295e2 100644 --- a/gcc/testsuite/obj-c++.dg/property/property-neg-7.mm +++ b/gcc/testsuite/obj-c++.dg/property/property-neg-7.mm @@ -13,8 +13,8 @@ void foo (NSArray *ans[], id pid, id apid[], int i) { NSArray *test; - test.count = 1; /* { dg-error "readonly property cannot be set" } */ - ((NSArray *)pid).count = 1; /* { dg-error "readonly property cannot be set" } */ - ((NSArray *)apid[i]).count = 1; /* { dg-error "readonly property cannot be set" } */ - ans[i].count = 3; /* { dg-error "readonly property cannot be set" } */ + test.count = 1; /* { dg-error "'readonly' property cannot be set" } */ + ((NSArray *)pid).count = 1; /* { dg-error "'readonly' property cannot be set" } */ + ((NSArray *)apid[i]).count = 1; /* { dg-error "'readonly' property cannot be set" } */ + ans[i].count = 3; /* { dg-error "'readonly' property cannot be set" } */ } diff --git a/gcc/testsuite/objc.dg/property/dotsyntax-17.m b/gcc/testsuite/objc.dg/property/dotsyntax-17.m index ce0159822014..050d9bf9f1c9 100644 --- a/gcc/testsuite/objc.dg/property/dotsyntax-17.m +++ b/gcc/testsuite/objc.dg/property/dotsyntax-17.m @@ -35,19 +35,19 @@ int main (void) { MyRootClass *object = [[MyRootClass alloc] init]; - object.count = 10; /* { dg-error "readonly property cannot be set" } */ + object.count = 10; /* { dg-error "'readonly' property cannot be set" } */ if (object.count != 10) /* Ok */ abort (); /* Test errors when trying to change a readonly property using pre/post increment/decrement operators. */ - object.count++; /* { dg-error "readonly property cannot be set" } */ + object.count++; /* { dg-error "'readonly' property cannot be set" } */ - ++object.count; /* { dg-error "readonly property cannot be set" } */ + ++object.count; /* { dg-error "'readonly' property cannot be set" } */ - object.count--; /* { dg-error "readonly property cannot be set" } */ + object.count--; /* { dg-error "'readonly' property cannot be set" } */ - --object.count; /* { dg-error "readonly property cannot be set" } */ + --object.count; /* { dg-error "'readonly' property cannot be set" } */ /* Test errors when trying to change something using Objective-C 2.0 dot-syntax but there is a setter but no getter. */ diff --git a/gcc/testsuite/objc.dg/property/property-neg-7.m b/gcc/testsuite/objc.dg/property/property-neg-7.m index 245a807f4483..d721ed1295e2 100644 --- a/gcc/testsuite/objc.dg/property/property-neg-7.m +++ b/gcc/testsuite/objc.dg/property/property-neg-7.m @@ -13,8 +13,8 @@ void foo (NSArray *ans[], id pid, id apid[], int i) { NSArray *test; - test.count = 1; /* { dg-error "readonly property cannot be set" } */ - ((NSArray *)pid).count = 1; /* { dg-error "readonly property cannot be set" } */ - ((NSArray *)apid[i]).count = 1; /* { dg-error "readonly property cannot be set" } */ - ans[i].count = 3; /* { dg-error "readonly property cannot be set" } */ + test.count = 1; /* { dg-error "'readonly' property cannot be set" } */ + ((NSArray *)pid).count = 1; /* { dg-error "'readonly' property cannot be set" } */ + ((NSArray *)apid[i]).count = 1; /* { dg-error "'readonly' property cannot be set" } */ + ans[i].count = 3; /* { dg-error "'readonly' property cannot be set" } */ } diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 85ce204ec264..94b258498dc5 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3619,7 +3619,7 @@ verify_gimple_assign_unary (gassign *stmt) && (!VECTOR_INTEGER_TYPE_P (rhs1_type) || !VECTOR_FLOAT_TYPE_P (lhs_type))) { - error ("invalid types in conversion to floating point"); + error ("invalid types in conversion to floating-point"); debug_generic_expr (lhs_type); debug_generic_expr (rhs1_type); return true; @@ -4811,7 +4811,7 @@ verify_gimple_label (glabel *stmt) if (!DECL_NONLOCAL (decl) && !FORCED_LABEL (decl) && DECL_CONTEXT (decl) != current_function_decl) { - error ("label%'s context is not the current function decl"); + error ("label context is not the current function declaration"); err |= true; } diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index c8063486f2db..23c56b5661a1 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -4728,6 +4728,14 @@ make_pass_cleanup_eh (gcc::context *ctxt) return new pass_cleanup_eh (ctxt); } +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow GCC + diagnostic conventions but are only used for debugging. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Verify that BB containing STMT as the last statement, has precisely the edge that make_eh_edges would create. */ @@ -4874,3 +4882,7 @@ verify_eh_dispatch_edge (geh_dispatch *stmt) return false; } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 1d6eae101ee7..455579c12903 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -35,6 +35,13 @@ along with GCC; see the file COPYING3. If not see #include "gomp-constants.h" #include "gimple.h" +/* Disable warnings about quoting issues in the pp_xxx calls below + that (intentionally) don't follow GCC diagnostic conventions. */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Local functions, macros and variables. */ static const char *op_symbol (const_tree); static void pretty_print_string (pretty_printer *, const char*, unsigned); @@ -4250,3 +4257,7 @@ pp_double_int (pretty_printer *pp, double_int d, bool uns) pp_string (pp, pp_buffer (pp)->digit_buffer); } } + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 899d47ff588d..e643b33a6b00 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -974,14 +974,14 @@ verify_ssa_operands (struct function *fn, gimple *stmt) def = SSA_NAME_VAR (def); if (build_vdef != def) { - error ("virtual definition of statement not up-to-date"); + error ("virtual definition of statement not up to date"); return true; } if (gimple_vdef (stmt) && ((def_p = gimple_vdef_op (stmt)) == NULL_DEF_OPERAND_P || DEF_FROM_PTR (def_p) != gimple_vdef (stmt))) { - error ("virtual def operand missing for stmt"); + error ("virtual def operand missing for statement"); return true; } @@ -991,14 +991,14 @@ verify_ssa_operands (struct function *fn, gimple *stmt) use = SSA_NAME_VAR (use); if (build_vuse != use) { - error ("virtual use of statement not up-to-date"); + error ("virtual use of statement not up to date"); return true; } if (gimple_vuse (stmt) && ((use_p = gimple_vuse_op (stmt)) == NULL_USE_OPERAND_P || USE_FROM_PTR (use_p) != gimple_vuse (stmt))) { - error ("virtual use operand missing for stmt"); + error ("virtual use operand missing for statement"); return true; } @@ -1015,7 +1015,7 @@ verify_ssa_operands (struct function *fn, gimple *stmt) } if (i == build_uses.length ()) { - error ("excess use operand for stmt"); + error ("excess use operand for statement"); debug_generic_expr (USE_FROM_PTR (use_p)); return true; } @@ -1025,14 +1025,14 @@ verify_ssa_operands (struct function *fn, gimple *stmt) FOR_EACH_VEC_ELT (build_uses, i, op) if (op != NULL) { - error ("use operand missing for stmt"); + error ("use operand missing for statement"); debug_generic_expr (*op); return true; } if (gimple_has_volatile_ops (stmt) != volatile_p) { - error ("stmt volatile flag not up-to-date"); + error ("statement volatile flag not up to date"); return true; } diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 8e3aec1e0a69..4b6fa449d572 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -627,6 +627,15 @@ release_defs_bitset (bitmap toremove) } +/* Disable warnings about missing quoting in GCC diagnostics for + the verification errors. Their format strings don't follow GCC + diagnostic conventions and the calls are ultimately followed by + one to internal_error. */ +#if __GNUC__ > 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-diag" +#endif + /* Verify virtual SSA form. */ bool @@ -1193,6 +1202,9 @@ err: internal_error ("verify_ssa failed"); } +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif /* Initialize global DFA and SSA structures. */ diff --git a/gcc/varasm.c b/gcc/varasm.c index 9397152dbce7..626a4c9f9a0d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -5904,7 +5904,7 @@ do_assemble_alias (tree decl, tree target) else #endif error_at (DECL_SOURCE_LOCATION (decl), - "ifunc is not supported on this target"); + "%qs is not supported on this target", "ifunc"); } # ifdef ASM_OUTPUT_DEF_FROM_DECLS @@ -5962,9 +5962,9 @@ assemble_alias (tree decl, tree target) ultimate_transparent_alias_target (&target); if (alias == target) - error ("weakref %q+D ultimately targets itself", decl); + error ("%qs symbol %q+D ultimately targets itself", "weakref", decl); if (TREE_PUBLIC (decl)) - error ("weakref %q+D must have static linkage", decl); + error ("%qs symbol %q+D must have static linkage", "weakref", decl); } else { @@ -5981,7 +5981,7 @@ assemble_alias (tree decl, tree target) if (TREE_CODE (decl) == FUNCTION_DECL && lookup_attribute ("ifunc", DECL_ATTRIBUTES (decl))) error_at (DECL_SOURCE_LOCATION (decl), - "ifunc is not supported in this configuration"); + "%qs is not supported in this configuration", "ifunc"); else error_at (DECL_SOURCE_LOCATION (decl), "only weak aliases are supported in this configuration"); -- 2.39.2