Hi,

It appears that TCC does not recognize C99 _Pragma keyword
and instead treats it as implicit function declaration or syntax error:

$ cat main.c ; ./tcc -std=c99 main.c ; ./tcc --version
int main(void) {
        _Pragma("");
        return 0;
}
_Pragma("");
main.c:2: warning: implicit declaration of function '_Pragma'
main.c:5: error: identifier expected
tcc version 0.9.28rc 2024-12-12 mob@ea75d5c (x86_64 Linux)

I haven't seen this anywhere reported.
The quick workaround is to wrap '_Pragma' with macro like so:
#if defined(__TINYC__) && !defined(_Pragma)
#     define _Pragma(x)
#endif

references:
https://en.cppreference.com/w/c/preprocessor/impl
https://godbolt.org/z/YbEs48rx4

Best Regards,
Kornel
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to