[Bug c++/100646] [11 Regression] gcc -E -fdirectives-only causes "error: unterminated comment" when no new line at the end of file

2021-07-19 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100646

Jakub Jelinek  changed:

   What|Removed |Added

 CC||boris at kolpackov dot net

--- Comment #8 from Jakub Jelinek  ---
*** Bug 101298 has been marked as a duplicate of this bug. ***

[Bug c++/100646] [11 Regression] gcc -E -fdirectives-only causes "error: unterminated comment" when no new line at the end of file

2021-05-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100646

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Jakub Jelinek  ---
Fixed for 11.2.

[Bug c++/100646] [11 Regression] gcc -E -fdirectives-only causes "error: unterminated comment" when no new line at the end of file

2021-05-31 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100646

--- Comment #6 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:3a2fa2e819d4714cecf5048eda2b7e52ba9e3cdd

commit r11-8490-g3a2fa2e819d4714cecf5048eda2b7e52ba9e3cdd
Author: Jakub Jelinek 
Date:   Thu May 20 09:09:07 2021 +0200

libcpp: Fix up -fdirectives-only handling of // comments on last line not
terminated with newline [PR100646]

As can be seen on the testcases, before the -fdirectives-only preprocessing
rewrite the preprocessor would assume // comments are terminated by the
end of file even when newline wasn't there, but now we error out.
The following patch restores the previous behavior.

2021-05-20  Jakub Jelinek  

PR preprocessor/100646
* lex.c (cpp_directive_only_process): Treat end of file as
termination
for !is_block comments.

* gcc.dg/cpp/pr100646-1.c: New test.
* gcc.dg/cpp/pr100646-2.c: New test.

(cherry picked from commit d15a2d261b24adcbfe5e663b15dde3df5d2b3486)

[Bug c++/100646] [11 Regression] gcc -E -fdirectives-only causes "error: unterminated comment" when no new line at the end of file

2021-05-20 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100646

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org
Summary|[11/12 Regression] gcc -E   |[11 Regression] gcc -E
   |-fdirectives-only causes|-fdirectives-only causes
   |"error: unterminated|"error: unterminated
   |comment" when no new line   |comment" when no new line
   |at the end of file  |at the end of file

--- Comment #5 from Jakub Jelinek  ---
Fixed on the trunk so far.