Why does tcc report such an error?

After upgrading to 9.3 from 9.1, TCC always report:
Code:
/usr/include/stdio.h:63: error: ';' expected (got "va_list")

#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#ifndef _VA_LIST_DECLARED
typedef __va_list va_list;   <--- line 63
#define _VA_LIST_DECLARED
#endif
#endif
IIRC, there is no such an error on 9.1.

Regards!
 
According to the source website for TCC (http://bellard.org/tcc/), lang/tcc, the project is no longer actively being worked on. Considering those lines of code above were written 12 years ago (Source: http://svnweb.freebsd.org/base?view=revision&revision=104585), it seems the most likely explanation is the unmaintained TCC rather than code cited above. Can you use a more modern compiler or is there another option?
I am using GCC/Clang now. The TinyTCC is just being used for study. BTW, I have sent the issue to TCC mailing list.

Regards!
 
stdio.h is the culprit.
Code:
extern int printf(char *, ...);
int main(){
            printf("hello, world!\n");
            return 0;
}
Test:
Code:
% tcc -run hello.c
hello, world!
 
Last edited:
What if you preprocess the code with the system cc and the compile the output with tcc? It looks like a preprocessor problem, maybe maximum include depth reached or something...
 
Code:
% cc -E hello.c -o hello.i
% tcc -c hello.i
hello.i:1: error: unrecognized file type
Strange, but there is no problem with the same test if
Code:
% cc -c hello.i
% cc -o hello hello.c
% ./hello
Hello, World!
 
PR 202093 fixes the problem partially. TinyCC is able to compile but it fails to link (currently investigating this further).

Using -run option works fine again.
 
Back
Top