RC6 raises error in esp_now.h library

I'm #including the <esp_now.h> library and I'm getting complaints from the IDE rc6.

The library contains a macro, and the IDE is flagging an error on

RTC_DATA_ATTR int bootCount = 0;

Specifically,

macro RTC_DATA_ATTR

#define RTC_DATA_ATTR _SECTION_ATTR_IMPL(".rtc.data", COUNTER)

Argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a commaclang(attribute_section_invalid_for_target)

This is one of those things like I mentioned in the other topic where there is some code that is specific to the GCC toolchain used by the ESP32 boards platform, and not known about by the clangd language server.

You can see a related effort by the Arduino Language Server developer to filter some of these out here:

However, it would be very difficult to filter all of them because there are many different toolchains used by the ecosystem of hundreds of 3rd party Arduino boards platforms.

I think in the end you simply have to be a bit "fuzzy" in your interpretation of the results from the language server. Sometimes that red squiggle is telling you something very important. Other times you will need to disregard it.

Knowing which is which is very difficult and I fear this sort of concern will be very common as more and more people start using Arduino IDE 2.x, most especially for the beginners.