summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct2
-rw-r--r--Tachometer.c2
-rw-r--r--bits.c3
-rw-r--r--bsd_base64.c2
-rw-r--r--crc24q.c2
-rw-r--r--driver_italk.c4
-rw-r--r--drivers.c2
-rw-r--r--gpsclient.c1
-rw-r--r--gpsd.c1
-rw-r--r--gpsd_json.c6
-rw-r--r--gpsmon.c1
-rw-r--r--gpspacket.c2
-rw-r--r--gpsutils.c5
-rw-r--r--libgps_core.c1
-rw-r--r--libgps_sock.c1
-rw-r--r--libgpsd_core.c1
-rw-r--r--libgpsmm.cpp2
-rw-r--r--net_dgpsip.c1
-rw-r--r--ntpshm.c1
-rw-r--r--ppsthread.c1
-rw-r--r--srecord.c2
21 files changed, 34 insertions, 9 deletions
diff --git a/SConstruct b/SConstruct
index 83589ce8..e8c1c436 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1386,7 +1386,7 @@ for (target,sources,description,params) in splint_table:
env.Alias('splint',Splint(target,sources,description,params))
Utility("cppcheck", ["gpsd.h", "packet_names.h"],
- "cppcheck -U__UNUSED__ --template gcc --enable=all --inline-suppr --suppress='*:driver_proto.c' --force $SRCDIR")
+ "cppcheck -U__UNUSED__ -UAF_UNSPEC -UINADDR_ANY -UFIXED_PORT_SPEED -UFIXED_STOP_BITS -U_WIN32 -U__CYGWIN__ --template gcc --enable=all --inline-suppr --suppress='*:driver_proto.c' --force $SRCDIR")
# Experimental check with clang analyzer
Utility("scan-build", ["gpsd.h", "packet_names.h"],
diff --git a/Tachometer.c b/Tachometer.c
index d9a69ab2..3113f16b 100644
--- a/Tachometer.c
+++ b/Tachometer.c
@@ -579,11 +579,13 @@ static void Destroy(Widget w)
/* Exported Procedures */
+// cppcheck-suppress unusedFunction
int TachometerGetValue(Widget w)
{
return (((TachometerWidget) w)->tachometer.value);
}
+// cppcheck-suppress unusedFunction
int TachometerSetValue(Widget w, int i)
{
int old;
diff --git a/bits.c b/bits.c
index 21b635f0..4b6015e9 100644
--- a/bits.c
+++ b/bits.c
@@ -137,7 +137,6 @@ void putbed64(char *buf, int off, double val)
/*@+shiftimplementation -ignoresigns@*/
}
-// cppcheck-suppress unusedFunction
u_int16_t swap_u16(u_int16_t i)
/* byte-swap a 16-bit unsigned int */
{
@@ -149,7 +148,6 @@ u_int16_t swap_u16(u_int16_t i)
return (c1 << 8) + c2;
}
-// cppcheck-suppress unusedFunction
u_int32_t swap_u32(u_int32_t i)
/* byte-swap a 32-bit unsigned int */
{
@@ -163,7 +161,6 @@ u_int32_t swap_u32(u_int32_t i)
return ((u_int32_t)c1 << 24) + ((u_int32_t)c2 << 16) + ((u_int32_t)c3 << 8) + c4;
}
-// cppcheck-suppress unusedFunction
u_int64_t swap_u64(u_int64_t i)
/* byte-swap a 64-bit unsigned int */
{
diff --git a/bsd_base64.c b/bsd_base64.c
index eba89d99..9a7b5f70 100644
--- a/bsd_base64.c
+++ b/bsd_base64.c
@@ -185,6 +185,7 @@ b64_ntop(unsigned char const *src, size_t srclength, char *target,
return (datalength);
}
+#ifdef __UNUSED__
/*@ -matchanyintegral +type @*/
/* skips all whitespace anywhere.
@@ -311,5 +312,6 @@ int b64_pton(char const *src, unsigned char *target, size_t targsize)
}
/*@ +matchanyintegral -charint @*/
+#endif /* __UNUSED__ */
#endif /* !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP) */
diff --git a/crc24q.c b/crc24q.c
index 9d1cb050..34b2dd46 100644
--- a/crc24q.c
+++ b/crc24q.c
@@ -159,6 +159,7 @@ unsigned crc24q_hash(unsigned char *data, int len)
#define MID(x) (unsigned char)(((x) >> 8) & 0xff)
#define HI(x) (unsigned char)(((x) >> 16) & 0xff)
+#ifdef __UNUSED__
void crc24q_sign(unsigned char *data, int len)
{
unsigned crc = crc24q_hash(data, len);
@@ -167,6 +168,7 @@ void crc24q_sign(unsigned char *data, int len)
data[len + 1] = MID(crc);
data[len + 2] = LO(crc);
}
+#endif /* __UNUSED__ */
bool crc24q_check(unsigned char *data, int len)
{
diff --git a/driver_italk.c b/driver_italk.c
index cdb3c7b9..35d5a6d2 100644
--- a/driver_italk.c
+++ b/driver_italk.c
@@ -387,14 +387,14 @@ static gps_mask_t italk_parse_input(struct gps_device_t *session)
return 0;
}
-#ifdef __future__
+#ifdef __UNUSED__
static void italk_ping(struct gps_device_t *session)
/* send a "ping". it may help us detect an itrax more quickly */
{
char *ping = "<?>";
(void)gpsd_write(session, ping, 3);
}
-#endif /* __future__ */
+#endif /* __UNUSED__ */
/* *INDENT-OFF* */
const struct gps_type_t italk_binary =
diff --git a/drivers.c b/drivers.c
index f741d1b4..55f2bdc9 100644
--- a/drivers.c
+++ b/drivers.c
@@ -1029,7 +1029,7 @@ static const struct gps_type_t garmintxt = {
.channels = 0, /* not used */
.probe_detect = NULL, /* no probe */
.get_packet = generic_get, /* how to get a packet */
- .parse_packet = generic_parse_input, /* how to parse one */
+ .parse_packet = garmintxt_parse, /* how to parse one */
.rtcm_writer = NULL, /* don't send RTCM data, */
.event_hook = NULL, /* no event hook */
#ifdef RECONFIGURE_ENABLE
diff --git a/gpsclient.c b/gpsclient.c
index 1c573c09..9e924b99 100644
--- a/gpsclient.c
+++ b/gpsclient.c
@@ -83,6 +83,7 @@ PyDoc_STRVAR(module_doc,
extern PyMODINIT_FUNC initclienthelpers(void);
PyMODINIT_FUNC
+// cppcheck-suppress unusedFunction
initclienthelpers(void)
{
PyObject *m;
diff --git a/gpsd.c b/gpsd.c
index c1e916ac..f721403d 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -356,6 +356,7 @@ static socket_t passivesock_af(int af, char *service, char *tcp_or_udp, int qlen
INVALIDATE_SOCKET(s);
if ((pse = getservbyname(service, tcp_or_udp)))
port = ntohs((in_port_t) pse->s_port);
+ // cppcheck-suppress unreadVariable
else if ((port = (in_port_t) atoi(service)) == 0) {
gpsd_report(context.debug, LOG_ERROR,
"can't get \"%s\" service entry.\n", service);
diff --git a/gpsd_json.c b/gpsd_json.c
index 5e02aa4b..0b4d76a1 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -1570,6 +1570,7 @@ void json_aivdm_dump(const struct ais_t *ais,
#define NAVAIDTYPE_DISPLAY(n) (((n) < (unsigned int)NITEMS(navaid_type_legends[0])) ? navaid_type_legends[n] : "INVALID NAVAID TYPE")
+ // cppcheck-suppress variableScope
static const char *signal_legends[] = {
"N/A",
"Serious emergency – stop or divert according to instructions.",
@@ -1625,6 +1626,7 @@ void json_aivdm_dump(const struct ais_t *ais,
"Cancel route identified by message linkage",
};
+ // cppcheck-suppress variableScope
static const char *idtypes[] = {
"mmsi",
"imo",
@@ -1632,6 +1634,7 @@ void json_aivdm_dump(const struct ais_t *ais,
"other",
};
+ // cppcheck-suppress variableScope
static const char *racon_status[] = {
"No RACON installed",
"RACON not monitored",
@@ -1639,6 +1642,7 @@ void json_aivdm_dump(const struct ais_t *ais,
"RACON ERROR"
};
+ // cppcheck-suppress variableScope
static const char *light_status[] = {
"No light or no monitoring",
"Light ON",
@@ -1646,6 +1650,7 @@ void json_aivdm_dump(const struct ais_t *ais,
"Light ERROR"
};
+ // cppcheck-suppress variableScope
static const char *rta_status[] = {
"Operational",
"Limited operation",
@@ -1653,6 +1658,7 @@ void json_aivdm_dump(const struct ais_t *ais,
"N/A",
};
+ // cppcheck-suppress variableScope
const char *position_types[8] = {
"Not available",
"Port-side to",
diff --git a/gpsmon.c b/gpsmon.c
index b7542ab0..dad50af3 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -991,6 +991,7 @@ int main(int argc, char **argv)
#endif
) {
(void)gps_open(source.server, source.port, &session.gpsdata);
+ // cppcheck-suppress pointerLessThanZero
if (session.gpsdata.gps_fd < 0) {
(void)fprintf(stderr,
"%s: connection failure on %s:%s, error %d = %s.\n",
diff --git a/gpspacket.c b/gpspacket.c
index ca46f87f..7a74adc7 100644
--- a/gpspacket.c
+++ b/gpspacket.c
@@ -243,6 +243,7 @@ level of the message and the message itself.\n\
extern PyMODINIT_FUNC initpacket(void);
PyMODINIT_FUNC
+// cppcheck-suppress unusedFunction
initpacket(void)
{
PyObject *m;
@@ -271,6 +272,7 @@ initpacket(void)
PyModule_AddIntConstant(m, "GEOSTAR_PACKET", GEOSTAR_PACKET);
PyModule_AddIntConstant(m, "RTCM2_PACKET", RTCM2_PACKET);
PyModule_AddIntConstant(m, "RTCM3_PACKET", RTCM3_PACKET);
+ PyModule_AddIntConstant(m, "JSON_PACKET", JSON_PACKET);
PyModule_AddIntConstant(m, "LOG_IO", LOG_IO);
}
diff --git a/gpsutils.c b/gpsutils.c
index 76017e82..9b0761b2 100644
--- a/gpsutils.c
+++ b/gpsutils.c
@@ -406,8 +406,9 @@ double earth_distance_and_bearings(double lat1, double lon1, double lat2, double
double a, b, f; // WGS-84 ellipsoid params
double L, L_P, U1, U2, s_U1, c_U1, s_U2, c_U2;
double uSq, A, B, d_S, lambda;
- double s_L, c_L, s_S, C;
- double c_S, S, s_A, c_SqA, c_2SM;
+ // cppcheck-suppress variableScope
+ double s_L, c_L, s_A, C;
+ double c_S, S, s_S, c_SqA, c_2SM;
int i = 100;
a = WGS84A;
diff --git a/libgps_core.c b/libgps_core.c
index f19262e7..567cf254 100644
--- a/libgps_core.c
+++ b/libgps_core.c
@@ -212,6 +212,7 @@ bool gps_waiting(const struct gps_data_t *gpsdata CONDITIONALLY_UNUSED, int time
#endif /* SHM_EXPORT_ENABLE */
#ifdef SOCKET_EXPORT_ENABLE
+ // cppcheck-suppress pointerPositive
if ((intptr_t)(gpsdata->gps_fd) >= 0)
waiting = gps_sock_waiting(gpsdata, timeout);
#endif /* SOCKET_EXPORT_ENABLE */
diff --git a/libgps_sock.c b/libgps_sock.c
index e02028e4..edb812dc 100644
--- a/libgps_sock.c
+++ b/libgps_sock.c
@@ -182,6 +182,7 @@ int gps_sock_read(/*@out@*/struct gps_data_t *gpsdata)
* If we received 0 bytes, other side of socket is closing.
* Return -1 as end-of-data indication.
*/
+ // cppcheck-suppress duplicateBranch
if (status == 0)
return -1;
#ifndef USE_QT
diff --git a/libgpsd_core.c b/libgpsd_core.c
index ce567de0..99c72547 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -465,6 +465,7 @@ int gpsd_activate(struct gps_device_t *session, const int mode)
if (mode != O_CONTINUE)
session->mode = mode;
+ // cppcheck-suppress pointerLessThanZero
if (session->gpsdata.gps_fd < 0)
return -1;
else {
diff --git a/libgpsmm.cpp b/libgpsmm.cpp
index d335ad43..fa421aa3 100644
--- a/libgpsmm.cpp
+++ b/libgpsmm.cpp
@@ -69,11 +69,13 @@ const char *gpsmm::data(void)
return gps_data(gps_state());
}
+// cppcheck-suppress unusedFunction
void gpsmm::clear_fix(void)
{
gps_clear_fix(&(gps_state()->fix));
}
+// cppcheck-suppress unusedFunction
void gpsmm::enable_debug(int level, FILE *fp)
{
#ifdef CLIENTDEBUG_ENABLE
diff --git a/net_dgpsip.c b/net_dgpsip.c
index c7d305c5..b74ab758 100644
--- a/net_dgpsip.c
+++ b/net_dgpsip.c
@@ -34,6 +34,7 @@ int dgpsip_open(struct gps_device_t *device, const char *dgpsserver)
device->gpsdata.gps_fd =
netlib_connectsock(AF_UNSPEC, dgpsserver, dgpsport, "tcp");
+ // cppcheck-suppress pointerPositive
if (device->gpsdata.gps_fd >= 0) {
char hn[256], buf[BUFSIZ];
gpsd_report(device->context->debug, LOG_PROG,
diff --git a/ntpshm.c b/ntpshm.c
index 91c1d768..33050a09 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -298,6 +298,7 @@ struct sock_sample {
double offset;
int pulse;
int leap;
+ // cppcheck-suppress unusedStructMember
int _pad;
int magic; /* must be SOCK_MAGIC */
};
diff --git a/ppsthread.c b/ppsthread.c
index 1b771992..299e61a5 100644
--- a/ppsthread.c
+++ b/ppsthread.c
@@ -216,6 +216,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
while (session->thread_report_hook != NULL || session->context->pps_hook != NULL) {
bool ok = false;
#if defined(HAVE_SYS_TIMEPPS_H)
+ // cppcheck-suppress variableScope
bool ok_kpps = false;
#endif /* HAVE_SYS_TIMEPPS_H */
char *log = NULL;
diff --git a/srecord.c b/srecord.c
index b76ba9ac..afbbefa5 100644
--- a/srecord.c
+++ b/srecord.c
@@ -54,11 +54,13 @@ bin2srec(unsigned int type, unsigned int offset, unsigned int num,
return 0;
}
+// cppcheck-suppress unusedFunction
int srec_hdr(unsigned int num, unsigned char *bbuf, unsigned char *sbuf)
{
return bin2srec(0, 0, num, bbuf, sbuf);
}
+// cppcheck-suppress unusedFunction
int srec_fin(unsigned int num, unsigned char *sbuf)
{
unsigned char bbuf[4], sum;