espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.44k stars 7.25k forks source link

Expansion Macro : ESP_NETIF_DEFAULT_WIFI_STA() not match with esp_netif_config_t (IDFGH-2390) #4507

Closed kangbudz closed 4 years ago

kangbudz commented 4 years ago

Environment

Problem Description

When i to migrate code to ESP-IDF 4 and use esp_netif, got issue in compilation for expansion macro doesn't match //Detailed problem description goes here. Compile Message Error : /home/esp/esp-idf/components/esp_netif/include/esp_netif_defaults.h:50:5: error: designator order for field 'esp_netif_config::driver' does not match declaration order in 'esp_netif_config_t' {aka 'esp_netif_config'} } ^

Expected Behavior

After check in esp_netif_style.h header file found :

typedef struct esp_netif_netstack_config esp_netif_netstack_config_t;

/**
 * @brief  Generic esp_netif configuration
 */
struct esp_netif_config {
    const esp_netif_inherent_config_t *base;
    const esp_netif_driver_ifconfig_t *driver;
    const esp_netif_netstack_config_t *stack;
};

and esp_netif_default.h file :

#define ESP_NETIF_DEFAULT_WIFI_STA()                  \
    {                                                 \
        .base = ESP_NETIF_BASE_DEFAULT_WIFI_STA,      \
        .stack = ESP_NETIF_NETSTACK_DEFAULT_WIFI_STA, \
        .driver = NULL,  \
    }

Actual Behavior

Is it cause for base,driver,stack order different? Which one is correct? if not caused by order different, let us know how to solve it.

Steps to repropduce

  1. just run build
  2. ...

Debug Logs

/home/esp/esp32-project/XGmmp_IDF4/main/app_main.cpp:471:39: note: in expansion of macro 'ESP_NETIF_DEFAULT_WIFI_STA'
     esp_netif_config_t netif_config = ESP_NETIF_DEFAULT_WIFI_STA();
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/esp/esp-idf/components/esp_netif/include/esp_netif_defaults.h:50:5: error: designator order for field 'esp_netif_config::driver' does not match declaration order in 'esp_netif_config_t' {aka 'esp_netif_config'}
     }
     ^
skandalfo commented 4 years ago

See updates in #4389 ...