espressif / esp-tflite-micro

TensorFlow Lite Micro for Espressif Chipsets
Apache License 2.0
395 stars 85 forks source link

Mixed explicit/implicit initializers in conv.cc, depthwise_conv.cc (TFMIC-43) #100

Open vasilerares opened 1 week ago

vasilerares commented 1 week ago

Checklist

How often does this bug occurs?

always

Expected behavior

Build successful when enabling C++ 20.

Actual behavior (suspected bug)

Errors due to some struct members being designated, while others not when building the project with C++ 20 switch.

Affected files: conv.cc and depthwise_conv.cc

Error logs or terminal output

257 |                                 .channels = num_input_channels, 1
      |                                                                 ^
../components/tflite-lib/tensorflow/lite/micro/kernels/esp_nn/depthwise_conv.cc:261:68: error: either all initializer clauses should be designated or none of them should be
  261 |                                 .channels = output->dims->data[3], 1
      |                                                                    ^
../components/tflite-lib/tensorflow/lite/micro/kernels/esp_nn/depthwise_conv.cc:263:80: error: either all initializer clauses should be designated or none of them should be
  263 |     data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
      |                                                                                ^
[193/283] Building CXX object esp-idf/tflite-lib/CMakeFiles/__idf_tflite-lib.dir/tensorflow/lite/micro/kernels/esp_nn/conv.cc.obj
FAILED: esp-idf/tflite-lib/CMakeFiles/__idf_tflite-lib.dir/tensorflow/lite/micro/kernels/esp_nn/conv.cc.obj 
/home/nomo/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-g++ -DADF_VER=\"v2.7-dirty\" -DESP_PLATFORM -DIDF_VER=\"v5.3.1-dirty\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ -D_GLIBCXX_HAVE_POSIX_SEMAPHORE -D_GLIBCXX_USE_POSIX_SEMAPHORE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -Iconfig -I../components/tflite-lib -I../components/tflite-lib/third_party/gemmlowp -I../components/tflite-lib/third_party/flatbuffers/include -I../components/tflite-lib/third_party/ruy -I../components/tflite-lib/third_party/kissfft -I../components/tflite-lib/signal/micro/kernels -I../components/tflite-lib/signal/src -I../components/tflite-lib/signal/src/kiss_fft_wrappers -I/home/nomo/esp/idf/components/newlib/platform_include -I/home/nomo/esp/idf/components/freertos/config/include -I/home/nomo/esp/idf/components/freertos/config/include/freertos -I/home/nomo/esp/idf/components/freertos/config/xtensa/include -I/home/nomo/esp/idf/components/freertos/FreeRTOS-Kernel/include -I/home/nomo/esp/idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/home/nomo/esp/idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos -I/home/nomo/esp/idf/components/freertos/esp_additions/include -I/home/nomo/esp/idf/components/esp_hw_support/include -I/home/nomo/esp/idf/components/esp_hw_support/include/soc -I/home/nomo/esp/idf/components/esp_hw_support/include/soc/esp32 -I/home/nomo/esp/idf/components/esp_hw_support/dma/include -I/home/nomo/esp/idf/components/esp_hw_support/ldo/include -I/home/nomo/esp/idf/components/esp_hw_support/port/esp32/. -I/home/nomo/esp/idf/components/esp_hw_support/port/esp32/include -I/home/nomo/esp/idf/components/heap/include -I/home/nomo/esp/idf/components/log/include -I/home/nomo/esp/idf/components/soc/include -I/home/nomo/esp/idf/components/soc/esp32 -I/home/nomo/esp/idf/components/soc/esp32/include -I/home/nomo/esp/idf/components/hal/platform_port/include -I/home/nomo/esp/idf/components/hal/esp32/include -I/home/nomo/esp/idf/components/hal/include -I/home/nomo/esp/idf/components/esp_rom/include -I/home/nomo/esp/idf/components/esp_rom/include/esp32 -I/home/nomo/esp/idf/components/esp_rom/esp32 -I/home/nomo/esp/idf/components/esp_common/include -I/home/nomo/esp/idf/components/esp_system/include -I/home/nomo/esp/idf/components/esp_system/port/soc -I/home/nomo/esp/idf/components/esp_system/port/include/private -I/home/nomo/esp/idf/components/xtensa/esp32/include -I/home/nomo/esp/idf/components/xtensa/include -I/home/nomo/esp/idf/components/xtensa/deprecated_include -I/home/nomo/esp/idf/components/lwip/include -I/home/nomo/esp/idf/components/lwip/include/apps -I/home/nomo/esp/idf/components/lwip/include/apps/sntp -I/home/nomo/esp/idf/components/lwip/lwip/src/include -I/home/nomo/esp/idf/components/lwip/port/include -I/home/nomo/esp/idf/components/lwip/port/freertos/include -I/home/nomo/esp/idf/components/lwip/port/esp32xx/include -I/home/nomo/esp/idf/components/lwip/port/esp32xx/include/arch -I/home/nomo/esp/idf/components/lwip/port/esp32xx/include/sys -I../components/esp-nn/include -I../components/esp-nn/src/common -I/home/nomo/esp/idf/components/esp_timer/include -I/home/nomo/esp/idf/components/driver/deprecated -I/home/nomo/esp/idf/components/driver/i2c/include -I/home/nomo/esp/idf/components/driver/touch_sensor/include -I/home/nomo/esp/idf/components/driver/twai/include -I/home/nomo/esp/idf/components/driver/touch_sensor/esp32/include -I/home/nomo/esp/idf/components/esp_pm/include -I/home/nomo/esp/idf/components/esp_ringbuf/include -I/home/nomo/esp/idf/components/esp_driver_gpio/include -I/home/nomo/esp/idf/components/esp_driver_pcnt/include -I/home/nomo/esp/idf/components/esp_driver_gptimer/include -I/home/nomo/esp/idf/components/esp_driver_spi/include -I/home/nomo/esp/idf/components/esp_driver_mcpwm/include -I/home/nomo/esp/idf/components/esp_driver_ana_cmpr/include -I/home/nomo/esp/idf/components/esp_driver_i2s/include -I/home/nomo/esp/idf/components/esp_driver_sdmmc/include -I/home/nomo/esp/idf/components/sdmmc/include -I/home/nomo/esp/idf/components/esp_driver_sdspi/include -I/home/nomo/esp/idf/components/esp_driver_sdio/include -I/home/nomo/esp/idf/components/esp_driver_dac/include -I/home/nomo/esp/idf/components/esp_driver_rmt/include -I/home/nomo/esp/idf/components/esp_driver_tsens/include -I/home/nomo/esp/idf/components/esp_driver_sdm/include -I/home/nomo/esp/idf/components/esp_driver_i2c/include -I/home/nomo/esp/idf/components/esp_driver_uart/include -I/home/nomo/esp/idf/components/vfs/include -I/home/nomo/esp/idf/components/esp_driver_ledc/include -I/home/nomo/esp/idf/components/esp_driver_parlio/include -I/home/nomo/esp/idf/components/esp_driver_usb_serial_jtag/include -mlongcalls -Wno-frame-address  -fno-builtin-memcpy -fno-builtin-memset -fno-builtin-bzero -fno-builtin-stpcpy -fno-builtin-strncpy -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -mdisable-hardware-atomics -Og -fno-shrink-wrap -fmacro-prefix-map=/workspaces/satellite-firmware=. -fmacro-prefix-map=/home/nomo/esp/idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -Werror -Werror=unused-variable -Wdisabled-optimization -Winit-self -Wmissing-include-dirs -std=gnu++2b -fno-exceptions -fno-rtti -Woverloaded-virtual -Wstrict-null-sentinel -Wno-c++20-compat -Wno-error=attributes -Wno-error=shadow -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-error=sign-compare -Wno-error=double-promotion -DESP_NN -Wno-type-limits -Wno-noexcept -Wno-deprecated-declarations -Wno-overloaded-virtual -Wno-shadow -fno-unwind-tables -fmessage-length=0 -DTF_LITE_STATIC_MEMORY -DTF_LITE_DISABLE_X86_NEON -O3 -Wsign-compare -Wdouble-promotion -Wunused-variable -Wmissing-field-initializers -Wunused-function -Wswitch -Wvla -Wstrict-aliasing -Wno-nonnull -Wno-unused-variable -std=gnu++2a -MD -MT esp-idf/tflite-lib/CMakeFiles/__idf_tflite-lib.dir/tensorflow/lite/micro/kernels/esp_nn/conv.cc.obj -MF esp-idf/tflite-lib/CMakeFiles/__idf_tflite-lib.dir/tensorflow/lite/micro/kernels/esp_nn/conv.cc.obj.d -o esp-idf/tflite-lib/CMakeFiles/__idf_tflite-lib.dir/tensorflow/lite/micro/kernels/esp_nn/conv.cc.obj -c ../components/tflite-lib/tensorflow/lite/micro/kernels/esp_nn/conv.cc
../components/tflite-lib/tensorflow/lite/micro/kernels/esp_nn/conv.cc: In function 'void tflite::{anonymous}::EvalQuantizedPerChannel(TfLiteContext*, TfLiteNode*, const TfLiteConvParams&, const NodeData&, const TfLiteEvalTensor*, const TfLiteEvalTensor*, const TfLiteEvalTensor*, TfLiteEvalTensor*)':
../components/tflite-lib/tensorflow/lite/micro/kernels/esp_nn/conv.cc:230:33: error: either all initializer clauses should be designated or none of them should be
  230 |                                 input_depth, 1
      |                                 ^~~~~~~~~~~
../components/tflite-lib/tensorflow/lite/micro/kernels/esp_nn/conv.cc:234:59: error: either all initializer clauses should be designated or none of them should be
  234 |                                 .channels = output_depth, 1
      |                                                           ^
../components/tflite-lib/tensorflow/lite/micro/kernels/esp_nn/conv.cc:236:95: error: either all initializer clauses should be designated or none of them should be
  236 |     data_dims_t filter_dims = {.width = filter_width, .height = filter_height, .channels = 0, 0};
      |

Steps to reproduce the behavior

set(CMAKE_CXX_STANDARD 20) in project CMakeLists.txt

Project release version

latest

System architecture

Intel/AMD 64-bit (modern PC, older Mac)

Operating system

Linux

Operating system version

Ubuntu 22.04

Shell

ZSH

Additional context

No response