aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-02-25 18:04:45 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-02-27 17:07:26 +0700
commitbf69ddbfef954594fcf70cb1702d16ea359c1637 (patch)
tree466b5aaee0b1527feea5df1d56b8d9451501b506
parent70a4e2e6f8a215631a53b74c3b3798cf4f12b79c (diff)
gtp: use OSMO_ASSERT() in gtp_new()
When using built-in static_assert() [1], gcc v12.2.1 fails: In file included from gsn.c:27: gsn.c: In function 'gtp_new': gsn.c:444:54: error: expression in static assertion is not constant 444 | osmo_static_assert(gtp_T_defs[0].default_val != 0, first_default_val_not_zero); | ^ The reason is likely that gtp_T_defs[] is not const, so it cannot be assert()ed statically. With the current osmo_static_assert() implementation, this assert does nothing. One can change the gtp_T_defs[0].default_val to 0 and the code will still compile. Change-Id: Ia8af1736b63d501661046fe70befe5bbabc1045a Related: [1] libosmocore.git I5ca34bc14c05e8c38c721d7df33feb1c6c41c76e
-rw-r--r--gtp/gsn.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gtp/gsn.c b/gtp/gsn.c
index 9776b28..8b3ea3a 100644
--- a/gtp/gsn.c
+++ b/gtp/gsn.c
@@ -441,7 +441,7 @@ int gtp_new(struct gsn_t **gsn, char *statedir, struct in_addr *listen,
/* Initialize timers: */
(*gsn)->tdef = gtp_T_defs;
/* Small hack to properly reset tdef for old clients not using the tdef_group: */
- osmo_static_assert(gtp_T_defs[0].default_val != 0, first_default_val_not_zero);
+ OSMO_ASSERT(gtp_T_defs[0].default_val != 0);
if (gtp_T_defs[0].val == 0)
osmo_tdefs_reset((*gsn)->tdef);