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.
This commit is contained in:
Jakub Jelinek 2021-11-17 17:31:40 +01:00
parent dd159a4167
commit 049f0efeaa
2 changed files with 14 additions and 1 deletions

View file

@ -0,0 +1,13 @@
/* PR preprocessor/103130 */
/* { dg-do preprocess } */
/* { dg-options -fdirectives-only } */
/*\
* this is a comment
\*/
int
main ()
{
return 0;
}

View file

@ -4891,7 +4891,7 @@ cpp_directive_only_process (cpp_reader *pfile,
break;
case '*':
if (pos > peek && !esc)
if (pos > peek)
star = is_block;
esc = false;
break;