From 77d0a8490c4333fb8c25f8a33d523e775f1b1156 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 6 Sep 2014 05:14:14 -0400 Subject: Minimal option requires conditionalization of some code. All regression tests pass with default options (GPS tests are disabled with minimal on, because socket_export is off). --- libgps_core.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'libgps_core.c') diff --git a/libgps_core.c b/libgps_core.c index 42c5051c..d481e699 100644 --- a/libgps_core.c +++ b/libgps_core.c @@ -75,6 +75,7 @@ int gps_open(/*@null@*/const char *host, else if (status == -2) status = SHM_NOATTACH; } +#define USES_HOST #endif /* SHM_EXPORT_ENABLE */ #ifdef DBUS_EXPORT_ENABLE @@ -83,14 +84,21 @@ int gps_open(/*@null@*/const char *host, if (status != 0) status = DBUS_FAILURE; } +#define USES_HOST #endif /* DBUS_EXPORT_ENABLE */ #ifdef SOCKET_EXPORT_ENABLE if (status == -1) { status = gps_sock_open(host, port, gpsdata); } +#define USES_HOST #endif /* SOCKET_EXPORT_ENABLE */ +#ifndef USES_HOST + fprintf(stderr, "No methods available for connnecting to %s!\n", host); +#endif /* USES_HOST */ +#undef USES_HOST + gpsdata->set = 0; gpsdata->status = STATUS_NO_FIX; gpsdata->satellites_used = 0; @@ -101,7 +109,13 @@ int gps_open(/*@null@*/const char *host, /*@ +branchstate +compdef @*/ } -int gps_close(struct gps_data_t *gpsdata) +#if defined(SHM_EXPORT_ENABLE) || defined(SOCKET_EXPORT_ENABLE) +#define CONDITIONALLY_UNUSED +#else +#define CONDITIONALLY_UNUSED UNUSED +#endif + +int gps_close(struct gps_data_t *gpsdata CONDITIONALLY_UNUSED) /* close a gpsd connection */ { int status = -1; @@ -124,7 +138,7 @@ int gps_close(struct gps_data_t *gpsdata) return status; } -int gps_read(struct gps_data_t *gpsdata) +int gps_read(struct gps_data_t *gpsdata CONDITIONALLY_UNUSED) /* read from a gpsd connection */ { int status = -1; @@ -221,8 +235,9 @@ bool gps_waiting(const struct gps_data_t *gpsdata CONDITIONALLY_UNUSED, int time return waiting; } -int gps_mainloop(struct gps_data_t *gpsdata, int timeout, - void (*hook)(struct gps_data_t *gpsdata)) +int gps_mainloop(struct gps_data_t *gpsdata CONDITIONALLY_UNUSED, + int timeout CONDITIONALLY_UNUSED, + void (*hook)(struct gps_data_t *gpsdata) CONDITIONALLY_UNUSED) { int status = -1; -- cgit v1.2.1