diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-03-30 17:10:53 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-03-30 17:10:53 -0400 |
commit | 28bf37132d86cc59320e21d843960d086cef664c (patch) | |
tree | bf085b5f89f1d1061b6a88ecc66c50721b13d86c /gpsutils.c | |
parent | ecb7e1ff3ec73000918c56861c55258c2d4deada (diff) | |
download | gpsd-28bf37132d86cc59320e21d843960d086cef664c.tar.gz |
Retire splint from our set of static analyzers.
The proximate cause was that we've been seing emission of error
messages that were randomly and disturbingly variable across different
environments - notably Raspbian and Gentoo splint gave nontrivially
different results than Ubuntu 14.10 splint. And this was *not* due to
Ubuntu patches! A pristine splint built from the 3.1.2 tarball on
Ubuntu didn't match the Raspbian and Gentoo results either.
But this has been coming for a while. Easy access to more modern
static analyzers such as coverity, scan-build and cppcheck has been
decreasing the utility of splint, which is unmaintained and somewhat
buggy and not easy to use.
Only file not cleaned is ppsthread.c, because Gary has been working
on it during this cleanup.
All regression tests pass. PPS observed live on GR601-W.
Diffstat (limited to 'gpsutils.c')
-rw-r--r-- | gpsutils.c | 37 |
1 files changed, 11 insertions, 26 deletions
@@ -19,7 +19,7 @@ #include <errno.h> #include <ctype.h> -#include "gpsd.h" /* could be gps.h if we didn't need splint decorations */ +#include "gps.h" #include "libgps.h" #ifdef USE_QT @@ -27,21 +27,11 @@ #include <QStringList> #endif -#ifdef S_SPLINT_S -/*@-matchfields@*/ -struct timespec - { - time_t tv_sec; /* Seconds. */ - long tv_nsec; /* Nanoseconds. */ - }; -/*@+matchfields@*/ -#endif /* S_SPLINT_S */ /* * Berkeley implementation of strtod(), inlined to avoid locale problems * with the decimal point and stripped down to an atof()-equivalent. */ -/*@-shiftimplementation +charint@*/ double safe_atof(const char *string) /* Takes a decimal ASCII floating-point number, optionally * preceded by white space. Must have form "-I.FE-X", @@ -240,11 +230,10 @@ done: } return fraction; } -/*@+shiftimplementation -charint@*/ #define MONTHSPERYEAR 12 /* months per calendar year */ -void gps_clear_fix( /*@out@*/ struct gps_fix_t *fixp) +void gps_clear_fix(struct gps_fix_t *fixp) /* stuff a fix structure with recognizable out-of-band values */ { fixp->time = NAN; @@ -263,15 +252,15 @@ void gps_clear_fix( /*@out@*/ struct gps_fix_t *fixp) fixp->epc = NAN; } -void gps_clear_dop( /*@out@*/ struct dop_t *dop) +void gps_clear_dop( struct dop_t *dop) { dop->xdop = dop->ydop = dop->vdop = dop->tdop = dop->hdop = dop->pdop = dop->gdop = NAN; } -void gps_merge_fix( /*@ out @*/ struct gps_fix_t *to, +void gps_merge_fix(struct gps_fix_t *to, gps_mask_t transfer, - /*@ in @*/ struct gps_fix_t *from) + struct gps_fix_t *from) /* merge new data into an old fix */ { if ((NULL == to) || (NULL == from)) @@ -309,8 +298,8 @@ void gps_merge_fix( /*@ out @*/ struct gps_fix_t *to, timestamp_t timestamp(void) { struct timespec ts; - /*@i2@*/(void)clock_gettime(CLOCK_REALTIME, &ts); - /*@i2@*/return (timestamp_t)(ts.tv_sec + ts.tv_nsec * 1e-9); + (void)clock_gettime(CLOCK_REALTIME, &ts); + return (timestamp_t)(ts.tv_sec + ts.tv_nsec * 1e-9); } time_t mkgmtime(register struct tm * t) @@ -321,7 +310,6 @@ time_t mkgmtime(register struct tm * t) static const int cumdays[MONTHSPERYEAR] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; - /*@ +matchanyintegral @*/ year = 1900 + t->tm_year + t->tm_mon / MONTHSPERYEAR; result = (year - 1970) * 365 + cumdays[t->tm_mon % MONTHSPERYEAR]; result += (year - 1968) / 4; @@ -339,11 +327,10 @@ time_t mkgmtime(register struct tm * t) result += t->tm_sec; if (t->tm_isdst == 1) result -= 3600; - /*@ -matchanyintegral @*/ return (result); } -timestamp_t iso8601_to_unix( /*@in@*/ char *isotime) +timestamp_t iso8601_to_unix(char *isotime) /* ISO8601 UTC to Unix UTC, no leapsecond correction. */ { #ifndef USE_QT @@ -352,7 +339,7 @@ timestamp_t iso8601_to_unix( /*@in@*/ char *isotime) struct tm tm; memset(&tm,0,sizeof(tm)); - /*@i1@*/ dp = strptime(isotime, "%Y-%m-%dT%H:%M:%S", &tm); + dp = strptime(isotime, "%Y-%m-%dT%H:%M:%S", &tm); if (dp != NULL && *dp == '.') usec = strtod(dp, NULL); else @@ -378,7 +365,7 @@ timestamp_t iso8601_to_unix( /*@in@*/ char *isotime) } /* *INDENT-OFF* */ -/*@observer@*/char *unix_to_iso8601(timestamp_t fixtime, /*@ out @*/ +char *unix_to_iso8601(timestamp_t fixtime, /*@ out @*/ char isotime[], size_t len) /* Unix UTC time to ISO8601, no timezone adjustment */ /* example: 2007-12-11T23:38:51.033Z */ @@ -401,7 +388,7 @@ timestamp_t iso8601_to_unix( /*@in@*/ char *isotime) */ (void)snprintf(fractstr, sizeof(fractstr), "%.3f", fractional); /* add fractional part, ignore leading 0; "0.2" -> ".2" */ - /*@i2@*/(void)snprintf(isotime, len, "%s%sZ",timestr, strchr(fractstr,'.')); + (void)snprintf(isotime, len, "%s%sZ",timestr, strchr(fractstr,'.')); return isotime; } /* *INDENT-ON* */ @@ -410,7 +397,6 @@ timestamp_t iso8601_to_unix( /*@in@*/ char *isotime) /* Distance in meters between two points specified in degrees, optionally with initial and final bearings. */ -/*@-mustdefine@*/ double earth_distance_and_bearings(double lat1, double lon1, double lat2, double lon2, double *ib, double *fb) { /* @@ -480,7 +466,6 @@ double earth_distance_and_bearings(double lat1, double lon1, double lat2, double return (WGS84B * A * (S - d_S)); } -/*@+mustdefine@*/ /* Distance in meters between two points specified in degrees. */ double earth_distance(double lat1, double lon1, double lat2, double lon2) |