On closer inspection, termbox2.h does include signal.h itself[1], and additionally defines _XOPEN_SOURCE[2] and _DEFAULT_SOURCE, so the inclusion of signal.h can't be escaped.
My testing has shown that when -std=c99 is specified, it is as if that switch explicitly undefines _DEFAULT_SOURCE/_XOPEN_SOURCE **defined inside the header file** (this is the weird part). If -D_DEFAULT_SOURCE is given as an argument, or without -std=c99, when gcc is called directly rather than through the wrapper, c99, there are no warnings: $ c99 -E edit.c | grep fileno if (fstat(fileno(fp), &st) != 0) { $ gcc -E edit.c | grep fileno int fileno(FILE *); int fileno_unlocked(FILE *); if (fstat(fileno(fp), &st) != 0) { $ c99 -D_DEFAULT_SOURCE -E edit.c | grep fileno int fileno(FILE *); int fileno_unlocked(FILE *); if (fstat(fileno(fp), &st) != 0) { $ I use Alpine Linux, thus musl libc. Searching the web yielded the answer[3] on Stack Overflow, though: > If you want this to cleanly compile with -std=c99, you must consider the > inclusion of the _DEFAULT_SOURCE feature test macro I'm not sure about why you wouldn't want POSIX compliance though (To compile on Plan9? But it has APE[4]). [1]: https://github.com/arthur-jacquin/edit/blob/41cd580d80459d1f13ef923c812cf6a858b240f0/termbox2.h#L40 [2]: https://github.com/arthur-jacquin/edit/blob/41cd580d80459d1f13ef923c812cf6a858b240f0/termbox2.h#L29 [3]: https://stackoverflow.com/a/10435860 [4]: https://9p.io/wiki/plan9/Porting_alien_software_to_Plan_9/index.html
signature.asc
Description: PGP signature