summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-10-08 20:41:26 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-10-08 20:41:26 +0000
commitddbf08114a5b7ab2fce99e2c2341a1e4dda27660 (patch)
tree6bd20d9bd643af0905bfa968c1f9c1ace0075e8c
parent4faa3944c623cbaa711ec9d39338d8872d0cf9f1 (diff)
Split <setjmp.h> out of <csetjmp>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249743 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/csetjmp4
-rw-r--r--include/setjmp.h40
-rw-r--r--test/std/depr/depr.c.headers/setjmp_h.pass.cpp4
3 files changed, 44 insertions, 4 deletions
diff --git a/include/csetjmp b/include/csetjmp
index d0b2c0789..58a9c73ab 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 000000000..d429c8624
--- /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 <setjmp.h>
+
+#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 36f425390..9bc35b747 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 <setjmp.h>
#include <type_traits>
+#ifndef setjmp
+#error setjmp not defined
+#endif
+
int main()
{
jmp_buf jb;