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

commit 0da6d2a81350c427a6980d2192f416dca8249d40
Author: Waffl3x <[email protected]>
Date:   Tue May 5 09:01:56 2026 -0600

    OpenMP/C++: Remove case PRAGMA_OMP_ALLOCATE from cp_parser_omp_construct
    
    The OpenMP allocate directive is not a construct, and thus is not supposed
    to be handled by cp_parser_omp_construct, as far as I can tell it never was.
    With this change PRAGMA_OMP_ALLOCATE will correctly trap if handled here,
    as such this patch should have no functional impact, merely clarifying
    intent and preventing future incorrect usage.
    
    This also adds a few clarifying comments, based on my interpretation of the
    code. The significance of the return value of cp_parser_pragma is still not
    totally clear to me so no general comments are included for it.
    
    gcc/cp/ChangeLog:
    
            * parser.cc (cp_parser_omp_construct)
            <case PRAGMA_OMP_ALLOCATE>: Remove.
            (cp_parser_pragma): Add comments.
    
    Signed-off-by: Waffl3x <[email protected]>

Diff:
---
 gcc/cp/parser.cc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index e1c6658561a6..fae6ed69e62a 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -56890,9 +56890,6 @@ cp_parser_omp_construct (cp_parser *parser, cp_token 
*pragma_tok, bool *if_p)
     case PRAGMA_OACC_WAIT:
       stmt = cp_parser_oacc_wait (parser, pragma_tok);
       break;
-    case PRAGMA_OMP_ALLOCATE:
-      cp_parser_omp_allocate (parser, pragma_tok);
-      return;
     case PRAGMA_OMP_ATOMIC:
       cp_parser_omp_atomic (parser, pragma_tok, false);
       return;
@@ -57602,7 +57599,9 @@ cp_parser_pragma (cp_parser *parser, enum 
pragma_context context, bool *if_p)
       cp_parser_omp_construct (parser, pragma_tok, if_p);
       return true;
     case PRAGMA_OMP_ALLOCATE:
+      /* The allocate directive is not a construct.  */
       cp_parser_omp_allocate (parser, pragma_tok);
+      /* EOL is handled in cp_parser_omp_allocate, don't break.  */
       return false;
     case PRAGMA_OACC_ATOMIC:
     case PRAGMA_OACC_CACHE:

Reply via email to