erenon / bazel_clang_tidy

Run clang-tidy on Bazel C++ targets directly, efficiently, with caching enabled
MIT License
96 stars 51 forks source link

Pass `-xc++` to compiler for .h files #52

Closed lalten closed 7 months ago

lalten commented 7 months ago

Passing the language to the compiler explicitly prevents errors like

2 errors generated.
Error while processing /home/.../sandbox/linux-sandbox/1234/execroot/path/to/file.h.
error: invalid argument '-std=c++17' not allowed with 'C' [clang-diagnostic-error]
error: argument unused during compilation: '-stdlib=libstdc++' [clang-diagnostic-unused-command-line-argument]
Found compiler error(s).
erenon commented 7 months ago

what about the .h files that are actually C files? anyways, I see this change doesn't make the situation worse. thanks!