From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by sourceware.org (Postfix) with ESMTPS id 9048F386F420 for ; Fri, 13 Nov 2020 14:57:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9048F386F420 Received: by mail-lf1-x143.google.com with SMTP id j205so14230265lfj.6 for ; Fri, 13 Nov 2020 06:57:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=h9Z2SPopnVsKa3pQcXsfehU8ASpJ2pIBw+4yax/Txtc=; b=I9tdkXtaici3qGvdEEeuq691RnRK9vKHY8mA/ARbajE8Fw6xJ6N/GJWWVEhfz9hIlw IG6DA8b8rWOqcMFSRmSj9G2jubvKHnLRSXGSe51PZR9CRknaaBZY/Spn34uIT+WvtY1Y zcGs3L2RuMBawusSpmvumud1A96SRvBDJDB+FuPfeHz9555B46LWUZ+Pbsr+w1NIEVhn +8P95RJ9Gg189g1AvyxykpYyu9Kbhv51Qc1e+KMKyPVcBEI1JWrn1Z/fFJLuFvO26QOB jZXLUzpeqPSRB3SMS9tEEQqFxLciKSYhbQWse64HdC7ulW5UQDup5EkLeCzigD74MVsX gnGw== X-Gm-Message-State: AOAM531IrD2AGUD7AM+mUgGPDyhteenDBcc2hlsSjP8vu4AgCEzi5H7I IFspyp7sS4OERof82Pm+F+w8+U3rGVDrYz12UOY= X-Google-Smtp-Source: ABdhPJwm/3gbp+z6D3mIOBd4HOXJzPM1CThpWnGZ30jTTBaqU9RJGB6c3jzvcYqGuKwZfFm12Wrj76ncc1QQe/+fgBw= X-Received: by 2002:a19:c108:: with SMTP id r8mr1001926lff.443.1605279463255; Fri, 13 Nov 2020 06:57:43 -0800 (PST) MIME-Version: 1.0 References: <98207018-7512-c842-94d9-cc3125b0b2c8@redhat.com> In-Reply-To: <98207018-7512-c842-94d9-cc3125b0b2c8@redhat.com> From: Austin Morton Date: Fri, 13 Nov 2020 09:57:31 -0500 Message-ID: Subject: Re: [PATCH v2] c: Silently ignore pragma region [PR85487] To: Jeff Law Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 14:57:46 -0000 On the contrary, as a user of GCC I would much prefer a consistent behavior for #pragma region based purely on GCC version. IE, so you can tell people: "just update to GCC X.Y and those warnings will go away" rather than: "update to GCC X.Y and pass some new flags - but make sure not to pass them to old GCC versions, since that will generate a new warning" I do agree it may be generally useful to have a configurable way to specify pragmas to ignore at runtime, but that is not what I was trying to accomplish here. Both clang and MSVC handle this pragma without any runtime configuration, and I think GCC should as well. Austin On Thu, Nov 12, 2020 at 11:25 PM Jeff Law wrote: > > > On 9/2/20 6:59 PM, Austin Morton via Gcc-patches wrote: > > #pragma region is a feature introduced by Microsoft in order to allow > > manual grouping and folding of code within Visual Studio. It is > > entirely ignored by the compiler. Clang has supported this feature > > since 2012 when in MSVC compatibility mode, and enabled it across the > > board in 2018. > > > > As it stands, you cannot use #pragma region within GCC without > > disabling unknown pragma warnings, which is not advisable. > > > > I propose GCC adopt "#pragma region" and "#pragma endregion" in order > > to alleviate these issues. Because the pragma has no purpose at > > compile time, the implementation is trivial. > > > > > > Microsoft Documentation on the feature: > > https://docs.microsoft.com/en-us/cpp/preprocessor/region-endregion > > > > LLVM change which enabled pragma region across the board: > > https://reviews.llvm.org/D42248 > > --- > > gcc/ChangeLog | 5 +++++ > > gcc/c-family/ChangeLog | 5 +++++ > > gcc/c-family/c-pragma.c | 10 ++++++++++ > > gcc/doc/cpp.texi | 6 ++++++ > > gcc/testsuite/ChangeLog | 5 +++++ > > gcc/testsuite/gcc.dg/pragma-region.c | 21 +++++++++++++++++++++ > > 6 files changed, 52 insertions(+) > > create mode 100644 gcc/testsuite/gcc.dg/pragma-region.c > > I'm not sure that this is really the way we want to handle this stuff. > I understand the problem you're trying to solve, but embedding a list of > pragmas to ignore into the compiler itself just seems like the wrong > approach -- it bakes that set of pragmas to ignore into the compiler. > > > ISTM that we'd be better off either having a command line option to list > the set of pragmas to ignore, or they should be pulled from a file > specified on the command line. That would seem to be a lot more > friendly to downstream users since each project could set the list of > pragmas to ignore on their own and have that set updated dynamically > over time without having to patch and update GCC. > > > Any chance you would be willing to work on that? > > Jeff >