Replace `ABSL_ATTRIBUTE_UNUSED`:

* With commented-out parameter name if it applies to a function parameter which
  is never used. This is more idiomatic and shorter.

* With `[[maybe_unused]]` otherwise, i.e. the parameter is used conditionally
  (due to `if constexpr`, possibly empty variadic expansion, or `#if`) or the
  name is something other than a function parameter.

The parameter name is still skipped altogether when the parameter is never used
to pass a value but e.g. disambiguates overloads (`operator++(int)`,
`std::in_place_t`), specifies a type where an explicit template parameter
would not work, or introduces template parameters through
`std::index_sequence<indices...>`.

Replace `ABSL_ATTRIBUTE_NORETURN` with `[[noreturn]]`. It is available since
C++11.

Replace `ABSL_FALLTHROUGH_INTENDED` with `[[fallthrough]]`. It is available
since C++17.

Attribute macros for non-standard and thus non-portable attributes remain.

PiperOrigin-RevId: 912676701
diff --git a/python/riegeli/bytes/python_writer.cc b/python/riegeli/bytes/python_writer.cc
index 06ed84f..f26a524 100644
--- a/python/riegeli/bytes/python_writer.cc
+++ b/python/riegeli/bytes/python_writer.cc
@@ -28,7 +28,6 @@
 #include <limits>
 #include <optional>
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/numeric/bits.h"
 #include "absl/status/status.h"
@@ -211,7 +210,7 @@
   switch (flush_type) {
     case FlushType::kFromObject:
       if (!owns_dest_) return true;
-      ABSL_FALLTHROUGH_INTENDED;
+      [[fallthrough]];
     case FlushType::kFromProcess:
     case FlushType::kFromMachine:
       PythonLock lock;
diff --git a/riegeli/base/BUILD b/riegeli/base/BUILD
index 4a8299a..5ffd289 100644
--- a/riegeli/base/BUILD
+++ b/riegeli/base/BUILD
@@ -11,7 +11,6 @@
     name = "type_traits",
     hdrs = ["type_traits.h"],
     deps = [
-        "@com_google_absl//absl/base:core_headers",
         "@com_google_absl//absl/base:nullability",
         "@com_google_absl//absl/strings:string_view",
         "@com_google_absl//absl/utility",
@@ -144,7 +143,6 @@
         ":arithmetic",
         ":assert",
         ":estimated_allocated_size",
-        "@com_google_absl//absl/base:core_headers",
         "@com_google_absl//absl/base:nullability",
         "@com_google_absl//absl/numeric:bits",
     ],
@@ -306,7 +304,6 @@
     deps = [
         ":arithmetic",
         ":estimated_allocated_size",
-        "@com_google_absl//absl/base:core_headers",
         "@com_google_absl//absl/base:nullability",
         "@com_google_absl//absl/container:flat_hash_map",
         "@com_google_absl//absl/container:flat_hash_set",
@@ -321,10 +318,7 @@
 cc_library(
     name = "closing_ptr",
     hdrs = ["closing_ptr.h"],
-    deps = [
-        "@com_google_absl//absl/base:core_headers",
-        "@com_google_absl//absl/base:nullability",
-    ],
+    deps = ["@com_google_absl//absl/base:nullability"],
 )
 
 cc_library(
diff --git a/riegeli/base/any.h b/riegeli/base/any.h
index 81c397b..c42bb43 100644
--- a/riegeli/base/any.h
+++ b/riegeli/base/any.h
@@ -214,7 +214,7 @@
   template <typename DependentHandle = Handle,
             std::enable_if_t<
                 !IsComparableAgainstNullptr<DependentHandle>::value, int> = 0>
-  void AssertNotNull(ABSL_ATTRIBUTE_UNUSED absl::string_view message) const {}
+  void AssertNotNull(absl::string_view /*message*/) const {}
 
   template <typename DependentHandle = Handle,
             std::enable_if_t<IsComparableAgainstNullptr<DependentHandle>::value,
diff --git a/riegeli/base/any_initializer.h b/riegeli/base/any_initializer.h
index 9eb9776..6f176d8 100644
--- a/riegeli/base/any_initializer.h
+++ b/riegeli/base/any_initializer.h
@@ -156,11 +156,9 @@
 
 template <typename Handle>
 void AnyInitializer<Handle>::ConstructMethodEmpty(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef context,
-    ABSL_ATTRIBUTE_UNUSED Storage dest,
-    MethodsAndHandle* dest_methods_and_handle,
-    ABSL_ATTRIBUTE_UNUSED size_t available_size,
-    ABSL_ATTRIBUTE_UNUSED size_t available_align) {
+    TypeErasedRef /*context*/, Storage /*dest*/,
+    MethodsAndHandle* dest_methods_and_handle, size_t /*available_size*/,
+    size_t /*available_align*/) {
   dest_methods_and_handle->methods = &NullMethods::kMethods;
   new (&dest_methods_and_handle->handle)
       Handle(any_internal::SentinelHandle<Handle>());
@@ -248,9 +246,8 @@
         any_internal::IsAnyClosingPtr<Handle, TargetT<Manager>>::value, int>>
 void AnyInitializer<Handle>::ConstructMethod(
     TypeErasedRef context, Storage dest,
-    MethodsAndHandle* dest_methods_and_handle,
-    ABSL_ATTRIBUTE_UNUSED size_t available_size,
-    ABSL_ATTRIBUTE_UNUSED size_t available_align) {
+    MethodsAndHandle* dest_methods_and_handle, size_t /*available_size*/,
+    size_t /*available_align*/) {
   using Target = TargetT<Manager>;
   // Materialize `Target` to adopt its storage.
   const Target target =
diff --git a/riegeli/base/any_internal.h b/riegeli/base/any_internal.h
index 7783871..7170be4 100644
--- a/riegeli/base/any_internal.h
+++ b/riegeli/base/any_internal.h
@@ -23,7 +23,6 @@
 #include <type_traits>
 #include <utility>
 
-#include "absl/base/attributes.h"
 #include "absl/meta/type_traits.h"
 #include "riegeli/base/arithmetic.h"
 #include "riegeli/base/closing_ptr.h"
@@ -236,19 +235,15 @@
 template <typename Handle>
 struct NullMethods {
  private:
-  static void Destroy(ABSL_ATTRIBUTE_UNUSED Storage self) {}
-  static void Move(ABSL_ATTRIBUTE_UNUSED Storage src,
-                   ABSL_ATTRIBUTE_UNUSED Storage dest,
+  static void Destroy(Storage /*self*/) {}
+  static void Move(Storage /*src*/, Storage /*dest*/,
                    MethodsAndHandle<Handle>* dest_methods_and_handle) {
     dest_methods_and_handle->methods = &kMethods;
     new (&dest_methods_and_handle->handle) Handle(SentinelHandle<Handle>());
   }
-  static bool IsOwning(ABSL_ATTRIBUTE_UNUSED const Storage self) {
-    return false;
-  }
-  static void RegisterSubobjects(
-      ABSL_ATTRIBUTE_UNUSED const Storage self,
-      ABSL_ATTRIBUTE_UNUSED MemoryEstimator& memory_estimator) {}
+  static bool IsOwning(const Storage /*self*/) { return false; }
+  static void RegisterSubobjects(const Storage /*self*/,
+                                 MemoryEstimator& /*memory_estimator*/) {}
 
  public:
   static constexpr Methods<Handle> kMethods = {
@@ -264,7 +259,7 @@
         reinterpret_cast<Dependency<Handle, Manager>* const*>(self));
   }
 
-  static void Destroy(ABSL_ATTRIBUTE_UNUSED Storage self) {}
+  static void Destroy(Storage /*self*/) {}
   static void Move(Storage src, Storage dest,
                    MethodsAndHandle<Handle>* dest_methods_and_handle) {
     new (dest) Dependency<Handle, Manager>*(dep_ptr(src));
@@ -275,9 +270,8 @@
   static TypeErasedRef GetRawManager(const Storage self) {
     return TypeErasedRef(dep_ptr(self)->manager());
   }
-  static void RegisterSubobjects(
-      ABSL_ATTRIBUTE_UNUSED const Storage self,
-      ABSL_ATTRIBUTE_UNUSED MemoryEstimator& memory_estimator) {}
+  static void RegisterSubobjects(const Storage /*self*/,
+                                 MemoryEstimator& /*memory_estimator*/) {}
 
  public:
   static constexpr Methods<Handle> kMethods = {
diff --git a/riegeli/base/assert.h b/riegeli/base/assert.h
index c9a58fc..927f5ae 100644
--- a/riegeli/base/assert.h
+++ b/riegeli/base/assert.h
@@ -98,7 +98,7 @@
   std::ostream& details() { return *details_; }
 
   // Prints the check failure message and terminates the program.
-  ABSL_ATTRIBUTE_NORETURN ~CheckFailed();
+  [[noreturn]] ~CheckFailed();
 
  private:
   const char* file_;
@@ -150,9 +150,9 @@
 
 // Writes "Check failed in function: expression != nullptr" and terminates
 // the program.
-ABSL_ATTRIBUTE_NORETURN void CheckNotNullFailed(const char* file, int line,
-                                                const char* function,
-                                                const char* expression);
+[[noreturn]] void CheckNotNullFailed(const char* file, int line,
+                                     const char* function,
+                                     const char* expression);
 
 // Indicates that a check failed with the message header
 // "Check failed in function: Impossible".
@@ -221,7 +221,7 @@
 
 template <typename T>
 inline T&& EvalAssertNotNull(T&& value) {
-  ABSL_ATTRIBUTE_UNUSED const bool condition =
+  [[maybe_unused]] const bool condition =
       true || value == nullptr;  // Check that this compiles.
   return std::forward<T>(value);
 }
@@ -247,12 +247,10 @@
  public:
   UnreachableStream() { RIEGELI_INTERNAL_UNREACHABLE(); }
 
-  ABSL_ATTRIBUTE_NORETURN ~UnreachableStream() {
-    RIEGELI_INTERNAL_UNREACHABLE();
-  }
+  [[noreturn]] ~UnreachableStream() { RIEGELI_INTERNAL_UNREACHABLE(); }
 
   template <typename T>
-  UnreachableStream& operator<<(ABSL_ATTRIBUTE_UNUSED T&& src) {
+  UnreachableStream& operator<<(T&& /*src*/) {
     return *this;
   }
 };
@@ -503,8 +501,8 @@
 
 // Asserts that a region of memory is initialized, which is checked when running
 // under memory sanitizer.
-inline void AssertInitialized(ABSL_ATTRIBUTE_UNUSED const char* data,
-                              ABSL_ATTRIBUTE_UNUSED size_t size) {
+inline void AssertInitialized([[maybe_unused]] const char* data,
+                              [[maybe_unused]] size_t size) {
 #ifdef MEMORY_SANITIZER
   __msan_check_mem_is_initialized(data, size);
 #endif
@@ -512,8 +510,8 @@
 
 // Marks that a region of memory should be treated as uninitialized, which is
 // checked when running under memory sanitizer.
-inline void MarkPoisoned(ABSL_ATTRIBUTE_UNUSED const char* data,
-                         ABSL_ATTRIBUTE_UNUSED size_t size) {
+inline void MarkPoisoned([[maybe_unused]] const char* data,
+                         [[maybe_unused]] size_t size) {
 #ifdef MEMORY_SANITIZER
   __msan_poison(data, size);
 #endif
diff --git a/riegeli/base/binary_search.h b/riegeli/base/binary_search.h
index d1ae524..e2fc31a 100644
--- a/riegeli/base/binary_search.h
+++ b/riegeli/base/binary_search.h
@@ -19,7 +19,6 @@
 #include <type_traits>
 #include <utility>
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/status/status.h"
 #include "absl/status/statusor.h"
@@ -335,9 +334,8 @@
 
 template <typename Traits, typename OtherPos>
 inline SearchGuide<typename Traits::Pos> GetSearchGuide(
-    SearchGuide<OtherPos>&& guide,
-    ABSL_ATTRIBUTE_UNUSED typename Traits::Pos&& pos,
-    ABSL_ATTRIBUTE_UNUSED const Traits& traits) {
+    SearchGuide<OtherPos>&& guide, typename Traits::Pos&& /*pos*/,
+    const Traits& /*traits*/) {
   return std::move(guide);
 }
 
@@ -347,7 +345,7 @@
 template <typename Pos, typename Ordering>
 struct CancelSearch<Pos, Ordering,
                     std::enable_if_t<IsOrdering<Ordering>::value>> {
-  static PartialOrdering DoCancel(ABSL_ATTRIBUTE_UNUSED const Pos& pos) {
+  static PartialOrdering DoCancel(const Pos& /*pos*/) {
     return PartialOrdering::equivalent;
   }
   static PartialOrdering DoNotCancel(Ordering ordering) {
diff --git a/riegeli/base/byte_fill.h b/riegeli/base/byte_fill.h
index 2bdb988..af9a19f 100644
--- a/riegeli/base/byte_fill.h
+++ b/riegeli/base/byte_fill.h
@@ -25,7 +25,6 @@
 #include <utility>
 #include <variant>
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/strings/cord.h"
 #include "absl/strings/string_view.h"
@@ -145,25 +144,24 @@
   ZeroBlock& operator=(const ZeroBlock& that) = default;
 
   // Supports `ExternalRef`.
-  friend Chain::Block RiegeliToChainBlock(
-      ABSL_ATTRIBUTE_UNUSED const ZeroBlock* self, absl::string_view substr) {
+  friend Chain::Block RiegeliToChainBlock(const ZeroBlock* /*self*/,
+                                          absl::string_view substr) {
     return ToChainBlock(substr);
   }
 
   // Supports `ExternalRef`.
-  friend absl::Cord RiegeliToCord(ABSL_ATTRIBUTE_UNUSED const ZeroBlock* self,
+  friend absl::Cord RiegeliToCord(const ZeroBlock* /*self*/,
                                   absl::string_view substr) {
     return ToCord(substr);
   }
 
   // Supports `ExternalRef`.
-  friend ExternalStorage RiegeliToExternalStorage(
-      ABSL_ATTRIBUTE_UNUSED const ZeroBlock* self) {
-    return ExternalStorage(nullptr, [](ABSL_ATTRIBUTE_UNUSED void* ptr) {});
+  friend ExternalStorage RiegeliToExternalStorage(const ZeroBlock* /*self*/) {
+    return ExternalStorage(nullptr, [](void* /*ptr*/) {});
   }
 
   // Supports `ExternalRef` and `Chain::Block`.
-  friend void RiegeliDumpStructure(ABSL_ATTRIBUTE_UNUSED const ZeroBlock* self,
+  friend void RiegeliDumpStructure(const ZeroBlock* /*self*/,
                                    std::ostream& dest) {
     DumpStructure(dest);
   }
@@ -186,10 +184,7 @@
   const char* data() const { return data_; }
 
   // Supports `ExternalRef`.
-  friend bool RiegeliExternalCopy(
-      ABSL_ATTRIBUTE_UNUSED const SmallBlock* self) {
-    return true;
-  }
+  friend bool RiegeliExternalCopy(const SmallBlock* /*self*/) { return true; }
 
  private:
   char data_[kSize];
diff --git a/riegeli/base/chain.cc b/riegeli/base/chain.cc
index 17d917d..04dcc8f 100644
--- a/riegeli/base/chain.cc
+++ b/riegeli/base/chain.cc
@@ -71,8 +71,8 @@
   /*implicit*/ operator absl::string_view() const;
 
   // Supports `ExternalRef` and `Chain::Block`.
-  friend void RiegeliDumpStructure(
-      ABSL_ATTRIBUTE_UNUSED const FlatCordBlock* self, std::ostream& dest) {
+  friend void RiegeliDumpStructure(const FlatCordBlock* /*self*/,
+                                   std::ostream& dest) {
     dest << "[cord] { }";
   }
 
diff --git a/riegeli/base/chain_base.h b/riegeli/base/chain_base.h
index e957426..fc845da 100644
--- a/riegeli/base/chain_base.h
+++ b/riegeli/base/chain_base.h
@@ -732,8 +732,7 @@
 #else
   template <typename T>
 #endif
-  static void AssertSubstr(ABSL_ATTRIBUTE_UNUSED const T& object,
-                           ABSL_ATTRIBUTE_UNUSED absl::string_view substr) {
+  static void AssertSubstr(const T& /*object*/, absl::string_view /*substr*/) {
   }
 
   bool is_mutable() const { return is_internal() && has_unique_owner(); }
diff --git a/riegeli/base/chain_details.h b/riegeli/base/chain_details.h
index 432dfd2..50f8cbd 100644
--- a/riegeli/base/chain_details.h
+++ b/riegeli/base/chain_details.h
@@ -354,8 +354,7 @@
     std::enable_if_t<std::conjunction_v<std::negation<HasCallOperatorSubstr<T>>,
                                         HasCallOperatorWhole<T>>,
                      int> = 0>
-inline void CallOperator(T&& object,
-                         ABSL_ATTRIBUTE_UNUSED absl::string_view substr) {
+inline void CallOperator(T&& object, absl::string_view /*substr*/) {
   std::forward<T>(object)();
 }
 
@@ -364,14 +363,12 @@
     std::enable_if_t<std::conjunction_v<std::negation<HasCallOperatorSubstr<T>>,
                                         std::negation<HasCallOperatorWhole<T>>>,
                      int> = 0>
-inline void CallOperator(ABSL_ATTRIBUTE_UNUSED T&& object,
-                         ABSL_ATTRIBUTE_UNUSED absl::string_view substr) {}
+inline void CallOperator(T&& /*object*/, absl::string_view /*substr*/) {}
 
 template <typename T,
           std::enable_if_t<MemoryEstimator::RegisterSubobjectsIsGood<T>::value,
                            int> = 0>
-inline void RegisterSubobjects(const T* object,
-                               ABSL_ATTRIBUTE_UNUSED absl::string_view substr,
+inline void RegisterSubobjects(const T* object, absl::string_view /*substr*/,
                                MemoryEstimator& memory_estimator) {
   memory_estimator.RegisterSubobjects(object);
 }
@@ -379,8 +376,7 @@
 template <typename T,
           std::enable_if_t<!MemoryEstimator::RegisterSubobjectsIsGood<T>::value,
                            int> = 0>
-inline void RegisterSubobjects(ABSL_ATTRIBUTE_UNUSED const T* object,
-                               absl::string_view substr,
+inline void RegisterSubobjects(const T* /*object*/, absl::string_view substr,
                                MemoryEstimator& memory_estimator) {
   memory_estimator.RegisterUnknownType<T>();
   // As an approximation of memory usage of an unknown type, register just the
@@ -423,8 +419,7 @@
         std::conjunction_v<std::negation<HasRiegeliDumpStructureWithSubstr<T>>,
                            HasRiegeliDumpStructureWithoutData<T>>,
         int> = 0>
-inline void DumpStructure(const T* object,
-                          ABSL_ATTRIBUTE_UNUSED absl::string_view substr,
+inline void DumpStructure(const T* object, absl::string_view /*substr*/,
                           std::ostream& dest) {
   RiegeliDumpStructure(object, dest);
 }
@@ -435,8 +430,7 @@
                          std::negation<HasRiegeliDumpStructureWithSubstr<T>>,
                          std::negation<HasRiegeliDumpStructureWithoutData<T>>>,
                      int> = 0>
-inline void DumpStructure(ABSL_ATTRIBUTE_UNUSED const T* object,
-                          ABSL_ATTRIBUTE_UNUSED absl::string_view substr,
+inline void DumpStructure(const T* /*object*/, absl::string_view /*substr*/,
                           std::ostream& dest) {
   chain_internal::DumpStructureDefault(dest);
 }
diff --git a/riegeli/base/closing_ptr.h b/riegeli/base/closing_ptr.h
index 6459f88..d008d08 100644
--- a/riegeli/base/closing_ptr.h
+++ b/riegeli/base/closing_ptr.h
@@ -17,7 +17,6 @@
 
 #include <memory>
 
-#include "absl/base/attributes.h"
 #include "absl/base/nullability.h"
 
 ABSL_POINTERS_DEFAULT_NONNULL
@@ -27,7 +26,7 @@
 // A deleter for `std::unique_ptr` which does nothing.
 struct NullDeleter {
   template <typename T>
-  void operator()(ABSL_ATTRIBUTE_UNUSED T* ptr) const {}
+  void operator()(T* /*ptr*/) const {}
 };
 
 // Marks the pointer with the intent to transfer the responsibility to close the
diff --git a/riegeli/base/debug.cc b/riegeli/base/debug.cc
index 3e78256..cf0fcf0 100644
--- a/riegeli/base/debug.cc
+++ b/riegeli/base/debug.cc
@@ -20,7 +20,6 @@
 #include <optional>
 #include <type_traits>
 
-#include "absl/base/attributes.h"
 #include "absl/base/nullability.h"
 #include "absl/strings/cord.h"
 #include "absl/strings/string_view.h"
@@ -178,11 +177,11 @@
   }
 }
 
-void RiegeliDebug(ABSL_ATTRIBUTE_UNUSED std::nullptr_t src, DebugStream& dest) {
+void RiegeliDebug(std::nullptr_t /*src*/, DebugStream& dest) {
   dest.Write("nullptr");
 }
 
-void RiegeliDebug(ABSL_ATTRIBUTE_UNUSED std::nullopt_t src, DebugStream& dest) {
+void RiegeliDebug(std::nullopt_t /*src*/, DebugStream& dest) {
   dest.Write("nullopt");
 }
 
diff --git a/riegeli/base/dependency.h b/riegeli/base/dependency.h
index 23b0008..2c4cef5 100644
--- a/riegeli/base/dependency.h
+++ b/riegeli/base/dependency.h
@@ -739,8 +739,8 @@
       typename DependentSubhandle = Subhandle,
       std::enable_if_t<!IsComparableAgainstNullptr<DependentSubhandle>::value,
                        int> = 0>
-  static void AssertNotNull(ABSL_ATTRIBUTE_UNUSED Subhandle handle,
-                            ABSL_ATTRIBUTE_UNUSED absl::string_view message) {}
+  static void AssertNotNull(Subhandle /*handle*/,
+                            absl::string_view /*message*/) {}
 };
 
 }  // namespace dependency_internal
diff --git a/riegeli/base/estimated_allocated_size.h b/riegeli/base/estimated_allocated_size.h
index 00ab5df..6891f71 100644
--- a/riegeli/base/estimated_allocated_size.h
+++ b/riegeli/base/estimated_allocated_size.h
@@ -36,7 +36,7 @@
 
 // Returns the estimated size which was allocated at `ptr` when requested to
 // allocate `requested_size`.
-inline size_t EstimatedAllocatedSize(ABSL_ATTRIBUTE_UNUSED const void* ptr,
+inline size_t EstimatedAllocatedSize(const void* /*ptr*/,
                                      size_t requested_size) {
   // Placeholder for using `ptr`, which might be possible on some platforms.
   return EstimatedAllocatedSize(requested_size);
diff --git a/riegeli/base/external_ref_base.h b/riegeli/base/external_ref_base.h
index f0bb578..ddd7af9 100644
--- a/riegeli/base/external_ref_base.h
+++ b/riegeli/base/external_ref_base.h
@@ -290,7 +290,7 @@
   template <typename T,
             std::enable_if_t<!HasCallOperator<absl::remove_cvref_t<T>>::value,
                              int> = 0>
-  static void CallOperatorWhole(ABSL_ATTRIBUTE_UNUSED T&& object) {}
+  static void CallOperatorWhole(T&& /*object*/) {}
 
   template <typename T,
             std::enable_if_t<HasCallOperatorSubstr<T>::value, int> = 0>
@@ -302,8 +302,7 @@
                 std::conjunction_v<std::negation<HasCallOperatorSubstr<T>>,
                                    HasCallOperatorWhole<T>>,
                 int> = 0>
-  static void CallOperatorSubstr(
-      T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view substr) {
+  static void CallOperatorSubstr(T&& object, absl::string_view /*substr*/) {
     std::forward<T>(object)();
   }
   template <
@@ -312,8 +311,7 @@
           std::conjunction_v<std::negation<HasCallOperator<T>>,
                              HasCallOperatorSubstr<absl::remove_cvref_t<T>>>,
           int> = 0>
-  static void CallOperatorSubstr(
-      T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view substr) {
+  static void CallOperatorSubstr(T&& object, absl::string_view /*substr*/) {
     absl::remove_cvref_t<T> copy(object);
     const absl::string_view data{BytesRef(copy)};
     std::move(copy)(data);
@@ -326,16 +324,14 @@
               std::negation<HasCallOperatorSubstr<absl::remove_cvref_t<T>>>,
               HasCallOperatorWhole<absl::remove_cvref_t<T>>>,
           int> = 0>
-  static void CallOperatorSubstr(
-      T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view substr) {
+  static void CallOperatorSubstr(T&& object, absl::string_view /*substr*/) {
     (absl::remove_cvref_t<T>(object))();
   }
   template <typename T,
             std::enable_if_t<!HasCallOperator<absl::remove_cvref_t<T>>::value,
                              int> = 0>
-  static void CallOperatorSubstr(
-      ABSL_ATTRIBUTE_UNUSED T&& object,
-      ABSL_ATTRIBUTE_UNUSED absl::string_view substr) {}
+  static void CallOperatorSubstr(T&& /*object*/, absl::string_view /*substr*/) {
+  }
 
   template <typename T>
   static external_ref_internal::PointerTypeT<T> Pointer(T&& object) {
@@ -363,8 +359,7 @@
 #else
   template <typename T>
 #endif
-  static void AssertSubstr(ABSL_ATTRIBUTE_UNUSED const T& object,
-                           ABSL_ATTRIBUTE_UNUSED absl::string_view substr) {
+  static void AssertSubstr(const T& /*object*/, absl::string_view /*substr*/) {
   }
 
   template <typename T, typename Callback, typename Enable = void>
@@ -415,9 +410,8 @@
   template <typename T, typename Callback,
             std::enable_if_t<
                 HasRiegeliExternalDelegateWhole<T, Callback>::value, int> = 0>
-  static void ExternalDelegateWhole(
-      T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data,
-      Callback&& delegate_to) {
+  static void ExternalDelegateWhole(T&& object, absl::string_view /*data*/,
+                                    Callback&& delegate_to) {
     RiegeliExternalDelegate(ExternalRef::Pointer(std::forward<T>(object)),
                             std::forward<Callback>(delegate_to));
   }
@@ -453,9 +447,8 @@
               std::negation<HasRiegeliExternalDelegateSubstr<T, Callback>>,
               HasRiegeliExternalDelegateWhole<T, Callback>>,
           int> = 0>
-  static void ExternalDelegateSubstr(
-      T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view substr,
-      Callback&& delegate_to) {
+  static void ExternalDelegateSubstr(T&& object, absl::string_view /*substr*/,
+                                     Callback&& delegate_to) {
     RiegeliExternalDelegate(ExternalRef::Pointer(std::forward<T>(object)),
                             std::forward<Callback>(delegate_to));
   }
@@ -504,8 +497,8 @@
 
   template <typename T,
             std::enable_if_t<HasRiegeliToChainBlockWhole<T>::value, int> = 0>
-  static Chain::Block ToChainBlockWhole(
-      T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) {
+  static Chain::Block ToChainBlockWhole(T&& object,
+                                        absl::string_view /*data*/) {
     return RiegeliToChainBlock(ExternalRef::Pointer(std::forward<T>(object)));
   }
   template <typename T,
@@ -587,8 +580,8 @@
                       std::negation<HasToChainBlockWhole<DependentT>>,
                       HasToChainBlockWhole<absl::remove_cvref_t<DependentT>>>,
                   int> = 0>
-    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(
-        T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) && {
+    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(T&& object,
+                                               absl::string_view /*data*/) && {
       use_chain_block_(context_, ExternalRef::ToChainBlockWhole(
                                      absl::remove_cvref_t<T>(object)));
     }
@@ -614,8 +607,8 @@
                       HasExternalDelegateWhole<absl::remove_cvref_t<DependentT>,
                                                ConverterToChainBlockWhole>>,
                   int> = 0>
-    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(
-        T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) && {
+    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(T&& object,
+                                               absl::string_view /*data*/) && {
       ExternalRef::ExternalDelegateWhole(absl::remove_cvref_t<T>(object),
                                          std::move(*this));
     }
@@ -627,8 +620,8 @@
                                          absl::remove_cvref_t<DependentT>,
                                          ConverterToChainBlockWhole>>>,
                   int> = 0>
-    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(
-        T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) && {
+    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(T&& object,
+                                               absl::string_view /*data*/) && {
       use_chain_block_(context_, Chain::Block(std::forward<T>(object)));
     }
 
@@ -832,8 +825,7 @@
 
   template <typename T,
             std::enable_if_t<HasRiegeliToCordWhole<T>::value, int> = 0>
-  static absl::Cord ToCordWhole(T&& object,
-                                ABSL_ATTRIBUTE_UNUSED absl::string_view data) {
+  static absl::Cord ToCordWhole(T&& object, absl::string_view /*data*/) {
     return RiegeliToCord(ExternalRef::Pointer(std::forward<T>(object)));
   }
   template <typename T,
@@ -911,8 +903,8 @@
                              std::negation<HasToCordWhole<DependentT>>,
                              HasToCordWhole<absl::remove_cvref_t<DependentT>>>,
                          int> = 0>
-    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(
-        T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) && {
+    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(T&& object,
+                                               absl::string_view /*data*/) && {
       use_cord_(context_, ExternalRef::ToCordWhole(absl::remove_cvref_t<T>(
                               std::forward<T>(object))));
     }
@@ -938,8 +930,8 @@
                 HasExternalDelegateWhole<absl::remove_cvref_t<DependentT>,
                                          ConverterToCordWhole>>,
             int> = 0>
-    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(
-        T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) && {
+    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(T&& object,
+                                               absl::string_view /*data*/) && {
       ExternalRef::ExternalDelegateWhole(absl::remove_cvref_t<T>(object),
                                          std::move(*this));
     }
@@ -970,8 +962,8 @@
                 std::negation<
                     SupportsExternalRefSubstr<std::decay_t<DependentT>>>>,
             int> = 0>
-    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(
-        T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) && {
+    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(T&& object,
+                                               absl::string_view /*data*/) && {
       ObjectForCordWhole<std::decay_t<T>> object_for_cord(
           std::forward<T>(object));
       const absl::string_view moved_data{BytesRef(*object_for_cord)};
@@ -1222,8 +1214,8 @@
 
   template <typename T,
             std::enable_if_t<HasRiegeliToExternalDataWhole<T>::value, int> = 0>
-  static ExternalData ToExternalDataWhole(
-      T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) {
+  static ExternalData ToExternalDataWhole(T&& object,
+                                          absl::string_view /*data*/) {
     return RiegeliToExternalData(ExternalRef::Pointer(std::forward<T>(object)));
   }
   template <
@@ -1290,8 +1282,8 @@
                       std::negation<HasToExternalDataWhole<DependentT>>,
                       HasToExternalDataWhole<absl::remove_cvref_t<DependentT>>>,
                   int> = 0>
-    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(
-        T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) && {
+    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(T&& object,
+                                               absl::string_view /*data*/) && {
       use_external_data_(context_, ExternalRef::ToExternalDataWhole(
                                        absl::remove_cvref_t<T>(object)));
     }
@@ -1318,8 +1310,8 @@
                       HasExternalDelegateWhole<absl::remove_cvref_t<DependentT>,
                                                ConverterToExternalDataWhole>>,
                   int> = 0>
-    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(
-        T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) && {
+    ABSL_ATTRIBUTE_ALWAYS_INLINE void Callback(T&& object,
+                                               absl::string_view /*data*/) && {
       ExternalRef::ExternalDelegateWhole(absl::remove_cvref_t<T>(object),
                                          std::move(*this));
     }
@@ -1331,7 +1323,7 @@
                                          absl::remove_cvref_t<DependentT>,
                                          ConverterToExternalDataWhole>>>,
                   int> = 0>
-    void Callback(T&& object, ABSL_ATTRIBUTE_UNUSED absl::string_view data) {
+    void Callback(T&& object, absl::string_view /*data*/) {
       auto* const storage =
           new ExternalObjectWhole<std::decay_t<T>>(std::forward<T>(object));
       const absl::string_view moved_data{BytesRef(**storage)};
diff --git a/riegeli/base/external_ref_support.h b/riegeli/base/external_ref_support.h
index 3906805..800c60b 100644
--- a/riegeli/base/external_ref_support.h
+++ b/riegeli/base/external_ref_support.h
@@ -23,16 +23,13 @@
 #include <utility>
 #include <vector>
 
-#include "absl/base/attributes.h"
 #include "riegeli/base/bytes_ref.h"
 #include "riegeli/base/external_data.h"
 
 namespace riegeli {
 
 // Default implementation for `ExternalRef` support.
-inline bool RiegeliExternalCopy(ABSL_ATTRIBUTE_UNUSED const void* self) {
-  return false;
-}
+inline bool RiegeliExternalCopy(const void* /*self*/) { return false; }
 
 // Indicates support for `ExternalRef(std::string&&)`.
 void RiegeliSupportsExternalRefWhole(std::string*);
diff --git a/riegeli/base/hybrid_direct_map.h b/riegeli/base/hybrid_direct_map.h
index 9bc8a15..bf76ce6 100644
--- a/riegeli/base/hybrid_direct_map.h
+++ b/riegeli/base/hybrid_direct_map.h
@@ -153,7 +153,7 @@
   CopyDirectMap(DelayedConstructor<Value>* absl_nullable dest_values) const;
   absl_nullable std::unique_ptr<SlowMap> CopySlowMap() const;
 
-  ABSL_ATTRIBUTE_NORETURN static void KeyNotFound(Key key);
+  [[noreturn]] static void KeyNotFound(Key key);
 
   size_t FirstRawKey() const;
 
@@ -642,7 +642,7 @@
   // Detect building `HybridDirectMap` from a moved-from `src` if possible.
   if constexpr (std::conjunction_v<std::negation<std::is_reference<Src>>,
                                    std::is_move_constructible<Src>>) {
-    ABSL_ATTRIBUTE_UNUSED Src moved = std::forward<Src>(src);
+    [[maybe_unused]] Src moved = std::forward<Src>(src);
   }
 #endif
 }
@@ -957,8 +957,8 @@
 }
 
 template <typename Key, typename Value, typename Traits>
-ABSL_ATTRIBUTE_NORETURN void
-HybridDirectMapImpl<Key, Value, Traits>::KeyNotFound(Key key) {
+[[noreturn]] void HybridDirectMapImpl<Key, Value, Traits>::KeyNotFound(
+    Key key) {
   RIEGELI_CHECK_UNREACHABLE()
       << "HybridDirectMap key not found: " << riegeli::Debug(key);
 }
diff --git a/riegeli/base/initializer.h b/riegeli/base/initializer.h
index cc3be0e..6bbc89f 100644
--- a/riegeli/base/initializer.h
+++ b/riegeli/base/initializer.h
@@ -339,7 +339,7 @@
     // `T` is a reference type here, so `T&&` is the same as `T`.
     return std::move(*this).Construct();
   }
-  T&& Reference(ABSL_ATTRIBUTE_UNUSED TemporaryStorage<T>&& storage) &&
+  T&& Reference(TemporaryStorage<T>&& /*storage*/) &&
       ABSL_ATTRIBUTE_LIFETIME_BOUND {
     return std::move(*this).Reference();
   }
@@ -703,8 +703,7 @@
     : methods_(methods), context_(std::forward<Arg>(arg)) {}
 
 template <typename T>
-T InitializerBase<T>::ConstructMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef context) {
+T InitializerBase<T>::ConstructMethodDefault(TypeErasedRef /*context*/) {
   return T();
 }
 
@@ -734,9 +733,8 @@
 }
 
 template <typename T>
-T&& InitializerBase<T>::ReferenceMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef context,
-    TemporaryStorage<T>&& storage) {
+T&& InitializerBase<T>::ReferenceMethodDefault(TypeErasedRef /*context*/,
+                                               TemporaryStorage<T>&& storage) {
   return std::move(storage).emplace();
 }
 
@@ -775,8 +773,8 @@
 }
 
 template <typename T>
-void InitializerAssignableBase<T>::ResetMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef context, T& dest) {
+void InitializerAssignableBase<T>::ResetMethodDefault(TypeErasedRef /*context*/,
+                                                      T& dest) {
   riegeli::Reset(dest);
 }
 
diff --git a/riegeli/base/memory_estimator.h b/riegeli/base/memory_estimator.h
index b1b4f97..bd46c2b 100644
--- a/riegeli/base/memory_estimator.h
+++ b/riegeli/base/memory_estimator.h
@@ -30,7 +30,6 @@
 #include <variant>
 #include <vector>
 
-#include "absl/base/attributes.h"
 #include "absl/base/nullability.h"
 #include "absl/container/flat_hash_map.h"
 #include "absl/container/flat_hash_set.h"
@@ -247,8 +246,7 @@
   }
   bool RegisterNodeImpl(const void* absl_nullable ptr) override;
   void RegisterUnknownTypeImpl() override {}
-  void RegisterUnknownTypeImpl(
-      ABSL_ATTRIBUTE_UNUSED std::type_index index) override {}
+  void RegisterUnknownTypeImpl(std::type_index /*index*/) override {}
 
  private:
   absl::flat_hash_set<const void*> objects_seen_;
@@ -269,8 +267,7 @@
       delete;
 
  protected:
-  void RegisterDynamicMemoryImpl(ABSL_ATTRIBUTE_UNUSED const void* ptr,
-                                 size_t memory) override {
+  void RegisterDynamicMemoryImpl(const void* /*ptr*/, size_t memory) override {
     RegisterMemory(memory);
   }
   void RegisterDynamicMemoryImpl(size_t memory) override {
@@ -280,8 +277,7 @@
     return ptr != nullptr;
   }
   void RegisterUnknownTypeImpl() override {}
-  void RegisterUnknownTypeImpl(
-      ABSL_ATTRIBUTE_UNUSED std::type_index index) override {}
+  void RegisterUnknownTypeImpl(std::type_index /*index*/) override {}
 };
 
 // A `MemoryEstimator` which can report encountered types for which
@@ -412,7 +408,7 @@
 
 template <typename T, std::enable_if_t<std::is_reference_v<T>, int>>
 inline void MemoryEstimator::RegisterSubobjects(
-    ABSL_ATTRIBUTE_UNUSED const std::remove_reference_t<T>* object) {}
+    const std::remove_reference_t<T>* /*object*/) {}
 
 template <typename Iterator>
 inline void MemoryEstimator::RegisterSubobjects(Iterator begin, Iterator end) {
diff --git a/riegeli/base/moving_dependency.h b/riegeli/base/moving_dependency.h
index 1905c70..6675c5b 100644
--- a/riegeli/base/moving_dependency.h
+++ b/riegeli/base/moving_dependency.h
@@ -104,7 +104,7 @@
                   std::negation<std::is_constructible<Mover, Host&, Host&>>,
                   std::is_constructible<Mover, Host&>>,
               int> = 0>
-Mover MakeMover(Host& self, ABSL_ATTRIBUTE_UNUSED Host& that) {
+Mover MakeMover(Host& self, Host& /*that*/) {
   return Mover(self);
 }
 
@@ -115,8 +115,7 @@
                   std::negation<std::is_constructible<Mover, Host&>>,
                   std::is_default_constructible<Mover>>,
               int> = 0>
-Mover MakeMover(ABSL_ATTRIBUTE_UNUSED Host& self,
-                ABSL_ATTRIBUTE_UNUSED Host& that) {
+Mover MakeMover(Host& /*self*/, Host& /*that*/) {
   return Mover();
 }
 
@@ -148,7 +147,7 @@
               std::conjunction_v<std::negation<HasDoneWithSelf<Mover, Host>>,
                                  HasDoneWithoutSelf<Mover>>,
               int> = 0>
-inline void Done(Mover& mover, ABSL_ATTRIBUTE_UNUSED Host& self) {
+inline void Done(Mover& mover, Host& /*self*/) {
   mover.Done();
 }
 
@@ -157,8 +156,7 @@
               std::conjunction_v<std::negation<HasDoneWithSelf<Mover, Host>>,
                                  std::negation<HasDoneWithoutSelf<Mover>>>,
               int> = 0>
-inline void Done(ABSL_ATTRIBUTE_UNUSED Mover& mover,
-                 ABSL_ATTRIBUTE_UNUSED Host& self) {}
+inline void Done(Mover& /*mover*/, Host& /*self*/) {}
 
 template <typename Enable, typename T, typename... Args>
 struct HasResetImpl : std::false_type {};
@@ -272,17 +270,16 @@
 
   // Required when `Host` uses virtual inheritance.
   template <typename Host>
-  MovingDependency(MovingDependency&& that,
-                   ABSL_ATTRIBUTE_UNUSED Host& this_host,
-                   ABSL_ATTRIBUTE_UNUSED Host& that_host) noexcept
+  MovingDependency(MovingDependency&& that, Host& /*this_host*/,
+                   Host& /*that_host*/) noexcept
       : MovingDependency::Dependency(
             static_cast<typename MovingDependency::Dependency&&>(that)) {}
 
   // Required when `Host` uses virtual inheritance.
   template <typename Host>
-  ABSL_ATTRIBUTE_REINITIALIZES void Reset(
-      MovingDependency&& that, ABSL_ATTRIBUTE_UNUSED Host& this_host,
-      ABSL_ATTRIBUTE_UNUSED Host& that_host) noexcept {
+  ABSL_ATTRIBUTE_REINITIALIZES void Reset(MovingDependency&& that,
+                                          Host& /*this_host*/,
+                                          Host& /*that_host*/) noexcept {
     MovingDependency::Dependency::operator=(
         static_cast<typename MovingDependency::Dependency&&>(that));
   }
diff --git a/riegeli/base/new_aligned.h b/riegeli/base/new_aligned.h
index c95ae9f..9582a2a 100644
--- a/riegeli/base/new_aligned.h
+++ b/riegeli/base/new_aligned.h
@@ -21,7 +21,6 @@
 #include <new>
 #include <utility>
 
-#include "absl/base/attributes.h"
 #include "absl/base/nullability.h"
 #include "absl/numeric/bits.h"
 #include "riegeli/base/arithmetic.h"
@@ -42,8 +41,7 @@
 }
 
 template <>
-inline void EnsureSpaceForObject<void>(
-    ABSL_ATTRIBUTE_UNUSED size_t& num_bytes) {}
+inline void EnsureSpaceForObject<void>(size_t& /*num_bytes*/) {}
 
 template <typename T, typename... Args>
 inline void ConstructObject(T* ptr, Args&&... args) {
@@ -51,7 +49,7 @@
 }
 
 template <>
-inline void ConstructObject(ABSL_ATTRIBUTE_UNUSED void* ptr) {}
+inline void ConstructObject(void* /*ptr*/) {}
 
 template <typename T>
 inline void DestroyObject(T* ptr) {
@@ -59,7 +57,7 @@
 }
 
 template <>
-inline void DestroyObject(ABSL_ATTRIBUTE_UNUSED void* ptr) {}
+inline void DestroyObject(void* /*ptr*/) {}
 
 }  // namespace new_aligned_internal
 
diff --git a/riegeli/base/recycling_pool.h b/riegeli/base/recycling_pool.h
index 3f7df78..57d9cf6 100644
--- a/riegeli/base/recycling_pool.h
+++ b/riegeli/base/recycling_pool.h
@@ -132,7 +132,7 @@
 
   // A refurbisher which does nothing; see `Get()`.
   struct DefaultRefurbisher {
-    void operator()(ABSL_ATTRIBUTE_UNUSED T* ptr) const {}
+    void operator()(T* /*ptr*/) const {}
   };
 
   explicit RecyclingPool(RecyclingPoolOptions options = RecyclingPoolOptions())
@@ -240,7 +240,7 @@
 
   // A refurbisher which does nothing; see `Get()`.
   struct DefaultRefurbisher {
-    void operator()(ABSL_ATTRIBUTE_UNUSED T* ptr) const {}
+    void operator()(T* /*ptr*/) const {}
   };
 
   explicit KeyedRecyclingPool(
diff --git a/riegeli/base/stable_dependency.h b/riegeli/base/stable_dependency.h
index a4100b9..b0ae3b3 100644
--- a/riegeli/base/stable_dependency.h
+++ b/riegeli/base/stable_dependency.h
@@ -261,8 +261,7 @@
 template <typename Handle, typename Manager>
 Dependency<Handle, Manager>&
 StableDependencyDefault<Handle, Manager>::AssumeAllocatedSlow(
-    ABSL_ATTRIBUTE_UNUSED const StableDependencyDefault<Handle, Manager>&
-        self) {
+    const StableDependencyDefault<Handle, Manager>& /*self*/) {
   RIEGELI_ASSUME_UNREACHABLE()
       << "Failed invariant of StableDependency: "
          "dep_ == nullptr but ensure_allocated_ == AssumeAllocatedSlow";
diff --git a/riegeli/base/type_traits.h b/riegeli/base/type_traits.h
index 852d158..976c75c 100644
--- a/riegeli/base/type_traits.h
+++ b/riegeli/base/type_traits.h
@@ -23,7 +23,6 @@
 #include <type_traits>
 #include <utility>
 
-#include "absl/base/attributes.h"
 #include "absl/base/nullability.h"
 #include "absl/strings/string_view.h"
 #include "absl/utility/utility.h"  // IWYU pragma: keep
@@ -144,7 +143,7 @@
 // `std::index_sequence`.
 template <typename Tuple, size_t... indices>
 std::tuple<std::tuple_element_t<indices, Tuple>...> SelectFromTuple(
-    ABSL_ATTRIBUTE_UNUSED Tuple&& tuple, std::index_sequence<indices...>) {
+    [[maybe_unused]] Tuple&& tuple, std::index_sequence<indices...>) {
   return {std::forward<std::tuple_element_t<indices, Tuple>>(
       std::get<indices>(tuple))...};
 }
diff --git a/riegeli/bytes/backward_writer.h b/riegeli/bytes/backward_writer.h
index 7aa7ff1..19a286a 100644
--- a/riegeli/bytes/backward_writer.h
+++ b/riegeli/bytes/backward_writer.h
@@ -345,7 +345,7 @@
 
   // Implementation of `SetWriteSizeHint()`.
   virtual void SetWriteSizeHintImpl(
-      ABSL_ATTRIBUTE_UNUSED std::optional<Position> write_size_hint) {}
+      std::optional<Position> /*write_size_hint*/) {}
 
   // Implementation of the slow part of `Push()`.
   //
diff --git a/riegeli/bytes/cfile_handle.cc b/riegeli/bytes/cfile_handle.cc
index 69a5b53..6cdb7d3 100644
--- a/riegeli/bytes/cfile_handle.cc
+++ b/riegeli/bytes/cfile_handle.cc
@@ -31,7 +31,6 @@
 #endif
 #include <utility>
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/status/status.h"
 #include "absl/strings/str_cat.h"
@@ -53,23 +52,19 @@
 
 }  // namespace cfile_internal
 
-FILE* CFileHandle::GetMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
+FILE* CFileHandle::GetMethodDefault(TypeErasedRef /*target*/) {
   return nullptr;
 }
 
-bool CFileHandle::IsOwningMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
+bool CFileHandle::IsOwningMethodDefault(TypeErasedRef /*target*/) {
   return false;
 }
 
-absl::string_view CFileHandle::FilenameMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
+absl::string_view CFileHandle::FilenameMethodDefault(TypeErasedRef /*target*/) {
   return kDefaultFilename;
 }
 
-absl::Status CFileHandle::CloseMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
+absl::Status CFileHandle::CloseMethodDefault(TypeErasedRef /*target*/) {
   return absl::OkStatus();
 }
 
diff --git a/riegeli/bytes/cfile_handle.h b/riegeli/bytes/cfile_handle.h
index 71999c0..091390d 100644
--- a/riegeli/bytes/cfile_handle.h
+++ b/riegeli/bytes/cfile_handle.h
@@ -324,7 +324,7 @@
     CFileDeleterBase::operator=(that);
   }
 
-  static void Destroy(ABSL_ATTRIBUTE_UNUSED FILE* file) {}
+  static void Destroy(FILE* /*file*/) {}
 };
 
 class OwnedCFileDeleter : public CFileDeleterBase {
diff --git a/riegeli/bytes/cfile_writer.h b/riegeli/bytes/cfile_writer.h
index 6ff2abb..dfa34ab 100644
--- a/riegeli/bytes/cfile_writer.h
+++ b/riegeli/bytes/cfile_writer.h
@@ -597,7 +597,7 @@
   switch (flush_type) {
     case FlushType::kFromObject:
       if (!dest_.IsOwning() || !dest_.get().IsOwning()) return true;
-      ABSL_FALLTHROUGH_INTENDED;
+      [[fallthrough]];
     case FlushType::kFromProcess:
     case FlushType::kFromMachine:
       if (ABSL_PREDICT_FALSE(fflush(dest_.get().get()) != 0)) {
diff --git a/riegeli/bytes/cord_reader.h b/riegeli/bytes/cord_reader.h
index 115e792..2b27699 100644
--- a/riegeli/bytes/cord_reader.h
+++ b/riegeli/bytes/cord_reader.h
@@ -217,7 +217,7 @@
  public:
   static auto member() { return &CordReader::src_; }
 
-  explicit Mover(CordReader& self, ABSL_ATTRIBUTE_UNUSED CordReader& that)
+  explicit Mover(CordReader& self, [[maybe_unused]] CordReader& that)
       : behind_scratch_(&self),
         uses_buffer_(self.start() != nullptr),
         position_(IntCast<size_t>(self.start_pos())),
diff --git a/riegeli/bytes/fd_handle.cc b/riegeli/bytes/fd_handle.cc
index c1e6c1a..6b1d3e1 100644
--- a/riegeli/bytes/fd_handle.cc
+++ b/riegeli/bytes/fd_handle.cc
@@ -34,7 +34,6 @@
 #include <utility>
 #endif
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/status/status.h"
 #include "absl/strings/str_cat.h"
@@ -55,22 +54,15 @@
 
 }  // namespace fd_internal
 
-int FdHandle::GetMethodDefault(ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
-  return -1;
-}
+int FdHandle::GetMethodDefault(TypeErasedRef /*target*/) { return -1; }
 
-bool FdHandle::IsOwningMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
-  return false;
-}
+bool FdHandle::IsOwningMethodDefault(TypeErasedRef /*target*/) { return false; }
 
-absl::string_view FdHandle::FilenameMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
+absl::string_view FdHandle::FilenameMethodDefault(TypeErasedRef /*target*/) {
   return kDefaultFilename;
 }
 
-absl::Status FdHandle::CloseMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
+absl::Status FdHandle::CloseMethodDefault(TypeErasedRef /*target*/) {
   return absl::OkStatus();
 }
 
diff --git a/riegeli/bytes/fd_handle.h b/riegeli/bytes/fd_handle.h
index a8fbf68..ba6259d 100644
--- a/riegeli/bytes/fd_handle.h
+++ b/riegeli/bytes/fd_handle.h
@@ -355,7 +355,7 @@
   // Supports creating an `UnownedFd` converted from any `FdBase`.
   void Reset(const FdDeleterBase& that) { FdDeleterBase::operator=(that); }
 
-  static void Destroy(ABSL_ATTRIBUTE_UNUSED int fd) {}
+  static void Destroy(int /*fd*/) {}
 };
 
 class OwnedFdDeleter : public FdDeleterBase {
diff --git a/riegeli/bytes/fd_mmap_reader.cc b/riegeli/bytes/fd_mmap_reader.cc
index 6028d4d..2d736e0 100644
--- a/riegeli/bytes/fd_mmap_reader.cc
+++ b/riegeli/bytes/fd_mmap_reader.cc
@@ -61,7 +61,6 @@
 #endif
 #include <utility>
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/status/status.h"
 #ifndef _WIN32
@@ -143,8 +142,8 @@
     : std::true_type {};
 
 template <typename DependentInt>
-inline void FdSetReadAllHint(ABSL_ATTRIBUTE_UNUSED DependentInt src,
-                             ABSL_ATTRIBUTE_UNUSED bool read_all_hint) {
+inline void FdSetReadAllHint([[maybe_unused]] DependentInt src,
+                             [[maybe_unused]] bool read_all_hint) {
   if constexpr (HavePosixFadvise<DependentInt>::value) {
 #ifdef POSIX_FADV_SEQUENTIAL
     posix_fadvise(src, 0, 0,
@@ -169,7 +168,7 @@
   void operator()(absl::string_view data) const;
 
   // Supports `ExternalRef` and `Chain::Block`.
-  friend void RiegeliDumpStructure(ABSL_ATTRIBUTE_UNUSED const MMapBlock* self,
+  friend void RiegeliDumpStructure(const MMapBlock* /*self*/,
                                    std::ostream& dest) {
     dest << "[mmap] { }";
   }
diff --git a/riegeli/bytes/fd_reader.cc b/riegeli/bytes/fd_reader.cc
index 77bab48..8b5ad5a 100644
--- a/riegeli/bytes/fd_reader.cc
+++ b/riegeli/bytes/fd_reader.cc
@@ -59,7 +59,6 @@
 #endif
 #include <utility>
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/numeric/bits.h"
 #include "absl/status/status.h"
@@ -147,8 +146,8 @@
     : std::true_type {};
 
 template <typename DependentInt>
-inline void FdSetReadAllHint(ABSL_ATTRIBUTE_UNUSED DependentInt src,
-                             ABSL_ATTRIBUTE_UNUSED bool read_all_hint) {
+inline void FdSetReadAllHint([[maybe_unused]] DependentInt src,
+                             [[maybe_unused]] bool read_all_hint) {
   if constexpr (HavePosixFadvise<DependentInt>::value) {
 #ifdef POSIX_FADV_SEQUENTIAL
     posix_fadvise(src, 0, 0,
diff --git a/riegeli/bytes/fd_reader.h b/riegeli/bytes/fd_reader.h
index a660d04..24214bc 100644
--- a/riegeli/bytes/fd_reader.h
+++ b/riegeli/bytes/fd_reader.h
@@ -112,7 +112,7 @@
     // `set_text()` affects `mode()`.
     //
     // Default: `false`.
-    Options& set_text(ABSL_ATTRIBUTE_UNUSED bool text) &
+    Options& set_text([[maybe_unused]] bool text) &
         ABSL_ATTRIBUTE_LIFETIME_BOUND {
 #ifdef _WIN32
       mode_ =
diff --git a/riegeli/bytes/fd_writer.h b/riegeli/bytes/fd_writer.h
index 48f3009..decc4f6 100644
--- a/riegeli/bytes/fd_writer.h
+++ b/riegeli/bytes/fd_writer.h
@@ -253,7 +253,7 @@
     // `set_text()` affects `mode()`.
     //
     // Default: `false`.
-    Options& set_text(ABSL_ATTRIBUTE_UNUSED bool text) &
+    Options& set_text([[maybe_unused]] bool text) &
         ABSL_ATTRIBUTE_LIFETIME_BOUND {
 #ifdef _WIN32
       mode_ =
diff --git a/riegeli/bytes/ostream_writer.h b/riegeli/bytes/ostream_writer.h
index 2208502..56acbf2 100644
--- a/riegeli/bytes/ostream_writer.h
+++ b/riegeli/bytes/ostream_writer.h
@@ -319,7 +319,7 @@
   switch (flush_type) {
     case FlushType::kFromObject:
       if (!dest_.IsOwning()) return true;
-      ABSL_FALLTHROUGH_INTENDED;
+      [[fallthrough]];
     case FlushType::kFromProcess:
     case FlushType::kFromMachine:
       errno = 0;
diff --git a/riegeli/bytes/path_ref.h b/riegeli/bytes/path_ref.h
index 0b00245..8291cbd 100644
--- a/riegeli/bytes/path_ref.h
+++ b/riegeli/bytes/path_ref.h
@@ -97,9 +97,9 @@
       typename DependentPath = std::filesystem::path,
       std::enable_if_t<std::is_same_v<typename DependentPath::value_type, char>,
                        int> = 0>
-  /*implicit*/ PathRef(
-      const std::filesystem::path& path ABSL_ATTRIBUTE_LIFETIME_BOUND,
-      ABSL_ATTRIBUTE_UNUSED TemporaryStorage<std::string>&& storage)
+  /*implicit*/ PathRef(const std::filesystem::path& path
+                           ABSL_ATTRIBUTE_LIFETIME_BOUND,
+                       TemporaryStorage<std::string>&& /*storage*/)
       : PathRef(path) {}
 
   // For `std::filesystem::path` with `value_type = wchar_t`, stores a reference
diff --git a/riegeli/bytes/reader.h b/riegeli/bytes/reader.h
index 40fb2f0..e5561df 100644
--- a/riegeli/bytes/reader.h
+++ b/riegeli/bytes/reader.h
@@ -514,7 +514,7 @@
   virtual void VerifyEndImpl();
 
   // Implementation of `SetReadAllHint()`.
-  virtual void SetReadAllHintImpl(ABSL_ATTRIBUTE_UNUSED bool read_all_hint) {}
+  virtual void SetReadAllHintImpl(bool /*read_all_hint*/) {}
 
   // Implementation of the slow part of `Pull()`.
   //
diff --git a/riegeli/bytes/stringify.h b/riegeli/bytes/stringify.h
index 1402668..b8019cc 100644
--- a/riegeli/bytes/stringify.h
+++ b/riegeli/bytes/stringify.h
@@ -59,9 +59,9 @@
 //
 // There is no need to define `RiegeliStringifiedSize()` for types convertible
 // to `BytesRef`, even if they support `AbslStringify()`.
-inline Position StringifiedSize(ABSL_ATTRIBUTE_UNUSED char src) { return 1; }
+inline Position StringifiedSize(char /*src*/) { return 1; }
 #if __cpp_char8_t
-inline Position StringifiedSize(ABSL_ATTRIBUTE_UNUSED char8_t src) { return 1; }
+inline Position StringifiedSize(char8_t /*src*/) { return 1; }
 #endif
 inline Position StringifiedSize(BytesRef src) { return src.size(); }
 ABSL_ATTRIBUTE_ALWAYS_INLINE inline Position StringifiedSize(const char* src) {
diff --git a/riegeli/bytes/write.h b/riegeli/bytes/write.h
index ba0116b..f2792fa 100644
--- a/riegeli/bytes/write.h
+++ b/riegeli/bytes/write.h
@@ -69,7 +69,7 @@
 
 template <typename... Srcs, typename Dest>
 ABSL_ATTRIBUTE_ALWAYS_INLINE inline absl::Status WriteInternal(
-    ABSL_ATTRIBUTE_UNUSED std::tuple<Srcs...> srcs, Dest&& dest) {
+    [[maybe_unused]] std::tuple<Srcs...> srcs, Dest&& dest) {
   DependencyRef<Writer*, Dest> dest_dep(std::forward<Dest>(dest));
   if constexpr (HasStringifiedSize<Srcs...>::value) {
     if (dest_dep.IsOwning()) {
@@ -96,7 +96,7 @@
 
 template <typename... Srcs, typename Dest>
 ABSL_ATTRIBUTE_ALWAYS_INLINE inline absl::Status BackwardWriteInternal(
-    ABSL_ATTRIBUTE_UNUSED std::tuple<Srcs...> srcs, Dest&& dest) {
+    [[maybe_unused]] std::tuple<Srcs...> srcs, Dest&& dest) {
   DependencyRef<BackwardWriter*, Dest> dest_dep(std::forward<Dest>(dest));
   if constexpr (HasStringifiedSize<Srcs...>::value) {
     if (dest_dep.IsOwning()) {
diff --git a/riegeli/bytes/writer.h b/riegeli/bytes/writer.h
index c7087c9..2ee245a 100644
--- a/riegeli/bytes/writer.h
+++ b/riegeli/bytes/writer.h
@@ -431,7 +431,7 @@
 
   // Implementation of `SetWriteSizeHint()`.
   virtual void SetWriteSizeHintImpl(
-      ABSL_ATTRIBUTE_UNUSED std::optional<Position> write_size_hint) {}
+      std::optional<Position> /*write_size_hint*/) {}
 
   // Implementation of the slow part of `Push()`.
   //
diff --git a/riegeli/chunk_encoding/brotli_encoder_selection.cc b/riegeli/chunk_encoding/brotli_encoder_selection.cc
index d4c936a..ad90e3b 100644
--- a/riegeli/chunk_encoding/brotli_encoder_selection.cc
+++ b/riegeli/chunk_encoding/brotli_encoder_selection.cc
@@ -32,7 +32,7 @@
 
 ABSL_ATTRIBUTE_WEAK std::unique_ptr<Writer> NewBrotliWriter(
     Chain* compressed, const CompressorOptions& compressor_options,
-    ABSL_ATTRIBUTE_UNUSED const RecyclingPoolOptions& recycling_pool_options) {
+    const RecyclingPoolOptions& /*recycling_pool_options*/) {
   switch (compressor_options.brotli_encoder()) {
     case BrotliEncoder::kRBrotliOrCBrotli:
     case BrotliEncoder::kCBrotli:
diff --git a/riegeli/csv/csv_reader.cc b/riegeli/csv/csv_reader.cc
index 7d0df78..d467f8c 100644
--- a/riegeli/csv/csv_reader.cc
+++ b/riegeli/csv/csv_reader.cc
@@ -23,7 +23,6 @@
 #include <utility>
 #include <vector>
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/status/status.h"
 #include "absl/strings/str_cat.h"
@@ -433,7 +432,7 @@
           return Fail(absl::InvalidArgumentError("Missing LF after CR"));
         }
         src.move_cursor(1);
-        ABSL_FALLTHROUGH_INTENDED;
+        [[fallthrough]];
       case CharClass::kLf:
         ++line_number_;
         if (skip_empty_lines_ && field_index == 0 && field.empty()) {
@@ -482,7 +481,7 @@
               return Fail(absl::InvalidArgumentError("Missing LF after CR"));
             }
             src.move_cursor(1);
-            ABSL_FALLTHROUGH_INTENDED;
+            [[fallthrough]];
           case CharClass::kLf:
             ++line_number_;
             if (ABSL_PREDICT_FALSE(standalone_record_)) {
@@ -630,7 +629,7 @@
           return false;
         }
         if (ABSL_PREDICT_FALSE(*src.cursor() != '\n')) return false;
-        ABSL_FALLTHROUGH_INTENDED;
+        [[fallthrough]];
       case CharClass::kLf:
         if (skip_empty_lines_) {
           ++line_number_;
diff --git a/riegeli/digests/digester_handle.cc b/riegeli/digests/digester_handle.cc
index 146a6dd..92e2f16 100644
--- a/riegeli/digests/digester_handle.cc
+++ b/riegeli/digests/digester_handle.cc
@@ -18,7 +18,6 @@
 
 #include <optional>
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/status/status.h"
 #include "absl/strings/cord.h"
@@ -38,40 +37,33 @@
 }
 
 void DigesterBaseHandle::SetWriteSizeHintMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target,
-    ABSL_ATTRIBUTE_UNUSED std::optional<Position> write_size_hint) {}
+    TypeErasedRef /*target*/, std::optional<Position> /*write_size_hint*/) {}
 
-bool DigesterBaseHandle::WriteMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target,
-    ABSL_ATTRIBUTE_UNUSED absl::string_view src) {
+bool DigesterBaseHandle::WriteMethodDefault(TypeErasedRef /*target*/,
+                                            absl::string_view /*src*/) {
   return true;
 }
 
-bool DigesterBaseHandle::WriteChainMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target,
-    ABSL_ATTRIBUTE_UNUSED const Chain& src) {
+bool DigesterBaseHandle::WriteChainMethodDefault(TypeErasedRef /*target*/,
+                                                 const Chain& /*src*/) {
   return true;
 }
 
-bool DigesterBaseHandle::WriteCordMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target,
-    ABSL_ATTRIBUTE_UNUSED const absl::Cord& src) {
+bool DigesterBaseHandle::WriteCordMethodDefault(TypeErasedRef /*target*/,
+                                                const absl::Cord& /*src*/) {
   return true;
 }
 
-bool DigesterBaseHandle::WriteByteFillMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target,
-    ABSL_ATTRIBUTE_UNUSED ByteFill src) {
+bool DigesterBaseHandle::WriteByteFillMethodDefault(TypeErasedRef /*target*/,
+                                                    ByteFill /*src*/) {
   return true;
 }
 
-bool DigesterBaseHandle::CloseMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
+bool DigesterBaseHandle::CloseMethodDefault(TypeErasedRef /*target*/) {
   return true;
 }
 
-absl::Status DigesterBaseHandle::StatusMethodDefault(
-    ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
+absl::Status DigesterBaseHandle::StatusMethodDefault(TypeErasedRef /*target*/) {
   return absl::OkStatus();
 }
 
diff --git a/riegeli/digests/digester_handle.h b/riegeli/digests/digester_handle.h
index 91763a2..20b84bf 100644
--- a/riegeli/digests/digester_handle.h
+++ b/riegeli/digests/digester_handle.h
@@ -222,7 +222,7 @@
   absl::Status status() const { return methods()->status(target()); }
 
  protected:
-  ABSL_ATTRIBUTE_NORETURN static void FailedDigestMethodDefault();
+  [[noreturn]] static void FailedDigestMethodDefault();
 
  private:
   template <typename Function,
@@ -521,8 +521,7 @@
       T, std::void_t<decltype(std::declval<T&>().Digest())>> : std::true_type {
   };
 
-  static DigestType DigestMethodDefault(
-      ABSL_ATTRIBUTE_UNUSED TypeErasedRef target) {
+  static DigestType DigestMethodDefault(TypeErasedRef /*target*/) {
     if constexpr (!std::is_void_v<DigestType>) FailedDigestMethodDefault();
   }
 
diff --git a/riegeli/gcs/gcs_internal.h b/riegeli/gcs/gcs_internal.h
index a2c1c80..ba174e0 100644
--- a/riegeli/gcs/gcs_internal.h
+++ b/riegeli/gcs/gcs_internal.h
@@ -15,7 +15,6 @@
 #ifndef RIEGELI_GCS_GCS_INTERNAL_H_
 #define RIEGELI_GCS_GCS_INTERNAL_H_
 
-#include "absl/base/attributes.h"
 #include "absl/status/status.h"
 #include "google/cloud/status.h"
 
@@ -35,19 +34,17 @@
   return option;
 }
 template <typename T, typename... Options>
-const T& GetOption(ABSL_ATTRIBUTE_UNUSED const T& previous_option,
-                   const T& option, const Options&... options) {
-  return GetOption<T>(option, options...);
-}
-template <typename T, typename Other, typename... Options>
-const T& GetOption(const T& option,
-                   ABSL_ATTRIBUTE_UNUSED const Other& other_option,
+const T& GetOption(const T& /*previous_option*/, const T& option,
                    const Options&... options) {
   return GetOption<T>(option, options...);
 }
 template <typename T, typename Other, typename... Options>
-auto GetOption(ABSL_ATTRIBUTE_UNUSED const Other& other_option,
-               const Options&... options) {
+const T& GetOption(const T& option, const Other& /*other_option*/,
+                   const Options&... options) {
+  return GetOption<T>(option, options...);
+}
+template <typename T, typename Other, typename... Options>
+auto GetOption(const Other& /*other_option*/, const Options&... options) {
   return GetOption<T>(options...);
 }
 
diff --git a/riegeli/lines/line_writing.h b/riegeli/lines/line_writing.h
index 3a9e16b..cd49723 100644
--- a/riegeli/lines/line_writing.h
+++ b/riegeli/lines/line_writing.h
@@ -93,7 +93,7 @@
 
 template <typename... Srcs>
 ABSL_ATTRIBUTE_ALWAYS_INLINE inline bool WriteLineInternal(
-    ABSL_ATTRIBUTE_UNUSED std::tuple<Srcs...> srcs, Writer& dest,
+    [[maybe_unused]] std::tuple<Srcs...> srcs, Writer& dest,
     WriteLineOptions options) {
   if (ABSL_PREDICT_FALSE(!std::apply(
           [&](Srcs&&... srcs) {
diff --git a/riegeli/lines/text_reader.h b/riegeli/lines/text_reader.h
index 2ed9e7f..c9aaabf 100644
--- a/riegeli/lines/text_reader.h
+++ b/riegeli/lines/text_reader.h
@@ -271,8 +271,8 @@
 }
 
 template <typename Src>
-inline TextReader<ReadNewline::kLf, Src>::TextReader(
-    Initializer<Src> src, ABSL_ATTRIBUTE_UNUSED Options options)
+inline TextReader<ReadNewline::kLf, Src>::TextReader(Initializer<Src> src,
+                                                     Options /*options*/)
     : TextReader::PrefixLimitingReader(std::move(src)) {}
 
 template <typename Src>
@@ -281,8 +281,8 @@
 }
 
 template <typename Src>
-inline void TextReader<ReadNewline::kLf, Src>::Reset(
-    Initializer<Src> src, ABSL_ATTRIBUTE_UNUSED Options options) {
+inline void TextReader<ReadNewline::kLf, Src>::Reset(Initializer<Src> src,
+                                                     Options /*options*/) {
   TextReader::PrefixLimitingReader::Reset(std::move(src));
 }
 
diff --git a/riegeli/lines/text_writer.h b/riegeli/lines/text_writer.h
index 33762be..55286ef 100644
--- a/riegeli/lines/text_writer.h
+++ b/riegeli/lines/text_writer.h
@@ -246,8 +246,8 @@
 }
 
 template <typename Dest>
-inline TextWriter<WriteNewline::kLf, Dest>::TextWriter(
-    Initializer<Dest> dest, ABSL_ATTRIBUTE_UNUSED Options options)
+inline TextWriter<WriteNewline::kLf, Dest>::TextWriter(Initializer<Dest> dest,
+                                                       Options /*options*/)
     : TextWriter::PrefixLimitingWriter(std::move(dest)) {}
 
 template <typename Dest>
@@ -256,8 +256,8 @@
 }
 
 template <typename Dest>
-inline void TextWriter<WriteNewline::kLf, Dest>::Reset(
-    Initializer<Dest> dest, ABSL_ATTRIBUTE_UNUSED Options options) {
+inline void TextWriter<WriteNewline::kLf, Dest>::Reset(Initializer<Dest> dest,
+                                                       Options /*options*/) {
   TextWriter::PrefixLimitingWriter::Reset(std::move(dest));
 }
 
diff --git a/riegeli/messages/field_copier.h b/riegeli/messages/field_copier.h
index 58243db..0f7cb4f 100644
--- a/riegeli/messages/field_copier.h
+++ b/riegeli/messages/field_copier.h
@@ -166,9 +166,9 @@
       std::enable_if_t<(dependent_wire_types & WireTypeSet::kLengthDelimited) ==
                            WireTypeSet::kLengthDelimited,
                        int> = 0>
-  absl::Status HandleLengthDelimitedFromCord(
-      CordIteratorSpan repr, ABSL_ATTRIBUTE_UNUSED std::string& scratch,
-      Context&... context) const {
+  absl::Status HandleLengthDelimitedFromCord(CordIteratorSpan repr,
+                                             std::string& /*scratch*/,
+                                             Context&... context) const {
     return message_writer(context...)
         .WriteString(field_number, std::move(repr));
   }
@@ -297,9 +297,10 @@
       std::enable_if_t<(dependent_wire_types & WireTypeSet::kLengthDelimited) ==
                            WireTypeSet::kLengthDelimited,
                        int> = 0>
-  absl::Status DynamicHandleLengthDelimitedFromCord(
-      int field_number, CordIteratorSpan repr,
-      ABSL_ATTRIBUTE_UNUSED std::string& scratch, Context&... context) const {
+  absl::Status DynamicHandleLengthDelimitedFromCord(int field_number,
+                                                    CordIteratorSpan repr,
+                                                    std::string& /*scratch*/,
+                                                    Context&... context) const {
     return message_writer(context...)
         .WriteString(field_number, std::move(repr));
   }
@@ -420,9 +421,9 @@
       std::enable_if_t<(dependent_wire_types & WireTypeSet::kLengthDelimited) ==
                            WireTypeSet::kLengthDelimited,
                        int> = 0>
-  absl::Status HandleLengthDelimitedFromCord(
-      CordIteratorSpan repr, ABSL_ATTRIBUTE_UNUSED std::string& scratch,
-      Context&... context) const {
+  absl::Status HandleLengthDelimitedFromCord(CordIteratorSpan repr,
+                                             std::string& /*scratch*/,
+                                             Context&... context) const {
     return message_writer(context...)
         .WriteString(field_number_, std::move(repr));
   }
diff --git a/riegeli/messages/field_handlers.h b/riegeli/messages/field_handlers.h
index 00080ec..8eebcd8 100644
--- a/riegeli/messages/field_handlers.h
+++ b/riegeli/messages/field_handlers.h
@@ -983,7 +983,7 @@
               std::is_invocable_v<const Action&, Value, Context&...>, int>>
 absl::Status OnRepeatedVarintType<Value, kind, field_number, Action>::
     HandleLengthDelimitedFromCord(CordIteratorSpan repr,
-                                  ABSL_ATTRIBUTE_UNUSED std::string& scratch,
+                                  std::string& /*scratch*/,
                                   Context&... context) const {
   if (const absl::string_view chunk =
           absl::Cord::ChunkRemaining(repr.iterator());
@@ -1094,7 +1094,7 @@
               std::is_invocable_v<const Action&, Value, Context&...>, int>>
 absl::Status
 OnRepeatedFixedType<Value, field_number, Action>::HandleLengthDelimitedFromCord(
-    CordIteratorSpan repr, ABSL_ATTRIBUTE_UNUSED std::string& scratch,
+    CordIteratorSpan repr, std::string& /*scratch*/,
     Context&... context) const {
   if (ABSL_PREDICT_FALSE(repr.length() % sizeof(Value) > 0)) {
     return field_handlers_internal::ReadPackedFixedError<sizeof(Value)>();
diff --git a/riegeli/messages/fields_found.h b/riegeli/messages/fields_found.h
index 1953e58..b10c899 100644
--- a/riegeli/messages/fields_found.h
+++ b/riegeli/messages/fields_found.h
@@ -750,7 +750,7 @@
 template <int field_number>
 struct FieldTrackerActionWrapper {
   template <typename Action, typename Skip, typename... Context>
-  absl::Status operator()(Action&& action, ABSL_ATTRIBUTE_UNUSED Skip&& skip,
+  absl::Status operator()(Action&& action, Skip&& /*skip*/,
                           Context&... context) const {
     if (absl::Status status = std::forward<Action>(action)();
         ABSL_PREDICT_FALSE(!status.ok())) {
diff --git a/riegeli/messages/serialized_message_assembler.cc b/riegeli/messages/serialized_message_assembler.cc
index fb5d929..2535e92 100644
--- a/riegeli/messages/serialized_message_assembler.cc
+++ b/riegeli/messages/serialized_message_assembler.cc
@@ -20,7 +20,6 @@
 #include <string>
 #include <utility>
 
-#include "absl/base/attributes.h"
 #include "absl/base/nullability.h"
 #include "absl/base/optimization.h"
 #include "absl/container/inlined_vector.h"
@@ -151,12 +150,11 @@
 struct SerializedMessageAssembler::LeafHandler {
   static constexpr int kFieldNumber = kUnboundFieldNumber;
 
-  absl::Status HandleVarint(
-      uint64_t repr,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<FieldValues> fields_to_add,
-      absl::Span<const bool> fields_to_remove,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<bool> submessages_rewritten,
-      SerializedMessageWriter& message_writer) const {
+  absl::Status HandleVarint(uint64_t repr,
+                            absl::Span<FieldValues> /*fields_to_add*/,
+                            absl::Span<const bool> fields_to_remove,
+                            absl::Span<bool> /*submessages_rewritten*/,
+                            SerializedMessageWriter& message_writer) const {
     if (field_for_remove.raw < fields_to_remove.size() &&
         fields_to_remove[field_for_remove.raw]) {
       return absl::OkStatus();
@@ -164,12 +162,11 @@
     return message_writer.WriteUInt64(field_number, repr);
   }
 
-  absl::Status HandleFixed32(
-      uint32_t repr,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<FieldValues> fields_to_add,
-      absl::Span<const bool> fields_to_remove,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<bool> submessages_rewritten,
-      SerializedMessageWriter& message_writer) const {
+  absl::Status HandleFixed32(uint32_t repr,
+                             absl::Span<FieldValues> /*fields_to_add*/,
+                             absl::Span<const bool> fields_to_remove,
+                             absl::Span<bool> /*submessages_rewritten*/,
+                             SerializedMessageWriter& message_writer) const {
     if (field_for_remove.raw < fields_to_remove.size() &&
         fields_to_remove[field_for_remove.raw]) {
       return absl::OkStatus();
@@ -177,12 +174,11 @@
     return message_writer.WriteFixed32(field_number, repr);
   }
 
-  absl::Status HandleFixed64(
-      uint64_t repr,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<FieldValues> fields_to_add,
-      absl::Span<const bool> fields_to_remove,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<bool> submessages_rewritten,
-      SerializedMessageWriter& message_writer) const {
+  absl::Status HandleFixed64(uint64_t repr,
+                             absl::Span<FieldValues> /*fields_to_add*/,
+                             absl::Span<const bool> fields_to_remove,
+                             absl::Span<bool> /*submessages_rewritten*/,
+                             SerializedMessageWriter& message_writer) const {
     if (field_for_remove.raw < fields_to_remove.size() &&
         fields_to_remove[field_for_remove.raw]) {
       return absl::OkStatus();
@@ -191,10 +187,9 @@
   }
 
   absl::Status HandleLengthDelimitedFromReader(
-      ReaderSpan<> repr,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<FieldValues> fields_to_add,
+      ReaderSpan<> repr, absl::Span<FieldValues> /*fields_to_add*/,
       absl::Span<const bool> fields_to_remove,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<bool> submessages_rewritten,
+      absl::Span<bool> /*submessages_rewritten*/,
       SerializedMessageWriter& message_writer) const {
     if (field_for_remove.raw < fields_to_remove.size() &&
         fields_to_remove[field_for_remove.raw]) {
@@ -204,10 +199,10 @@
   }
 
   absl::Status HandleLengthDelimitedFromCord(
-      CordIteratorSpan repr, ABSL_ATTRIBUTE_UNUSED std::string& scratch,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<FieldValues> fields_to_add,
+      CordIteratorSpan repr, std::string& /*scratch*/,
+      absl::Span<FieldValues> /*fields_to_add*/,
       absl::Span<const bool> fields_to_remove,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<bool> submessages_rewritten,
+      absl::Span<bool> /*submessages_rewritten*/,
       SerializedMessageWriter& message_writer) const {
     if (field_for_remove.raw < fields_to_remove.size() &&
         fields_to_remove[field_for_remove.raw]) {
@@ -217,10 +212,9 @@
   }
 
   absl::Status HandleLengthDelimitedFromString(
-      absl::string_view repr,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<FieldValues> fields_to_add,
+      absl::string_view repr, absl::Span<FieldValues> /*fields_to_add*/,
       absl::Span<const bool> fields_to_remove,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<bool> submessages_rewritten,
+      absl::Span<bool> /*submessages_rewritten*/,
       SerializedMessageWriter& message_writer) const {
     if (field_for_remove.raw < fields_to_remove.size() &&
         fields_to_remove[field_for_remove.raw]) {
@@ -229,11 +223,10 @@
     return message_writer.WriteString(field_number, repr);
   }
 
-  absl::Status HandleBeginGroup(
-      ABSL_ATTRIBUTE_UNUSED absl::Span<FieldValues> fields_to_add,
-      absl::Span<const bool> fields_to_remove,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<bool> submessages_rewritten,
-      SerializedMessageWriter& message_writer) const {
+  absl::Status HandleBeginGroup(absl::Span<FieldValues> /*fields_to_add*/,
+                                absl::Span<const bool> fields_to_remove,
+                                absl::Span<bool> /*submessages_rewritten*/,
+                                SerializedMessageWriter& message_writer) const {
     if (field_for_remove.raw < fields_to_remove.size() &&
         fields_to_remove[field_for_remove.raw]) {
       return absl::OkStatus();
@@ -241,11 +234,10 @@
     return message_writer.OpenGroup(field_number);
   }
 
-  absl::Status HandleEndGroup(
-      ABSL_ATTRIBUTE_UNUSED absl::Span<FieldValues> fields_to_add,
-      absl::Span<const bool> fields_to_remove,
-      ABSL_ATTRIBUTE_UNUSED absl::Span<bool> submessages_rewritten,
-      SerializedMessageWriter& message_writer) const {
+  absl::Status HandleEndGroup(absl::Span<FieldValues> /*fields_to_add*/,
+                              absl::Span<const bool> fields_to_remove,
+                              absl::Span<bool> /*submessages_rewritten*/,
+                              SerializedMessageWriter& message_writer) const {
     if (field_for_remove.raw < fields_to_remove.size() &&
         fields_to_remove[field_for_remove.raw]) {
       return absl::OkStatus();
@@ -281,7 +273,7 @@
   }
 
   absl::Status HandleLengthDelimitedFromCord(
-      CordIteratorSpan repr, ABSL_ATTRIBUTE_UNUSED std::string& scratch,
+      CordIteratorSpan repr, std::string& /*scratch*/,
       absl::Span<FieldValues> fields_to_add,
       absl::Span<const bool> fields_to_remove,
       absl::Span<bool> submessages_rewritten,
diff --git a/riegeli/snappy/framed/framed_snappy_reader.h b/riegeli/snappy/framed/framed_snappy_reader.h
index ef40f7d..ed3632b 100644
--- a/riegeli/snappy/framed/framed_snappy_reader.h
+++ b/riegeli/snappy/framed/framed_snappy_reader.h
@@ -215,8 +215,8 @@
 };
 
 template <typename Src>
-inline FramedSnappyReader<Src>::FramedSnappyReader(
-    Initializer<Src> src, ABSL_ATTRIBUTE_UNUSED Options options)
+inline FramedSnappyReader<Src>::FramedSnappyReader(Initializer<Src> src,
+                                                   Options /*options*/)
     : src_(std::move(src)) {
   Initialize(src_.get());
 }
@@ -228,8 +228,8 @@
 }
 
 template <typename Src>
-inline void FramedSnappyReader<Src>::Reset(
-    Initializer<Src> src, ABSL_ATTRIBUTE_UNUSED Options options) {
+inline void FramedSnappyReader<Src>::Reset(Initializer<Src> src,
+                                           Options /*options*/) {
   FramedSnappyReaderBase::Reset();
   src_.Reset(std::move(src));
   Initialize(src_.get());
diff --git a/riegeli/snappy/hadoop/hadoop_snappy_reader.h b/riegeli/snappy/hadoop/hadoop_snappy_reader.h
index a8f211d..7a9b232 100644
--- a/riegeli/snappy/hadoop/hadoop_snappy_reader.h
+++ b/riegeli/snappy/hadoop/hadoop_snappy_reader.h
@@ -179,8 +179,8 @@
 }
 
 template <typename Src>
-inline HadoopSnappyReader<Src>::HadoopSnappyReader(
-    Initializer<Src> src, ABSL_ATTRIBUTE_UNUSED Options options)
+inline HadoopSnappyReader<Src>::HadoopSnappyReader(Initializer<Src> src,
+                                                   Options /*options*/)
     : src_(std::move(src)) {
   Initialize(src_.get());
 }
@@ -192,8 +192,8 @@
 }
 
 template <typename Src>
-inline void HadoopSnappyReader<Src>::Reset(
-    Initializer<Src> src, ABSL_ATTRIBUTE_UNUSED Options options) {
+inline void HadoopSnappyReader<Src>::Reset(Initializer<Src> src,
+                                           Options /*options*/) {
   HadoopSnappyReaderBase::Reset();
   src_.Reset(std::move(src));
   Initialize(src_.get());
diff --git a/riegeli/snappy/snappy_reader.h b/riegeli/snappy/snappy_reader.h
index 1c4fe5e..463c191 100644
--- a/riegeli/snappy/snappy_reader.h
+++ b/riegeli/snappy/snappy_reader.h
@@ -188,7 +188,7 @@
 
 template <typename Src>
 inline SnappyReader<Src>::SnappyReader(Initializer<Src> src,
-                                       ABSL_ATTRIBUTE_UNUSED Options options)
+                                       Options /*options*/)
     : src_(std::move(src)) {
   Initialize(src_.get());
 }
@@ -201,7 +201,7 @@
 
 template <typename Src>
 inline void SnappyReader<Src>::Reset(Initializer<Src> src,
-                                     ABSL_ATTRIBUTE_UNUSED Options options) {
+                                     Options /*options*/) {
   SnappyReaderBase::Reset();
   src_.Reset(std::move(src));
   Initialize(src_.get());
diff --git a/riegeli/tensorflow/io/file_writer.h b/riegeli/tensorflow/io/file_writer.h
index 2a571d0..14c31ff 100644
--- a/riegeli/tensorflow/io/file_writer.h
+++ b/riegeli/tensorflow/io/file_writer.h
@@ -361,7 +361,7 @@
   switch (flush_type) {
     case FlushType::kFromObject:
       if (!dest_.IsOwning()) return true;
-      ABSL_FALLTHROUGH_INTENDED;
+      [[fallthrough]];
     case FlushType::kFromProcess:
       if (const absl::Status status = dest_->Flush();
           ABSL_PREDICT_FALSE(!status.ok())) {
diff --git a/riegeli/xz/xz_reader.cc b/riegeli/xz/xz_reader.cc
index e9f9653..7ae7837 100644
--- a/riegeli/xz/xz_reader.cc
+++ b/riegeli/xz/xz_reader.cc
@@ -21,7 +21,6 @@
 #include <memory>
 #include <utility>
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/status/status.h"
 #include "absl/strings/str_cat.h"
@@ -183,7 +182,7 @@
     switch (liblzma_code) {
       case LZMA_OK:
         if (length_read >= min_length) break;
-        ABSL_FALLTHROUGH_INTENDED;
+        [[fallthrough]];
       case LZMA_BUF_ERROR:
         if (ABSL_PREDICT_FALSE(decompressor_->avail_in > 0)) {
           RIEGELI_ASSERT_EQ(decompressor_->avail_out, 0u)
diff --git a/riegeli/zlib/zlib_reader.cc b/riegeli/zlib/zlib_reader.cc
index 0678214..1872e8f 100644
--- a/riegeli/zlib/zlib_reader.cc
+++ b/riegeli/zlib/zlib_reader.cc
@@ -22,7 +22,6 @@
 #include <optional>
 #include <utility>
 
-#include "absl/base/attributes.h"
 #include "absl/base/optimization.h"
 #include "absl/status/status.h"
 #include "absl/strings/str_cat.h"
@@ -162,7 +161,7 @@
     switch (zlib_code) {
       case Z_OK:
         if (length_read >= min_length) break;
-        ABSL_FALLTHROUGH_INTENDED;
+        [[fallthrough]];
       case Z_BUF_ERROR:
         if (ABSL_PREDICT_FALSE(z_stream_ptr->avail_in > 0)) {
           RIEGELI_ASSERT_EQ(z_stream_ptr->avail_out, 0u)
@@ -217,7 +216,7 @@
           }
           continue;
         }
-        ABSL_FALLTHROUGH_INTENDED;
+        [[fallthrough]];
       default:
         FailOperation("inflate()", zlib_code);
         break;
@@ -353,7 +352,7 @@
             decompressor->avail_out < 1) {
           return true;
         }
-        ABSL_FALLTHROUGH_INTENDED;
+        [[fallthrough]];
       case Z_BUF_ERROR:
         RIEGELI_ASSERT_EQ(decompressor->avail_in, 0u)
             << "inflate() returned but there are still input data";
diff --git a/riegeli/zstd/zstd_dictionary.h b/riegeli/zstd/zstd_dictionary.h
index 57a4ad7..21c6fa4 100644
--- a/riegeli/zstd/zstd_dictionary.h
+++ b/riegeli/zstd/zstd_dictionary.h
@@ -141,7 +141,7 @@
   struct ZSTD_CDictCache;
 
   struct ZSTD_CDictReleaser {
-    void operator()(ABSL_ATTRIBUTE_UNUSED ZSTD_CDict* ptr) {
+    void operator()(ZSTD_CDict* /*ptr*/) {
       // `*ptr` is owned by `*compression_cache`.
       compression_cache.Reset();
     }