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
|
@ -546,9 +546,9 @@ ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn,
|
|||
#define BT_GATT_CHARACTERISTIC(_uuid, _props, _perm, _read, _write, _value) \
|
||||
BT_GATT_ATTRIBUTE(BT_UUID_GATT_CHRC, BT_GATT_PERM_READ, \
|
||||
bt_gatt_attr_read_chrc, NULL, \
|
||||
(&(struct bt_gatt_chrc) { .uuid = _uuid, \
|
||||
.value_handle = 0U, \
|
||||
.properties = _props, })), \
|
||||
((struct bt_gatt_chrc[]) { { .uuid = _uuid, \
|
||||
.value_handle = 0U, \
|
||||
.properties = _props, } })), \
|
||||
BT_GATT_ATTRIBUTE(_uuid, _perm, _read, _write, _value)
|
||||
|
||||
#if IS_ENABLED(CONFIG_BT_SETTINGS_CCC_LAZY_LOADING)
|
||||
|
@ -660,8 +660,8 @@ ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
|||
* @param _perm CCC access permissions.
|
||||
*/
|
||||
#define BT_GATT_CCC(_changed, _perm) \
|
||||
BT_GATT_CCC_MANAGED((&(struct _bt_gatt_ccc) \
|
||||
BT_GATT_CCC_INITIALIZER(_changed, NULL, NULL)), _perm)
|
||||
BT_GATT_CCC_MANAGED(((struct _bt_gatt_ccc[]) \
|
||||
{BT_GATT_CCC_INITIALIZER(_changed, NULL, NULL)}), _perm)
|
||||
|
||||
/** @brief Read Characteristic Extended Properties Attribute helper
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue