Reland "Replace RTC_WARN_UNUSED_RESULT with ABSL_MUST_USE_RESULT in c++ code"

This is a reland of 8c2250eddc7263036397179a0794b9b17d7afb38

Original change's description:
> Replace RTC_WARN_UNUSED_RESULT with ABSL_MUST_USE_RESULT in c++ code
>
> Bug: webrtc:12336
> Change-Id: If76f00d0883b5c8a90d3ef5554f5e22384b3fb58
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/197620
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32978}

Bug: webrtc:12336
Change-Id: I1cd017d45c1578528dec4532345950e9823f4a63
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201732
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33003}
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 184c298..f6efa8e 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -78,10 +78,12 @@
     "system:arch",
     "system:no_unique_address",
     "system:rtc_export",
-    "system:unused",
     "third_party/base64",
   ]
-  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+  absl_deps = [
+    "//third_party/abseil-cpp/absl/base:core_headers",
+    "//third_party/abseil-cpp/absl/types:optional",
+  ]
   public_deps = []  # no-presubmit-check TODO(webrtc:8603)
 
   sources = [
diff --git a/rtc_base/swap_queue.h b/rtc_base/swap_queue.h
index 9eac49a..3c8149c 100644
--- a/rtc_base/swap_queue.h
+++ b/rtc_base/swap_queue.h
@@ -17,8 +17,8 @@
 #include <utility>
 #include <vector>
 
+#include "absl/base/attributes.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/system/unused.h"
 
 namespace webrtc {
 
@@ -127,7 +127,7 @@
   // When specified, the T given in *input must pass the ItemVerifier() test.
   // The contents of *input after the call are then also guaranteed to pass the
   // ItemVerifier() test.
-  bool Insert(T* input) RTC_WARN_UNUSED_RESULT {
+  ABSL_MUST_USE_RESULT bool Insert(T* input) {
     RTC_DCHECK(input);
 
     RTC_DCHECK(queue_item_verifier_(*input));
@@ -168,7 +168,7 @@
   // empty). When specified, The T given in *output must pass the ItemVerifier()
   // test and the contents of *output after the call are then also guaranteed to
   // pass the ItemVerifier() test.
-  bool Remove(T* output) RTC_WARN_UNUSED_RESULT {
+  ABSL_MUST_USE_RESULT bool Remove(T* output) {
     RTC_DCHECK(output);
 
     RTC_DCHECK(queue_item_verifier_(*output));
diff --git a/rtc_base/synchronization/BUILD.gn b/rtc_base/synchronization/BUILD.gn
index 16922af..6b22b22 100644
--- a/rtc_base/synchronization/BUILD.gn
+++ b/rtc_base/synchronization/BUILD.gn
@@ -36,7 +36,6 @@
     "..:checks",
     "..:macromagic",
     "..:platform_thread_types",
-    "../system:unused",
   ]
   absl_deps = [ "//third_party/abseil-cpp/absl/base:core_headers" ]
   if (rtc_use_absl_mutex) {
diff --git a/rtc_base/synchronization/mutex.h b/rtc_base/synchronization/mutex.h
index 620fe74..0023d90e 100644
--- a/rtc_base/synchronization/mutex.h
+++ b/rtc_base/synchronization/mutex.h
@@ -13,9 +13,9 @@
 
 #include <atomic>
 
+#include "absl/base/attributes.h"
 #include "absl/base/const_init.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/system/unused.h"
 #include "rtc_base/thread_annotations.h"
 
 #if defined(WEBRTC_ABSL_MUTEX)
@@ -41,7 +41,7 @@
   void Lock() RTC_EXCLUSIVE_LOCK_FUNCTION() {
     impl_.Lock();
   }
-  RTC_WARN_UNUSED_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
+  ABSL_MUST_USE_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
     return impl_.TryLock();
   }
   void Unlock() RTC_UNLOCK_FUNCTION() {
diff --git a/rtc_base/synchronization/mutex_abseil.h b/rtc_base/synchronization/mutex_abseil.h
index 4ad1d07..9247065 100644
--- a/rtc_base/synchronization/mutex_abseil.h
+++ b/rtc_base/synchronization/mutex_abseil.h
@@ -11,6 +11,7 @@
 #ifndef RTC_BASE_SYNCHRONIZATION_MUTEX_ABSEIL_H_
 #define RTC_BASE_SYNCHRONIZATION_MUTEX_ABSEIL_H_
 
+#include "absl/base/attributes.h"
 #include "absl/synchronization/mutex.h"
 #include "rtc_base/thread_annotations.h"
 
@@ -23,7 +24,7 @@
   MutexImpl& operator=(const MutexImpl&) = delete;
 
   void Lock() RTC_EXCLUSIVE_LOCK_FUNCTION() { mutex_.Lock(); }
-  RTC_WARN_UNUSED_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
+  ABSL_MUST_USE_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
     return mutex_.TryLock();
   }
   void Unlock() RTC_UNLOCK_FUNCTION() { mutex_.Unlock(); }
diff --git a/rtc_base/synchronization/mutex_critical_section.h b/rtc_base/synchronization/mutex_critical_section.h
index d206794..cb3d6a0 100644
--- a/rtc_base/synchronization/mutex_critical_section.h
+++ b/rtc_base/synchronization/mutex_critical_section.h
@@ -23,6 +23,7 @@
 #include <sal.h>  // must come after windows headers.
 // clang-format on
 
+#include "absl/base/attributes.h"
 #include "rtc_base/thread_annotations.h"
 
 namespace webrtc {
@@ -37,7 +38,7 @@
   void Lock() RTC_EXCLUSIVE_LOCK_FUNCTION() {
     EnterCriticalSection(&critical_section_);
   }
-  RTC_WARN_UNUSED_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
+  ABSL_MUST_USE_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
     return TryEnterCriticalSection(&critical_section_) != FALSE;
   }
   void Unlock() RTC_UNLOCK_FUNCTION() {
diff --git a/rtc_base/synchronization/mutex_pthread.h b/rtc_base/synchronization/mutex_pthread.h
index c9496e7..8898ca5 100644
--- a/rtc_base/synchronization/mutex_pthread.h
+++ b/rtc_base/synchronization/mutex_pthread.h
@@ -18,6 +18,7 @@
 #include <pthread_spis.h>
 #endif
 
+#include "absl/base/attributes.h"
 #include "rtc_base/thread_annotations.h"
 
 namespace webrtc {
@@ -39,7 +40,7 @@
   ~MutexImpl() { pthread_mutex_destroy(&mutex_); }
 
   void Lock() RTC_EXCLUSIVE_LOCK_FUNCTION() { pthread_mutex_lock(&mutex_); }
-  RTC_WARN_UNUSED_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
+  ABSL_MUST_USE_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
     return pthread_mutex_trylock(&mutex_) == 0;
   }
   void Unlock() RTC_UNLOCK_FUNCTION() { pthread_mutex_unlock(&mutex_); }