https://gcc.gnu.org/g:8782866a01b9c14707f29a14530732f102f62b51
commit r17-6098-g8782866a01b9c14707f29a14530732f102f62b51 Author: Waffl3x <[email protected]> Date: Tue May 5 15:01:56 2026 +0000 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 349ffeedbcd0..4e7f733c81d3 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -57125,9 +57125,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; @@ -57837,7 +57834,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:
