gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH] Building test_libgps can fail with specifc build opti


From: Robert Norris
Subject: [gpsd-dev] [PATCH] Building test_libgps can fail with specifc build options.
Date: Tue, 28 Jun 2016 22:53:33 +0000

test_libgps will fail with this build command:
 scons shared=True socket_export=True minimal=True test_libgps
resulting with undefined reference to 'libgps_dump_state' errors

As test_libgps would force debugging on, yet libgps_dump_state() is compiled 
out.

Simply wrap libgps_dump_state() calls with suitable ifdefs
 and don't force the LIBGPS_DEBUG define in code.
---
 test_libgps.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/test_libgps.c b/test_libgps.c
index c9db543..8baadf7 100644
--- a/test_libgps.c
+++ b/test_libgps.c
@@ -10,8 +10,6 @@
 #include <stdarg.h>
 #include <ctype.h>
 
-#define LIBGPS_DEBUG
-
 #include "gps.h"
 #include "libgps.h"
 #include "gpsdclient.h"
@@ -94,7 +92,9 @@ int main(int argc, char *argv[])
        while (fgets(buf, sizeof(buf), stdin) != NULL) {
            if (buf[0] == '{' || isalpha(buf[0])) {
                gps_unpack(buf, &gpsdata);
+#ifdef LIBGPS_DEBUG
                libgps_dump_state(&gpsdata);
+#endif
            }
        }
 #endif
@@ -115,8 +115,10 @@ int main(int argc, char *argv[])
                        errno, gps_errstr(errno));
        }
 #ifdef SOCKET_EXPORT_ENABLE
+#ifdef LIBGPS_DEBUG
        libgps_dump_state(&collect);
 #endif
+#endif
        (void)gps_close(&collect);
     } else {
        int tty = isatty(0);
@@ -135,8 +137,10 @@ int main(int argc, char *argv[])
            (void)gps_send(&collect, buf);
            (void)gps_read(&collect);
 #ifdef SOCKET_EXPORT_ENABLE
+#ifdef LIBGPS_DEBUG
            libgps_dump_state(&collect);
 #endif
+#endif
        }
        (void)gps_close(&collect);
     }
-- 
2.8.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]