Commit Graph

37 Commits

Author SHA1 Message Date
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
Sybren A. Stüvel ce67a9d39f Cleanup: Clang-Tidy bugprone-copy-constructor-init fix
No expected functional changes.
2020-09-04 17:17:57 +02:00
Sybren A. Stüvel 3215651f47 Cleanup: Clang-Tidy, describe current status of rules
No functional changes.
2020-09-04 16:29:18 +02:00
Sybren A. Stüvel fb5e2f5610 Cleanup: Clang-Tidy bugprone-incorrect-roundings fixes
Should cause no noticeable difference.
2020-09-04 16:23:08 +02:00
Sybren A. Stüvel 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
Sybren A. Stüvel e72a520a4c Cleanup: Clang-Tidy readability-redundant-declaration fix
No functional changes.
2020-09-04 13:31:10 +02:00
Sybren A. Stüvel cc2b114a21 Cleanup: Clang-Tidy readability-static-accessed-through-instance fixes
No functional changes.
2020-09-04 12:37:56 +02:00
Sybren A. Stüvel 8057ab10db Cleanup: Clang-Tidy readability-const-return-type fixes
No functional changes.
2020-09-04 12:04:47 +02:00
Sybren A. Stüvel 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
Sybren A. Stüvel 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
Sybren A. Stüvel 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
Sybren A. Stüvel 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
Sybren A. Stüvel a9c91ce331 Cleanup: fixed Clang-Tidy `bugprone-suspicious-string-compare` warnings
No functional changes.
2020-08-07 17:16:49 +02:00
Sybren A. Stüvel 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
Sybren A. Stüvel 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
Sybren A. Stüvel 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
Jacques Lucke 88d358902f Clang-Tidy: Enable readability-redundant-string-cstr 2020-07-03 15:55:09 +02:00
Hans Goudey 19ff145e66 Clang-Tidy: Enable readability-redundant-control-flow 2020-07-03 09:41:55 -04:00
Jacques Lucke 2633683b52 Clang-tidy: enable readability-container-size-empty warning
Reviewers: sergey

Differential Revision: https://developer.blender.org/D8197
2020-07-03 14:59:27 +02:00
Sergey Sharybin 6fea8ec183 Clang-Tidy: Enable redundant static qualifier warning
This change enables readability-static-definition-in-anonymous-namespace
warning in .clang-tidy configuration.
2020-07-03 12:58:13 +02:00
Sergey Sharybin 83eeaddce8 Clang-tidy: Enable bugprone-lambda-function-name warning 2020-07-03 12:30:20 +02:00
Sergey Sharybin dfdd23bae6 Clang-Tidy: Silence warning affecting newer code
For now Clang-Tidy should be passable with the codebase as is. This warning
will be addressed as quality day task.
2020-07-03 10:23:44 +02:00
Sergey Sharybin 9ea5469178 Initial support of clang-tidy toolchain
Clang Tidy is a Clang based "linter" tool which goal is to help
fixing typical programming errors.

It is run as a separate compile step of every file, which slows
compilation down but allows to fully analyze the file the same
way as compiler does and catch non-trivial bugprone cases.

This change includes:

- CMake option called `WITH_CLANG_TIDY` which enables Clang Tidy
  linter tool on all source in the `source/` directory.

  This option is only available on Linux, as it is currently the
  easiest platform to get the Clang Tidy toolchain to work.

- CMake module which is aimed to find latest available Clang Tidy.

- Set of rules which allows to have Blender fully compiled without
  extra issues.

The goal of this change is to provide a base ground so that solving
all the warnings can happen later on, as a team effort.

It should be possible to use Clang Tidy side-by-side with both GCC
and Clang, but there seems to be some tweaks to be done in CMake to
make it really work for Blender. For now use Clang toolchain if
there are issues with GCC+Clang Tidy.

It will be worked on in the nearest future to bring seamless
experience for all configurations.

Currently there is no official way of getting Clang Tidy on macOS,
and on Windows there are some difficulties of hooking up Clang Tidy
from LLVM package to the MSVC compiler toolchain.

The actual warnings in the code will be addressed as a part of the
Code Quality Days, task T78535.

Differential Revision: https://developer.blender.org/D7937
2020-07-03 09:57:41 +02:00