alignment.compile.pass.cpp 922 B

123456789101112131415161718192021222324
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // The Itanium ABI requires that _Unwind_Exception objects are "double-word
  10. // aligned".
  11. #include <unwind.h>
  12. // EHABI : 8-byte aligned
  13. // itanium: largest supported alignment for the system
  14. #if defined(_LIBUNWIND_ARM_EHABI)
  15. static_assert(alignof(_Unwind_Control_Block) == 8,
  16. "_Unwind_Control_Block must be double-word aligned");
  17. #else
  18. struct MaxAligned {} __attribute__((__aligned__));
  19. static_assert(alignof(_Unwind_Exception) == alignof(MaxAligned),
  20. "_Unwind_Exception must be maximally aligned");
  21. #endif