[libcxx] r295428 - Use inline namespaces with GCC instead of __attribute__((__strong__)).

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 16 23:31:38 PST 2017


Author: ericwf
Date: Fri Feb 17 01:31:38 2017
New Revision: 295428

URL: http://llvm.org/viewvc/llvm-project?rev=295428&view=rev
Log:
Use inline namespaces with GCC instead of __attribute__((__strong__)).

GCC 7.0.1 started warning that __attribute__((__strong__)) is depricated.
This patch switches to using inline namespace with GCC instead. I believe
this wasn't done originally in order to support older GCC versions w/o
support for inline namespaces, or because earlier versions of GCC warned
users that the STL was using an inline namespace (even though it shouldn't affect users).

However I believe all of the above problems are gone for GCC 4.9 and greater.
Therefore switching to using inline namespaces instead of using __strong__
is the most correct behavior.

Modified:
    libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=295428&r1=295427&r2=295428&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Feb 17 01:31:38 2017
@@ -482,14 +482,13 @@ namespace std {
 
 #endif  // __GXX_EXPERIMENTAL_CXX0X__
 
-#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
+#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE {
 #define _LIBCPP_END_NAMESPACE_STD  } }
 #define _VSTD std::_LIBCPP_NAMESPACE
 
 namespace std {
-namespace _LIBCPP_NAMESPACE {
-}
-using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
+  inline namespace _LIBCPP_NAMESPACE {
+  }
 }
 
 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)




More information about the cfe-commits mailing list