[libcxx-commits] [libcxxabi] r358690 - [libc++] Make sure we re-export some missing libc++abi symbols from libc++
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 18 10:18:15 PDT 2019
Author: ldionne
Date: Thu Apr 18 10:18:15 2019
New Revision: 358690
URL: http://llvm.org/viewvc/llvm-project?rev=358690&view=rev
Log:
[libc++] Make sure we re-export some missing libc++abi symbols from libc++
Summary:
Ensure we re-export __cxa_throw_bad_array_new_length and
__cxa_uncaught_exceptions from libc++, since they are now
provided by libc++abi.
Doing this allows us to stop linking explicitly against libc++abi in
the libc++abi tests, since libc++ re-exports all the necessary symbols.
However, there is one caveat to that. We don't want libc++ to re-export
__cxa_uncaught_exception (the singular form), since it's only provided
for backwards compatibility. Hence, for the single test where we check
this backwards compatibility, we explicitly link against libc++abi.
PR27405
PR22654
Reviewers: EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D60424
Added:
libcxxabi/trunk/test/uncaught_exception.pass.sh.cpp
Modified:
libcxxabi/trunk/test/uncaught_exceptions.pass.cpp
Added: libcxxabi/trunk/test/uncaught_exception.pass.sh.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/uncaught_exception.pass.sh.cpp?rev=358690&view=auto
==============================================================================
--- libcxxabi/trunk/test/uncaught_exception.pass.sh.cpp (added)
+++ libcxxabi/trunk/test/uncaught_exception.pass.sh.cpp Thu Apr 18 10:18:15 2019
@@ -0,0 +1,34 @@
+//===------------------- uncaught_exceptions.pass.cpp ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcxxabi-no-exceptions
+
+// This tests that libc++abi still provides __cxa_uncaught_exception() for
+// ABI compatibility, even though the Standard doesn't require it to.
+//
+// We need to explicitly link against libc++abi, because libc++ does not
+// re-export this symbol.
+
+// RUN: %build -lc++abi -o %t.exe
+// RUN: %t.exe
+
+#include <cxxabi.h>
+#include <cassert>
+
+// namespace __cxxabiv1 {
+// extern bool __cxa_uncaught_exception () throw();
+// }
+
+struct A {
+ ~A() { assert( __cxxabiv1::__cxa_uncaught_exception()); }
+};
+
+int main () {
+ try { A a; throw 3; assert(false); }
+ catch (int) {}
+}
Modified: libcxxabi/trunk/test/uncaught_exceptions.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/uncaught_exceptions.pass.cpp?rev=358690&r1=358689&r2=358690&view=diff
==============================================================================
--- libcxxabi/trunk/test/uncaught_exceptions.pass.cpp (original)
+++ libcxxabi/trunk/test/uncaught_exceptions.pass.cpp Thu Apr 18 10:18:15 2019
@@ -9,29 +9,19 @@
// UNSUPPORTED: libcxxabi-no-exceptions
#include <cxxabi.h>
-#include <exception>
#include <cassert>
// namespace __cxxabiv1 {
-// extern bool __cxa_uncaught_exception () throw();
-// extern unsigned int __cxa_uncaught_exceptions() throw();
+// extern unsigned int __cxa_uncaught_exceptions() throw();
// }
struct A {
- ~A() { assert( __cxxabiv1::__cxa_uncaught_exception()); }
- };
-
-struct B {
- B(unsigned cnt) : data_(cnt) {}
- ~B() { assert( data_ == __cxxabiv1::__cxa_uncaught_exceptions()); }
+ A(unsigned cnt) : data_(cnt) {}
+ ~A() { assert( data_ == __cxxabiv1::__cxa_uncaught_exceptions()); }
unsigned data_;
- };
+};
-int main ()
-{
- try { A a; throw 3; assert (false); }
- catch (int) {}
-
- try { B b(1); throw 3; assert (false); }
+int main () {
+ try { A a(1); throw 3; assert(false); }
catch (int) {}
}
More information about the libcxx-commits
mailing list