From 5a715483cd50180778974d96fdb3c4a8fef598e4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 8 Mar 2015 13:15:48 -0400 Subject: splint cleanup of new code. --- gpsd.c | 2 +- gpsmon.c | 2 +- libgpsd_core.c | 8 ++++---- ntpshmread.c | 1 + ppsthread.c | 5 +++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gpsd.c b/gpsd.c index 9c19bfa1..53a033dc 100644 --- a/gpsd.c +++ b/gpsd.c @@ -1526,7 +1526,7 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed) //gpsd_log(&context.errout, LOG_PROG, "NTP: No time this packet\n"); } else if (isnan(device->newdata.time)) { //gpsd_log(&context.errout, LOG_PROG, "NTP: bad new time\n"); -#ifdef PPS_ENABLE +#if defined(PPS_ENABLE) && !defined(S_SPLINT_S) } else if (device->newdata.time <= device->pps_thread.fixin_real.tv_sec) { //gpsd_log(&context.errout, LOG_PROG, "NTP: Not a new time\n"); #endif /* PPS_ENABLE */ diff --git a/gpsmon.c b/gpsmon.c index 88de9b63..2d40ccd1 100644 --- a/gpsmon.c +++ b/gpsmon.c @@ -852,7 +852,7 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED) * and it is a new second. */ if ( 0 != isnan(device->newdata.time)) { // "NTP: bad new time -#ifdef PPS_ENABLE +#if defined(PPS_ENABLE) && !defined(S_SPLINT_S) } else if (device->newdata.time <= device->pps_thread.fixin_real.tv_sec) { // "NTP: Not a new time #endif /* PPS_ENABLE */ diff --git a/libgpsd_core.c b/libgpsd_core.c index e8ed6852..4178b5f3 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -422,7 +422,7 @@ static void ppsthread_log(volatile struct pps_thread_t *pps_thread, } -/*@-usereleased -compdef@*/ +/*@-usereleased -compdef -compmempass@*/ void gpsd_clear(struct gps_device_t *session) /* device has been opened - clear its storage for use */ { @@ -443,15 +443,15 @@ void gpsd_clear(struct gps_device_t *session) /* set up the context structure for the PPS thread monitor */ memset((void *)&session->pps_thread, 0, sizeof(session->pps_thread)); session->pps_thread.devicefd = session->gpsdata.gps_fd; - session->pps_thread.devicename = session->gpsdata.dev.path; + /*@i2@*/session->pps_thread.devicename = session->gpsdata.dev.path; session->pps_thread.pps_hook = NULL; session->pps_thread.log_hook = ppsthread_log; - session->pps_thread.context = (void *)session; + /*@i4@*/session->pps_thread.context = (void *)session; #endif /* PPS_ENABLE */ session->opentime = timestamp(); } -/*@+usereleased +compdef@*/ +/*@+usereleased +compdef +compmempass@*/ int gpsd_open(struct gps_device_t *session) /* open a device for access to its data */ diff --git a/ntpshmread.c b/ntpshmread.c index 11532e1a..1282f779 100644 --- a/ntpshmread.c +++ b/ntpshmread.c @@ -20,6 +20,7 @@ #endif /* S_SPLINT_S*/ #include "ntpshm.h" +#include "compiler.h" struct shmTime /*@null@*/ *shm_get(const int unit, const bool create, const bool forall) /* initialize a SHM segment */ diff --git a/ppsthread.c b/ppsthread.c index 68b07070..9fddbba9 100644 --- a/ppsthread.c +++ b/ppsthread.c @@ -131,7 +131,8 @@ TS_NORM( r ); \ } while (0) -static pthread_mutex_t ppslast_mutex = PTHREAD_MUTEX_INITIALIZER; + +/*@i1@*/static pthread_mutex_t ppslast_mutex = PTHREAD_MUTEX_INITIALIZER; #if defined(HAVE_SYS_TIMEPPS_H) /*@-compdestroy -nullpass -unrecog@*/ @@ -246,7 +247,7 @@ static int init_kernel_pps(volatile struct pps_thread_t *pps_thread) * port file descriptor. */ // cppcheck-suppress redundantAssignment - ret = pps_thread->device_fd; + ret = pps_thread->devicefd; #endif /* assert(ret >= 0); */ pps_thread->log_hook(pps_thread, THREAD_INF, -- cgit v1.2.1