[libc++] Fix a few warnings in system headers with GCC

This isn't fixing all of them, but at least it's making some progress.

Differential Revision: https://reviews.llvm.org/D106283

NOKEYCHECK=True
GitOrigin-RevId: 2e4755ff6058b5032b77ccca04aa6dab7db081a5
diff --git a/include/semaphore b/include/semaphore
index 20c9b1e..906f62e 100644
--- a/include/semaphore
+++ b/include/semaphore
@@ -98,7 +98,7 @@
     _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
     void acquire()
     {
-        auto const __test_fn = [=]() -> bool {
+        auto const __test_fn = [this]() -> bool {
             auto __old = __a.load(memory_order_relaxed);
             return (__old != 0) && __a.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed);
         };
@@ -108,7 +108,7 @@
     _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
     bool try_acquire_for(chrono::duration<Rep, Period> const& __rel_time)
     {
-        auto const __test_fn = [=]() -> bool {
+        auto const __test_fn = [this]() -> bool {
             auto __old = __a.load(memory_order_acquire);
             while(1) {
                 if (__old == 0)