blynkkk / blynk-library

Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
https://blynk.io
MIT License
3.81k stars 1.38k forks source link

`defined(__has_include)` and `__has_include(...)` should not be in the same `#if` #576

Closed mcspr closed 1 year ago

mcspr commented 1 year ago

Description

per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html

The first ‘#if’ test succeeds only when the operator is supported by the version of GCC (or another compiler) being used. Only when that test succeeds is it valid to use __has_include as a preprocessor operator. As a result, combining the two tests into a single expression as shown below would only be valid with a compiler that supports the operator but not with others that don’t.

so, we should have two #if, checking for macro and only then using it recent compiler versions obviously work, just noticed this when user tried to use our old Core version shipping with gcc 4.8.x https://github.com/esp8266/Arduino/issues/8798

Issues Resolved

-