treewide: avoid address-of-compound-literal idiom in headers
In C99 the construct (T){init-list} is called a compound literal, and is an lvalue. In C++ it is simply a cast expression to non-rvalue type, which is a prvalue. In both languages the expression is a temporary, but in C99 taking its address is well-defined while in C++ it is an error diagnosed as "taking address of temporary". Headers that may be used in C++ application code must avoid invalid expressions. Replace all uses of &(T){init-list} in headers with the functionally equivalent but C++-legal (T[]){{init-list}}. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
0c69c285ec
commit
2802fa4e6d
6 changed files with 32 additions and 32 deletions
|
@ -46,12 +46,12 @@ struct bt_le_conn_param {
|
|||
* @param to Supervision Timeout (N * 10 ms)
|
||||
*/
|
||||
#define BT_LE_CONN_PARAM(int_min, int_max, lat, to) \
|
||||
(&(struct bt_le_conn_param) { \
|
||||
((struct bt_le_conn_param[]) { { \
|
||||
.interval_min = (int_min), \
|
||||
.interval_max = (int_max), \
|
||||
.latency = (lat), \
|
||||
.timeout = (to), \
|
||||
})
|
||||
} })
|
||||
|
||||
/** Default LE connection parameters:
|
||||
* Connection Interval: 30-50 ms
|
||||
|
@ -859,9 +859,9 @@ struct bt_br_conn_param {
|
|||
* @param role_switch True if role switch is allowed
|
||||
*/
|
||||
#define BT_BR_CONN_PARAM(role_switch) \
|
||||
(&(struct bt_br_conn_param) { \
|
||||
((struct bt_br_conn_param[]) { { \
|
||||
.allow_role_switch = (role_switch), \
|
||||
})
|
||||
} })
|
||||
|
||||
/** Default BR/EDR connection parameters:
|
||||
* Role switch allowed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue