summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-07-18 20:40:46 +0000
committerEric Fiselier <eric@efcs.ca>2015-07-18 20:40:46 +0000
commit87a82490fc6b89fd3dfe033054e1bdc6b87fd9f4 (patch)
treea46ba3cd7c970a70e9b3dd8c5c7cc40b7aada192 /libcxx
parenta1e0aa5020209dad9c03a4dfa704a138e9ce89b5 (diff)
downloadbcm5719-llvm-87a82490fc6b89fd3dfe033054e1bdc6b87fd9f4.tar.gz
bcm5719-llvm-87a82490fc6b89fd3dfe033054e1bdc6b87fd9f4.zip
Enable and fix warnings during the build.
Although CMake adds warning flags, they are ignored in the libc++ headers because the headers '#pragma system header' themselves. This patch disables the system header pragma when building libc++ and fixes the warnings that arose. The warnings fixed were: 1. <memory> - anonymous structs are a GNU extension 2. <functional> - anonymous structs are a GNU extension. 3. <__hash_table> - Embedded preprocessor directives have undefined behavior. 4. <string> - Definition is missing noexcept from declaration. 5. <__std_stream> - Unused variable. llvm-svn: 242623
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/CMakeLists.txt2
-rw-r--r--libcxx/include/__hash_table12
-rw-r--r--libcxx/include/__std_stream1
-rw-r--r--libcxx/include/functional20
-rw-r--r--libcxx/include/memory6
-rw-r--r--libcxx/include/string7
6 files changed, 29 insertions, 19 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 3b5df5a9941..a7bc792e391 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -175,6 +175,8 @@ macro(append_if list condition var)
endmacro()
# Get warning flags
+# Disable the system header pragma.
+add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
if (NOT MSVC)
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
list(APPEND LIBCXX_COMPILE_FLAGS -Werror=return-type)
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index f3a20309df7..ec20e10fcb5 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -984,15 +984,17 @@ public:
__equal_range_multi(const _Key& __k) const;
void swap(__hash_table& __u)
+#if _LIBCPP_STD_VER <= 11
_NOEXCEPT_(
__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
-#if _LIBCPP_STD_VER <= 11
&& (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
|| __is_nothrow_swappable<__pointer_allocator>::value)
&& (!__node_traits::propagate_on_container_swap::value
|| __is_nothrow_swappable<__node_allocator>::value)
-#endif
);
+#else
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
+#endif
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const _NOEXCEPT
@@ -2351,15 +2353,17 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(
template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
+#if _LIBCPP_STD_VER <= 11
_NOEXCEPT_(
__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
-#if _LIBCPP_STD_VER <= 11
&& (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
|| __is_nothrow_swappable<__pointer_allocator>::value)
&& (!__node_traits::propagate_on_container_swap::value
|| __is_nothrow_swappable<__node_allocator>::value)
-#endif
)
+#else
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
+#endif
{
{
__node_pointer_pointer __npp = __bucket_list_.release();
diff --git a/libcxx/include/__std_stream b/libcxx/include/__std_stream
index 5403adabc34..f867cd23bdd 100644
--- a/libcxx/include/__std_stream
+++ b/libcxx/include/__std_stream
@@ -276,7 +276,6 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
codecvt_base::result __r;
char_type* pbase = &__1buf;
char_type* pptr = pbase + 1;
- char_type* epptr = pptr;
do
{
const char_type* __e;
diff --git a/libcxx/include/functional b/libcxx/include/functional
index 5ee94176302..9bed783153e 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -2402,14 +2402,14 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<long double>
size_t __b;
size_t __c;
size_t __d;
- };
+ } __s;
} __u;
- __u.__a = 0;
- __u.__b = 0;
- __u.__c = 0;
- __u.__d = 0;
+ __u.__s.__a = 0;
+ __u.__s.__b = 0;
+ __u.__s.__c = 0;
+ __u.__s.__d = 0;
__u.__t = __v;
- return __u.__a ^ __u.__b ^ __u.__c ^ __u.__d;
+ return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
#elif defined(__x86_64__)
// Zero out padding bits
union
@@ -2419,12 +2419,12 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<long double>
{
size_t __a;
size_t __b;
- };
+ } __s;
} __u;
- __u.__a = 0;
- __u.__b = 0;
+ __u.__s.__a = 0;
+ __u.__s.__b = 0;
__u.__t = __v;
- return __u.__a ^ __u.__b;
+ return __u.__s.__a ^ __u.__s.__b;
#else
return __scalar_hash<long double>::operator()(__v);
#endif
diff --git a/libcxx/include/memory b/libcxx/include/memory
index 22311aaace9..df35a07143c 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -3420,7 +3420,7 @@ struct __scalar_hash<_Tp, 2>
{
size_t __a;
size_t __b;
- };
+ } __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@@ -3442,7 +3442,7 @@ struct __scalar_hash<_Tp, 3>
size_t __a;
size_t __b;
size_t __c;
- };
+ } __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@@ -3465,7 +3465,7 @@ struct __scalar_hash<_Tp, 4>
size_t __b;
size_t __c;
size_t __d;
- };
+ } __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
diff --git a/libcxx/include/string b/libcxx/include/string
index 6be21955b14..5777ee2a547 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1936,7 +1936,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string()
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
- : __r_(__a)
+#if _LIBCPP_STD_VER <= 14
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+#else
+ _NOEXCEPT
+#endif
+: __r_(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
OpenPOWER on IntegriCloud