* [PATCH] libcpp: Fix up handling of block comments in -fdirectives-only mode [PR103130]
@ 2021-11-17 9:22 Jakub Jelinek
2021-11-17 15:59 ` Marek Polacek
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2021-11-17 9:22 UTC (permalink / raw)
To: Joseph S. Myers, Marek Polacek, Jason Merrill, David Malcolm; +Cc: gcc-patches
Hi!
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.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
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.
--- libcpp/lex.c.jj 2021-11-01 14:37:06.706853026 +0100
+++ libcpp/lex.c 2021-11-16 16:54:04.022644499 +0100
@@ -4493,7 +4493,7 @@ cpp_directive_only_process (cpp_reader *
break;
case '*':
- if (pos > peek && !esc)
+ if (pos > peek)
star = is_block;
esc = false;
break;
--- gcc/testsuite/c-c++-common/cpp/dir-only-9.c.jj 2021-11-16 16:56:57.121217975 +0100
+++ gcc/testsuite/c-c++-common/cpp/dir-only-9.c 2021-11-16 16:56:14.524815094 +0100
@@ -0,0 +1,13 @@
+/* PR preprocessor/103130 */
+/* { dg-do preprocess } */
+/* { dg-options -fdirectives-only } */
+
+/*\
+ * this is a comment
+\*/
+
+int
+main ()
+{
+ return 0;
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] libcpp: Fix up handling of block comments in -fdirectives-only mode [PR103130]
2021-11-17 9:22 [PATCH] libcpp: Fix up handling of block comments in -fdirectives-only mode [PR103130] Jakub Jelinek
@ 2021-11-17 15:59 ` Marek Polacek
0 siblings, 0 replies; 2+ messages in thread
From: Marek Polacek @ 2021-11-17 15:59 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Joseph S. Myers, Jason Merrill, David Malcolm, gcc-patches
On Wed, Nov 17, 2021 at 10:22:32AM +0100, Jakub Jelinek wrote:
> Hi!
>
> 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.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
OK for trunk and 11, thanks.
> 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.
>
> --- libcpp/lex.c.jj 2021-11-01 14:37:06.706853026 +0100
> +++ libcpp/lex.c 2021-11-16 16:54:04.022644499 +0100
> @@ -4493,7 +4493,7 @@ cpp_directive_only_process (cpp_reader *
> break;
>
> case '*':
> - if (pos > peek && !esc)
> + if (pos > peek)
> star = is_block;
> esc = false;
> break;
> --- gcc/testsuite/c-c++-common/cpp/dir-only-9.c.jj 2021-11-16 16:56:57.121217975 +0100
> +++ gcc/testsuite/c-c++-common/cpp/dir-only-9.c 2021-11-16 16:56:14.524815094 +0100
> @@ -0,0 +1,13 @@
> +/* PR preprocessor/103130 */
> +/* { dg-do preprocess } */
> +/* { dg-options -fdirectives-only } */
> +
> +/*\
> + * this is a comment
> +\*/
> +
> +int
> +main ()
> +{
> + return 0;
> +}
>
> Jakub
>
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-17 15:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 9:22 [PATCH] libcpp: Fix up handling of block comments in -fdirectives-only mode [PR103130] Jakub Jelinek
2021-11-17 15:59 ` Marek Polacek
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).