Skip to content

Commit 476c12f

Browse files
pdgendtMaureenHelm
authored andcommitted
include: zephyr: net: coap_service: Use _CONCAT expansion
Passing MACRO arguments that need expansion require _CONCAT. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent 96c6c78 commit 476c12f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

include/zephyr/net/coap_service.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct coap_service {
5959
};
6060

6161
#define __z_coap_service_define(_name, _host, _port, _flags, _res_begin, _res_end) \
62-
static struct coap_service_data coap_service_data_##_name = { \
62+
static struct coap_service_data _CONCAT(coap_service_data_, _name) = { \
6363
.sock_fd = -1, \
6464
}; \
6565
const STRUCT_SECTION_ITERABLE(coap_service, _name) = { \
@@ -69,7 +69,7 @@ struct coap_service {
6969
.flags = _flags, \
7070
.res_begin = (_res_begin), \
7171
.res_end = (_res_end), \
72-
.data = &coap_service_data_##_name, \
72+
.data = &_CONCAT(coap_service_data_, _name), \
7373
}
7474

7575
/** @endcond */
@@ -111,8 +111,8 @@ struct coap_service {
111111
* @param _service Name of the associated service.
112112
*/
113113
#define COAP_RESOURCE_DEFINE(_name, _service, ...) \
114-
STRUCT_SECTION_ITERABLE_ALTERNATE(coap_resource_##_service, coap_resource, _name) \
115-
= __VA_ARGS__
114+
STRUCT_SECTION_ITERABLE_ALTERNATE(_CONCAT(coap_resource_, _service), coap_resource, \
115+
_name) = __VA_ARGS__
116116

117117
/**
118118
* @brief Define a CoAP service with static resources.
@@ -132,11 +132,11 @@ struct coap_service {
132132
* @param _flags Configuration flags @see @ref COAP_SERVICE_FLAGS.
133133
*/
134134
#define COAP_SERVICE_DEFINE(_name, _host, _port, _flags) \
135-
extern struct coap_resource _CONCAT(_coap_resource_##_name, _list_start)[]; \
136-
extern struct coap_resource _CONCAT(_coap_resource_##_name, _list_end)[]; \
135+
extern struct coap_resource _CONCAT(_CONCAT(_coap_resource_, _name), _list_start)[]; \
136+
extern struct coap_resource _CONCAT(_CONCAT(_coap_resource_, _name), _list_end)[]; \
137137
__z_coap_service_define(_name, _host, _port, _flags, \
138-
&_CONCAT(_coap_resource_##_name, _list_start)[0], \
139-
&_CONCAT(_coap_resource_##_name, _list_end)[0])
138+
&_CONCAT(_CONCAT(_coap_resource_, _name), _list_start)[0], \
139+
&_CONCAT(_CONCAT(_coap_resource_, _name), _list_end)[0])
140140

141141
/**
142142
* @brief Count the number of CoAP services.
@@ -177,7 +177,7 @@ struct coap_service {
177177
* @param _it Name of iterator (of type @ref coap_resource)
178178
*/
179179
#define COAP_RESOURCE_FOREACH(_service, _it) \
180-
STRUCT_SECTION_FOREACH_ALTERNATE(coap_resource_##_service, coap_resource, _it)
180+
STRUCT_SECTION_FOREACH_ALTERNATE(_CONCAT(coap_resource_, _service), coap_resource, _it)
181181

182182
/**
183183
* @brief Iterate over all static resources associated with @p _service .

0 commit comments

Comments
 (0)