espressif / idf-eclipse-plugin

Espressif-IDE (based on Eclipse CDT) for ESP-IDF CMake based projects 4.x and above
Eclipse Public License 2.0
300 stars 120 forks source link

Atomics are not recognized (IEP-554) #388

Open dizcza opened 2 years ago

dizcza commented 2 years ago

Describe the bug stdatomic.h functions and macros are shown in red in Eclipse with the IDF plugin. I'm not sure if this is an issue in the Eclipse itself or specific to the ESP-IDF plugin.

To Reproduce

#include <stdatomic.h>
atomic_int a_handle;

Expected behavior Eclipse recognizes the atomic_int keyword.

Screenshots Screenshot from 2021-10-27 13-10-24

Environment Information: eclipse_info.txt

ESP-IDF Tools Information:

* xtensa-esp32-elf: Toolchain for Xtensa (ESP32) based on GCC
  - esp-2021r2-8.4.0 (recommended, installed)
* xtensa-esp32s2-elf: Toolchain for Xtensa (ESP32-S2) based on GCC
  - esp-2021r2-8.4.0 (recommended, installed)
* xtensa-esp32s3-elf: Toolchain for Xtensa (ESP32-S3) based on GCC
  - esp-2021r2-8.4.0 (recommended, installed)
* xtensa-clang: LLVM for Xtensa (ESP32, ESP32-S2) based on clang (optional)
  - 12.0.1-d9341b81fc (recommended)
* riscv32-esp-elf: Toolchain for 32-bit RISC-V based on GCC
  - esp-2021r2-8.4.0 (recommended, installed)
* esp32ulp-elf: Toolchain for ESP32 ULP coprocessor
  - 2.28.51-esp-20191205 (recommended, installed)
* esp32s2ulp-elf: Toolchain for ESP32-S2 and ESP32-S3 ULP coprocessors
  - 2.28.51-esp-20191205 (recommended, installed)
* cmake: CMake build system (optional)
  - 3.20.3 (recommended, installed)
* openocd-esp32: OpenOCD for ESP32
  - v0.10.0-esp32-20210902 (recommended, installed)
* ninja: Ninja build system (optional)
  - 1.10.2 (recommended, installed)

IDF Eclipse Plugin Version: Version: 2.2.0.202108131352

Eclipse Error log: There are no errors in the build commands, and the "Error log" tab is empty.

List of unsupported reserved words Eclipse does not recognize the following keywords:

sigmaaa commented 2 years ago

Hi @dizcza, sorry for the late reply. Looks like this issue in the eclipse itself https://bugs.eclipse.org/bugs/show_bug.cgi?id=445297#c8. The indexer does not recognize the _Atomic keyword, which subsequently leads to the mentioned problem. I don't see the indexer issue for the identical library for c++ - <atomic>, so you can try to use it as a workaround, but you need to convert your project to c++.

fix related to the dirent.h is on the master branch now and we will include it to the next release. I'll take a look on the issue related to the driver/sdmmc_host.h and will keep you updated. Thanks for reporting it

sigmaaa commented 2 years ago

Hi @dizcza,

Regarding the definition of SDMMC_SLOT_FLAG_INTERNAL_PULLU from the filedriver / sdmmc_host.h, can you check the indexer settings, please? Right click on the project -> Properties -> General C / C ++ -> Indexer -> Index all header options check if this option is disabled for your project or for your workspace settings. I just discovered that this option can lead to your indexer issue where you can navigate to the definition but still see it as unresolved inclusion.

I did some testing on the host (peripherals -> sdio -> host) template, which is using this library. I don't see errors with index all header options is disabled, and I see them otherwise. Also, with this option enabled, looks like headers order has some value for the indexer, so if I move driver/sdmmc_host.h on the top, unresolved inclusions are gone.

dizcza commented 2 years ago

The Indexer configuration was the default one, without the "Index all header options" option enabled. When I enabled it, apart from being unable to resolve SDMMC_SLOT_FLAG_INTERNAL_PULLUP, it failed to resolve other things from the driver/sdmmc_host.h header like SDMMC_FREQ_HIGHSPEED. So I turned it off and moved the header to the top of a file. I didn't help either.

sigmaaa commented 2 years ago

I can reproduce the problem with SDMMC_SLOT_FLAG_INTERNAL_PULLUP only when this option is turned on, so I was thinking it was your case. We will investigate further, than.

dizcza commented 2 years ago

well, the issue I've opened here is merely for you to know. I doubt this should be a high-priority task IMHO.

Samg381 commented 1 year ago

This is still an issue.