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