public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/113760] [DR1693] gcc rejects valid empty-declaration in pedantic mode
Date: Wed, 15 May 2024 17:26:01 +0000	[thread overview]
Message-ID: <bug-113760-4-7fZmngSp6j@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113760-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113760

--- Comment #18 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:0b3eac4b54a52bf206b88743d1e987badc97cff4

commit r15-522-g0b3eac4b54a52bf206b88743d1e987badc97cff4
Author: Marek Polacek <polacek@redhat.com>
Date:   Mon Feb 12 19:36:16 2024 -0500

    c++: DR 569, DR 1693: fun with semicolons [PR113760]

    Prompted by c++/113760, I started looking into a bogus "extra ;"
    warning in C++11.  It quickly turned out that if I want to fix
    this for good, the fix will not be so small.

    This patch touches on DR 569, an extra ; at namespace scope should
    be allowed since C++11:

      struct S {
      };
      ; // pedwarn in C++98

    It also touches on DR 1693, which allows superfluous semicolons in
    class definitions since C++11:

      struct S {
        int a;
        ; // pedwarn in C++98
      };

    Note that a single semicolon is valid after a member function definition:

      struct S {
        void foo () {}; // only warns with -Wextra-semi
      };

    There's a new function maybe_warn_extra_semi to handle all of the above
    in a single place.  So now they all get a fix-it hint.

    -Wextra-semi turns on all "extra ;" diagnostics.  Currently, options
    like -Wc++11-compat or -Wc++11-extensions are not considered.

            DR 1693
            PR c++/113760
            DR 569

    gcc/c-family/ChangeLog:

            * c.opt (Wextra-semi): Initialize to -1.

    gcc/cp/ChangeLog:

            * parser.cc (extra_semi_kind): New.
            (maybe_warn_extra_semi): New.
            (cp_parser_declaration): Call maybe_warn_extra_semi.
            (cp_parser_member_declaration): Likewise.

    gcc/ChangeLog:

            * doc/invoke.texi: Update -Wextra-semi documentation.

    gcc/testsuite/ChangeLog:

            * g++.dg/diagnostic/semicolon1.C: New test.
            * g++.dg/diagnostic/semicolon10.C: New test.
            * g++.dg/diagnostic/semicolon11.C: New test.
            * g++.dg/diagnostic/semicolon12.C: New test.
            * g++.dg/diagnostic/semicolon13.C: New test.
            * g++.dg/diagnostic/semicolon14.C: New test.
            * g++.dg/diagnostic/semicolon15.C: New test.
            * g++.dg/diagnostic/semicolon16.C: New test.
            * g++.dg/diagnostic/semicolon17.C: New test.
            * g++.dg/diagnostic/semicolon2.C: New test.
            * g++.dg/diagnostic/semicolon3.C: New test.
            * g++.dg/diagnostic/semicolon4.C: New test.
            * g++.dg/diagnostic/semicolon5.C: New test.
            * g++.dg/diagnostic/semicolon6.C: New test.
            * g++.dg/diagnostic/semicolon7.C: New test.
            * g++.dg/diagnostic/semicolon8.C: New test.
            * g++.dg/diagnostic/semicolon9.C: New test.

  parent reply	other threads:[~2024-05-15 17:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05  7:07 [Bug c++/113760] New: " tanksherman27 at gmail dot com
2024-02-05  7:14 ` [Bug c++/113760] " pinskia at gcc dot gnu.org
2024-02-05  7:19 ` pinskia at gcc dot gnu.org
2024-02-05  7:23 ` pinskia at gcc dot gnu.org
2024-02-05 10:13 ` redi at gcc dot gnu.org
2024-02-05 14:49 ` kab at acm dot org
2024-02-05 15:10 ` [Bug c++/113760] [DR1693] " redi at gcc dot gnu.org
2024-02-07  9:29 ` jakub at gcc dot gnu.org
2024-02-12 16:38 ` mpolacek at gcc dot gnu.org
2024-02-12 16:46 ` mpolacek at gcc dot gnu.org
2024-02-12 17:07 ` mpolacek at gcc dot gnu.org
2024-02-12 21:29 ` mpolacek at gcc dot gnu.org
2024-02-12 23:36 ` harald at gigawatt dot nl
2024-02-12 23:49 ` mpolacek at gcc dot gnu.org
2024-02-13  1:17 ` harald at gigawatt dot nl
2024-02-13  1:54 ` mpolacek at gcc dot gnu.org
2024-02-13 19:27 ` mpolacek at gcc dot gnu.org
2024-02-13 23:08 ` cvs-commit at gcc dot gnu.org
2024-02-13 23:09 ` mpolacek at gcc dot gnu.org
2024-05-15 17:26 ` cvs-commit at gcc dot gnu.org [this message]
2024-05-15 17:26 ` mpolacek at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113760-4-7fZmngSp6j@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).