Message ID | 20231002222344.2714786-1-lhyatt@gmail.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1724946vqb; Mon, 2 Oct 2023 15:24:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYHx8IsdoxE2HzhHW7bobSiI9Tbbr16BSs1+4u1COA3b5+NUMtgjUJ9VXTPdikeR/RPFks X-Received: by 2002:aa7:d696:0:b0:532:c909:a06c with SMTP id d22-20020aa7d696000000b00532c909a06cmr11374297edr.18.1696285462345; Mon, 02 Oct 2023 15:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696285462; cv=none; d=google.com; s=arc-20160816; b=lvYqh54kDakPA52Qrx6wzNy1HBtc3iO4HFSOYoCoROiZDjExPAHIq1iV3FLFXju55j J5+MEi89lUIScwhpSKyt6OUrnLvf2gyJJ4xtr+V/I3EbgthxG0ly/wmqpKlTz8Dsq6kg UhnRQ5wVf7IZQWAOIs+Swo03L++vgKAkRrkqiAJj9/MJWIbOyN4CMUX3F8XHvoVc3d// FR9AI55diS+Va4HfacQ/q2d6R+xUVHY0B1tUP15HmIbbviViDC0HFie0K+DZjwVB/uhF Nbe2rw9+I3WiqBOXxsxy9+haCReFu8GhmjxxN9Qhg2Mho8+uCTBepmawk7FcF1CVx3hI PyFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=hHGPotvjxfpzMHfWxt8IUUJCCmt9himczjCvI4Zulpc=; fh=nfBkqenZlXK8N3U+CwE1Ju+aGndKKEqCeWWaqIiAkr0=; b=JHH7ylBbIaJfH7Cbk6NyxT00tZz8hnOjqqglClgvaevdKXsCpat/SUIfoSULqSKNrr aepjuH5NoKwS7MYNMxgpmyGduNKj65qo8valL77XDelh8WDdKCxzuxdijBTnuzymAu9c qqUAaRozaFuxiAq7I+mUn4CdfvoV3oCrEJn0jSFsOjV/kNDmVGEiZt8/AuX9Khmwy7Hk hBrSOPPftn6FoUrk8+hm9oGCe7kBZFeDvvoMJ+VZmkrbJVMpAzHSPhdM64FtdxnvKYRN UnIgWyYDpFIb4u35UQEnZoIpgmnKr6fa5uu4qYqVluPwTUE7tDe4pbNp24swW74fWcjL FEbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VGiClhCl; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id h3-20020aa7de03000000b00534cca3fbf7si6767896edv.190.2023.10.02.15.24.22 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 15:24:22 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VGiClhCl; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF6E5385696A for <ouuuleilei@gmail.com>; Mon, 2 Oct 2023 22:24:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by sourceware.org (Postfix) with ESMTPS id 752A33858D33 for <gcc-patches@gcc.gnu.org>; Mon, 2 Oct 2023 22:23:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 752A33858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-77428e40f71so22759285a.1 for <gcc-patches@gcc.gnu.org>; Mon, 02 Oct 2023 15:23:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696285429; x=1696890229; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hHGPotvjxfpzMHfWxt8IUUJCCmt9himczjCvI4Zulpc=; b=VGiClhClDIHJ1U8Ib2bxVJpeBL9xwV9DqrwFBBitehS/bKIYHzh2Tfb3d0DkLiAxgh DgZIIYpoJlfwAUtrOheElQ/JAT3Kq9VlG4UKzQnZkc9UyPQIPoaOdUwYjG64G03a/i5E 4QcugwhW97kdLsnXNd1864JR/hI5Sf4tjm2w3nHIu7o8izAb/nyYgSHL0DzgXqaDLDgc yCZ6V8/dBRg9Fh9gzHCVgriRxgUTpY5tAJUzXbR4cAjNVjuYhPLVs682C6HhcDbi7Yc0 9T6AiJw8zE0C/YkWa4TtI1zFVNKpLPRh9wGGy32Uio1xk4G5OsLDEcmBqz3/nEtMc4Tt oRUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696285429; x=1696890229; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hHGPotvjxfpzMHfWxt8IUUJCCmt9himczjCvI4Zulpc=; b=svR7n/RV1Pvkb5lWAfqe+0Dh1qNRXxEBhVOtzCrL3s1S9lVTVQLOG983yTJcu7jSYA rsowAQwnK+u2tfaPp+39ALX6lUcVSTS5ajd4AZV9CqOqKOKaskj1ySc0nqpMedyXcwBk Eayb/RzX/s4cViwO2GlKFwZYVt2yM9sfJtKKuGRG9n5Z3yl7TUWx+rn/pHpqmYXHuTFd kf56KoTU0SiESFzoIzmoZ3PvLacJfqjSgsb+SOdYsX0KgANA9Zg3p9PZiJfTDHrjjfpt vs07h2PCM/DmNLUBNCjx/whOtYxGlFbQxNxjNKDnnxDaW4CV8c+Zx7Dap5n605WZVzSQ Ge0w== X-Gm-Message-State: AOJu0YzFb17ZCoTIQUyqcuEjBT2BbRoUcwzjc3zRYxTYQLgOXA25avMa pi4hzwu+Sgd0si3qJXt+alynNRPgo6Q= X-Received: by 2002:a0c:a998:0:b0:658:6d82:54bc with SMTP id a24-20020a0ca998000000b006586d8254bcmr15022173qvb.32.1696285429477; Mon, 02 Oct 2023 15:23:49 -0700 (PDT) Received: from localhost.localdomain (96-67-140-173-static.hfc.comcastbusiness.net. [96.67.140.173]) by smtp.gmail.com with ESMTPSA id c13-20020a0ca9cd000000b0065b079366a7sm7209987qvb.114.2023.10.02.15.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 15:23:48 -0700 (PDT) From: Lewis Hyatt <lhyatt@gmail.com> To: gcc-patches@gcc.gnu.org Cc: Lewis Hyatt <lhyatt@gmail.com> Subject: [PATCH] libcpp: testsuite: Add test for fixed _Pragma bug [PR82335] Date: Mon, 2 Oct 2023 18:23:44 -0400 Message-Id: <20231002222344.2714786-1-lhyatt@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3038.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, 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 server2.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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778684225026618236 X-GMAIL-MSGID: 1778684225026618236 |
Series |
libcpp: testsuite: Add test for fixed _Pragma bug [PR82335]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Lewis Hyatt
Oct. 2, 2023, 10:23 p.m. UTC
Hello- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82335 is another _Pragma-related bug that got fixed in GCC 12 but is still open. Before closing it out, I thought it would be good to add the testcase from that PR, which we don't have exactly in the testsuite already. Is it OK please? Thanks! -Lewis -- >8 -- This PR was fixed by r12-4797 and r12-5454. Add test coverage from the PR that is not represented elsewhere. gcc/testsuite/ChangeLog: PR preprocessor/82335 * c-c++-common/cpp/diagnostic-pragma-3.c: New test. --- .../c-c++-common/cpp/diagnostic-pragma-3.c | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c
Comments
May I please ping this one, and/or, is it something straightforward enough I can just commit it as obvious? Thanks! https://gcc.gnu.org/pipermail/gcc-patches/2023-October/631814.html -Lewis On Mon, Oct 2, 2023 at 6:23 PM Lewis Hyatt <lhyatt@gmail.com> wrote: > > Hello- > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82335 is another > _Pragma-related bug that got fixed in GCC 12 but is still open. Before > closing it out, I thought it would be good to add the testcase from that > PR, which we don't have exactly in the testsuite already. Is it OK please? > Thanks! > > -Lewis > > -- >8 -- > > This PR was fixed by r12-4797 and r12-5454. Add test coverage from the PR > that is not represented elsewhere. > > gcc/testsuite/ChangeLog: > > PR preprocessor/82335 > * c-c++-common/cpp/diagnostic-pragma-3.c: New test. > --- > .../c-c++-common/cpp/diagnostic-pragma-3.c | 37 +++++++++++++++++++ > 1 file changed, 37 insertions(+) > create mode 100644 gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c > > diff --git a/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c b/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c > new file mode 100644 > index 00000000000..459dcec73b3 > --- /dev/null > +++ b/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c > @@ -0,0 +1,37 @@ > +/* This is like diagnostic-pragma-2.c, but handles the case where everything > + is wrapped inside a macro, which previously caused additional issues tracked > + in PR preprocessor/82335. */ > + > +/* { dg-do compile } */ > +/* { dg-additional-options "-save-temps -Wattributes -Wtype-limits" } */ > + > +#define B _Pragma("GCC diagnostic push") \ > + _Pragma("GCC diagnostic ignored \"-Wattributes\"") > +#define E _Pragma("GCC diagnostic pop") > + > +#define X() B int __attribute((unknown_attr)) x; E > +#define Y B int __attribute((unknown_attr)) y; E > +#define WRAP(x) x > + > +void test1(void) > +{ > + WRAP(X()) > + WRAP(Y) > +} > + > +/* Additional test provided on the PR. */ > +#define PRAGMA(...) _Pragma(#__VA_ARGS__) > +#define PUSH_IGN(X) PRAGMA(GCC diagnostic push) PRAGMA(GCC diagnostic ignored X) > +#define POP() PRAGMA(GCC diagnostic pop) > +#define TEST(X, Y) \ > + PUSH_IGN("-Wtype-limits") \ > + int Y = (__typeof(X))-1 < 0; \ > + POP() > + > +int test2() > +{ > + unsigned x; > + TEST(x, i1); > + WRAP(TEST(x, i2)) > + return i1 + i2; > +}
On Wed, Oct 18, 2023 at 05:03:57PM -0400, Lewis Hyatt wrote: > May I please ping this one, and/or, is it something straightforward > enough I can just commit it as obvious? Thanks! > https://gcc.gnu.org/pipermail/gcc-patches/2023-October/631814.html Please go ahead and apply the patch, thanks. Sorry about the wait. > -Lewis > > On Mon, Oct 2, 2023 at 6:23 PM Lewis Hyatt <lhyatt@gmail.com> wrote: > > > > Hello- > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82335 is another > > _Pragma-related bug that got fixed in GCC 12 but is still open. Before > > closing it out, I thought it would be good to add the testcase from that > > PR, which we don't have exactly in the testsuite already. Is it OK please? > > Thanks! > > > > -Lewis > > > > -- >8 -- > > > > This PR was fixed by r12-4797 and r12-5454. Add test coverage from the PR > > that is not represented elsewhere. > > > > gcc/testsuite/ChangeLog: > > > > PR preprocessor/82335 > > * c-c++-common/cpp/diagnostic-pragma-3.c: New test. > > --- > > .../c-c++-common/cpp/diagnostic-pragma-3.c | 37 +++++++++++++++++++ > > 1 file changed, 37 insertions(+) > > create mode 100644 gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c > > > > diff --git a/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c b/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c > > new file mode 100644 > > index 00000000000..459dcec73b3 > > --- /dev/null > > +++ b/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c > > @@ -0,0 +1,37 @@ > > +/* This is like diagnostic-pragma-2.c, but handles the case where everything > > + is wrapped inside a macro, which previously caused additional issues tracked > > + in PR preprocessor/82335. */ > > + > > +/* { dg-do compile } */ > > +/* { dg-additional-options "-save-temps -Wattributes -Wtype-limits" } */ > > + > > +#define B _Pragma("GCC diagnostic push") \ > > + _Pragma("GCC diagnostic ignored \"-Wattributes\"") > > +#define E _Pragma("GCC diagnostic pop") > > + > > +#define X() B int __attribute((unknown_attr)) x; E > > +#define Y B int __attribute((unknown_attr)) y; E > > +#define WRAP(x) x > > + > > +void test1(void) > > +{ > > + WRAP(X()) > > + WRAP(Y) > > +} > > + > > +/* Additional test provided on the PR. */ > > +#define PRAGMA(...) _Pragma(#__VA_ARGS__) > > +#define PUSH_IGN(X) PRAGMA(GCC diagnostic push) PRAGMA(GCC diagnostic ignored X) > > +#define POP() PRAGMA(GCC diagnostic pop) > > +#define TEST(X, Y) \ > > + PUSH_IGN("-Wtype-limits") \ > > + int Y = (__typeof(X))-1 < 0; \ > > + POP() > > + > > +int test2() > > +{ > > + unsigned x; > > + TEST(x, i1); > > + WRAP(TEST(x, i2)) > > + return i1 + i2; > > +} > Marek
diff --git a/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c b/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c new file mode 100644 index 00000000000..459dcec73b3 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-3.c @@ -0,0 +1,37 @@ +/* This is like diagnostic-pragma-2.c, but handles the case where everything + is wrapped inside a macro, which previously caused additional issues tracked + in PR preprocessor/82335. */ + +/* { dg-do compile } */ +/* { dg-additional-options "-save-temps -Wattributes -Wtype-limits" } */ + +#define B _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wattributes\"") +#define E _Pragma("GCC diagnostic pop") + +#define X() B int __attribute((unknown_attr)) x; E +#define Y B int __attribute((unknown_attr)) y; E +#define WRAP(x) x + +void test1(void) +{ + WRAP(X()) + WRAP(Y) +} + +/* Additional test provided on the PR. */ +#define PRAGMA(...) _Pragma(#__VA_ARGS__) +#define PUSH_IGN(X) PRAGMA(GCC diagnostic push) PRAGMA(GCC diagnostic ignored X) +#define POP() PRAGMA(GCC diagnostic pop) +#define TEST(X, Y) \ + PUSH_IGN("-Wtype-limits") \ + int Y = (__typeof(X))-1 < 0; \ + POP() + +int test2() +{ + unsigned x; + TEST(x, i1); + WRAP(TEST(x, i2)) + return i1 + i2; +}