浏览代码

LibJS: Fix build error when some atomics are not lock-free

Normally, we want to avoid accidentally using such atomics, since
they're much slower. In this case however, we're just implementing
another atomics API, it is then up to the JavaScript code to avoid
using the slow atomics.
Sergey Bugaev 1 年之前
父节点
当前提交
9c6c2284d9
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp

+ 8 - 0
Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp

@@ -4,6 +4,14 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+// This file explicitly implements support for JS Atomics API, which can
+// involve slow (non-lock-free) atomic ops.
+#include <AK/Platform.h>
+
+#ifdef AK_COMPILER_CLANG
+#    pragma clang diagnostic ignored "-Watomic-alignment"
+#endif
+
 #include <AK/Atomic.h>
 #include <AK/ByteBuffer.h>
 #include <AK/Endian.h>