public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/107089] New: Line-terminating '\' leaves the characters when the next-line is a multi-line comment
@ 2022-09-29 17:47 wcs84014 at xcoxc dot com
  2022-09-29 22:42 ` [Bug preprocessor/107089] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: wcs84014 at xcoxc dot com @ 2022-09-29 17:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107089

            Bug ID: 107089
           Summary: Line-terminating '\' leaves the characters when the
                    next-line is a multi-line comment
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wcs84014 at xcoxc dot com
  Target Milestone: ---

I found it when I tried to use the CPP as a general-purpose macro.

~$ gcc -v
Target: x86_64-linux-gnu /gcc version 11.2.0 (Debian 11.2.0-13)

~$ cat a.c
1=\
//xyz
ok*/

2=\
/*xyz
NG*/

3=\(sp)(nl)
/*xyz
NG*/

4=\
//*xyz
ok:gcc NG:-traditional*/


~$ cat a.c | cpp -P -C -nostdinc  #-traditional-cpp
1=//xyz
ok*/
2=/*xyz
z
NG*/
<stdin>:9:3: warning: backslash and newline separated by space
3=/*xyz
yz
NG*/
4=//*xyz
ok:gcc NG:-traditional*/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/107089] Line-terminating '\' leaves the characters when the next-line is a multi-line comment
  2022-09-29 17:47 [Bug preprocessor/107089] New: Line-terminating '\' leaves the characters when the next-line is a multi-line comment wcs84014 at xcoxc dot com
@ 2022-09-29 22:42 ` pinskia at gcc dot gnu.org
  2022-09-30  2:35 ` wcs84014 at xcoxc dot com
  2022-10-06 10:00 ` wcs84014 at xcoxc dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-09-29 22:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107089

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>I found it when I tried to use the CPP as a general-purpose macro.

Well it is not designed to be a general purpose macro processor.
You might want to try something like m4 instead.

https://en.wikipedia.org/wiki/M4_(computer_language)

Or any other that are already general-purpose macro processors:

https://en.wikipedia.org/wiki/General-purpose_macro_processor

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/107089] Line-terminating '\' leaves the characters when the next-line is a multi-line comment
  2022-09-29 17:47 [Bug preprocessor/107089] New: Line-terminating '\' leaves the characters when the next-line is a multi-line comment wcs84014 at xcoxc dot com
  2022-09-29 22:42 ` [Bug preprocessor/107089] " pinskia at gcc dot gnu.org
@ 2022-09-30  2:35 ` wcs84014 at xcoxc dot com
  2022-10-06 10:00 ` wcs84014 at xcoxc dot com
  2 siblings, 0 replies; 4+ messages in thread
From: wcs84014 at xcoxc dot com @ 2022-09-30  2:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107089

--- Comment #2 from JohnDoe <wcs84014 at xcoxc dot com> ---
>Andrew Pinski 
Thank you for your reply.

That's right. Therefore, I am currently using my own parser.
Nobody needs fix, so you can close this topic.

However, the cause of the bug seems to be a mistake in the pointer count as:
while(++p) <-> while(p++)

I already read the document:
https://gcc.gnu.org/onlineDocscpp

I have used a little M4 in Autotools. Certainly POSIX, portable, real macro,
but minor. I tried to provide a mechanism to customize to ordinary users using
the CPP.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/107089] Line-terminating '\' leaves the characters when the next-line is a multi-line comment
  2022-09-29 17:47 [Bug preprocessor/107089] New: Line-terminating '\' leaves the characters when the next-line is a multi-line comment wcs84014 at xcoxc dot com
  2022-09-29 22:42 ` [Bug preprocessor/107089] " pinskia at gcc dot gnu.org
  2022-09-30  2:35 ` wcs84014 at xcoxc dot com
@ 2022-10-06 10:00 ` wcs84014 at xcoxc dot com
  2 siblings, 0 replies; 4+ messages in thread
From: wcs84014 at xcoxc dot com @ 2022-10-06 10:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107089

JohnDoe <wcs84014 at xcoxc dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from JohnDoe <wcs84014 at xcoxc dot com> ---
Close report.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-06 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29 17:47 [Bug preprocessor/107089] New: Line-terminating '\' leaves the characters when the next-line is a multi-line comment wcs84014 at xcoxc dot com
2022-09-29 22:42 ` [Bug preprocessor/107089] " pinskia at gcc dot gnu.org
2022-09-30  2:35 ` wcs84014 at xcoxc dot com
2022-10-06 10:00 ` wcs84014 at xcoxc dot com

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