cmake-ide
cmake-ide copied to clipboard
series of warnings from flycheck with cmake.3.6.2, gcc.6.x and llvm-4.0.0.
Hi. I'm trying to configure cmake-ide (through spacemacs-cmake-ide layer) into fairly large C++ project. Project uses cmake to generate Makefile, then gcc.6.2.1 is used to compile the project.
Looks like rtags and irony works ok, but I have problems with flycheck.
When I visit some *.cpp file I get the following error from flycheck:
Suspicious state from syntax checker c/c++-clang: Flycheck checker c/c++-clang returned non-zero exit code 1, but its output contained no errors: error: unknown warning option '-Wuseless-cast'
error: unknown warning option '-Wlogical-op'; did you mean '-Wlong-long'?
error: unknown warning option '-Wstrict-null-sentinel'
error: unknown warning option '-Wformat-signedness'
error: unknown warning option '-Wlogical-op'; did you mean '-Wlong-long'?
error: unknown warning option '-Wduplicated-cond'; did you mean '-Wduplicate-enum'?
error: unknown warning option '-Wshift-overflow=2'; did you mean '-Wshift-overflow'?
error: unknown warning option '-Werror=cpp'
to workaround the problem I've just added extra filter to cmake-ide-set-compiler-flags function:
(setq flycheck-clang-args (cmake-ide--filter (lambda (x) (not (string-match "\\(-Wlogical-op\\|-Wuseless-cast\\|-Wstrict-null-sentinel\\|-Wformat-signedness\\|-Wduplicated-cond\\|-Wshift-overflow=[0-9]+\\|-Werror\\|-Wno-error=cpp\\)" x))) flycheck-clang-args))
Since then, the flycheck at least started working, ie I could see some error highlighted throughout the buffer.
There are three cases with it. 1st: if it is legal/used at all to use c/c++-clang flycheck checker to syntax check project that takes flags from gcc to use it by clang? I mean, do the people use cmake-ide's syntax checking for such projects?
2nd: If Yes, then do You think the errors above are rather llvm ones?
3rd: Is there any better solution for the workaround?
best regards,
Mat
My guess is that your project sets compiler flags assuming gcc. I'd fix the CMake build of it to use compiler-appropriate flags. I don't think there's much that can be done on cmake-ide
s end of this story.