-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix clang-tidy warnings #1485
Fix clang-tidy warnings #1485
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1485 +/- ##
==========================================
- Coverage 80.42% 80.39% -0.03%
==========================================
Files 121 121
Lines 3421 3426 +5
==========================================
+ Hits 2751 2754 +3
- Misses 670 672 +2 |
Codecov Report
@@ Coverage Diff @@
## master #1485 +/- ##
==========================================
- Coverage 83.67% 80.39% -3.28%
==========================================
Files 123 121 -2
Lines 3380 3426 +46
==========================================
- Hits 2828 2754 -74
- Misses 552 672 +120 |
Given how often people complain about this, I agree that it is time to fix it, but I really dislike this specific change, and would prefer to restructure the code differently instead. However, I ran into some trouble reproducing the warning -- can you post what version of clang-tidy have you used, what did your compilation database look like and so on? |
➜ build git:(master) clang-tidy --version ➜ build git:(master) cat ../.clang-tidy |
Thanks |
I have also faced this issue and would be great to have it fixed. |
Adding an assertion before dereferencing the pointer should also silence the warning. |
Codecov Report
@@ Coverage Diff @@
## master #1485 +/- ##
==========================================
- Coverage 86.5% 80.39% -6.12%
==========================================
Files 136 121 -15
Lines 5275 3426 -1849
==========================================
- Hits 4563 2754 -1809
+ Misses 712 672 -40 |
Fixed in #1735 |
Clang-tidy gives a warning like this:
/usr/local/include/catch2/catch.hpp:5444:9: warning: Returning null reference [clang-analyzer-core.uninitialized.UndefReturn]
return *IMutableContext::currentContext;
This simple change fixes the warning and the overhead is minimal.