[libc-commits] [PATCH] D75721: [libc] [NFC] Remove -Wc11-extensions warning
Alex Brachet via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Mar 5 19:07:10 PST 2020
abrachet created this revision.
abrachet added reviewers: sivachandra, PaulkaToast.
Herald added subscribers: tschuett, jfb, MaskRay.
abrachet added a comment.
It's worth mentioning compiler version I was getting this warning on.
$ clang --version
clang version 11.0.0 (https://github.com/llvm/llvm-project.git 6d2372ce584f0fd26575e31d63278b98be2cfa1c)
`_Atomic` is not an official C++ keyword, when `-pedantic` is specified the compiler gives a warning about its usage.
This patch uses <stdatomic.h> and it's `atomic_uint_least32_t`. Unfortunately there is no `atomic_uint32_t`. This works because <stdatomic.h> is a system header which isn't subject to the same warnings. Alternatively we could add `#pragma GCC system_header` to thread_utils.h.
https://reviews.llvm.org/D75721
Files:
libc/src/threads/linux/thread_utils.h
Index: libc/src/threads/linux/thread_utils.h
===================================================================
--- libc/src/threads/linux/thread_utils.h
+++ libc/src/threads/linux/thread_utils.h
@@ -9,9 +9,14 @@
#ifndef LLVM_LIBC_SRC_THREADS_LINUX_THREAD_UTILS_H
#define LLVM_LIBC_SRC_THREADS_LINUX_THREAD_UTILS_H
+#include "include/threads.h"
+
+#include <stdatomic.h>
#include <stdint.h>
-using FutexData = _Atomic uint32_t;
+using FutexData = atomic_uint_least32_t;
+static_assert(sizeof(FutexData) == sizeof(thrd_t::__clear_tid),
+ "FutexData must be the same size as thrd_t::__clear_tid");
struct ThreadParams {
static constexpr uintptr_t DefaultStackSize = 1 << 15; // 32 KB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75721.248640.patch
Type: text/x-patch
Size: 709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200306/e86ec530/attachment.bin>
More information about the libc-commits
mailing list