From 9ebd2cc0f617c7c9b656f55868719db46562f581 Mon Sep 17 00:00:00 2001 From: Hrudaynath Dhabe Date: Tue, 14 Jan 2020 18:59:39 +0530 Subject: [PATCH] Fix wps config for support with gnu++11 as well as c99. --- .../include/esp_supplicant/esp_wps.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/components/wpa_supplicant/include/esp_supplicant/esp_wps.h b/components/wpa_supplicant/include/esp_supplicant/esp_wps.h index 5bf61d3090..c06ae2e368 100644 --- a/components/wpa_supplicant/include/esp_supplicant/esp_wps.h +++ b/components/wpa_supplicant/include/esp_supplicant/esp_wps.h @@ -71,13 +71,20 @@ typedef struct { wps_factory_information_t factory_info; } esp_wps_config_t; +/* C & C++ compilers have different rules about C99-style named initializers */ +#ifdef __cplusplus +#define WPS_AGG(X) { X } +#else +#define WPS_AGG(X) X +#endif + #define WPS_CONFIG_INIT_DEFAULT(type) { \ .wps_type = type, \ .factory_info = { \ - .manufacturer = "ESPRESSIF", \ - .model_number = "ESP32", \ - .model_name = "ESPRESSIF IOT", \ - .device_name = "ESP STATION", \ + WPS_AGG( .manufacturer = "ESPRESSIF" ), \ + WPS_AGG( .model_number = "ESP32" ), \ + WPS_AGG( .model_name = "ESPRESSIF IOT" ), \ + WPS_AGG( .device_name = "ESP STATION" ), \ } \ }