| Message ID | 20260505151030.1749548-4-waffl3x@baylibre.com |
|---|---|
| State | New |
| Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id A1A074B9DB48 for <patchwork@sourceware.org>; Tue, 5 May 2026 15:11:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1A074B9DB48 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=baylibre-com.20251104.gappssmtp.com header.i=@baylibre-com.20251104.gappssmtp.com header.a=rsa-sha256 header.s=20251104 header.b=dCeazgTw X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 9BFA74BA23F6 for <gcc-patches@gcc.gnu.org>; Tue, 5 May 2026 15:10:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9BFA74BA23F6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9BFA74BA23F6 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777993839; cv=none; b=UKBWpOKzl/K87PzvysC1LXDt/WzQp9SX+cnzmBuSvh/LU/Aq2KKcw0RPNrG1gBfV2gbbTWfT90GgVR2IybRCKKpPJF9F6EEXHhgt65RHrsWzfc5o9Rgjvo/VehUiqwtcGXEj1MF/IcrzURBaMh8V2qNP6sXeZF2Y4v0mDt+nu6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777993839; c=relaxed/simple; bh=5uDVyM+V78QBMhAG06zjqq7my4+lkK5B+DeOQXP9fn4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dM6LYHkB07YQFpeM7BdvGNof7UmgFY2y0EDuWBp+qkpRPWnEfMigD6iA+3tgEb1mlW9VcmWM4vNnoziWODDqgE0vYYF00nnjn+5ajQt2kPLivZo2vBubs37SBdcxmD3UnD25ODiickwDWuGPGq3DzEK30lX0oEqwTJi/Z0e1tjQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BFA74BA23F6 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-826c4c6d95dso266076b3a.0 for <gcc-patches@gcc.gnu.org>; Tue, 05 May 2026 08:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1777993838; x=1778598638; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3JMEH/PgOWQQPvaebZ8C/RP7WfisHsGqHaiguptCQo4=; b=dCeazgTwKEPR/COTFXh4wmmw8qBqQ3QRZUZJ30GJJj8hI1l+S7Gl5A17QdnHud4M+o QCRG8J5ioyAAa3cRPLUCiugal9fER+Y8OqCJ91qlKOUhdwE7wk6v0kOIj67srHOw0OTG w35e5r2gLGbTAAi2FcmWCNpBMoe4E8+J+g7M0ujnJ3B/RcapsIR/zk6n2I376sua0qo7 7MBWXVhn1MKRbopAABtV7YE3Q9dsVBurX1sDP4rX0kBczsf3djAYACg3jdjvd5FifaHi IUH37tRXnVnZyedYxVUIZteKgHPv7jYTdNN1qcirHsofP0zvviiOYLnxNSqIrfNAe5+n vUWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777993838; x=1778598638; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=3JMEH/PgOWQQPvaebZ8C/RP7WfisHsGqHaiguptCQo4=; b=Jw5aExfbOBU6ac55nl9WslHfdWULLUs7J9tf1jN0pknMpgO9GpOsjvQR7/M4YADnKp mOAFzsS97RxmtHTsANJ3Vz89idDe0ZwVAIACAmFIiWe/sAM1uBON8NRhWUgdHGMuFI0X 2jZZM27JjP+gWnvGYfEOmoGQZOt+Z9tjA71y9kGkwUzFgdyXwtXjHHhExqOD5fg5p/F/ XVvMPBmhvPcOsjmxnUXTbYqpCjDjlzfNuHBAOKySg4lutwdCag7K6ovqAB2CA1D50y75 OwMLiC1hTI/1nxl5Tt2D7eY8yfUOxaklDm0Xlt+zJbyq8zSx5EuZP3J/6W7Sxc7cYTdb Cqtg== X-Gm-Message-State: AOJu0YxozN9Ls+g5TBWDnl8eyJXdicKMw9QdxMNVQcd+G11KogVnyQsb 3CEWsQnlE8Y4Zwb8XZJEyt91MAy40vyfbmtTk9qnkN1k3hNI03neIvTwMPNMX63IrUsh79GYUSF d0wKD X-Gm-Gg: AeBDieuxhsmDytJ5m+6hmzZmxm0IYomj6UYaZsHjA+S18Th7Id3or1V+Z2Th+V6wh5p NtTjuEOV7u2le8B2NXJVGrEdoQGb4ti6z+b36tu9A+LF2bkysme4N10XIPsM1lyRrpmgZXYzT6X MIVUrW4Xr5vGWjdH8NEegOUjj+N6aXqOmAQtOQpox21WfPpshGb7IwtUETekGwpfnJ1EU7u6EmD KW0v1k4UlaNz0D5/IDdMWsjjT6Or/Z/1+7xByn3PgyzFQSa8IKHtO3+OUQg5+zlaiJd3B8mlrti lBSK/AnnVxszyvLS3OOZSrVILgsnIcVLsc5AulrgbETpcrRezsJCA69Qg5aJpYH3pDYN8Pva513 AS+n1d98QWJToy+T0Tjx+A4WCUY1UwO2Z3Hu7j/rfLwho6OBQVP7dU4ZtE0HT5doimkQyxefZXp QdybbVOaV/HPYanDhBcWI//NZ7D2NFRHOZT0J25vofcd36mWRtQA== X-Received: by 2002:a05:6a21:a510:b0:3a3:2819:5d41 with SMTP id adf61e73a8af0-3a7f1c8590amr8179948637.5.1777993838433; Tue, 05 May 2026 08:10:38 -0700 (PDT) Received: from waffl3x-prestige.lan ([2001:56a:f98a:b800:1f67:ce08:3cbd:86b8]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83965645140sm2674956b3a.12.2026.05.05.08.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 08:10:37 -0700 (PDT) From: Waffl3x <waffl3x@baylibre.com> To: gcc-patches@gcc.gnu.org Cc: Waffl3x <waffl3x@baylibre.com> Subject: [PATCH 03/12] OpenMP/C++: Remove case PRAGMA_OMP_ALLOCATE from cp_parser_omp_construct Date: Tue, 5 May 2026 09:01:56 -0600 Message-ID: <20260505151030.1749548-4-waffl3x@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260505151030.1749548-1-waffl3x@baylibre.com> References: <CAH+W3Ppbho4pj6W-rWk4mMssrttOjt7aNco-oWW5Sw5f5Yx2GA@mail.gmail.com> <20260505151030.1749548-1-waffl3x@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
| Series |
OpenMP/C++: 'allocate' directive
|
|
Commit Message
Waffl3x
May 5, 2026, 3:01 p.m. UTC
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 <waffl3x@baylibre.com>
---
gcc/cp/parser.cc | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
On 5/5/26 09:01, Waffl3x wrote: > 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 <waffl3x@baylibre.com> I think this one also qualifies as "obvious". It's consistent with how the C parser handles this and fixes what appears to be a think-o in the C++ parser support (which was added at the same time). I assume this is all adequately tested by later patches in the series, right? -Sandra
Waffl3x wrote: > The OpenMP allocate directive is not a construct, and thus is not supposed > to be handled by cp_parser_omp_construct, ... > gcc/cp/ChangeLog: > > * parser.cc (cp_parser_omp_construct) > <case PRAGMA_OMP_ALLOCATE>: Remove. > (cp_parser_pragma): Add comments. > --- a/gcc/cp/parser.cc > +++ b/gcc/cp/parser.cc > @@ -56537,9 +56537,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; Well spotted. Thanks! > @@ -57249,7 +57246,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; The first one is IMHO more confusing than helpful - it is true for about a third of the directives listed - i.e. both construct and non-constructs are handled here. I think the second comment is not needed (true for about half of the directives in this function + both its the only thing done after the switch statement) - however, it also does not really harm. Otherwise, LGTM. Tobias
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index dc67cfd9f7c..ed24621452a 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -56537,9 +56537,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; @@ -57249,7 +57246,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: