Revert "Remove ALLOW_UNUSED macros."

This reverts commit 07d7f6b349a9a9d7c3bb651ddd67940a3e7baf22.

Reason for revert: Broke DEPS roll into Chromium.

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>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I9cbeba33480d595295f860effc072e4aa1d2cae2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/98456
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/win32/cfx_psfonttracker.cpp b/core/fxge/win32/cfx_psfonttracker.cpp
index 53eb063..9e7ec57 100644
--- a/core/fxge/win32/cfx_psfonttracker.cpp
+++ b/core/fxge/win32/cfx_psfonttracker.cpp
@@ -6,6 +6,7 @@
 
 #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;
@@ -14,13 +15,14 @@
 
 void CFX_PSFontTracker::AddFontObject(const CFX_Font* font) {
   uint64_t tag = font->GetObjectTag();
-  [[maybe_unused]] bool inserted;
+  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 ec73a74..7b3590c 100644
--- a/third_party/base/compiler_specific.h
+++ b/third_party/base/compiler_specific.h
@@ -7,6 +7,23 @@
 
 #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 89a5f1b..0bb7a68 100644
--- a/third_party/base/win/scoped_select_object.h
+++ b/third_party/base/win/scoped_select_object.h
@@ -8,6 +8,7 @@
 #include <windows.h>
 
 #include "third_party/base/check.h"
+#include "third_party/base/compiler_specific.h"
 
 namespace pdfium {
 namespace base {
@@ -28,7 +29,8 @@
   ScopedSelectObject& operator=(const ScopedSelectObject&) = delete;
 
   ~ScopedSelectObject() {
-    [[maybe_unused]] HGDIOBJ object = SelectObject(hdc_, oldobj_);
+    HGDIOBJ object = SelectObject(hdc_, oldobj_);
+    ALLOW_UNUSED_LOCAL(object);
     DCHECK((GetObjectType(oldobj_) != OBJ_REGION && object) ||
            (GetObjectType(oldobj_) == OBJ_REGION && object != HGDI_ERROR));
   }