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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Jakub Jelinek
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:281a6a0a8b3b2fd7c07ad6e0bf8454d60d9d5034

commit r15-10156-g281a6a0a8b3b2fd7c07ad6e0bf8454d60d9d5034
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Jul 30 13:23:56 2025 +0200

    c++: Make __extension__ silence -Wlong-long pedwarns/warnings [PR121133]

    The PR13358 r0-92909 change changed the diagnostics on long long
    in C++ (either with -std=c++98 or -Wlong-long), but unlike the
    C FE we unfortunately warn even in the
    __extension__ long long a;
    etc. cases.  The C FE in that case in
    disable_extension_diagnostics saves and clears not just
    pedantic flag but also warn_long_long (and several others), while
    C++ FE only temporarily disables pedantic.

    The following patch makes it behave like the C FE in this regard,
    though (__extension__ 1LL) still doesn't work because of the
    separate lexing (and I must say I have no idea how to fix that).

    Or do you prefer a solution closer to the C FE, cp_parser_extension_opt
    saving the values into a bitfield and have another function to restore
    the state (or use RAII)?

    2025-07-30  Jakub Jelinek  <ja...@redhat.com>

            PR c++/121133
            * parser.cc (cp_parser_unary_expression): Adjust
            cp_parser_extension_opt caller and restore warn_long_long.
            (cp_parser_declaration): Likewise.
            (cp_parser_block_declaration): Likewise.
            (cp_parser_member_declaration): Likewise.
            (cp_parser_extension_opt): Add SAVED_LONG_LONG argument,
            save previous warn_long_long state into it and clear it
            for __extension__.

            * g++.dg/warn/pr121133-1.C: New test.
            * g++.dg/warn/pr121133-2.C: New test.
            * g++.dg/warn/pr121133-3.C: New test.
            * g++.dg/warn/pr121133-4.C: New test.

    (cherry picked from commit fac66b476afccac607dbd9b4e971a42a04666387)

Reply via email to