Enable ClangTidy check misc-definitions-in-headers.

https://clang.llvm.org/extra/clang-tidy/checks/misc-definitions-in-headers.html

Finds non-extern non-inline function and variable definitions in header
files, which can lead to potential ODR violations in case these headers
are included from multiple translation units.

Change-Id: I5a80d8bddbc7fae97a3b714ac4e376bcefc3b060
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307436
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
John Stiles 2020-08-02 14:20:38 -04:00 committed by Skia Commit-Bot
parent 8423d060bd
commit 0633f76324
2 changed files with 5 additions and 5 deletions

View File

@ -1 +1 @@
Checks: '-*,bugprone-use-after-move,bugprone-unused-raii,bugprone-undelegated-constructor,bugprone-argument-comment,performance-for-range-copy,bugprone-bool-pointer-implicit-conversion,readability-redundant-preprocessor,google-build-namespaces'
Checks: '-*,bugprone-use-after-move,bugprone-unused-raii,bugprone-undelegated-constructor,bugprone-argument-comment,performance-for-range-copy,bugprone-bool-pointer-implicit-conversion,readability-redundant-preprocessor,misc-definitions-in-headers,google-build-namespaces'

View File

@ -66,7 +66,7 @@ static Sk4px xfer_aa(const Sk4px& d, const Sk4px& s, const Sk4px& aa) {
// For some transfermodes we specialize AA, either for correctness or performance.
#define XFERMODE_AA(Xfermode) \
template <> Sk4px xfer_aa<Xfermode>(const Sk4px& d, const Sk4px& s, const Sk4px& aa)
template <> inline Sk4px xfer_aa<Xfermode>(const Sk4px& d, const Sk4px& s, const Sk4px& aa)
// Plus' clamp needs to happen after AA. skia:3852
XFERMODE_AA(Plus) { // [ clamp( (1-AA)D + (AA)(S+D) ) == clamp(D + AA*S) ]
@ -75,14 +75,14 @@ XFERMODE_AA(Plus) { // [ clamp( (1-AA)D + (AA)(S+D) ) == clamp(D + AA*S) ]
#undef XFERMODE_AA
// Src and Clear modes are safe to use with unitialized dst buffers,
// Src and Clear modes are safe to use with uninitialized dst buffers,
// even if the implementation branches based on bytes from dst (e.g. asserts in Debug mode).
// For those modes, just lie to MSAN that dst is always intialized.
template <typename Xfermode> static void mark_dst_initialized_if_safe(void*, void*) {}
template <> void mark_dst_initialized_if_safe<Src>(void* dst, void* end) {
template <> inline void mark_dst_initialized_if_safe<Src>(void* dst, void* end) {
sk_msan_mark_initialized(dst, end, "Src doesn't read dst.");
}
template <> void mark_dst_initialized_if_safe<Clear>(void* dst, void* end) {
template <> inline void mark_dst_initialized_if_safe<Clear>(void* dst, void* end) {
sk_msan_mark_initialized(dst, end, "Clear doesn't read dst.");
}