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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems -traditional-cpp behavior varies a lot.
E.g. on
#define m1(a,b,c,d)a/**/b/**/c/**/d
m1(/,*,foo,*/)
#define foobar 123
#define m2(a,b)a/**/b
m2(foo,bar)
$ gcc-3.2/obj/gcc/tradcpp0 -E -traditional-cpp pr69869-2.c
# 1 "pr69869-2.c"

/*foo*/


123
$ gcc-3.3/obj/gcc/cc1 -E -traditional-cpp pr69869-2.c
# 1 "pr69869-2.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "pr69869-2.c"




123
(and likewise for newer gcc versions).
$ llvm/obj/bin/clang -E -traditional-cpp pr69869-2.c
# 1 "pr69869-2.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 347 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "pr69869-2.c" 2

/ * foo */


foo bar

Really weird.

With the #c0 testcase:
$ gcc-3.2/obj/gcc/tradcpp0 -E -traditional-cpp pr69869.c
# 1 "pr69869.c"


all:                                                                            
        $(RM)   ./bin/*
$ gcc-3.3/obj/gcc/cc1 -E -traditional-cpp pr69869.c
# 1 "pr69869.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "pr69869.c"


pr69869.c:4: unterminated comment
all:                                                                            
        $(RM)   ./bin
3.4-current trunk ICE.
$ llvm/obj/bin/clang -E -traditional-cpp pr69869.c
# 1 "pr69869.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 347 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "pr69869.c" 2


all:                                                                            
        $(RM)   ./bin/ *

Given the 3.3+ behavior on pr69869-2.c, I'd think unterminated comment error
would be best, or should we follow 3.2 and earlier and somehow not consider
comments when token pasted together?

Reply via email to