Commit Graph

57 Commits

Author SHA1 Message Date
Jacques Lucke
9159295c3c Clang Tidy: ignore some passes that changed or were added in version 13
I get hundreds of clang-tidy errors without ignoring those passes right now.
To not forget about the passes, I added them to T78535.
2021-11-23 19:45:05 +01:00
Jacques Lucke
19dfb6ea1f Cleanup: enable modernize-use-equals-default check
This removes a lot of unnecessary code that is generated by
the compiler automatically.

In very few cases, a defaulted destructor in a .cc file is
still necessary, because of forward declarations in the header.

I removed some defaulted virtual destructors, because they are not
necessary, when the parent class has a virtual destructor already.

Defaulted constructors are only necessary when there is another
constructor, but the class should still be default constructible.

Differential Revision: https://developer.blender.org/D10911
2021-04-08 11:07:27 +02:00
Jacques Lucke
f56fddbf9a Clang Tidy: disable WarningsAsErrors
This makes regular development more pleasant, because one does not have
to fix unrelated clang tidy mistakes when one is in the middle of something.
Before this change, I would usually turn clang-tidy off entirely, but then
forget to turn it on again.

This change has been agreed on by Sergey as well.
2021-03-29 11:04:34 +02:00
Jacques Lucke
2e213003b8 Cleanup: add comment
See rBb9cd2f4531ca670c196b0b14b1359d0f375103c2 for more info.
2021-03-22 11:35:19 +01:00
Jacques Lucke
a506f87c90 Clang Tidy: disable modernize-raw-string-literal again
This check does not work when gtests are enabled yet.
See rBb9cd2f4531ca670c196b0b14b1359d0f375103c2 for more details.
2021-03-22 11:26:48 +01:00
Sergey Sharybin
b4dca4ea2c Cleanup: Use raw string literal
Resolves modernize-raw-string-literal Clang-Tidy warning

The way warning works is it suggests to use raw literal when
overhead of having escape characters is higher than the overhead
of having raw literal syntax (talking about code size overhead).
This means that the warning will not trigger for "foo\"bar".

Differential Revision: https://developer.blender.org/D10322
2021-02-05 16:43:23 +01:00
Sergey Sharybin
5ec4ba8080 Cleanup: Use lambda instead of function bind
More detailed explanation why it is a preferred way of coding
nowadays can be found at

https://clang.llvm.org/extra/clang-tidy/checks/modernize-avoid-bind.html

Resolves modernize-avoid-bind Clang-Tidy warning.

Differential Revision: https://developer.blender.org/D10320
2021-02-05 16:43:23 +01:00
Sergey Sharybin
56903024dc Cleanup: Use transparent functor
Resolves modernize-use-transparent-functors Clang-Tidy warning.

Differential Revision: https://developer.blender.org/D10323
2021-02-05 15:39:50 +01:00
Ankit Meel
7054d03701 Cleanup: Clang-tidy modernize-use-default-member-init
Using assignment syntax as we don't use `{}` initialization yet.

Reviewed By: sergey
Differential Revision: https://developer.blender.org/D9501
2021-02-05 19:09:36 +05:30
7f2d356a67 Cleanup: Clang-Tidy, modernize-use-using
Replace `typedef` with `using` in C++ code.

In the case of `typedef struct SomeName { ... } SomeName;` I removed the
`typedef` altogether, as this is unnecessary in C++. Such cases have been
rewritten to `struct SomeName { ... };`

No functional changes.
2020-12-04 12:46:43 +01:00
10a8286a26 Cleanup: Clang-tidy, actually enable the modernize-use-override rule
Forgot this in rB168909d9741.

No functional changes.
2020-12-04 12:31:49 +01:00
958df2ed1b Cleanup: Clang-Tidy, modernize-deprecated-headers
No functional changes.
2020-12-04 11:28:09 +01:00
Ankit Meel
88de58fd1a Clang-tidy, fix bugprone-exception-escape.
Remove redundant call to `ofstream::close()` from `~PSStrokeRenderer`
and `~TextStrokeRenderer`. ofstream will be destructed automatically.

- For `~Depsgraph`, `std::function`'s constructor can throw.
- Passing throwing statements in the lambda will not be detected by
  clang-tidy.
Fix these issues by using lambda as function argument.

Reviewed By: sergey, sybren
Differential Revision: https://developer.blender.org/D9497
2020-11-17 17:33:25 +05:30
Ankit Meel
4525049aa0 Cleanup: Clang-tidy, modernize-concat-nested-namespaces 2020-11-07 18:48:13 +05:30
16732def37 Cleanup: Clang-Tidy modernize-use-nullptr
Replace `NULL` with `nullptr` in C++ code.

