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/gerrit-log@lists.osmocom.org/.
osmith gerrit-no-reply at lists.osmocom.orgosmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/22629 )
Change subject: xua_msg: fix gcc 4 + -std=gnu11 error
......................................................................
xua_msg: fix gcc 4 + -std=gnu11 error
Fix 'error: initializer element is not constant' with debian 8's gcc
4.9.2, triggered by XUA_HDR. Create a new _XUA_HDR without the type cast,
and use it inside of const struct definitions (xua_test.c). The new
macro is needed, because removing the type cast from the original
XUA_HDR would break other uses.
Related: OS#5004
Change-Id: I890432ee976043d012b01023f7dd2cfecf79d115
---
M include/osmocom/sigtran/xua_msg.h
M tests/xua/xua_test.c
2 files changed, 15 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/29/22629/1
diff --git a/include/osmocom/sigtran/xua_msg.h b/include/osmocom/sigtran/xua_msg.h
index e912e02..749d158 100644
--- a/include/osmocom/sigtran/xua_msg.h
+++ b/include/osmocom/sigtran/xua_msg.h
@@ -22,7 +22,10 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/sigtran/mtp_sap.h>
-#define XUA_HDR(class, type) ((struct xua_common_hdr) { .spare = 0, .msg_class = (class), .msg_type = (type) })
+/* GCC-4 errors with 'initializer element is not constant' if using XUA_HDR
+ * inside a const struct (OS#5004) */
+#define _XUA_HDR(class, type) { .spare = 0, .msg_class = (class), .msg_type = (type) }
+#define XUA_HDR(class, type) ((struct xua_common_hdr) _XUA_HDR(class, type))
struct msgb;
struct osmo_sccp_addr;
diff --git a/tests/xua/xua_test.c b/tests/xua/xua_test.c
index 77daa56..4f2c96c 100644
--- a/tests/xua/xua_test.c
+++ b/tests/xua/xua_test.c
@@ -384,7 +384,7 @@
.name = "BSSMAP-RESET",
.sccp = PANDSIZ(bssmap_reset),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CL, SUA_CL_CLDT),
+ .hdr = _XUA_HDR(SUA_MSGC_CL, SUA_CL_CLDT),
.parts = {
PARTU32(SUA_IEI_PROTO_CLASS, &sua_proto_class0),
PARTARR(SUA_IEI_DEST_ADDR, sua_addr_ssn_bssmap),
@@ -395,7 +395,7 @@
.name = "BSSMAP-RESET-ACK",
.sccp = PANDSIZ(bssmap_reset_ack),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CL, SUA_CL_CLDT),
+ .hdr = _XUA_HDR(SUA_MSGC_CL, SUA_CL_CLDT),
.parts = {
PARTU32(SUA_IEI_PROTO_CLASS, &sua_proto_class0),
PARTARR(SUA_IEI_DEST_ADDR, sua_addr_ssn_bssmap_pc1),
@@ -406,7 +406,7 @@
.name = "BSSMAP-PAGING",
.sccp = PANDSIZ(bssmap_paging),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CL, SUA_CL_CLDT),
+ .hdr = _XUA_HDR(SUA_MSGC_CL, SUA_CL_CLDT),
.parts = {
PARTU32(SUA_IEI_PROTO_CLASS, &sua_proto_class0),
PARTARR(SUA_IEI_DEST_ADDR, sua_addr_ssn_bssmap_pc1),
@@ -417,7 +417,7 @@
.name = "BSSMAP-UDT",
.sccp = PANDSIZ(bssmap_udt),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CL, SUA_CL_CLDT),
+ .hdr = _XUA_HDR(SUA_MSGC_CL, SUA_CL_CLDT),
.parts = {
PARTU32(SUA_IEI_PROTO_CLASS, &sua_proto_class0),
PARTARR(SUA_IEI_DEST_ADDR, sua_addr_ssn_bssmap),
@@ -428,7 +428,7 @@
.name = "BSSMAP-CR",
.sccp = PANDSIZ(bssmap_cr),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CO, SUA_CO_CORE),
+ .hdr = _XUA_HDR(SUA_MSGC_CO, SUA_CO_CORE),
.parts = {
PARTU32(SUA_IEI_PROTO_CLASS, &sua_proto_class2),
PARTU32(SUA_IEI_SRC_REF, &sua_loc_ref_bsc),
@@ -439,7 +439,7 @@
.name = "BSSMAP-CC",
.sccp = PANDSIZ(bssmap_cc),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CO, SUA_CO_COAK),
+ .hdr = _XUA_HDR(SUA_MSGC_CO, SUA_CO_COAK),
.parts = {
PARTU32(SUA_IEI_PROTO_CLASS, &sua_proto_class2),
PARTU32(SUA_IEI_SRC_REF, &sua_loc_ref_msc),
@@ -450,7 +450,7 @@
.name = "BSSMAP-DTAP",
.sccp = PANDSIZ(bssmap_dtap),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CO, SUA_CO_CODT),
+ .hdr = _XUA_HDR(SUA_MSGC_CO, SUA_CO_CODT),
.parts = {
PARTU32(SUA_IEI_SRC_REF, &sua_loc_ref_msc),
},
@@ -459,7 +459,7 @@
.name = "BSSMAP-CLEAR",
.sccp = PANDSIZ(bssmap_clear),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CO, SUA_CO_CODT),
+ .hdr = _XUA_HDR(SUA_MSGC_CO, SUA_CO_CODT),
.parts = {
PARTU32(SUA_IEI_SRC_REF, &sua_loc_ref_msc),
},
@@ -468,7 +468,7 @@
.name = "BSSMAP-RELEASED",
.sccp = PANDSIZ(bssmap_released),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CO, SUA_CO_RELRE),
+ .hdr = _XUA_HDR(SUA_MSGC_CO, SUA_CO_RELRE),
.parts = {
PARTU32(SUA_IEI_DEST_REF, &sua_loc_ref_msc),
PARTU32(SUA_IEI_SRC_REF, &sua_loc_ref_bsc),
@@ -479,7 +479,7 @@
.name = "BSSMAP-RELEASE_COMPLETE",
.sccp = PANDSIZ(bssmap_release_complete),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CO, SUA_CO_RELCO),
+ .hdr = _XUA_HDR(SUA_MSGC_CO, SUA_CO_RELCO),
.parts = {
PARTU32(SUA_IEI_DEST_REF, &sua_loc_ref_bsc),
PARTU32(SUA_IEI_SRC_REF, &sua_loc_ref_msc),
@@ -489,7 +489,7 @@
.name = "TCAP",
.sccp = PANDSIZ(tcap_global_title),
.sua = {
- .hdr = XUA_HDR(SUA_MSGC_CL, SUA_CL_CLDT),
+ .hdr = _XUA_HDR(SUA_MSGC_CL, SUA_CL_CLDT),
.parts = {
},
},
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/22629
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I890432ee976043d012b01023f7dd2cfecf79d115
Gerrit-Change-Number: 22629
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210202/eeafbc16/attachment.htm>