From 63b114e9441b74fad228e082e6170a59194623b0 Mon Sep 17 00:00:00 2001 From: Daniel Kampert Date: Fri, 13 May 2022 15:02:55 +0200 Subject: [PATCH] nimble/host: Make BLE_UUIDxx_INIT macros C++ compatible Allows to use `ble_uuid.h` with C++ by changing the BLE_UUIDy_INIT macros. Build environment: ninja 1.9.0 cmake 3.16 xtensa-esp32-elf-gcc.exe (crosstool-NG esp-2021r2-patch3) 8.4.0 (based on GCC 8.4.0) --- nimble/host/include/host/ble_uuid.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nimble/host/include/host/ble_uuid.h b/nimble/host/include/host/ble_uuid.h index d3576c595..cc368368c 100644 --- a/nimble/host/include/host/ble_uuid.h +++ b/nimble/host/include/host/ble_uuid.h @@ -82,19 +82,25 @@ typedef union { #define BLE_UUID16_INIT(uuid16) \ { \ - .u.type = BLE_UUID_TYPE_16, \ + .u = { \ + .type = BLE_UUID_TYPE_16, \ + }, \ .value = (uuid16), \ } #define BLE_UUID32_INIT(uuid32) \ { \ - .u.type = BLE_UUID_TYPE_32, \ + .u = { \ + .type = BLE_UUID_TYPE_32, \ + }, \ .value = (uuid32), \ } -#define BLE_UUID128_INIT(uuid128...) \ +#define BLE_UUID128_INIT(uuid128 ...) \ { \ - .u.type = BLE_UUID_TYPE_128, \ + .u = { \ + .type = BLE_UUID_TYPE_128, \ + }, \ .value = { uuid128 }, \ }