From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 052C8385801D for ; Fri, 13 Nov 2020 04:25:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 052C8385801D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-500-orkYl0G4Md-RSOAerQPLRQ-1; Thu, 12 Nov 2020 23:25:35 -0500 X-MC-Unique: orkYl0G4Md-RSOAerQPLRQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD2A31882FC1; Fri, 13 Nov 2020 04:25:34 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-176.phx2.redhat.com [10.3.112.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91CA85B4A0; Fri, 13 Nov 2020 04:25:34 +0000 (UTC) Subject: Re: [PATCH v2] c: Silently ignore pragma region [PR85487] To: Austin Morton , GCC Patches References: From: Jeff Law Message-ID: <98207018-7512-c842-94d9-cc3125b0b2c8@redhat.com> Date: Thu, 12 Nov 2020 21:25:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, 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 04:25:41 -0000 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