Bug 83708 - Token-based policy broken by __VA_OPT__
Summary: Token-based policy broken by __VA_OPT__
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-06 01:24 UTC by Jun Woong
Modified: 2018-01-06 02:06 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jun Woong 2018-01-06 01:24:26 UTC
Use of __VA_OPT__ can break the token-based policy when those optional tokens do not come from arguments.

$ cat > foo.c
__VERSION__

#define foo(...) __VA_OPT__(foo)__VA_OPT__(bar)
foo(dummy)

$ gcc -E foo.c
# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "foo.c"
"8.0.0 20180105 (experimental)"


foobar