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

series of warnings from flycheck with cmake.3.6.2, gcc.6.x and llvm-4.0.0. #99

Open
vibrys opened this issue Apr 18, 2017 · 1 comment

Comments

@vibrys
Copy link
Contributor

vibrys commented Apr 18, 2017

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

@atilaneves
Copy link
Owner

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-ides end of this story.

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

2 participants