-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
QtCreator + clang warning about operator << precedence #191
Comments
So only the static analysis is giving such problems? Is the clang coming with QtCreator or is it installed along with GCC in MSYS2? What is the version of clang? Is the issue reproducible outside of QtCreator - perhaps on the command line with a direct call to the compiler? Indeed these warnings are supposed to be suppressed - I remember GCC bugs used to exist with suppressing warnings with such pragmas but I think that's not the case for the latest versions of GCC - and in your case this seems to be a clang warning... |
They only use it for static code analysis in the IDE, I use cmake/gcc for compiling. I am not sure which clang exe/lib they are using (I can only find a reference to
so I think they use the system clang somehow. I have
I have never used clang from the command line, but I will try to make a simple example and see what happens. |
I managed to run clang using the same options as QtCreator uses, and got no warnings there. Here is a minimal example
This is how it looks in QtCreator Here is the output from running clang from the command line, using the same options as QtCreator
The default QtCreator options for clang static analysis are found under Tools -> Options -> C++ -> Code Model -> Manage It seems like the doctest header is being parsed in the context of GCC and not clang, making the This is what the doctest header looks like in the editor. Greyed out code is excluded by the preprocessor. Although this might just be what QtCreator displays, there might be a separate "clang parsing" version of the file. Perhaps this issue belongs with QtCreator, and not doctest? |
Sorry for the late response... Could you try inserting Even if it works though I'm not sure I would add it to the macros in doctest - there would be too much pragmas unnecessary for most users and perhaps there would be a warning for an unrecognized pragma, in which case the So if it works you might either re-define If it doesn't work - that might be because the analyzer identifies itself as GCC (so In any case I see this as an issue with QtCreator. Let me know how you've handled it! |
I fixed the issues I was having by making a new file
And including that instead of including doctest.h directly. As you guessed I got a lot of warnings about unknown pragmas, so I hadded the following to my CMakeLists
I will try to file a bug with QtCreator. So you can close this issue if you want. |
Fair enough, thanks :) |
The static code analyzer (clang) in QtCreator is giving warning about operator precedence
-Woverloaded-shift-op-parentheses
From reading #156 I think these warnings are supposed to be suppressed, but it seems like this method is not working in QtCreator, leading to a lot of warnings. Any idea how to get this working in QtCreator?
I can suppress them on a global level using clang settings, but I'd rather not, if possible.
Extra information
The text was updated successfully, but these errors were encountered: