Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arduino: clangtidy breaks if --extra-arg=-std=c++17 is passed #310

Open
vanyasem opened this issue Dec 5, 2023 · 0 comments
Open

arduino: clangtidy breaks if --extra-arg=-std=c++17 is passed #310

vanyasem opened this issue Dec 5, 2023 · 0 comments

Comments

@vanyasem
Copy link

vanyasem commented Dec 5, 2023

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

  1. Create a project with platform: espressif8266 and framework: arduino
  2. Configure clangtidy as a check_tool in platformio.ini
  3. 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)
  4. Use c++17 features in your code. For example, define an inline constexpr
  5. 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
  6. Add --extra-arg=-std=c++17 as a flag for clangtidy
  7. Run pio check again

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant