The declaration may be in the header file but bracketed by
ifdefs that -std=c99 keeps from being included.

Just a thought.

Arnold

Stefanos via Tinycc-devel <[email protected]> wrote:

> I have tried with the latest commit 7e4fc3a0d01173575b3b29f71ae4da87322ba14b
> the following configuration setting
>
>     ./configure --extra-cflags='-std=c99'
>
>
> just for the sake of experimentation and have found there's a problematic
> behavior which probably is my fault, but have no idea what am I doing wrong
> here...
>
> My command is:
>
>     make clean && make -j4 && make test
>
> During the test, it returns the following error message:
>
>     make[1]: Entering directory
>     '/home/stefanos/repositories/active/tinycc/tests' ------------ version
>     ------------ tcc version 0.9.28rc 2025-11-19 mob@7e4fc3a (x86_64 Linux)
>     ------------ hello-exe ------------
>     Hello World
>     ------------ hello-run ------------
>     Hello World
>     ------------ libtest ------------
>     Hello World!
>     fib(32) = 2178309
>     add(32, 64) = 96
>     libtcc_test_mt.c: In function ‘sleep_ms’:
>     libtcc_test_mt.c:54:5: error: implicit declaration of function ‘usleep’; 
> did
>     you mean ‘sleep’? [-Wimplicit-function-declaration] 54 |     usleep(n *
>     1000); |     ^~~~~~
>           |     sleep
>     make[2]: *** [Makefile:104: libtcc_test_mt] Error 1
>     make[1]: *** [Makefile:84: all] Error 2
>     make[1]: Leaving directory 
> '/home/stefanos/repositories/active/tinycc/tests'
>     make: *** [Makefile:457: test] Error 2
>
> I opened tests/libtcc_test_mt.c file and saw there's a <unistd.h> header file
> which is responsible for `usleep()`.
>
> To verify it got parsed as expected, I run
>
>     tcc -E -P tests/libtcc_test_mt.c | grep usleep
>
> which indeed it returned
>
>     extern int usleep (__useconds_t __useconds);
>
> The same error remains as it with `-std=c11` too.
>
> Can someone help me figuring out what am I doing wrong here?
>
> _______________________________________________
> Tinycc-devel mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to