tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] macro expansion bug


From: Fabrice Bellard
Subject: Re: [Tinycc-devel] macro expansion bug
Date: Tue, 16 Mar 2004 23:42:17 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

Hi,

I see the problem. I am going to see if there is an easy fix. Thank you for the report !

Fabrice.

Neil Conway wrote:
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; }


------------------------------------------------------------------------

_______________________________________________
Tinycc-devel mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/tinycc-devel






reply via email to

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