Reland "Remove ALLOW_UNUSED macros."
This is a reland of commit 07d7f6b349a9a9d7c3bb651ddd67940a3e7baf22
Safe to do because the ALLOW_UNUSED macro is now truly unused.
Original change's description:
> Remove ALLOW_UNUSED macros.
>
> Following Chromium's changes for crbug.com/1286390 and switching to
> [[maybe_unused]] instead.
>
> Change-Id: I339fbdb85928d81bb159112799df2976934e4987
> Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/98393
> Commit-Queue: Lei Zhang <thestig@chromium.org>
> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Change-Id: Iba9905ab01adf900ee1fc5a04410c4c059042d24
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/98534
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/win32/cfx_psfonttracker.cpp b/core/fxge/win32/cfx_psfonttracker.cpp
index 9e7ec57..53eb063 100644
--- a/core/fxge/win32/cfx_psfonttracker.cpp
+++ b/core/fxge/win32/cfx_psfonttracker.cpp
@@ -6,7 +6,6 @@
#include "core/fxge/cfx_font.h"
#include "third_party/base/check.h"
-#include "third_party/base/compiler_specific.h"
#include "third_party/base/containers/contains.h"
CFX_PSFontTracker::CFX_PSFontTracker() = default;
@@ -15,14 +14,13 @@
void CFX_PSFontTracker::AddFontObject(const CFX_Font* font) {
uint64_t tag = font->GetObjectTag();
- bool inserted;
+ [[maybe_unused]] bool inserted;
if (tag != 0) {
inserted = seen_font_tags_.insert(tag).second;
} else {
inserted = seen_font_ptrs_.insert(UnownedPtr<const CFX_Font>(font)).second;
}
DCHECK(inserted);
- ALLOW_UNUSED_LOCAL(inserted);
}
bool CFX_PSFontTracker::SeenFontObject(const CFX_Font* font) const {
diff --git a/third_party/base/compiler_specific.h b/third_party/base/compiler_specific.h
index 7b3590c..ec73a74 100644
--- a/third_party/base/compiler_specific.h
+++ b/third_party/base/compiler_specific.h
@@ -7,23 +7,6 @@
#include "build/build_config.h"
-// Annotate a variable indicating it's ok if the variable is not used.
-// (Typically used to silence a compiler warning when the assignment
-// is important for some other reason.)
-// Use like:
-// int x = ...;
-// ALLOW_UNUSED_LOCAL(x);
-#define ALLOW_UNUSED_LOCAL(x) (void)x
-
-// Annotate a typedef or function indicating it's ok if it's not used.
-// Use like:
-// typedef Foo Bar ALLOW_UNUSED_TYPE;
-#if defined(COMPILER_GCC) || defined(__clang__)
-#define ALLOW_UNUSED_TYPE __attribute__((unused))
-#else
-#define ALLOW_UNUSED_TYPE
-#endif
-
// Annotate a function indicating it should not be inlined.
// Use like:
// NOINLINE void DoStuff() { ... }
diff --git a/third_party/base/win/scoped_select_object.h b/third_party/base/win/scoped_select_object.h
index 0bb7a68..89a5f1b 100644
--- a/third_party/base/win/scoped_select_object.h
+++ b/third_party/base/win/scoped_select_object.h
@@ -8,7 +8,6 @@
#include <windows.h>
#include "third_party/base/check.h"
-#include "third_party/base/compiler_specific.h"
namespace pdfium {
namespace base {
@@ -29,8 +28,7 @@
ScopedSelectObject& operator=(const ScopedSelectObject&) = delete;
~ScopedSelectObject() {
- HGDIOBJ object = SelectObject(hdc_, oldobj_);
- ALLOW_UNUSED_LOCAL(object);
+ [[maybe_unused]] HGDIOBJ object = SelectObject(hdc_, oldobj_);
DCHECK((GetObjectType(oldobj_) != OBJ_REGION && object) ||
(GetObjectType(oldobj_) == OBJ_REGION && object != HGDI_ERROR));
}