Page 1 of 1

mdf_info_load() fails in C++

Posted: Mon Nov 11, 2019 1:39 pm
by LahiruLKR
Currently, I am using ESP MDF to build a firmware for esp32 in C++. When using the function mdf_info_load() with "mdf_info_store.h" included, I get the following error.

Code: Select all

C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:75:52: error: expected primary-expression before 'typeof'
                     + __builtin_types_compatible_p(typeof(len), int8_t) * LENGTH_TYPE_NUMBER \
                                                    ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:75:71: error: expected primary-expression before ')' token
                     + __builtin_types_compatible_p(typeof(len), int8_t) * LENGTH_TYPE_NUMBER \
                                                                       ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:75:71: error: '__builtin_types_compatible_p' was not declared in this scope
                     + __builtin_types_compatible_p(typeof(len), int8_t) * LENGTH_TYPE_NUMBER \
                                                                       ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:76:52: error: expected primary-expression before 'typeof'
                     + __builtin_types_compatible_p(typeof(len), uint8_t) * LENGTH_TYPE_NUMBER \
                                                    ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:76:72: error: expected primary-expression before ')' token
                     + __builtin_types_compatible_p(typeof(len), uint8_t) * LENGTH_TYPE_NUMBER \
                                                                        ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:77:52: error: expected primary-expression before 'typeof'
                     + __builtin_types_compatible_p(typeof(len), int16_t) * LENGTH_TYPE_NUMBER \
                                                    ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:77:72: error: expected primary-expression before ')' token
                     + __builtin_types_compatible_p(typeof(len), int16_t) * LENGTH_TYPE_NUMBER \
                                                                        ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:78:52: error: expected primary-expression before 'typeof'
                     + __builtin_types_compatible_p(typeof(len), uint16_t) * LENGTH_TYPE_NUMBER \
                                                    ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:78:73: error: expected primary-expression before ')' token
                     + __builtin_types_compatible_p(typeof(len), uint16_t) * LENGTH_TYPE_NUMBER \
                                                                         ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:79:52: error: expected primary-expression before 'typeof'
                     + __builtin_types_compatible_p(typeof(len), int) * LENGTH_TYPE_NUMBER \
                                                    ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:79:65: error: expected primary-expression before 'int'
                     + __builtin_types_compatible_p(typeof(len), int) * LENGTH_TYPE_NUMBER \
                                                                 ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:80:52: error: expected primary-expression before 'typeof'
                     + __builtin_types_compatible_p(typeof(len), uint32_t) * LENGTH_TYPE_NUMBER \
                                                    ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:80:73: error: expected primary-expression before ')' token
                     + __builtin_types_compatible_p(typeof(len), uint32_t) * LENGTH_TYPE_NUMBER \
                                                                         ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:81:52: error: expected primary-expression before 'typeof'
                     + __builtin_types_compatible_p(typeof(len), int *) * LENGTH_TYPE_POINTER \
                                                    ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:81:65: error: expected primary-expression before 'int'
                     + __builtin_types_compatible_p(typeof(len), int *) * LENGTH_TYPE_POINTER \
                                                                 ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:82:52: error: expected primary-expression before 'typeof'
                     + __builtin_types_compatible_p(typeof(len), uint32_t *) * LENGTH_TYPE_POINTER)
                                                    ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:82:74: error: expected primary-expression before '*' token
                     + __builtin_types_compatible_p(typeof(len), uint32_t *) * LENGTH_TYPE_POINTER)
                                                                          ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
      ^
C:/msys32/home/lahiru_r/esp/esp-mdf/components/mcommon/include/mdf_info_store.h:82:75: error: expected primary-expression before ')' token
                     + __builtin_types_compatible_p(typeof(len), uint32_t *) * LENGTH_TYPE_POINTER)
                                                                           ^
../components/led_driver/src/LedDriver.cpp:49:6: note: in expansion of macro 'mdf_info_load'
  if (mdf_info_load(LIGHT_STATUS_STORE_KEY, &g_light_status, sizeof(light_status_t)) != MDF_OK) {
The issue is with "__builtin_types_compatible_p" which only supports C. I found the following discussion regarding the same issue that has occured in "mwifi.h".

https://github.com/espressif/esp-mdf/issues/17

Seems like "mdf_info_store.h" in the MDF library should be modified in the way you (ESP developers) modified "mwifi.h".
Appreciate if you could resolve this issue asap.

Re: mdf_info_load() fails in C++

Posted: Thu Dec 05, 2019 2:00 pm
by ESP_Bond
This issue has been fixed, please update esp-mdf