add google-build-namespaces to clang-tidy checks
Android's using this check in their clang-tidy builds. The check itself is well intentioned but doesn't seem to take into account the particular reason we do this... being able to use these types and functions from files compiled with different optimization settings without causing ODR violations or runtime crashes. Each of the places that's marked is using an anonymous namespace from a header for good reason, but I don't mind making clang-tidy ask us to explicitly exempt any others that may come up in the future. It's definitely unusual, and rarely the best idea. Adding -header-filters='.*' actually checks headers... until now they've been ignored. Change-Id: Ie421d2b47076bd384b10c7339cfb7a1c3ea90906 Reviewed-on: https://skia-review.googlesource.com/c/176963 Commit-Queue: Mike Klein <mtklein@google.com> Commit-Queue: Ben Wagner <bungeman@google.com> Auto-Submit: Mike Klein <mtklein@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
044044f5a2
commit
c33d614357
@ -1 +1 @@
|
||||
Checks: '-*,bugprone-use-after-move'
|
||||
Checks: '-*,bugprone-use-after-move,google-build-namespaces'
|
||||
|
@ -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<N,T> just proxies down to a pair of SkNx<N/2, T>.
|
||||
template <int N, typename T>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
namespace {
|
||||
namespace { // NOLINT(google-build-namespaces)
|
||||
|
||||
// ARMv8 has vrndm(q)_f32 to floor floats. Here we emulate it:
|
||||
// - roundtrip through integers via truncation
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "SkNx.h"
|
||||
|
||||
namespace {
|
||||
namespace { // NOLINT(google-build-namespaces)
|
||||
|
||||
struct Sk4x4f {
|
||||
Sk4f r,g,b,a;
|
||||
|
@ -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
|
||||
|
@ -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)); }
|
||||
|
||||
|
@ -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)); }
|
||||
|
||||
|
@ -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.");
|
||||
|
||||
|
@ -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) \
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
// Templates shared by various 4f gradient flavors.
|
||||
|
||||
namespace {
|
||||
namespace { // NOLINT(google-build-namespaces)
|
||||
|
||||
enum class ApplyPremul { True, False };
|
||||
|
||||
|
@ -17,11 +17,9 @@
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <memory>
|
||||
|
||||
namespace {
|
||||
template <typename CFRef> using SkUniqueCFRef =
|
||||
std::unique_ptr<skstd::remove_pointer_t<CFRef>,
|
||||
SkFunctionWrapper<void, skstd::remove_pointer_t<CFTypeRef>, CFRelease>>;
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user