[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #17 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Marek Polacek
:

https://gcc.gnu.org/g:2c4b5bd4440292eca51de1f09ccce0d139ab981e

commit r11-9474-g2c4b5bd4440292eca51de1f09ccce0d139ab981e
Author: Marek Polacek 
Date:   Mon Jan 17 16:26:01 2022 -0500

c-family: Have -Wformat-diag accept "decl-specifier" [PR103758]

I'm tired of seeing

cp/parser.c:15923:55: warning: misspelled term 'decl' in format; use
'declaration' instead [-Wformat-diag]
cp/parser.c:15925:57: warning: misspelled term 'decl' in format; use
'declaration' instead [-Wformat-diag]

every time I compile cp/parser.c, which happens...a lot.  I'd like my
compilation to be free of warnings, otherwise I'm going to miss some
important ones.

"decl-specifiers" is a C++ grammar term; it is not actual code, so
should not be wrapped with %< %>.  I hope we can accept it as an exception
in check_tokens.

It was surrounded by %< %> in cp_parser_decl_specifier_seq, so fix that.

In passing, fix a misspelling in missspellings.

PR c++/103758

gcc/c-family/ChangeLog:

* c-format.c (check_tokens): Accept "decl-specifier*".

gcc/cp/ChangeLog:

* parser.c (cp_parser_decl_specifier_seq): Replace
%
with %qD.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-condition.C: Adjust dg-error.

(cherry picked from commit bb936163e28fdbe1a751c55d5e5975e036322a3d)

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-17 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #16 from Marek Polacek  ---
Yeah, I'm testing a patch which does just that.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #15 from Jakub Jelinek  ---
Just replace startswith (x, y) with strncmp (x, y, strlen (y)) == 0 for 11 and
earlier.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-17 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #14 from Marek Polacek  ---
Oops, that broke the build:

.../c-family/c-format.c:3229:22: error: ‘startswith’ was not declared in this
scope
 3229 |   && startswith (format_chars, "decl-specifier"))

I've reverted the patch.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-17 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

Marek Polacek  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #13 from Marek Polacek  ---
Now fixed in GCC 11 too.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #12 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Marek Polacek
:

https://gcc.gnu.org/g:a59360efef52468ad4648304f7ba56037f130a9a

commit r11-9472-ga59360efef52468ad4648304f7ba56037f130a9a
Author: Marek Polacek 
Date:   Fri Dec 17 14:34:12 2021 -0500

c-family: Have -Wformat-diag accept "decl-specifier" [PR103758]

I'm tired of seeing

cp/parser.c:15923:55: warning: misspelled term 'decl' in format; use
'declaration' instead [-Wformat-diag]
cp/parser.c:15925:57: warning: misspelled term 'decl' in format; use
'declaration' instead [-Wformat-diag]

every time I compile cp/parser.c, which happens...a lot.  I'd like my
compilation to be free of warnings, otherwise I'm going to miss some
important ones.

"decl-specifiers" is a C++ grammar term; it is not actual code, so
should not be wrapped with %< %>.  I hope we can accept it as an exception
in check_tokens.

It was surrounded by %< %> in cp_parser_decl_specifier_seq, so fix that.

In passing, fix a misspelling in missspellings.

PR c++/103758

gcc/c-family/ChangeLog:

* c-format.c (check_tokens): Accept "decl-specifier*".

gcc/cp/ChangeLog:

* parser.c (cp_parser_decl_specifier_seq): Replace
%
with %qD.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-condition.C: Adjust dg-error.

(cherry picked from commit bb936163e28fdbe1a751c55d5e5975e036322a3d)

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-05 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #11 from CVS Commits  ---
The trunk branch has been updated by Marek Polacek :

https://gcc.gnu.org/g:1935db296892bbd9fc597889237528bd7e080ab1

commit r12-6277-g1935db296892bbd9fc597889237528bd7e080ab1
Author: Marek Polacek 
Date:   Wed Jan 5 17:53:30 2022 -0500

Avoid more -Wformat-diag warnings [PR103758]

Let's use "%, %, or %" rather than "[x|y|z]" as in the rest of
our codebase.

PR c++/103758

gcc/c-family/ChangeLog:

* c-pragma.c (handle_pragma_scalar_storage_order): Use %< %> in
diagnostic messages.
(handle_pragma_diagnostic): Likewise.

gcc/testsuite/ChangeLog:

