#include <exception>
#include <typeinfo>
+#include "test_macros.h"
+
class Base {
virtual void foo() {};
};
void (*default_handler)() = std::get_terminate();
std::set_terminate(my_terminate);
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
try {
#endif
Derived &d = test_bad_cast(gB);
assert(false);
((void)d);
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
} catch (std::bad_cast) {
// success
return 0;
#include <string>
#include <iostream>
+#include "test_macros.h"
+
class Base {
virtual void foo() {};
};
void (*default_handler)() = std::get_terminate();
std::set_terminate(my_terminate);
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
try {
#endif
test_bad_typeid(nullptr);
assert(false);
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
} catch (std::bad_typeid) {
// success
return 0;
#include <memory>
#include <vector>
+#include "test_macros.h"
+
using namespace __cxxabiv1;
if (std::__libcpp_atomic_load(first_byte, std::_AO_Acquire) == 0) {
Impl impl(g);
if (impl.cxa_guard_acquire() == INIT_IS_PENDING) {
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
try {
#endif
init();
impl.cxa_guard_release();
return PERFORMED;
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
} catch (...) {
impl.cxa_guard_abort();
return ABORTED;
]
if self.get_lit_bool('enable_exceptions', True):
self.cxx.compile_flags += ['-funwind-tables']
- else:
- self.cxx.compile_flags += ['-fno-exceptions', '-DLIBCXXABI_HAS_NO_EXCEPTIONS']
if not self.get_lit_bool('enable_threads', True):
self.cxx.compile_flags += ['-D_LIBCXXABI_HAS_NO_THREADS']
self.config.available_features.add('libcxxabi-no-threads')
#include <thread>
#endif
+#include "test_macros.h"
+
// Ensure that we initialize each variable once and only once.
namespace test1 {
static int run_count = 0;
// When initialization fails, ensure that we try to initialize it again next
// time.
namespace test2 {
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
static int run_count = 0;
int increment() {
++run_count;
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
// Wrapper routines
void *my_alloc2 ( size_t sz ) {
void *p = std::malloc ( sz );
int gDestructorCounter;
int gDestructorThrowTarget;
void throw_construct ( void * ) {
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
if ( gConstructorCounter == gConstructorThrowTarget )
throw 1;
++gConstructorCounter;
#endif
}
void throw_destruct ( void * ) {
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
if ( ++gDestructorCounter == gDestructorThrowTarget )
throw 2;
#endif
return retVal;
}
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
// Make sure the constructors and destructors are matched
int test_exception_in_constructor ( ) {
int retVal = 0;
}
#endif
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
// Make sure the constructors and destructors are matched
int test_exception_in_destructor ( ) {
int retVal = 0;
int retVal = 0;
retVal += test_empty ();
retVal += test_counted ();
-#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
retVal += test_exception_in_constructor ();
retVal += test_exception_in_destructor ();
#endif