annotate libcxxabi/test/noexception1.pass.cpp @ 174:f935e5e0dbe7

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 12:28:41 +0900
parents 0572611fdcc8
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===----------------------- noexception1.pass.cpp ------------------------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 // UNSUPPORTED: c++98, c++03
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
10 // REQUIRES: no-exceptions
150
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 #include <cxxabi.h>
anatofuz
parents:
diff changeset
13 #include <exception>
anatofuz
parents:
diff changeset
14 #include <cassert>
anatofuz
parents:
diff changeset
15 #include <stdlib.h>
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 // namespace __cxxabiv1 {
anatofuz
parents:
diff changeset
18 // void __cxa_increment_exception_refcount(void *thrown_object) throw();
anatofuz
parents:
diff changeset
19 // }
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 unsigned gCounter = 0;
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 void my_terminate() { exit(0); }
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 int main ()
anatofuz
parents:
diff changeset
26 {
anatofuz
parents:
diff changeset
27 // should not call std::terminate()
anatofuz
parents:
diff changeset
28 __cxxabiv1::__cxa_increment_exception_refcount(nullptr);
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 std::set_terminate(my_terminate);
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 // should call std::terminate()
anatofuz
parents:
diff changeset
33 __cxxabiv1::__cxa_increment_exception_refcount((void*) &gCounter);
anatofuz
parents:
diff changeset
34 assert(false);
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 return 0;
anatofuz
parents:
diff changeset
37 }