Cleanup quick_exit tests and get them passing in C++03.

Wrap the original test in _LIBCPP_HAS_QUICK_EXIT so it only runs when we have
quick_exit and add two new tests that check that when _LIBCPP_HAS_QUICK_EXIT
is not defined then no definition of std::at_quick_exit or std::quick_exit are
available.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222298 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2014-11-19 01:45:12 +00:00
parent 0bb95849ec
commit 221907d782
3 changed files with 53 additions and 2 deletions

View File

@@ -12,12 +12,13 @@
// test quick_exit and at_quick_exit // test quick_exit and at_quick_exit
#include <cstdlib> #include <cstdlib>
#include <type_traits>
void f() {} void f() {}
int main() int main()
{ {
#ifdef _LIBCPP_HAS_QUICK_EXIT
std::at_quick_exit(f); std::at_quick_exit(f);
quick_exit(0); std::quick_exit(0);
#endif
} }

View File

@@ -0,0 +1,25 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// test that referencing at_quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
// results in a compile error.
#include <cstdlib>
void f() {}
int main()
{
#ifndef _LIBCPP_HAS_QUICK_EXIT
std::at_quick_exit(f);
#else
#error
#endif
}

View File

@@ -0,0 +1,25 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// test that referencing quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
// results in a compile error.
#include <cstdlib>
void f() {}
int main()
{
#ifndef _LIBCPP_HAS_QUICK_EXIT
std::quick_exit(0);
#else
#error
#endif
}