public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9334] libcpp: Fix up handling of block comments in -fdirectives-only mode [PR103130] Date: Mon, 29 Nov 2021 08:50:03 +0000 (GMT) [thread overview] Message-ID: <20211129085003.944693898526@sourceware.org> (raw) https://gcc.gnu.org/g:0f0c24cf9622a3c74574a0e2d2bb2f51fed3e773 commit r11-9334-g0f0c24cf9622a3c74574a0e2d2bb2f51fed3e773 Author: Jakub Jelinek <jakub@redhat.com> Date: Wed Nov 17 17:31:40 2021 +0100 libcpp: Fix up handling of block comments in -fdirectives-only mode [PR103130] Normal preprocessing, -fdirectives-only preprocessing before the Nathan's rewrite, and all other compilers I've tried on godbolt treat even \*/ as end of a block comment, but the new -fdirectives-only handling doesn't. 2021-11-17 Jakub Jelinek <jakub@redhat.com> PR preprocessor/103130 * lex.c (cpp_directive_only_process): Treat even \*/ as end of block comment. * c-c++-common/cpp/dir-only-9.c: New test. (cherry picked from commit 049f0efeaa77b43a508172161ca040feb6bb5622) Diff: --- gcc/testsuite/c-c++-common/cpp/dir-only-9.c | 13 +++++++++++++ libcpp/lex.c | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/c-c++-common/cpp/dir-only-9.c b/gcc/testsuite/c-c++-common/cpp/dir-only-9.c new file mode 100644 index 00000000000..d11cd97cb71 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cpp/dir-only-9.c @@ -0,0 +1,13 @@ +/* PR preprocessor/103130 */ +/* { dg-do preprocess } */ +/* { dg-options -fdirectives-only } */ + +/*\ + * this is a comment +\*/ + +int +main () +{ + return 0; +} diff --git a/libcpp/lex.c b/libcpp/lex.c index 3791f388207..69dfb4ebb76 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -4453,7 +4453,7 @@ cpp_directive_only_process (cpp_reader *pfile, break; case '*': - if (pos > peek && !esc) + if (pos > peek) star = is_block; esc = false; break;
reply other threads:[~2021-11-29 8:50 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211129085003.944693898526@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).