tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: _NETBSD_SOURCE always defined leading to unwanted inclusions
On Sat, Apr 20, 2019 at 10:30:48PM +0200, tlaronde%polynum.com@localhost wrote:
> [I changed the subject because this was lost in the end of a message
> about _STANDALONE]
>
> When one does not specify something special (_ANSI_SOURCE or
> _POSIX_C_SOURCE or _XOPEN_SOURCE), _NETBSD_SOURCE is always defined
> due to the inclusion of sys/featuretest.h almost everywhere.
Yes, that's intentional.
> This leads to the inclusion of some chunks of code in <sys/time.h>,
> specially the definition of static functions (supposed to be inlined but
> this will depend on the compiler and on the flags--- -fno-inline).
>
> A first problem (YMMV) is that <time.h> can not be included anywhere
> but only outside of a block, since there are definitions and not only
> declarations.
Don't do that. You can't expect any header not specifically prepared
for the purpose to work correctly if included somewhere other than the
top level.
> The second problem is that the functions are not prefixed by '_' and can
> conflict with locally defined functions.
Those functions are part of the library API. If you want to restrict
what's defined, use _POSIX_C_SOURCE or one of its many cousins.
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index