gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] Warnings from 32 bit FreeBSD


From: Gary E. Miller
Subject: Re: [gpsd-dev] Warnings from 32 bit FreeBSD
Date: Thu, 13 Jun 2019 15:51:54 -0700

Yo Fred!

On Thu, 13 Jun 2019 15:32:48 -0700 (PDT)
Fred Wright <address@hidden> wrote:

> >> The "rule" is written down somewhere, though I don't remember
> >> exactly where.  
> >
> > Yeah, no one seems to recall where.  I just looked at Python.h.
> > They use the same double underscore we do.  When they figure it
> > out, we'll copy.  
> 
> Well, Python.h isn't necessarily the authority. :-) And using the
> wrong one can wind up fighting with the includes' internals.

Yup.  But when they give up, I don;t have much of a chance to do
better.

> >> -#ifdef __linux__
> >> -/* FreeBSD chokes on this */
> >> -/* getsid() needs _XOPEN_SOURCE, 500 means X/Open 1995 */
> >> -#define _XOPEN_SOURCE 500
> >> -#endif /* __linux__ */  
> >
> > Notice the mess here?  Fixing FreeBSD by testing for not linux?  
> 
> Yeah, I know, though that particular case seems to be based on the 
> particular value chosen.

I'm fixing that right now.

> > By pulling into gpsd_config.h there is only ever one value for
> > _ZOPEN_SOURCE. 
> >> +#ifndef __linux__  /* Avoid deprecation warnings on some Linuces
> >> */ #define _DARWIN_C_SOURCE
> >> +#define _BSD_SOURCE
> >> +#define _NETBSD_SOURCE
> >> +#endif /* !__linux__ */  
> >
> > Fixing for osX by again testing for not linux?  Ugh.  Gone.  
> 
> Actually, that Linux fix was really for _BSD_SOURCE, but it made
> sense to put them all in the conditional.

Yes, but better to define _BSD_SOURCE only when  needed.  I've got
that mostly fixed now.

>  I think the original
> intent was that each of those macros would only affect the named OS
> and be ignored by the others,

But the effect was exactly the opposite.  Instead of adding only when
needed, it is subtracted only when problematic.

> >> I'd expected something like this to work on the other files as
> >> well, with the possible exception of the isascii case.  Since
> >> isascii is just a trivial one-line macro, it may make more sense
> >> to provide a local definition than to wrestle with the right
> >> feature-test incantation to get the one-line definition from the
> >> OS includes.  
> >
> > Ugh.  Duplicating 30 year old standard code has got to go.  Modern
> > compilers inline isascii().  We can't duplicate the efficiency.  
> 
> Actually, I saw it defined more often as a macro than as an inline,
> and in any case there's no efficiency benefit to the inline.  The
> advantages of the inline are:

I'd rather let the distro make that decision.  We got our own problems.

> >> Another possibility would be to move a few more things into the
> >> os_compat module, which was intended to be the place for all the
> >> messy OS_specific stuff, so that the rest of the code wouldn't need
> >> any of that crud.  But again, this isn't something I'd do right
> >> before a release.  
> >
> > I looked at that.  I could not make it work.  
> 
> It would mean using different names, but not something for the
> release.

Then we agree, a dead end.  At least for now.

> > Care to share?  Your results are not the same as from others.  
> 
> Failures (mostly not including warnings):
> 
> CentOS 7:
> MacCent: Linux maccent.local 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb
> 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux MacCent: This
> system is: linux2 [...]

Seriously?  Demented.  The errors below look like NetBSD.

