public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Austin Morton <austinpmorton@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jeff Law <law@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v2] c: Silently ignore pragma region [PR85487]
Date: Fri, 13 Nov 2020 12:37:27 -0500	[thread overview]
Message-ID: <CAPWKHJTbE1Byfb2cFhLyT+ea8DbSF5xiixn0n_40kpByRePaHA@mail.gmail.com> (raw)
In-Reply-To: <20201113153511.GF3788@tucnak>

> 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.

  reply	other threads:[~2020-11-13 17:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  0:59 Austin Morton
2020-11-13  4:25 ` Jeff Law
2020-11-13 14:57   ` Austin Morton
2020-11-13 15:22     ` David Malcolm
2020-11-13 17:50       ` Austin Morton
2020-11-13 15:35     ` Jakub Jelinek
2020-11-13 17:37       ` Austin Morton [this message]
2020-11-13 23:29     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPWKHJTbE1Byfb2cFhLyT+ea8DbSF5xiixn0n_40kpByRePaHA@mail.gmail.com \
    --to=austinpmorton@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).