simplecpp icon indicating copy to clipboard operation
simplecpp copied to clipboard

simplecpp does not handle hashes in __VA_OPT__ correctly

Open glankk opened this issue 5 months ago • 0 comments

Test code:

#define A(x, ...) # __VA_OPT__(# x)
A(x, y)

#define B(x, ...) # __VA_OPT__(x ## __VA_ARGS__)
B(Hello, world)

simplecpp output:

#
"x"


"Hello" world

gcc output:

# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "<stdin>"

"\"x\""


"Helloworld"

clang output:

# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 411 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2

"\"x\""


"Helloworld"

glankk avatar Jul 03 '25 08:07 glankk