No functional changes.
2020-11-06 18:08:25 +01:00
Sergey Sharybin
3cb4c51308 Cleanup: Clang-Tidy, modernize-make-unique 2020-11-06 16:47:16 +01:00
Sergey Sharybin
af35ada2f3 Cleanup: Clang-Tidy, modernize-use-bool-literals 2020-11-06 14:32:51 +01:00
Sergey Sharybin
8d5073345d Cleanup: Clang-Tidy, modernize-use-emplace 2020-11-06 14:06:52 +01:00
Sergey Sharybin
a331d5c992 Cleanup: Clang-Tidy, modernize-redundant-void-arg 2020-11-06 13:40:46 +01:00
Sergey Sharybin
3b77c670f0 Clang Tidy: Expand modernize category
Gives an idea of which warnings are affecting Blender code base.
2020-11-06 12:16:02 +01:00
Sergey Sharybin
190170d4cc Cleanup: Clang-Tidy, readability-redundant-member-init 2020-11-06 11:54:53 +01:00
Ankit Meel
afd13710b8 Cleanup: Clang-tidy readability-named-parameter
No functional change.
2020-10-21 13:21:00 +05:30
Ankit Meel
7ac6f4d26c Cleanup: Clang-tidy readability-redundant-string-init
No functional change.
2020-10-21 13:15:17 +05:30
Ankit Meel
ee90effd3a Clang-tidy: disable new warnings.
Until it is decided whether to work on, or ignore these
warning, disable them. See T78535 

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9281
2020-10-21 12:58:39 +05:30
Sebastian Parborg
2115232a16 Cleanup: Clang-Tidy readability-inconsistent-declaration-parameter-name fix
No functional changes
2020-09-04 21:04:16 +02:00
ce67a9d39f Cleanup: Clang-Tidy bugprone-copy-constructor-init fix
No expected functional changes.
2020-09-04 17:17:57 +02:00
3215651f47 Cleanup: Clang-Tidy, describe current status of rules
No functional changes.
2020-09-04 16:29:18 +02:00
fb5e2f5610 Cleanup: Clang-Tidy bugprone-incorrect-roundings fixes
Should cause no noticeable difference.
2020-09-04 16:23:08 +02:00
570811f0ef Cleanup: Enable Clang-Tidy readability-qualified-auto rule
No functional changes. No changes except enabling the rule, even.
2020-09-04 13:39:32 +02:00
e72a520a4c Cleanup: Clang-Tidy readability-redundant-declaration fix
No functional changes.
2020-09-04 13:31:10 +02:00
cc2b114a21 Cleanup: Clang-Tidy readability-static-accessed-through-instance fixes
No functional changes.
2020-09-04 12:37:56 +02:00
8057ab10db Cleanup: Clang-Tidy readability-const-return-type fixes
No functional changes.
2020-09-04 12:04:47 +02:00
371ddda4d0 Cleanup: Clang-Tidy readability-redundant-preprocessor fixes
Remove redundantly nested `#if` and `#ifdef` statements.

One nested `#if 0` block was left untouched, as it's in particle code
that's no longer maintained. Furthermore, that block also has some
explanation as to the differences between the enabled & disabled parts.

One nested `#if 0` construct was completely removed, leaving only the
actually used bit of code. There was no explanation as to the usefulness
of the disabled code, and it hasn't been touched in years.

No functional changes.
2020-09-04 11:26:26 +02:00
ad6e63cb96 Cleanup: enable Clang-Tidy bugprone-parent-virtual-call rule
I added a single `NOLINT` exception with explanation.

No functional changes.
2020-08-07 17:59:26 +02:00
60b42ef117 Cleanup: enabled Clang-Tidy bugprone-suspicious-missing-comma rule
No functional changes because no code changed.
2020-08-07 17:46:32 +02:00
ca85da075b Cleanup: enabled Clang-Tidy bugprone-not-null-terminated-result rule
No functional changes because no code changed.
2020-08-07 17:38:45 +02:00
a9c91ce331 Cleanup: fixed Clang-Tidy bugprone-suspicious-string-compare warnings
No functional changes.
2020-08-07 17:16:49 +02:00
4c2ce816aa Cleanup: enabled Clang-Tidy rule bugprone-infinite-loop
Enabling it and doing a full rebuild didn't cause any warnings, so nothing
else to do here.

No functional changes.
2020-08-07 16:46:26 +02:00
6414da0381 Cleanup: enable and silence Clang-Tidy readability-function-size
Enable Clang-Tidy's `readability-function-size` rule and add a few
`NOLINT` markers to explicitly silence warnings for three functions.
These functions are huge and would IMO benefit from splitting up, but
are hard to without intimate knowledge of the code.

At least by enabling the rule, we can start tweaking the values and
refactoring other functions that bubble up as being too long/complex.

No functional changes.
2020-08-07 16:23:17 +02:00
c04088fed1 Cleanup: Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule. This should be the final commit of the series of commits that
addresses this particular rule.

No functional changes.
2020-08-07 13:38:07 +02:00
Sergey Sharybin
cfc6f9eb18 Clang-Tidy: Address readability-redundant-string-init 2020-08-07 12:18:15 +02:00
Jacques Lucke
efc6f6e1ae Clang-Tidy: ignore some newer checks
Those checks have been added to clang tidy within the last year.
They fail when I use a clang tidy version I built from source.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D8302
2020-07-15 14:24:24 +02:00
Jacques Lucke
725973485a Clang Tidy: enable readability-non-const-parameter warning
Clang Tidy reported a couple of false positives. I disabled
those `NOLINTNEXTLINE`.

Differential Revision: https://developer.blender.org/D8199
2020-07-13 11:27:09 +02:00
Sebastian Parborg
d7dbf90a02 Clang-tidy: Enable braces-around-statements warning 2020-07-03 21:23:33 +02:00
Sergey Sharybin
cad2d32be6 Clang-Tidy: Enable bugprone-misplaced-widening-cast 2020-07-03 17:10:27 +02:00
Jacques Lucke
4a5389816b Clang-Tidy: enable readability-named-parameter 2020-07-03 17:07:13 +02:00
Jacques Lucke
1019c9f582 Clang-Tidy: enable bugprone-too-small-loop-variable 2020-07-03 16:54:08 +02:00
Jacques Lucke
883f9dd6e5 Clang-Tidy: enable bugprone-assert-side-effect
Looks like we have no assertions with side effects.
2020-07-03 16:48:16 +02:00
Jacques Lucke
14fd91e7e8 Clang-Tidy: enable bugprone-argument-comment
It was called `inverted` in the header.
2020-07-03 16:39:06 +02:00
Sergey Sharybin
f891d4e2ad Clang-Tidy: Fix readability-delete-null-pointer warnings
Also enable it in the configuration.
2020-07-03 16:32:51 +02:00