Remove SK_MAYBE_UNUSED.

[[maybe_unused]] is built in to C++17.

Change-Id: I5e49d0801878fd9fbca62ab28080aa856e33ca79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550500
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2022-06-16 12:15:34 -04:00 committed by SkCQ
parent ac0923b567
commit a444743005
13 changed files with 31 additions and 39 deletions

View File

@ -41,7 +41,7 @@ public:
void onDraw(int loops, SkCanvas*) override {
// We xor results of FourByteInterp into junk to make sure the function runs.
SK_MAYBE_UNUSED volatile SkPMColor junk = 0;
[[maybe_unused]] volatile SkPMColor junk = 0;
for (int loop = 0; loop < loops; loop++) {
for (int i = 0; i < kInputs; i++) {

View File

@ -16,7 +16,7 @@ struct ControlBench : public Benchmark {
void onDraw(int loops, SkCanvas*) override {
// Nothing terribly useful: force a memory read, a memory write, and some math.
SK_MAYBE_UNUSED volatile uint32_t rand = 0;
[[maybe_unused]] volatile uint32_t rand = 0;
for (int i = 0; i < 1000*loops; i++) {
rand *= 1664525;
rand += 1013904223;

View File

@ -53,7 +53,7 @@ protected:
m2.reset();
// xor into a volatile prevents these comparisons from being optimized away.
SK_MAYBE_UNUSED volatile bool junk = false;
[[maybe_unused]] volatile bool junk = false;
junk ^= (m0 == m1);
junk ^= (m1 == m2);
junk ^= (m2 == m0);
@ -116,7 +116,7 @@ protected:
fArray[3], fArray[4], fArray[5],
fArray[6], fArray[7], fArray[8]);
// xoring into a volatile prevents the compiler from optimizing these away
SK_MAYBE_UNUSED volatile int junk = 0;
[[maybe_unused]] volatile int junk = 0;
junk ^= (fMatrix.getType());
fMatrix.dirtyMatrixTypeCache();
junk ^= (fMatrix.getType());

View File

@ -59,7 +59,7 @@ protected:
int mulLoopCount() const override { return 4; }
void performTest() override {
// xoring into a volatile prevents the compiler from optimizing these checks away.
SK_MAYBE_UNUSED volatile bool junk = false;
[[maybe_unused]] volatile bool junk = false;
junk ^= (fArray[6] != 0.0f || fArray[7] != 0.0f || fArray[8] != 1.0f);
junk ^= (fArray[2] != 0.0f || fArray[5] != 0.0f);
}
@ -78,7 +78,7 @@ protected:
int mulLoopCount() const override { return 4; }
void performTest() override {
// xoring into a volatile prevents the compiler from optimizing these checks away.
SK_MAYBE_UNUSED volatile int32_t junk = 0;
[[maybe_unused]] volatile int32_t junk = 0;
junk ^= (SkScalarAs2sCompliment(fArray[6]) |
SkScalarAs2sCompliment(fArray[7]) |
(SkScalarAs2sCompliment(fArray[8]) - kPersp1Int));

View File

@ -63,7 +63,7 @@ static SkPath make_conic_path() {
return path;
}
SK_MAYBE_UNUSED static SkPath make_quad_path(int maxPow2) {
[[maybe_unused]] static SkPath make_quad_path(int maxPow2) {
SkRandom rand;
SkPath path;
for (int i = 0; i < kNumCubicsInChalkboard; ++i) {
@ -73,7 +73,7 @@ SK_MAYBE_UNUSED static SkPath make_quad_path(int maxPow2) {
return path;
}
SK_MAYBE_UNUSED static SkPath make_line_path(int maxPow2) {
[[maybe_unused]] static SkPath make_line_path(int maxPow2) {
SkRandom rand;
SkPath path;
for (int i = 0; i < kNumCubicsInChalkboard; ++i) {

View File

@ -255,7 +255,7 @@ public:
RECT clip_bounds_RECT = toRECT(clip_bounds);
HRGN hrgn = CreateRectRgnIndirect(&clip_bounds_RECT);
SK_MAYBE_UNUSED int result = SelectClipRgn(hdc, hrgn);
[[maybe_unused]] int result = SelectClipRgn(hdc, hrgn);
SkASSERT(result != ERROR);
result = DeleteObject(hrgn);
SkASSERT(result != 0);

View File

@ -340,14 +340,6 @@
# endif
#endif
#if !defined(SK_MAYBE_UNUSED)
# if defined(__clang__) || defined(__GNUC__)
# define SK_MAYBE_UNUSED [[maybe_unused]]
# else
# define SK_MAYBE_UNUSED
# endif
#endif
/**
* If your judgment is better than the compiler's (i.e. you've profiled it),
* you can use SK_ALWAYS_INLINE to force inlining. E.g.

View File

@ -36,37 +36,37 @@ private:
* basic bitfield.
*/
#define GR_MAKE_BITFIELD_CLASS_OPS(X) \
SK_MAYBE_UNUSED constexpr GrTFlagsMask<X> operator~(X a) { \
[[maybe_unused]] constexpr GrTFlagsMask<X> operator~(X a) { \
return GrTFlagsMask<X>(~static_cast<int>(a)); \
} \
SK_MAYBE_UNUSED constexpr X operator|(X a, X b) { \
[[maybe_unused]] constexpr X operator|(X a, X b) { \
return static_cast<X>(static_cast<int>(a) | static_cast<int>(b)); \
} \
SK_MAYBE_UNUSED inline X& operator|=(X& a, X b) { \
[[maybe_unused]] inline X& operator|=(X& a, X b) { \
return (a = a | b); \
} \
SK_MAYBE_UNUSED constexpr bool operator&(X a, X b) { \
[[maybe_unused]] constexpr bool operator&(X a, X b) { \
return SkToBool(static_cast<int>(a) & static_cast<int>(b)); \
} \
SK_MAYBE_UNUSED constexpr GrTFlagsMask<X> operator|(GrTFlagsMask<X> a, GrTFlagsMask<X> b) { \
[[maybe_unused]] constexpr GrTFlagsMask<X> operator|(GrTFlagsMask<X> a, GrTFlagsMask<X> b) { \
return GrTFlagsMask<X>(a.value() | b.value()); \
} \
SK_MAYBE_UNUSED constexpr GrTFlagsMask<X> operator|(GrTFlagsMask<X> a, X b) { \
[[maybe_unused]] constexpr GrTFlagsMask<X> operator|(GrTFlagsMask<X> a, X b) { \
return GrTFlagsMask<X>(a.value() | static_cast<int>(b)); \
} \
SK_MAYBE_UNUSED constexpr GrTFlagsMask<X> operator|(X a, GrTFlagsMask<X> b) { \
[[maybe_unused]] constexpr GrTFlagsMask<X> operator|(X a, GrTFlagsMask<X> b) { \
return GrTFlagsMask<X>(static_cast<int>(a) | b.value()); \
} \
SK_MAYBE_UNUSED constexpr X operator&(GrTFlagsMask<X> a, GrTFlagsMask<X> b) { \
[[maybe_unused]] constexpr X operator&(GrTFlagsMask<X> a, GrTFlagsMask<X> b) { \
return static_cast<X>(a.value() & b.value()); \
} \
SK_MAYBE_UNUSED constexpr X operator&(GrTFlagsMask<X> a, X b) { \
[[maybe_unused]] constexpr X operator&(GrTFlagsMask<X> a, X b) { \
return static_cast<X>(a.value() & static_cast<int>(b)); \
} \
SK_MAYBE_UNUSED constexpr X operator&(X a, GrTFlagsMask<X> b) { \
[[maybe_unused]] constexpr X operator&(X a, GrTFlagsMask<X> b) { \
return static_cast<X>(static_cast<int>(a) & b.value()); \
} \
SK_MAYBE_UNUSED inline X& operator&=(X& a, GrTFlagsMask<X> b) { \
[[maybe_unused]] inline X& operator&=(X& a, GrTFlagsMask<X> b) { \
return (a = a & b); \
} \

View File

@ -65,16 +65,16 @@ private:
* Defines functions that make it possible to use bitwise operators on an enum.
*/
#define SK_MAKE_BITMASK_OPS(E) \
SK_MAYBE_UNUSED constexpr SkEnumBitMask<E> operator|(E a, E b) { \
[[maybe_unused]] constexpr SkEnumBitMask<E> operator|(E a, E b) { \
return SkEnumBitMask<E>(a) | b; \
} \
SK_MAYBE_UNUSED constexpr SkEnumBitMask<E> operator&(E a, E b) { \
[[maybe_unused]] constexpr SkEnumBitMask<E> operator&(E a, E b) { \
return SkEnumBitMask<E>(a) & b; \
} \
SK_MAYBE_UNUSED constexpr SkEnumBitMask<E> operator^(E a, E b) { \
[[maybe_unused]] constexpr SkEnumBitMask<E> operator^(E a, E b) { \
return SkEnumBitMask<E>(a) ^ b; \
} \
SK_MAYBE_UNUSED constexpr SkEnumBitMask<E> operator~(E e) { \
[[maybe_unused]] constexpr SkEnumBitMask<E> operator~(E e) { \
return ~SkEnumBitMask<E>(e); \
} \

View File

@ -304,7 +304,7 @@ inline VertexWriter& operator<<(VertexWriter& w, const VertexWriter::RepeatDesc<
}
template <>
SK_MAYBE_UNUSED inline VertexWriter& operator<<(VertexWriter& w, const skvx::float4& vector) {
[[maybe_unused]] inline VertexWriter& operator<<(VertexWriter& w, const skvx::float4& vector) {
w.validate(sizeof(vector));
vector.store(w.fPtr);
w = w.makeOffset(sizeof(vector));
@ -354,7 +354,7 @@ private:
};
template <>
SK_MAYBE_UNUSED inline VertexWriter& operator<<(VertexWriter& w, const VertexColor& color) {
[[maybe_unused]] inline VertexWriter& operator<<(VertexWriter& w, const VertexColor& color) {
w << color.fColor[0];
if (color.fWideColor) {
w << color.fColor[1]

View File

@ -87,9 +87,9 @@ GR_MAKE_BITFIELD_CLASS_OPS(PatchAttribs)
// When PatchAttribs::kExplicitCurveType is set, these are the values that tell the GPU what type of
// curve is being drawn.
constexpr static float kCubicCurveType SK_MAYBE_UNUSED = 0;
constexpr static float kConicCurveType SK_MAYBE_UNUSED = 1;
constexpr static float kTriangularConicCurveType SK_MAYBE_UNUSED = 2; // Conic curve with w=Inf.
constexpr static float kCubicCurveType [[maybe_unused]] = 0;
constexpr static float kConicCurveType [[maybe_unused]] = 1;
constexpr static float kTriangularConicCurveType [[maybe_unused]] = 2; // Conic curve with w=Inf.
// Returns the packed size in bytes of the attribs portion of tessellation patches (or instances) in
// GPU buffers.

View File

@ -15,7 +15,7 @@
#include "include/private/SkVx.h"
#include "src/gpu/tessellate/Tessellation.h"
#define AI SK_MAYBE_UNUSED SK_ALWAYS_INLINE
#define AI [[maybe_unused]] SK_ALWAYS_INLINE
// Wang's formula gives the minimum number of evenly spaced (in the parametric sense) line segments
// that a bezier curve must be chopped into in order to guarantee all lines stay within a distance

View File

@ -79,7 +79,7 @@ static SkTileMode optimize(SkTileMode tm, int dimension) {
// TODO: currently this only *always* used in asFragmentProcessor(), which is excluded on no-gpu
// builds. No-gpu builds only use needs_subset() in asserts, so release+no-gpu doesn't use it, which
// can cause builds to fail if unused warnings are treated as errors.
SK_MAYBE_UNUSED static bool needs_subset(SkImage* img, const SkRect& subset) {
[[maybe_unused]] static bool needs_subset(SkImage* img, const SkRect& subset) {
return subset != SkRect::Make(img->dimensions());
}