summaryrefslogtreecommitdiff
path: root/libgps_core.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-09-06 05:14:14 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-09-06 05:19:19 -0400
commit77d0a8490c4333fb8c25f8a33d523e775f1b1156 (patch)
tree7fbdbeac2d44495d9fdec1cd14415de3be33346f /libgps_core.c
parent392356e35d30f573ae34f4416dcd23c8692a1789 (diff)
downloadgpsd-77d0a8490c4333fb8c25f8a33d523e775f1b1156.tar.gz
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).
Diffstat (limited to 'libgps_core.c')
-rw-r--r--libgps_core.c23
1 files changed, 19 insertions, 4 deletions
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;