From 80cd103396fcd1185a476761bfb267ce12f64b32 Mon Sep 17 00:00:00 2001 From: Simon Dawson Date: Mon, 25 Aug 2014 10:31:18 +0100 Subject: [PATCH] Fix build error when ntpshm is false The build fails as follows libgpsd_core.c: In function 'ntpshm_latch': libgpsd_core.c:1660:24: error: 'const struct gps_type_t' has no member named 'time_offset' || device->device_type->time_offset == NULL) ^ libgpsd_core.c:1663:33: error: 'const struct gps_type_t' has no member named 'time_offset' fix_time += device->device_type->time_offset(device); ^ scons: *** [libgpsd_core.os] Error 1 The solution is to wrap #ifdef NTPSHM_ENABLE around the ntpshm_latch function Signed-off-by: Simon Dawson --- libgpsd_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libgpsd_core.c b/libgpsd_core.c index 6ec08a4..f7e8075 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -1638,6 +1638,7 @@ void gpsd_zero_satellites( /*@out@*/ struct gps_data_t *out) #endif } +#ifdef NTPSHM_ENABLE void ntpshm_latch(struct gps_device_t *device, struct timedrift_t /*@out@*/*td) /* latch the fact that we've saved a fix */ { @@ -1668,5 +1669,6 @@ void ntpshm_latch(struct gps_device_t *device, struct timedrift_t /*@out@*/*td) device->last_fixtime.clock = td->clock.tv_sec + td->clock.tv_nsec / 1e9; #endif /* S_SPLINT_S */ } +#endif /* NTPSHM_ENABLE */ /* end */ -- 2.1.2 From 48caee55069bdb7f7115e1930ace3914f4ddfe3b Mon Sep 17 00:00:00 2001 From: Simon Dawson Date: Wed, 3 Sep 2014 18:43:31 +0100 Subject: [PATCH] Complete wrapping of ntpshm_latch function in #ifdef NTPSHM_ENABLE Currently, the build fails as follows gpsmon.o: In function `gpsmon_hook': gpsmon.c:(.text+0x8b0): undefined reference to `ntpshm_latch' collect2: error: ld returned 1 exit status scons: *** [gpsmon] Error 1 Addresses Sacannah bug #43129: ntpshm patch is incomplete. Signed-off-by: Simon Dawson --- gpsd.h-tail | 2 ++ gpsmon.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/gpsd.h-tail b/gpsd.h-tail index 7b62ce1..7b44f91 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -857,7 +857,9 @@ extern unsigned int ais_binary_encode(struct ais_t *ais, /*@out@*/unsigned char extern void ntpshm_context_init(struct gps_context_t *); extern void ntpshm_session_init(struct gps_device_t *); extern int ntpshm_put(struct gps_device_t *, int, struct timedrift_t *); +#ifdef NTPSHM_ENABLE extern void ntpshm_latch(struct gps_device_t *device, /*@out@*/struct timedrift_t *td); +#endif /* NTPSHM_ENABLE */ extern void ntpshm_link_deactivate(struct gps_device_t *); extern void ntpshm_link_activate(struct gps_device_t *); diff --git a/gpsmon.c b/gpsmon.c index c812063..909f271 100644 --- a/gpsmon.c +++ b/gpsmon.c @@ -734,8 +734,10 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED) report_unlock(); +#ifdef NTPSHM_ENABLE /* Update the last fix time seen for PPS. FIXME: do this here? */ ntpshm_latch(device, &td); +#endif /* NTPSHM_ENABLE */ } /*@+observertrans +nullpass +globstate +compdef +uniondef@*/ -- 2.1.2