diff --git a/include/csetjmp b/include/csetjmp index d0b2c078..58a9c73a 100644 --- a/include/csetjmp +++ b/include/csetjmp @@ -38,10 +38,6 @@ void longjmp(jmp_buf env, int val); #pragma GCC system_header #endif -#ifndef setjmp -#define setjmp(env) setjmp(env) -#endif - _LIBCPP_BEGIN_NAMESPACE_STD using ::jmp_buf; diff --git a/include/setjmp.h b/include/setjmp.h new file mode 100644 index 00000000..d429c862 --- /dev/null +++ b/include/setjmp.h @@ -0,0 +1,40 @@ +// -*- C++ -*- +//===--------------------------- setjmp.h ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_SETJMP_H +#define _LIBCPP_SETJMP_H + +/* + setjmp.h synopsis + +Macros: + + setjmp + +Types: + + jmp_buf + +void longjmp(jmp_buf env, int val); + +*/ + +#include <__config> +#include_next + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +#ifndef setjmp +#define setjmp(env) setjmp(env) +#endif + +#endif // _LIBCPP_SETJMP_H diff --git a/test/std/depr/depr.c.headers/setjmp_h.pass.cpp b/test/std/depr/depr.c.headers/setjmp_h.pass.cpp index 36f42539..9bc35b74 100644 --- a/test/std/depr/depr.c.headers/setjmp_h.pass.cpp +++ b/test/std/depr/depr.c.headers/setjmp_h.pass.cpp @@ -12,6 +12,10 @@ #include #include +#ifndef setjmp +#error setjmp not defined +#endif + int main() { jmp_buf jb;