[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] C99 Aftermath
From: |
Gary E. Miller |
Subject: |
Re: [gpsd-dev] C99 Aftermath |
Date: |
Mon, 5 Sep 2016 18:33:42 -0700 |
Yo Fred!
On Mon, 5 Sep 2016 18:04:13 -0700 (PDT)
Fred Wright <address@hidden> wrote:
> On Mon, 5 Sep 2016, Gary E. Miller wrote:
> > On Mon, 5 Sep 2016 16:47:45 -0700 (PDT)
> > Fred Wright <address@hidden> wrote:
> >
> [...]
> > What I would like is the C99 stuff be guarded by #ifdef __linux__.
> > Then at least the Linux code can be clean.
>
> In this context, "clean" means "compatible with some hypothetical
> future compiler that demands C99 compliance with no alternative".
Not to mean, clean maens that hypothetical future patches break C99
and POSIX 2001 compliance by accident.
> While such compliance is a useful goal, it's not a terribly pressing
> one so far, and certainly not one that should take precedence over
> keeping the code working or fixing real bugs.
I see not conflict. The fix is easy. Just ifdef the C99 and POSIX
instructions, and/or tweak SConstuct.
> The problem with overuse of "#ifdef __linux__" is that it makes
> Linux-based testing less applicable to non-Linux behavior, and thus
> makes it easier for bugs to creep in for non-Linux platforms when most
> developers are testing on Linux. Keeping the code as "naturally
> portable" as possible maximizes the effectiveness of testing.
Can't say I agree. Since Linux seems to be the sanest C99 and
POSIX 2001 platform it is the best starting place.
If is only because FreeBSD is so standards non-compliant that we must not
enforce commpliance for that turkey.
I tried ifdef'ing out all the broken OS, but in the end just including Linux
does exactly the same thing and is a lot easier.
> To the extent that stuff *does* have to be platform specific, there's
> also the question of how much of that logic should be in the code
> itself, vs. how much should be handled in the "configure" setup.
Yes, always debateable. And I really don't care where it goes. If you
ahve a preference, have at it, otherwise I'll do it to my taste.
> > As noted above, I'd like the C99 enforced for Linux. That will
> > keep a lot of junk from creeping back in. Can you do the #ifdef
> > wrap and resubmit?
>
> Even if one were to take that approach, there's a nontrivial amount of
> work in determining the *right* thing to do in the Linux case,
Yes, there was, but since it is now done, let us not throw away that work.
> Note also that one can test for C99 compliance at any time purely by
> the command-line scons invocation, without making any code changes at
> all.
We are trying to save the programmer work, not leave work for him to do.
> In theory, one could simply say "CC=c99 scons ..." in many
> cases,
Sadly, only one, Linux. So just hard code it.
> Even fixing the warnings that appear *without* C99 should probably be
> higher priority than C99 compliance.
I have none in Linux. If you have some in your OS then please feel free
to make that your priority.
> OK, I'll send the patches. Beware of incoming mailbomb. :-)
I took a quick look, Not a long enough look to apply them yet, and
since we are still debating the first one I'll not do it yet.
I think the patches might be in the wrong order. You seem to be reverting
fixes before fixing the issue. Which will might break git-bisect. Are
you sure you order is correct?
RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
address@hidden Tel:+1 541 382 8588
pgpTQS3YZMtaQ.pgp
Description: OpenPGP digital signature