[PATCH] Fix build if __GLIBC_PREREQ is not defined
Jörg Krause
joerg.krause at embedded.rocks
Fri Mar 2 21:54:57 UTC 2018
Hi Thorsten,
On Fri, 2018-03-02 at 12:46 +0000, Thorsten Glaser wrote:
> Jörg Krause dixit:
>
> > Fixes build error with musl:
>
> musl doesn't define __GLIBC__ so the second check in...
>
> > #if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 26)
>
> ... suffices already.
No. Before evaluation, all macros are expanded. In case of musl, where
__GLIBC_PREREQ is not defined, the macro is expanded to 0 resulting in
the following invalid expression:
#if 1 && 0 && !0(2, 26)
> If you run into this, it must be a local problem,
> i.e. someone defined __GLIBC__ on a non-glibc system,
> since cpp short-circuits such an evaluation, and this
> is the documented way to use __GLIBC_PREREQ().
Jörg
More information about the libbsd
mailing list