[PATCH 2/7] tests: Fix warnings

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Tue Oct 8 10:04:42 UTC 2013


This fixes warnings that are raised by missing includes, missing casts,
missing return statements, using printf %lu with uint64_t, and unused
symbols.
---
 tests/auth/milenage_test.c |    4 +++-
 tests/conv/conv_test.c     |    2 ++
 tests/sms/sms_test.c       |    4 +---
 tests/smscb/smscb_test.c   |    1 +
 tests/timer/timer_test.c   |    2 +-
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c
index 7c996f0..0223764 100644
--- a/tests/auth/milenage_test.c
+++ b/tests/auth/milenage_test.c
@@ -7,6 +7,8 @@
 #include <osmocom/crypt/auth.h>
 #include <osmocom/core/utils.h>
 
+int milenage_opc_gen(uint8_t *opc, const uint8_t *k, const uint8_t *op);
+
 static void dump_auth_vec(struct osmo_auth_vector *vec)
 {
 	printf("RAND:\t%s\n", osmo_hexdump(vec->rand, sizeof(vec->rand)));
@@ -88,7 +90,7 @@ int main(int argc, char **argv)
 	if (rc < 0) {
 		printf("AUTS failed\n");
 	} else {
-		printf("AUTS success: SEQ.MS = %lu\n", test_aud.u.umts.sqn);
+		printf("AUTS success: SEQ.MS = %llu\n", (unsigned long long)test_aud.u.umts.sqn);
 	}
 
 	opc_test(&test_aud);
diff --git a/tests/conv/conv_test.c b/tests/conv/conv_test.c
index ab651d4..d9440f9 100644
--- a/tests/conv/conv_test.c
+++ b/tests/conv/conv_test.c
@@ -347,6 +347,8 @@ ubit_to_sbit(sbit_t *dst, ubit_t *src, int n)
 		dst[i] = src[i] ? -127 : 127;
 }
 
+static void sbit_to_ubit(ubit_t *dst, sbit_t *src, int n) __attribute__((unused));
+
 static void
 sbit_to_ubit(ubit_t *dst, sbit_t *src, int n)
 {
diff --git a/tests/sms/sms_test.c b/tests/sms/sms_test.c
index a79d454..896e134 100644
--- a/tests/sms/sms_test.c
+++ b/tests/sms/sms_test.c
@@ -266,18 +266,15 @@ static void test_gen_oa(void)
 int main(int argc, char** argv)
 {
 	printf("SMS testing\n");
-	struct msgb *msg;
 	uint8_t i;
 	uint16_t buffer_size;
 	uint8_t octet_length;
 	int octets_written;
 	uint8_t computed_octet_length;
 	uint8_t septet_length;
-	uint8_t gsm_septet_length;
 	uint8_t coded[256];
 	uint8_t tmp[160];
 	uint8_t septet_data[256];
-	uint8_t ud_header[6];
 	int nchars;
 	char result[256];
 
@@ -320,6 +317,7 @@ int main(int argc, char** argv)
 
 	/* Test: encode multiple SMS */
 	int number_of_septets = gsm_septet_encode(septet_data, (const char *) test_multiple_encode[0].input);
+	(void) number_of_septets;
 
 	/* SMS part 1 */
 	memset(tmp, 0x42, sizeof(tmp));
diff --git a/tests/smscb/smscb_test.c b/tests/smscb/smscb_test.c
index e10e12d..5925f69 100644
--- a/tests/smscb/smscb_test.c
+++ b/tests/smscb/smscb_test.c
@@ -21,6 +21,7 @@
 #include <osmocom/gsm/protocol/gsm_03_41.h>
 
 #include <stdio.h>
+#include <arpa/inet.h>
 
 static uint8_t smscb_msg[] = { 0x40, 0x10, 0x05, 0x0d, 0x01, 0x11 };
 
diff --git a/tests/timer/timer_test.c b/tests/timer/timer_test.c
index bb9a177..b746ace 100644
--- a/tests/timer/timer_test.c
+++ b/tests/timer/timer_test.c
@@ -115,7 +115,7 @@ static void secondary_timer_fired(void *data)
 	timersub(&current, &v->stop, &res);
 	if (timercmp(&res, &precision, >)) {
 		fprintf(stderr, "ERROR: timer %p has expired too late!\n",
-			v->timer);
+			(void *)&(v->timer));
 		too_late++;
 	}
 
-- 
1.7.9.5





More information about the OpenBSC mailing list