public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/104147] New: C preprocessor may remove the standard required whitespace between the preprocessing tokens
@ 2022-01-20 17:30 pavel.morozkin at gmail dot com
  2022-01-20 20:59 ` [Bug preprocessor/104147] [9/10/11/12 Regression] " jsm28 at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: pavel.morozkin at gmail dot com @ 2022-01-20 17:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104147
           Summary: C preprocessor may remove the standard required
                    whitespace between the preprocessing tokens
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pavel.morozkin at gmail dot com
  Target Milestone: ---

Sample code:
#define X(x,y)  x y
#define STR_(x) #x
#define STR(x)  STR_(x)
STR(X(Y,Y))

Invocations:
$ gcc t222.c -std=c11 -pedantic -Wall -Wextra -E -P
"Y Y"

$ gcc t222.c -std=c11 -pedantic -Wall -Wextra -E -P -D"Y()"
"YY"

Also 1: Somehow gcc takes into account the whitespace between `,` and `Y`:
$ gcc t222.c -std=c11 -pedantic -Wall -Wextra -E -P -D"Y()" -D"Z=STR(X(Y,Y))"
"YY"

$ gcc t222.c -std=c11 -pedantic -Wall -Wextra -E -P -D"Y()" -D"Z=STR(X(Y, Y))"
"Y Y"

Also 2: This:
STR(X(Y,
Y))

leads to:
$ gcc t222.c -std=c11 -pedantic -Wall -Wextra -E -P -D"Y()"
"Y Y"

However, this:
STR(X(Y
,Y))

leads to:
$ gcc t222.c -std=c11 -pedantic -Wall -Wextra -E -P -D"Y()"
"YY"

The whitespace is required by the standard.

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

end of thread, other threads:[~2022-05-11  6:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20 17:30 [Bug c/104147] New: C preprocessor may remove the standard required whitespace between the preprocessing tokens pavel.morozkin at gmail dot com
2022-01-20 20:59 ` [Bug preprocessor/104147] [9/10/11/12 Regression] " jsm28 at gcc dot gnu.org
2022-01-21  7:55 ` rguenth at gcc dot gnu.org
2022-01-31 14:07 ` jakub at gcc dot gnu.org
2022-01-31 14:50 ` jakub at gcc dot gnu.org
2022-02-01 19:50 ` cvs-commit at gcc dot gnu.org
2022-02-01 19:51 ` [Bug preprocessor/104147] [9/10/11 " jakub at gcc dot gnu.org
2022-02-19  8:02 ` cvs-commit at gcc dot gnu.org
2022-02-19  8:08 ` [Bug preprocessor/104147] [9/10 " jakub at gcc dot gnu.org
2022-05-10  8:23 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:24 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:36 ` jakub at gcc dot gnu.org

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