xref: /aosp_15_r20/external/llvm-libc/src/setjmp/setjmp_impl.h (revision 71db0c75aadcf003ffe3238005f61d7618a3fead)
1*71db0c75SAndroid Build Coastguard Worker //===-- Implementation header for setjmp ------------------------*- C++ -*-===//
2*71db0c75SAndroid Build Coastguard Worker //
3*71db0c75SAndroid Build Coastguard Worker // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*71db0c75SAndroid Build Coastguard Worker // See https://llvm.org/LICENSE.txt for license information.
5*71db0c75SAndroid Build Coastguard Worker // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*71db0c75SAndroid Build Coastguard Worker //
7*71db0c75SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
8*71db0c75SAndroid Build Coastguard Worker 
9*71db0c75SAndroid Build Coastguard Worker #ifndef LLVM_LIBC_SRC_SETJMP_SETJMP_IMPL_H
10*71db0c75SAndroid Build Coastguard Worker #define LLVM_LIBC_SRC_SETJMP_SETJMP_IMPL_H
11*71db0c75SAndroid Build Coastguard Worker 
12*71db0c75SAndroid Build Coastguard Worker // This header has the _impl prefix in its name to avoid conflict with the
13*71db0c75SAndroid Build Coastguard Worker // public header setjmp.h which is also included. here.
14*71db0c75SAndroid Build Coastguard Worker #include "hdr/types/jmp_buf.h"
15*71db0c75SAndroid Build Coastguard Worker #include "src/__support/macros/config.h"
16*71db0c75SAndroid Build Coastguard Worker #include "src/__support/macros/properties/compiler.h"
17*71db0c75SAndroid Build Coastguard Worker 
18*71db0c75SAndroid Build Coastguard Worker namespace LIBC_NAMESPACE_DECL {
19*71db0c75SAndroid Build Coastguard Worker 
20*71db0c75SAndroid Build Coastguard Worker // TODO(https://github.com/llvm/llvm-project/issues/112427)
21*71db0c75SAndroid Build Coastguard Worker // Some of the architecture-specific definitions are marked `naked`, which in
22*71db0c75SAndroid Build Coastguard Worker // GCC implies `nothrow`.
23*71db0c75SAndroid Build Coastguard Worker //
24*71db0c75SAndroid Build Coastguard Worker // Right now, our aliases aren't marked `nothrow`, so we wind up in a situation
25*71db0c75SAndroid Build Coastguard Worker // where clang will emit -Wmissing-exception-spec if we add `nothrow` here, but
26*71db0c75SAndroid Build Coastguard Worker // GCC will emit -Wmissing-attributes here without `nothrow`. We need to update
27*71db0c75SAndroid Build Coastguard Worker // LLVM_LIBC_FUNCTION to denote when a function throws or not.
28*71db0c75SAndroid Build Coastguard Worker 
29*71db0c75SAndroid Build Coastguard Worker #ifdef LIBC_COMPILER_IS_GCC
30*71db0c75SAndroid Build Coastguard Worker [[gnu::nothrow]]
31*71db0c75SAndroid Build Coastguard Worker #endif
32*71db0c75SAndroid Build Coastguard Worker int setjmp(jmp_buf buf);
33*71db0c75SAndroid Build Coastguard Worker 
34*71db0c75SAndroid Build Coastguard Worker } // namespace LIBC_NAMESPACE_DECL
35*71db0c75SAndroid Build Coastguard Worker 
36*71db0c75SAndroid Build Coastguard Worker #endif // LLVM_LIBC_SRC_SETJMP_SETJMP_IMPL_H
37