From b9536101dcc36995794ea81a4f74b5f132211142 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 10 Aug 2014 23:53:08 +0000 Subject: [PATCH] NFC. Move definition of _LIBCPP_ASSERT into __debug header and remove external include guards. Things done in this patch: 1. Make __debug include __config since it uses macros from it. 2. The current method of defining _LIBCPP_ASSERT is prone to redefinitions. Move the null _LIBCPP_ASSERT definition into the __debug header to prevent this. 3. Remove external <__debug> include gaurds. <__debug> guards almost all of its contents internally. There is no reason to be doing it externally. This patch should not change any functionality. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@215332 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__debug | 6 +++++- include/__hash_table | 6 +----- include/algorithm | 2 ++ include/experimental/optional | 6 +----- include/experimental/string_view | 2 ++ include/iterator | 6 +----- include/list | 6 +----- include/string | 2 ++ include/unordered_map | 2 ++ include/unordered_set | 2 ++ include/vector | 6 +----- 11 files changed, 20 insertions(+), 26 deletions(-) diff --git a/include/__debug b/include/__debug index f1805adcf..c1512246b 100644 --- a/include/__debug +++ b/include/__debug @@ -11,19 +11,23 @@ #ifndef _LIBCPP_DEBUG_H #define _LIBCPP_DEBUG_H +#include <__config> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif #if _LIBCPP_DEBUG_LEVEL >= 1 - # include # include # include # ifndef _LIBCPP_ASSERT # define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort())) # endif +#endif +#ifndef _LIBCPP_ASSERT +# define _LIBCPP_ASSERT(x, m) ((void)0) #endif #if _LIBCPP_DEBUG_LEVEL >= 2 diff --git a/include/__hash_table b/include/__hash_table index 4c4feb03e..7c954b680 100644 --- a/include/__hash_table +++ b/include/__hash_table @@ -20,11 +20,7 @@ #include <__undef_min_max> -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header diff --git a/include/algorithm b/include/algorithm index 4d064dae8..3ba104bf4 100644 --- a/include/algorithm +++ b/include/algorithm @@ -638,6 +638,8 @@ template #include <__undef_min_max> +#include <__debug> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif diff --git a/include/experimental/optional b/include/experimental/optional index 3848da872..41d86b4a1 100644 --- a/include/experimental/optional +++ b/include/experimental/optional @@ -151,11 +151,7 @@ public: #include <__undef_min_max> -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header diff --git a/include/experimental/string_view b/include/experimental/string_view index 3147e221e..b0382e5d2 100644 --- a/include/experimental/string_view +++ b/include/experimental/string_view @@ -182,6 +182,8 @@ namespace std { #include #include +#include <__debug> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif diff --git a/include/iterator b/include/iterator index f338e018d..88e615a32 100644 --- a/include/iterator +++ b/include/iterator @@ -338,11 +338,7 @@ template auto crend(const C& c) -> decltype(std::rend(c)); // #include #endif -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header diff --git a/include/list b/include/list index c36786dd4..13f8a53bf 100644 --- a/include/list +++ b/include/list @@ -179,11 +179,7 @@ template #include <__undef_min_max> -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header diff --git a/include/string b/include/string index d6c148ac6..fe72e9d38 100644 --- a/include/string +++ b/include/string @@ -453,6 +453,8 @@ basic_string operator "" s( const char32_t *str, size_t len ); // C++1 #include <__undef_min_max> +#include <__debug> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif diff --git a/include/unordered_map b/include/unordered_map index 4e2298bf9..0fa87d19a 100644 --- a/include/unordered_map +++ b/include/unordered_map @@ -351,6 +351,8 @@ template #include #include +#include <__debug> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif diff --git a/include/unordered_set b/include/unordered_set index fd378fa07..d06629fdc 100644 --- a/include/unordered_set +++ b/include/unordered_set @@ -325,6 +325,8 @@ template #include <__hash_table> #include +#include <__debug> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif diff --git a/include/vector b/include/vector index 5d41bd110..1be584d06 100644 --- a/include/vector +++ b/include/vector @@ -276,11 +276,7 @@ void swap(vector& x, vector& y) #include <__undef_min_max> -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header