summaryrefslogtreecommitdiffstats
path: root/include/cstdlib
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-08-29 20:43:38 +0000
committerEric Fiselier <eric@efcs.ca>2016-08-29 20:43:38 +0000
commit3ec6b84545c594625bf2277ddf01493e98c02c15 (patch)
treeb5d394c08bb4f843e7f82ba3d820d263c8ae324a /include/cstdlib
parent0a799bd4256f5da5b86d00991bc46ee05f6e3c48 (diff)
downloadexternal_libcxx-3ec6b84545c594625bf2277ddf01493e98c02c15.tar.gz
external_libcxx-3ec6b84545c594625bf2277ddf01493e98c02c15.tar.bz2
external_libcxx-3ec6b84545c594625bf2277ddf01493e98c02c15.zip
Fix or suppress GCC warnings during build.
Summary: Currently a number of GCC warnings are emitted when building libc++. This patch fixes or ignores all of them. The primary changes are: * Work around strict aliasing issues in `typeinfo::hash_code()` by using __attribute__((may_alias)). However I think a non-aliasing `hash_code()` implementation is possible. Further investigation needed. * Add `_LIBCPP_UNREACHABLE()` to switch in `strstream.cpp` to avoid -Wpotentially-uninitialized. * Fix -Wunused-value warning in `__all` by adding a void cast. * Ignore -Wattributes for now. There are a number of real attribute issues when using GCC but enabling the warning is too noisy. * Ignore -Wliteral-suffix since it warns about the use of reserved identifiers. Note Only GCC 7.0 supports disabling this warning. * Ignore -Wc++14-compat since it warns about the sized new/delete overloads. Reviewers: EricWF Differential Revision: https://reviews.llvm.org/D24003 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@280007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/cstdlib')
-rw-r--r--include/cstdlib6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/cstdlib b/include/cstdlib
index 10ed23107..9a775b844 100644
--- a/include/cstdlib
+++ b/include/cstdlib
@@ -89,6 +89,12 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
#pragma GCC system_header
#endif
+#ifdef __GNUC__
+#define _LIBCPP_UNREACHABLE() __builtin_unreachable()
+#else
+#define _LIBCPP_UNREACHABLE() _VSTD::abort()
+#endif
+
_LIBCPP_BEGIN_NAMESPACE_STD
using ::size_t;