annotate libcxxabi/test/exception_object_alignment.pass.cpp @ 173:0572611fdcc8 llvm10 llvm12

reorgnization done
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 11:55:54 +0900
parents 1d019706d866
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===---------------- exception_object_alignment.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
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
9 // UNSUPPORTED: no-exceptions
150
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 // Check that the pointer __cxa_allocate_exception returns is aligned to the
anatofuz
parents:
diff changeset
12 // default alignment for the target architecture.
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 #include <cassert>
anatofuz
parents:
diff changeset
15 #include <cstdint>
anatofuz
parents:
diff changeset
16 #include <cxxabi.h>
anatofuz
parents:
diff changeset
17 #include <type_traits>
anatofuz
parents:
diff changeset
18 #include <__cxxabi_config.h>
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 struct S {
anatofuz
parents:
diff changeset
21 int a[4];
anatofuz
parents:
diff changeset
22 } __attribute__((aligned));
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 int main() {
anatofuz
parents:
diff changeset
25 #if !defined(_LIBCXXABI_ARM_EHABI)
anatofuz
parents:
diff changeset
26 void *p = __cxxabiv1::__cxa_allocate_exception(16);
anatofuz
parents:
diff changeset
27 auto i = reinterpret_cast<uintptr_t>(p);
anatofuz
parents:
diff changeset
28 auto a = std::alignment_of<S>::value;
anatofuz
parents:
diff changeset
29 assert(i % a == 0);
anatofuz
parents:
diff changeset
30 __cxxabiv1::__cxa_free_exception(p);
anatofuz
parents:
diff changeset
31 #endif
anatofuz
parents:
diff changeset
32 return 0;
anatofuz
parents:
diff changeset
33 }