>If compiler predefined macros like __linux__ or __NetBSD__ are OK for
><skalibs/nonposix.h>, how about #if defined(__linux__) ||
>defined(__GNU__)? GCC predefines both __GNU__ and __gnu_hurd__ (I
>think, can be checked with 'cpp -dM - </dev/null') when compiling for
>the Hurd, and I suppose no other compiler targets that OS...
Do you mean __GNUC__ instead of __GNU__ ?
Testing defined(__GNUC__) would yield true whenever the compiler is gcc,
so _GNU_SOURCE would be defined even on BSDs when people use gcc. Not
optimal, and would make behaviour different depending on the compiler.
I'd rather #define _GNU_SOURCE unconditionally.
>Do you mean doing something like:
>
>#ifndef PATH_MAX
>#define PATH_MAX 4096
>#endif
>
>or removing references to PATH_MAX altogether?
The latter wherever possible. It's easy enough to compile with
-DPATH_MAX=4096, and I'd rather keep it like this than pretend to work
without PATH_MAX but fail with very long path names.
--
Laurent
Received on Thu Oct 17 2019 - 07:25:32 UTC