arduino: clangtidy breaks if `--extra-arg=-std=c++17` is passed
Configuration
Operating system: macOS 13.6.1 (Intel)
PlatformIO Version: PlatformIO Core, version 6.1.11
Espressif 8266 Version: 4.2.1
Description of problem
Steps to Reproduce
- Create a project with platform:
espressif8266and framework:arduino - Configure
clangtidyas acheck_toolinplatformio.ini - Write some c++ code with clangtidy warnings (for example, define a magic number:
60.0 is a magic number; consider replacing it with a named constant) - Use
c++17features in your code. For example, define aninline constexpr - Run
pio check- clangtidy will report using c++17 features as a warning:[medium:warning] inline variables are a C++17 extension [clang-diagnostic-c++17-extensions]together with other warnings of the project - Add
--extra-arg=-std=c++17as a flag forclangtidy - Run
pio checkagain
Actual Results
clangtidy exits immediately, and does not find any warnings: clangtidy PASSED 00:00:00.247
pio check -v without --extra-arg=-std=c++17: no-extra-args.log
pio check -v with --extra-arg=-std=c++17: extra-args.log
Expected Results
clangtidy reports all warnings except for c++17 warnings
If problems with PlatformIO Build System:
The content of platformio.ini:
[env]
framework = arduino
build_flags =
-std=c++17
check_tool = clangtidy
check_flags = --checks=* --extra-arg=-std=c++17
[env:esp_wroom_02]
platform = espressif8266
; Any board triggers the same issue
board = esp_wroom_02
Source file to reproduce issue:
#include <Arduino.h>
inline constexpr int cpp17_warning = 123; // Will trigger a c++17 warning
void setup()
{
delay(500); // Will trigger a Magic number warning
}
Additional info
The issue seems to be only reproducible when using the arduino framework. esp8266-nonos-sdk and esp8266-rtos-sdk frameworks did not suffer from the same issue.
The issue seems related to espressif8266 platform, as the issue is not reproducible on atmelavr or espressif32 platforms using arduino framework.