public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9473] Revert "c-family: Have -Wformat-diag accept "decl-specifier" [PR103758]"
@ 2022-01-17 18:38 Marek Polacek
  0 siblings, 0 replies; only message in thread
From: Marek Polacek @ 2022-01-17 18:38 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6830d3bd9ea06cf005f679fc1ebe490cb05b0696

commit r11-9473-g6830d3bd9ea06cf005f679fc1ebe490cb05b0696
Author: Marek Polacek <polacek@redhat.com>
Date:   Mon Jan 17 13:38:01 2022 -0500

    Revert "c-family: Have -Wformat-diag accept "decl-specifier" [PR103758]"
    
    This reverts commit a59360efef52468ad4648304f7ba56037f130a9a.

Diff:
---
 gcc/c-family/c-format.c                          | 8 +-------
 gcc/cp/parser.c                                  | 2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C | 2 +-
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index 407a56fd61e..0a63cacb0d9 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -3202,7 +3202,7 @@ check_tokens (const token_t *tokens, unsigned ntoks,
 			   wlen, format_chars);
   else
     {
-      /* Diagnose some common misspellings.  */
+      /* Diagnose some common missspellings.  */
       for (unsigned i = 0; i != sizeof badwords / sizeof *badwords; ++i)
 	{
 	  unsigned badwlen = strspn (badwords[i].name, " -");
@@ -3223,12 +3223,6 @@ check_tokens (const token_t *tokens, unsigned ntoks,
 		  plural = "s";
 		}
 
-	      /* As an exception, don't warn about "decl-specifier*" since
-		 it's a C++ grammar production.  */
-	      if (badwords[i].name[0] == 'd'
-		  && startswith (format_chars, "decl-specifier"))
-		continue;
-
 	      format_warning_substr (format_string_loc, format_string_cst,
 				     fmtchrpos, fmtchrpos + badwords[i].len,
 				     opt,
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d1b671e77c9..01006989a02 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -15054,7 +15054,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 ("%qD invalid in condition", ridpointers[token->keyword]);
+	error ("%<decl-specifier%> invalid in condition");
 
       if (found_decl_spec
 	  && (flags & CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR)
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C
index e81acba68ae..733d494c4d7 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 "'static' invalid" }
+  if (static long v = something()) { } // { dg-error "'decl-specifier' invalid" }
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-17 18:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 18:38 [gcc r11-9473] Revert "c-family: Have -Wformat-diag accept "decl-specifier" [PR103758]" Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).