diff --git a/.clang-tidy b/.clang-tidy index 1a04474905..3b54cd1895 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1 +1 @@ -Checks: '-*,bugprone-use-after-move' +Checks: '-*,bugprone-use-after-move,google-build-namespaces' diff --git a/include/private/SkNx.h b/include/private/SkNx.h index 29c4d7356e..4123ba8bc0 100644 --- a/include/private/SkNx.h +++ b/include/private/SkNx.h @@ -19,7 +19,7 @@ // Every single SkNx method wants to be fully inlined. (We know better than MSVC). #define AI SK_ALWAYS_INLINE -namespace { +namespace { // NOLINT(google-build-namespaces) // The default SkNx just proxies down to a pair of SkNx. template diff --git a/include/private/SkNx_neon.h b/include/private/SkNx_neon.h index 98ef3fe758..b994d61e6b 100644 --- a/include/private/SkNx_neon.h +++ b/include/private/SkNx_neon.h @@ -10,7 +10,7 @@ #include -namespace { +namespace { // NOLINT(google-build-namespaces) // ARMv8 has vrndm(q)_f32 to floor floats. Here we emulate it: // - roundtrip through integers via truncation diff --git a/include/private/SkNx_sse.h b/include/private/SkNx_sse.h index 335b70c1e9..55b1624518 100644 --- a/include/private/SkNx_sse.h +++ b/include/private/SkNx_sse.h @@ -21,7 +21,7 @@ // This file may assume <= SSE2, but must check SK_CPU_SSE_LEVEL for anything more recent. // If you do, make sure this is in a static inline function... anywhere else risks violating ODR. -namespace { +namespace { // NOLINT(google-build-namespaces) // Emulate _mm_floor_ps() with SSE2: // - roundtrip through integers via truncation diff --git a/src/core/Sk4px.h b/src/core/Sk4px.h index bc95596efe..724844ba27 100644 --- a/src/core/Sk4px.h +++ b/src/core/Sk4px.h @@ -17,7 +17,7 @@ // in Debug modes the compilers may not inline everything. So wrap everything in an // anonymous namespace to give each includer their own silo of this code (or the linker // will probably pick one randomly for us, which is rarely correct). -namespace { +namespace { // NOLINT(google-build-namespaces) // 1, 2 or 4 SkPMColors, generally vectorized. class Sk4px : public Sk16b { diff --git a/src/core/Sk4x4f.h b/src/core/Sk4x4f.h index 0fd6b38ef7..bcfd241f08 100644 --- a/src/core/Sk4x4f.h +++ b/src/core/Sk4x4f.h @@ -10,7 +10,7 @@ #include "SkNx.h" -namespace { +namespace { // NOLINT(google-build-namespaces) struct Sk4x4f { Sk4f r,g,b,a; diff --git a/src/core/SkGeometry.h b/src/core/SkGeometry.h index 315103d7b5..f7828dcc50 100644 --- a/src/core/SkGeometry.h +++ b/src/core/SkGeometry.h @@ -310,7 +310,7 @@ struct SkConic { }; // inline helpers are contained in a namespace to avoid external leakage to fragile SkNx members -namespace { +namespace { // NOLINT(google-build-namespaces) /** * use for : eval(t) == A * t^2 + B * t + C diff --git a/src/opts/Sk4px_NEON.h b/src/opts/Sk4px_NEON.h index 62f1deb4ac..455d35be8b 100644 --- a/src/opts/Sk4px_NEON.h +++ b/src/opts/Sk4px_NEON.h @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -namespace { // See Sk4px.h +namespace { // NOLINT(google-build-namespaces) inline Sk4px Sk4px::DupPMColor(SkPMColor px) { return Sk16b((uint8x16_t)vdupq_n_u32(px)); } diff --git a/src/opts/Sk4px_SSE2.h b/src/opts/Sk4px_SSE2.h index 624fc2271a..6bc6b48ebc 100644 --- a/src/opts/Sk4px_SSE2.h +++ b/src/opts/Sk4px_SSE2.h @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -namespace { // See Sk4px.h +namespace { // NOLINT(google-build-namespaces) inline Sk4px Sk4px::DupPMColor(SkPMColor px) { return Sk16b(_mm_set1_epi32(px)); } diff --git a/src/opts/Sk4px_none.h b/src/opts/Sk4px_none.h index 10c3dedd0f..4a44891f69 100644 --- a/src/opts/Sk4px_none.h +++ b/src/opts/Sk4px_none.h @@ -7,7 +7,7 @@ #include "SkUtils.h" -namespace { // See Sk4px.h +namespace { // NOLINT(google-build-namespaces) static_assert(sizeof(Sk4px) == 16, "This file uses memcpy / sk_memset32, so exact size matters."); diff --git a/src/opts/SkXfermode_opts.h b/src/opts/SkXfermode_opts.h index 5c3599135f..2178041bc5 100644 --- a/src/opts/SkXfermode_opts.h +++ b/src/opts/SkXfermode_opts.h @@ -21,7 +21,7 @@ namespace SK_OPTS_NS { #else -namespace { +namespace { // NOLINT(google-build-namespaces) // Most xfermodes can be done most efficiently 4 pixels at a time in 8 or 16-bit fixed point. #define XFERMODE(Xfermode) \ diff --git a/src/shaders/gradients/Sk4fGradientPriv.h b/src/shaders/gradients/Sk4fGradientPriv.h index 6755cb4e64..72f24d3a8a 100644 --- a/src/shaders/gradients/Sk4fGradientPriv.h +++ b/src/shaders/gradients/Sk4fGradientPriv.h @@ -17,7 +17,7 @@ // Templates shared by various 4f gradient flavors. -namespace { +namespace { // NOLINT(google-build-namespaces) enum class ApplyPremul { True, False }; diff --git a/src/utils/mac/SkUniqueCFRef.h b/src/utils/mac/SkUniqueCFRef.h index 6c907273e8..7f8ef1c1fb 100644 --- a/src/utils/mac/SkUniqueCFRef.h +++ b/src/utils/mac/SkUniqueCFRef.h @@ -17,11 +17,9 @@ #include #include -namespace { template using SkUniqueCFRef = std::unique_ptr, SkFunctionWrapper, CFRelease>>; -} // namespace #endif #endif