suppress warnings in tests for deprecated functions
[folly.git] / folly / MicroSpinLock.h
index 7acf216f70b5a5468ba3d991f33236d5cce2f2cb..17d181f79dc2dfee75cd9430e21aa5c676d6b532 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2015-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <atomic>
 #include <cassert>
 #include <cstdint>
+#include <mutex>
 #include <type_traits>
 
 #include <folly/Portability.h>
-#include <folly/detail/Sleeper.h>
-
-FOLLY_NAMESPACE_STD_BEGIN
-template <class Mutex>
-class lock_guard;
-FOLLY_NAMESPACE_STD_END
+#include <folly/lang/Align.h>
+#include <folly/synchronization/detail/Sleeper.h>
 
 namespace folly {
 
@@ -122,7 +119,7 @@ static_assert(
 #define FOLLY_CACHE_LINE_SIZE 64
 
 template <class T, size_t N>
-struct FOLLY_ALIGNED_MAX SpinLockArray {
+struct alignas(max_align_v) SpinLockArray {
   T& operator[](size_t i) {
     return data_[i].lock;
   }
@@ -144,9 +141,8 @@ struct FOLLY_ALIGNED_MAX SpinLockArray {
 
   // Check if T can theoretically cross a cache line.
   static_assert(
-      folly::max_align_v > 0 &&
-          FOLLY_CACHE_LINE_SIZE % folly::max_align_v == 0 &&
-          sizeof(T) <= folly::max_align_v,
+      max_align_v > 0 && FOLLY_CACHE_LINE_SIZE % max_align_v == 0 &&
+          sizeof(T) <= max_align_v,
       "T can cross cache line boundaries");
 
   char padding_[FOLLY_CACHE_LINE_SIZE];
@@ -159,4 +155,4 @@ typedef std::lock_guard<MicroSpinLock> MSLGuard;
 
 //////////////////////////////////////////////////////////////////////
 
-}
+} // namespace folly