%m, #614

Achim Gratz Stromeko at nexgo.de
Thu Aug 29 19:09:10 UTC 2019


Gary E. Miller via devel writes:
>> --8<---------------cut here---------------start------------->8---
>> _GNU_SOURCE should not always be defined, but it does need to be
>> defined in certain cases.  For example, on glibc < 2.10, you need to
>> define it to get strnlen() and struct ifreq.
>> 
>> From glibc 2.10, you instead need _POSIX_C_SOURCE >= 200809L
>> --8<---------------cut here---------------end--------------->8---
>
> Yup, that's what I said.  It is the trut4h direct from the strnlen()
> man page.  And your point is?

That this is completely irrelevant since firstly, ntpsec doesn't even
use strnlen to start with.  Secondly, struct ifreq doesn't need
_GNU_SOURCE, but some other definitions that may or may not be included
in what _GNU_SOURCE does.  Thirdly, even if there is an old glibc that
doesn't support _POSIX_C_SOURCE you still shouldn't use _GNU_SOURCE if
you want to keep POSIX compatibility.

> Not "long dead".  gpsd keeps running into that issue.

Guess what, SConstruct from gpsd doesn't define _GNU_SOURCE either.
It's not even mentioned anywhere and that since over four years.  So
tell me again how "gpsd keeps running into this issue" and why ntpsec
should care?

> The trick is to use feature macros only when needed.  This subjust came
> up because the 'when needed' part needed clarification for NTPsec usage.

There is no trick to feature test macros.  You specify what your API is
supposed to be and chose the set of macros that contain them (they need
to be compatible).  Asking for one API and hoping to get another is
however not a good use of them.

> Yup, sort of, but mutating the topic..  I think gpsd is now a good
> example of how to do that correctly, and documented in the SConstruct
> file.

Looked at it and it does nothing of the things you seem to talk about.
In case you wanted to claim that gpsd doesn't use feature test macros:

https://git.savannah.gnu.org/gitweb/?p=gpsd.git&a=search&h=HEAD&st=grep&s=%23+%3Fdefine+%2B_&sr=1

So the lack of them in one place leads to a wild spread of those in many
other places.  If you call that uncontrollable mess "doing it correctly"
then we can agree to disagree.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada



More information about the devel mailing list