From 744f2cfec8aa5fe48a3fc0d56d4de03251a2e7f9 Mon Sep 17 00:00:00 2001 From: Li Jingyi Date: Fri, 12 Jun 2020 17:19:09 +0800 Subject: [PATCH] feat(esp_common): update esp_wps.h path and add esp_compiler.h for wpa_supplciant sync with idf --- components/esp_common/include/esp_compiler.h | 18 ++++++++++++++++++ components/esp_common/src/esp_err_to_name.c | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/components/esp_common/include/esp_compiler.h b/components/esp_common/include/esp_compiler.h index 94ec29c2..6922c50a 100644 --- a/components/esp_common/include/esp_compiler.h +++ b/components/esp_common/include/esp_compiler.h @@ -30,4 +30,22 @@ #define unlikely(x) (x) #endif +/* + * Utility macros used for designated initializers, which work differently + * in C99 and C++ standards mainly for aggregate types. + * The member separator, comma, is already part of the macro, please omit the trailing comma. + * Usage example: + * struct config_t { char* pchr; char arr[SIZE]; } config = { + * ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(pchr) + * ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(arr, "Value") + * }; + */ +#ifdef __cplusplus +#define ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(member, value) { .member = value }, +#define ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(member) .member = { }, +#else +#define ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(member, value) .member = value, +#define ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(member) +#endif + #endif \ No newline at end of file diff --git a/components/esp_common/src/esp_err_to_name.c b/components/esp_common/src/esp_err_to_name.c index 7e1b7680..c21a9572 100644 --- a/components/esp_common/src/esp_err_to_name.c +++ b/components/esp_common/src/esp_err_to_name.c @@ -26,7 +26,7 @@ #include "esp_wifi.h" #endif #if __has_include("esp_wps.h") -#include "esp_wps.h" +#include "esp_supplicant/esp_wps.h" #endif #if __has_include("nvs.h") #include "nvs.h" @@ -234,7 +234,7 @@ static const esp_err_msg_t esp_err_msg_table[] = { # ifdef ESP_ERR_WIFI_FPM_MODE ERR_TBL_IT(ESP_ERR_WIFI_FPM_MODE), /* 12307 0x3013 Have not enable fpm mode */ # endif - // components/esp8266/include/esp_wps.h + // components/wpa_supplicant/include/esp_supplicant/esp_wps.h # ifdef ESP_ERR_WIFI_REGISTRAR ERR_TBL_IT(ESP_ERR_WIFI_REGISTRAR), /* 12339 0x3033 WPS registrar is not supported */ # endif