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

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

https://gcc.gnu.org/g:440be01b07941506d1c8819448bd17c8717d55f5

commit r15-5053-g440be01b07941506d1c8819448bd17c8717d55f5
Author: Marek Polacek <pola...@redhat.com>
Date:   Thu Oct 31 09:28:15 2024 -0400

    c: Implement C2y N3356, if declarations [PR117019]

    This patch implements C2y N3356, if declarations as described at
    <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3356.htm>.

    This feature is cognate with C++17 Selection statements with initializer
    <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0305r1.html>,
    but they are not the same yet.  For example, C++17 allows

      if (lock (); int i = getval ())

    whereas C2y does not.

    The proposal adds new grammar productions.  selection-header is handled
    in c_parser_selection_header which is the gist of the patch.
    simple-declaration is handled by c_parser_declaration_or_fndef, which
    gets a new parameter.

            PR c/117019

    gcc/c/ChangeLog:

            * c-parser.cc (c_parser_declaration_or_fndef): Adjust declaration.
            (c_parser_external_declaration): Adjust a call to
            c_parser_declaration_or_fndef.
            (c_parser_declaration_or_fndef): New bool parameter.  Return a tree
            instead of void.  Adjust for N3356.  Adjust a call to
            c_parser_declaration_or_fndef.
            (c_parser_compound_statement_nostart): Adjust calls to
            c_parser_declaration_or_fndef.
            (c_parser_selection_header): New.
            (c_parser_paren_selection_header): New.
            (c_parser_if_statement): Call c_parser_paren_selection_header
            instead of c_parser_paren_condition.
            (c_parser_switch_statement): Call c_parser_selection_header instead
of
            c_parser_expression.
            (c_parser_for_statement): Adjust calls to
c_parser_declaration_or_fndef.
            (c_parser_objc_methodprotolist): Likewise.
            (c_parser_oacc_routine): Likewise.
            (c_parser_omp_loop_nest): Likewise.
            (c_parser_omp_declare_simd): Likewise.

    gcc/testsuite/ChangeLog:

            * gcc.dg/c23-if-decls-1.c: New test.
            * gcc.dg/c23-if-decls-2.c: New test.
            * gcc.dg/c2y-if-decls-1.c: New test.
            * gcc.dg/c2y-if-decls-2.c: New test.
            * gcc.dg/c2y-if-decls-3.c: New test.
            * gcc.dg/c2y-if-decls-4.c: New test.
            * gcc.dg/c2y-if-decls-5.c: New test.
            * gcc.dg/c2y-if-decls-6.c: New test.
            * gcc.dg/c2y-if-decls-7.c: New test.
            * gcc.dg/c2y-if-decls-8.c: New test.
            * gcc.dg/c2y-if-decls-9.c: New test.
            * gcc.dg/c2y-if-decls-10.c: New test.
            * gcc.dg/c2y-if-decls-11.c: New test.
            * gcc.dg/gnu2y-if-decls-1.c: New test.
            * gcc.dg/gnu99-if-decls-1.c: New test.
            * gcc.dg/gnu99-if-decls-2.c: New test.
  • [Bug c/117019] [C2y] Implement ... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to