> MacCent: netlib.c: In function 'netlib_localsocket':
> MacCent: netlib.c:200:28: warning: implicit declaration of function
> 'SUN_LEN' [-Wimplicit-function-declaration] MacCent:   if
> (connect(sock, (struct sockaddr *)&saddr, SUN_LEN(&saddr)) < 0)
> { MacCent:                             ^ MacCent: os_compat.c: In
> function 'os_daemon': MacCent: os_compat.c:151:5: warning: implicit
> declaration of function 'daemon' [-Wimplicit-function-declaration]
> MacCent:      return daemon(nochdir, noclose); MacCent:      ^
> MacCent: driver_nmea2000.c: In function 'nmea2000_open':
> MacCent: driver_nmea2000.c:1549:18: error: storage size of 'ifr'
> isn't known MacCent:      struct ifreq ifr;
> MacCent:                   ^
> MacCent: driver_nmea2000.c:1549:18: warning: unused variable 'ifr' 
> [-Wunused-variable]
> MacCent: scons: *** [driver_nmea2000.o] Error 1

Identical to errors on NetBSD.  So fix them and make the patch for
CentOS and NetBSD.

> OpenBSD 5.6:
> MacOpen: OpenBSD MacOpen.local 5.6 GENERIC.MP#333 amd64
> MacOpen: This system is: openbsd5
> [...]
> MacOpen: cgps.c:1063: error: 'SIGWINCH' undeclared (first use in this 
> function)
> MacOpen: cgps.c:1063: error: (Each undeclared identifier is reported
> only once
> MacOpen: cgps.c:1063: error: for each function it appears in.)
> MacOpen: scons: *** [cgps.o] Error 1

Odd.:

    (void)signal(SIGWINCH, resize);

Any idea the magic incantation?



> Ubuntu 14.04:
> MacLinux: Linux ubuntu 4.4.0-143-generic #169~14.04.2-Ubuntu SMP Wed
> Feb 13 15:00:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
> MacLinux: This system is: linux2

Huh?  CentOs and Ubuntu have the same platfomr type.  That is
gonna hurt.

> MacLinux: In file included from tests/../libgps.h:14:0,
> MacLinux:                  from tests/test_libgps.c:15:
> MacLinux: tests/../gpsd_config.h:9:0: warning: "_POSIX_C_SOURCE"
> redefined [enabled by default] MacLinux:  #define _POSIX_C_SOURCE
> 2001112L [...]
> MacLinux: In file included from tests/../libgps.h:14:0,
> MacLinux:                  from tests/test_libgps.c:15:
> MacLinux: tests/../gpsd_config.h:13:0: warning: "__USE_MISC"
> redefined [enabled by default] MacLinux:  #define __USE_MISC
> [...]

I got a fix for those.  Too bad your compiler ddid not say redefined
from what.  My gcc does.

> Fedora 25:
> MacFed: Linux MacFed.local 4.13.16-100.fc25.x86_64 #1 SMP Mon Nov 27
> 19:52:46 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux MacFed: This system
> is: linux2 [...]
> MacFed: In file included from tests/../compiler.h:23:0,
> MacFed:                  from tests/../gpsd.h:10,
> MacFed:                  from tests/test_geoid.c:11:
> MacFed: tests/../gpsd_config.h:9:0: warning: "_POSIX_C_SOURCE"
> redefined MacFed:  #define _POSIX_C_SOURCE 2001112L
> [...]
> MacFed: In file included from tests/../compiler.h:23:0,
> MacFed:                  from tests/../gpsd.h:10,
> MacFed:                  from tests/test_geoid.c:11:
> MacFed: tests/../gpsd_config.h:13:0: warning: "__USE_MISC" redefined
> MacFed:  #define __USE_MISC
> [...]

Same as above.  Will be same fix.

> macOS High Sierra:
> MacHS: Darwin MacHS.local 17.7.0 Darwin Kernel Version 17.7.0: Wed
> Feb 27 00:43:23 PST 2019; root:xnu-4570.71.35~1/RELEASE_X86_64 x86_64
> MacHS: This system is: darwin [...]
> MacHS: In file included from tests/test_geoid.c:11:
> MacHS: In file included from tests/../gpsd.h:10:
> MacHS: In file included from tests/../compiler.h:23:
> MacHS: tests/../gpsd_config.h:15:9: warning: '__DARWIN_C_LEVEL' macro
> redefined [-Wmacro-redefined] MacHS: #define __DARWIN_C_LEVEL
> _POSIX_C_SOURCE [...]
> 
> Similar results on all macOS >=10.7

Well, that conflicts with most 3rd party doc on Darwin.  Easy fix.

> FreeBSD 10.3:
> MacFree: FreeBSD MacFree 10.3-RELEASE-p20 FreeBSD 10.3-RELEASE-p20
> #0: Wed Jul 12 03:13:07 UTC 2017
> address@hidden:/usr/obj/usr/src/sys/GENERIC
> amd64 MacFree: This system is: freebsd10 [...] MacFree:
> packet.c:1415:7: warning: implicit declaration of function 'isascii'
> is invalid in C99 [-Wimplicit-function-declaration] MacFree:
> if (!isascii(c)) { MacFree:              ^ MacFree: packet.c: In
> function 'nextstate': [...]
> MacFree: gpsmon.c: In function 'main':
> MacFree: gpsmon.c:1188:11: warning: implicit declaration of function 
> 'putenv'; did you mean 'setenv'? [-Wimplicit-function-declaration]
> MacFree:      (void)putenv("TZ=UTC"); // for ctime()
> MacFree:            ^~~~~~
> MacFree:            setenv
> MacFree: gpsd.c: In function 'main':
> MacFree: gpsd.c:2052:6: warning: implicit declaration of function
> 'nice'; did you mean 'pipe'? [-Wimplicit-function-declaration]
> MacFree:   if (nice(NICEVAL) == -1 && errno != 0)
> MacFree:       ^~~~
> MacFree:       pipe
> [...]

Those all get fixed by _XOPEN_SOURCE 500.  Been working on that.

> NetBSD 6.1.5:
> MacNet: NetBSD MacNet.local 6.1.5 NetBSD 6.1.5 (GENERIC) amd64
> MacNet: This system is: netbsd6

Oh.  Interesting.  That recently changed, and breaks SConstruct.
Easy fix.

> [...]
> MacNet: json.c: In function 'json_internal_read_object':
> MacNet: json.c:405:3: warning: array subscript has type 'char'
> MacNet: driver_nmea0183.c: In function 'merge_ddmmyy':
> MacNet: driver_nmea0183.c:151:9: warning: array subscript has type
> 'char' MacNet: driver_nmea0183.c: In function 'merge_hhmmss':
> MacNet: driver_nmea0183.c:219:9: warning: array subscript has type
> 'char' MacNet: driver_nmea0183.c:235:9: warning: array subscript has
> type 'char' MacNet: json.c: In function 'json_internal_read_object':
> MacNet: json.c:405:3: warning: array subscript has type 'char'

Hmm...  not sure.

Great.  That helps a lot.  Thanks!

I'll have a fix for most in a few hours.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin

Attachment: pgp3mimiRethU.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]