* gcc.dg/sso-6.c: Update dg-warning.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-05 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #10 from Martin Sebor  ---
The diagnostic kinds in the call:

  warning_at (loc, OPT_Wpragmas,
  "missing [error|warning|ignored|push|pop|ignored_attributes]"
  " after %<#pragma GCC diagnostic%>");

should be quoted, just like the #pragma.  (That's also what the message is
telling us.)

That said, rather than adding exceptions for every term of grammar that
triggers this warning, adding a new quoting directive will avoid the problem
and also let us annotate them in their own font (e.g., in italics).

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-05 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #9 from Marek Polacek  ---
Sure, I can make that change!

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-05 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #8 from Jakub Jelinek  ---
%, %, or % after actually.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-05 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek  ---
For ignored_attributes, I must say I don't really like the missing [x|y|z]
after ... wording, missing %, %, % after ... would be slightly less
compact, but more readable.  All of that appears in c-pragma.c and not
elsewhere:
c-family/c-pragma.c:GCC_BAD ("missing [big-endian|little-endian|default]
after %<#pragma scalar_storage_order%>");
c-family/c-pragma.c:GCC_BAD ("expected [big-endian|little-endian|default]
after %<#pragma scalar_storage_order%>");
c-family/c-pragma.c:  "missing
[error|warning|ignored|push|pop|ignored_attributes]"
c-family/c-pragma.c:  "expected
[error|warning|ignored|push|pop|ignored_attributes]"

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-05 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #6 from Marek Polacek  ---
Yes, the one in gimple-ssa-warn-access.c looks trivial, the other two are mine,
and will probably need another exception.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-05 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #5 from Martin Liška  ---
Btw. can we remove the last 3 remaining warnings for x86_64 and enabled
-Werror=format-diag (at least for bootstrap on x86_64):

/home/marxin/Programming/gcc/gcc/c-family/c-pragma.c:774:60: warning: unquoted
identifier or keyword ‘ignored_attributes’ in format [-Wformat-diag]
/home/marxin/Programming/gcc/gcc/c-family/c-pragma.c:833:61: warning: unquoted
identifier or keyword ‘ignored_attributes’ in format [-Wformat-diag]
/home/marxin/Programming/gcc/gcc/gimple-ssa-warn-access.cc:2844:30: warning:
quoted ‘%s’ directive in format; use ‘%qs’ instead [-Wformat-diag]

We've got -Wformat-diag for quite some time, but we haven't enabled -Werror for
it yet.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-03 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #4 from Marek Polacek  ---
Fixed in GCC 12, will backport to GCC 11 around Jan 17.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2022-01-03 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #3 from CVS Commits  ---
The trunk branch has been updated by Marek Polacek :

https://gcc.gnu.org/g:bb936163e28fdbe1a751c55d5e5975e036322a3d

commit r12-6195-gbb936163e28fdbe1a751c55d5e5975e036322a3d
Author: Marek Polacek 
Date:   Fri Dec 17 14:34:12 2021 -0500

c-family: Have -Wformat-diag accept "decl-specifier" [PR103758]

I'm tired of seeing

cp/parser.c:15923:55: warning: misspelled term 'decl' in format; use
'declaration' instead [-Wformat-diag]
cp/parser.c:15925:57: warning: misspelled term 'decl' in format; use
'declaration' instead [-Wformat-diag]

every time I compile cp/parser.c, which happens...a lot.  I'd like my
compilation to be free of warnings, otherwise I'm going to miss some
important ones.

"decl-specifiers" is a C++ grammar term; it is not actual code, so
should not be wrapped with %< %>.  I hope we can accept it as an exception
in check_tokens.

It was surrounded by %< %> in cp_parser_decl_specifier_seq, so fix that.

In passing, fix a misspelling in missspellings.

PR c++/103758

gcc/c-family/ChangeLog:

* c-format.c (check_tokens): Accept "decl-specifier*".

gcc/cp/ChangeLog:

* parser.c (cp_parser_decl_specifier_seq): Replace
%
with %qD.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-condition.C: Adjust dg-error.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2021-12-17 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2021-12-17 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

--- Comment #2 from Marek Polacek  ---
Incidentally, this

error ("% invalid in condition");

in cp_parser_decl_specifier_seq should be adjusted as well.

[Bug c++/103758] bogus warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

2021-12-17 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103758

Jason Merrill  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-12-17
 Ever confirmed|0   |1

--- Comment #1 from Jason Merrill  ---
Agreed.