[libcxx] r227973 - [libcxx] Add <experimental/system_error>
Eric Fiselier
eric at efcs.ca
Tue Feb 3 08:03:24 PST 2015
Author: ericwf
Date: Tue Feb 3 10:03:24 2015
New Revision: 227973
URL: http://llvm.org/viewvc/llvm-project?rev=227973&view=rev
Log:
[libcxx] Add <experimental/system_error>
Summary:
This patch just adds the variable templates in <experimental/system_error>.
see: https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#syserror
Reviewers: jroelofs, danalbert, K-ballo, mclow.lists
Reviewed By: mclow.lists
Subscribers: chandlerc, cfe-commits
Differential Revision: http://reviews.llvm.org/D7353
Added:
libcxx/trunk/include/experimental/system_error
libcxx/trunk/test/libcxx/experimental/utilities/syserror/
libcxx/trunk/test/libcxx/experimental/utilities/syserror/header.system_error.synop/
libcxx/trunk/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp
libcxx/trunk/test/libcxx/experimental/utilities/syserror/version.pass.cpp
libcxx/trunk/test/std/experimental/utilities/syserror/
libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/
libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp
libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp
libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp
Added: libcxx/trunk/include/experimental/system_error
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/system_error?rev=227973&view=auto
==============================================================================
--- libcxx/trunk/include/experimental/system_error (added)
+++ libcxx/trunk/include/experimental/system_error Tue Feb 3 10:03:24 2015
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//===-------------------------- system_error ------------------------------===//
+//
+// 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_EXPERIMENTAL_SYSTEM_ERROR
+#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
+
+/**
+ experimental/system_error synopsis
+
+// C++1y
+
+#include <system_error>
+
+namespace std {
+namespace experimental {
+inline namespace fundamentals_v1 {
+
+ // See C++14 19.5, System error support
+ template <class T> constexpr bool is_error_code_enum_v
+ = is_error_code_enum<T>::value;
+ template <class T> constexpr bool is_error_condition_enum_v
+ = is_error_condition_enum<T>::value;
+
+} // namespace fundamentals_v1
+} // namespace experimental
+} // namespace std
+
+*/
+
+#include <experimental/__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <system_error>
+
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
+#if __has_feature(cxx_variable_templates)
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_code_enum_v
+ = is_error_code_enum<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_condition_enum_v
+ = is_error_condition_enum<_Tp>::value;
+
+#endif /* __has_feature(cxx_variable_templates) */
+
+_LIBCPP_END_NAMESPACE_LFTS
+
+#endif /* _LIBCPP_STD_VER > 11 */
+
+#endif /* _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR */
\ No newline at end of file
Added: libcxx/trunk/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp?rev=227973&view=auto
==============================================================================
--- libcxx/trunk/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp Tue Feb 3 10:03:24 2015
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/system_error>
+
+#include <experimental/system_error>
+
+#ifndef _LIBCPP_STD_VER > 11
+# ifndef _LIBCPP_SYSTEM_ERROR
+# error "<experimental/system_error> must include <system_error>"
+# endif
+#endif
+
+int main()
+{
+}
Added: libcxx/trunk/test/libcxx/experimental/utilities/syserror/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/utilities/syserror/version.pass.cpp?rev=227973&view=auto
==============================================================================
--- libcxx/trunk/test/libcxx/experimental/utilities/syserror/version.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/experimental/utilities/syserror/version.pass.cpp Tue Feb 3 10:03:24 2015
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/system_error>
+
+#include <experimental/system_error>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
Added: libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp?rev=227973&view=auto
==============================================================================
--- libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp (added)
+++ libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp Tue Feb 3 10:03:24 2015
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/system_error>
+
+#include <experimental/system_error>
+
+int main()
+{
+ // Check that <system_error> has been included
+ std::error_code ec;
+ ((void)ec);
+}
Added: libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp?rev=227973&view=auto
==============================================================================
--- libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp (added)
+++ libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp Tue Feb 3 10:03:24 2015
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/system_error>
+
+// template <class T> constexpr bool is_error_code_enum_v;
+
+#include <experimental/system_error>
+#include <ios> /* for std::io_errc */
+
+namespace ex = std::experimental;
+
+int main() {
+ {
+ static_assert(ex::is_error_code_enum_v<std::io_errc>, "");
+
+ static_assert(ex::is_error_code_enum_v<std::io_errc> ==
+ std::is_error_code_enum<std::io_errc>::value, "");
+
+ static_assert(std::is_same<decltype(ex::is_error_code_enum_v<std::io_errc>),
+ const bool>::value, "");
+ }
+ {
+ static_assert(!ex::is_error_code_enum_v<int>, "");
+
+ static_assert(ex::is_error_code_enum_v<int> ==
+ std::is_error_code_enum<int>::value, "");
+ }
+}
Added: libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp?rev=227973&view=auto
==============================================================================
--- libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp (added)
+++ libcxx/trunk/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp Tue Feb 3 10:03:24 2015
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/system_error>
+
+// template <class T> constexpr bool is_error_condition_enum_v;
+
+#include <experimental/system_error>
+#include <type_traits>
+namespace ex = std::experimental;
+
+int main() {
+ {
+ static_assert(ex::is_error_condition_enum_v<std::errc>, "");
+
+ static_assert(ex::is_error_condition_enum_v<std::errc> ==
+ std::is_error_condition_enum<std::errc>::value, "");
+
+ static_assert(
+ std::is_same<decltype(ex::is_error_condition_enum_v<std::errc>),
+ const bool>::value,
+ "");
+ }
+ {
+ static_assert(!ex::is_error_condition_enum_v<int>, "");
+
+ static_assert(ex::is_error_condition_enum_v<int> ==
+ std::is_error_condition_enum<int>::value, "");
+ }
+}
More information about the cfe-commits
mailing list