tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] macro expansion bug


From: Neil Conway
Subject: [Tinycc-devel] macro expansion bug
Date: Thu, 04 Mar 2004 20:29:18 -0500
User-agent: Mozilla Thunderbird 0.5 (X11/20040304)

I'm trying to get PostgreSQL to compile using tcc. I've attached a reduced test case for the first problem I've encountered.

It seems that tcc attempts to parse the arguments to a macro call, even if those arguments are unused in the macro definition. In the test case, the '\054' is an illegal C literal, but since it is removed from the source file by the preprocessor, the test case should still be accepted by the compiler. The following text from C99 seems to confirm this (section 5.1.1.2, describing the "Translation phases"):

3. The source file is decomposed into preprocessing tokens and sequences of white-space characters (including comments). A source file shall not end in a partial preprocessing token or in a partial comment. Each comment is replaced by one space character. New-line characters are retained. Whether each nonempty sequence of white-space characters other than new-line is retained or replaced by one space character is implementation-defined.

4. Preprocessing directives are executed, macro invocations are expanded, and _Pragma unary operator expressions are executed.

GCC accepts the provided test case without error, tcc (from CVS) emits the following error:

$ tcc tcc_macro_expansion_bug_test_case.c
tcc_macro_expansion_bug_test_case.c:3: stray '\' in program

-Neil
#define DATA(x)   extern int no_such_variable

DATA(insert OID = 16 (  bool       PGNSP PGUID  1 t b t \054 0   0 boolin 
boolout boolrecv boolsend - c p f 0 -1 0 _null_ _null_ ));

int main(void) { return 1; }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]