From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by sourceware.org (Postfix) with ESMTPS id B7964393C870 for ; Fri, 13 Nov 2020 17:37:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B7964393C870 Received: by mail-lj1-x241.google.com with SMTP id o24so11677233ljj.6 for ; Fri, 13 Nov 2020 09:37: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=1U7f4J1hTJ2JbanHDVK9cbqrcQlAPXinKeNtCMkIQjU=; b=HT7Xwt4ESs66q+ETVzLmn++rUy2f/Vldflmohse9CLnF1aKUqFhVIA3l3Mrikvl1Lk byBzBp2pm1HCmVdltxxYPFbjUYGzSkMxh+FtYBUNNjPryoSmz1vrXF0ukORZq1dmmqPq jhPejwrdCodPjMghtB8Ewto1HaACDIi9rLW/c+OBIPFARhk9C5HeE7udfM5P8Ad03J1o d55DKgs/AwFS/eOpRG4tZlYJn7IWpM6vR9cbRsuOY8lImxIEOSGzwnw7QebvNa7TkrqN I3/ifQY6vl1SOuPKophPDsnUe2lfsGFQflONQiw9yqxtjtXZFRTwFhmURv4ggzxIFdRP u6ag== X-Gm-Message-State: AOAM5330nKZlY43ScKIcamECcWw2IH6gj9mmjz4Dm8GEUICsSsG3ELZk pwsUk20/WI2MVHVUB4H0VafKyHAQbWgDSNXZ3BE= X-Google-Smtp-Source: ABdhPJz/2joXdZDvdTw95dHod3Y3cfd0f3dWlkKN98WfOpvIJe9vv55LHjNSwyLSylSsGS4rHYjZAoDGNW95tFLDn2w= X-Received: by 2002:a2e:3204:: with SMTP id y4mr1423830ljy.342.1605289058470; Fri, 13 Nov 2020 09:37:38 -0800 (PST) MIME-Version: 1.0 References: <98207018-7512-c842-94d9-cc3125b0b2c8@redhat.com> <20201113153511.GF3788@tucnak> In-Reply-To: <20201113153511.GF3788@tucnak> From: Austin Morton Date: Fri, 13 Nov 2020 12:37:27 -0500 Message-ID: Subject: Re: [PATCH v2] c: Silently ignore pragma region [PR85487] To: Jakub Jelinek Cc: Jeff Law , GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 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 17:37:46 -0000 > But in that case the pragma shouldn't be ignored, but instead checked > against the various requirements. E.g. that region is followed by a single > optional name (are there any requirements on what name can be, can it be > just a single token, can it be C/C++ keyword, etc.), guess ignore all the > tokens after endregion if it is all a comment, and verify nesting > (all region/endregion are properly paired up). I cannot speak to the internals of the MSVC compiler, but I can say definitively that clang does not do any of this. The clang handling of #pragma region is a no-op, as can be seen here: https://github.com/llvm/llvm-project/blob/48b510c4bc0fe090e635ee0440e46fc176527d7e/clang/lib/Lex/Pragma.cpp#L1847 Additionally, the MSVC implementation appears to do no validation (or at least doesn't emit warnings that indicate that it does). https://godbolt.org/z/3zTbnn #pragma region is purely designed for editors to assist in code-folding (primarily visual studio and visual studio code, although I am sure others support it). The goal of this patch is to make GCC compatible with both clang and MSVC handling of this pragma, not to introduce novel functionality.