[clang] 6ad7e87 - clang: libstdc++ LWM is 4.8.3
Nathan Sidwell via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 22 05:26:49 PDT 2021
Author: Nathan Sidwell
Date: 2021-04-22T05:26:07-07:00
New Revision: 6ad7e87806c0af774cf2f8880694f79259925979
URL: https://github.com/llvm/llvm-project/commit/6ad7e87806c0af774cf2f8880694f79259925979
DIFF: https://github.com/llvm/llvm-project/commit/6ad7e87806c0af774cf2f8880694f79259925979.diff
LOG: clang: libstdc++ LWM is 4.8.3
Document oldest libstdc++ as 4.8.3, remove a hack for a 4.6 issue.
Differential Revision: https://reviews.llvm.org/D100465
Added:
Modified:
clang/docs/ReleaseNotes.rst
clang/docs/Toolchain.rst
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/SemaCXX/libstdcxx_atomic_ns_hack.cpp
Removed:
################################################################################
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index ad7ff71802ddc..a11d60cadb042 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -117,9 +117,16 @@ C Language Changes in Clang
C++ Language Changes in Clang
-----------------------------
+- The oldest supported GNU libstdc++ is now 4.8.3 (released 2014-05-22).
+ Clang workarounds for bugs in earlier versions have been removed.
+
- ...
-C++1z Feature Support
+C++20 Feature Support
+^^^^^^^^^^^^^^^^^^^^^
+...
+
+C++2b Feature Support
^^^^^^^^^^^^^^^^^^^^^
...
diff --git a/clang/docs/Toolchain.rst b/clang/docs/Toolchain.rst
index da65f14597b17..9c4099e15c98c 100644
--- a/clang/docs/Toolchain.rst
+++ b/clang/docs/Toolchain.rst
@@ -340,9 +340,10 @@ You can instruct Clang to use libc++ with the ``-stdlib=libc++`` flag.
libstdc++ (GNU)
^^^^^^^^^^^^^^^
-`libstdc++ <https://gcc.gnu.org/onlinedocs/libstdc++/>`_ is GCC's implementation
-of the C++ standard library. Clang supports a wide range of versions of
-libstdc++, from around version 4.2 onwards, and will implicitly work around
-some bugs in older versions of libstdc++.
+`libstdc++ <https://gcc.gnu.org/onlinedocs/libstdc++/>`_ is GCC's
+implementation of the C++ standard library. Clang supports libstdc++
+4.8.3 (released 2014-05-22) and later. Historically Clang implemented
+workarounds for issues discovered in libstdc++, and these are removed
+as fixed libstdc++ becomes sufficiently old.
You can instruct Clang to use libstdc++ with the ``-stdlib=libstdc++`` flag.
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 7a5f66d31105a..06ff38808ac85 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -10874,26 +10874,6 @@ static void DiagnoseNamespaceInlineMismatch(Sema &S, SourceLocation KeywordLoc,
NamespaceDecl *PrevNS) {
assert(*IsInline != PrevNS->isInline());
- // HACK: Work around a bug in libstdc++4.6's <atomic>, where
- // std::__atomic[0,1,2] are defined as non-inline namespaces, then reopened as
- // inline namespaces, with the intention of bringing names into namespace std.
- //
- // We support this just well enough to get that case working; this is not
- // sufficient to support reopening namespaces as inline in general.
- if (*IsInline && II && II->getName().startswith("__atomic") &&
- S.getSourceManager().isInSystemHeader(Loc)) {
- // Mark all prior declarations of the namespace as inline.
- for (NamespaceDecl *NS = PrevNS->getMostRecentDecl(); NS;
- NS = NS->getPreviousDecl())
- NS->setInline(*IsInline);
- // Patch up the lookup table for the containing namespace. This isn't really
- // correct, but it's good enough for this particular case.
- for (auto *I : PrevNS->decls())
- if (auto *ND = dyn_cast<NamedDecl>(I))
- PrevNS->getParent()->makeDeclVisibleInContext(ND);
- return;
- }
-
if (PrevNS->isInline())
// The user probably just forgot the 'inline', so suggest that it
// be added back.
diff --git a/clang/test/SemaCXX/libstdcxx_atomic_ns_hack.cpp b/clang/test/SemaCXX/libstdcxx_atomic_ns_hack.cpp
index 4e4523f853228..d519f7877da1e 100644
--- a/clang/test/SemaCXX/libstdcxx_atomic_ns_hack.cpp
+++ b/clang/test/SemaCXX/libstdcxx_atomic_ns_hack.cpp
@@ -7,29 +7,28 @@
// namespace to be converted from non-inline to inline in this one specific
// case.
+// the last 4.6 release was 2013, so the hack is removed. This checks __atomic
+// is not special.
#ifdef BE_THE_HEADER
#pragma clang system_header
namespace std {
- namespace __atomic0 {
- typedef int foobar;
- }
- namespace __atomic1 {
- typedef void foobar;
- }
+namespace __atomic0 { // expected-note {{previous definition}}
+typedef int foobar;
+} // namespace __atomic0
+namespace __atomic1 {
+typedef void foobar;
+} // namespace __atomic1
- inline namespace __atomic0 {}
-}
+inline namespace __atomic0 {} // expected-error {{cannot be reopened as inline}}
+} // namespace std
#else
#define BE_THE_HEADER
#include "libstdcxx_atomic_ns_hack.cpp"
-std::foobar fb;
-
-using T = void; // expected-note {{here}}
-using T = std::foobar; // expected-error {{
diff erent types ('std::foobar' (aka 'int') vs 'void')}}
+std::foobar fb; // expected-error {{no type named 'foobar' in namespace}}
#endif
More information about the cfe-commits
mailing list