diff options
Diffstat (limited to 'libcxx/test/std/language.support/support.start.term')
3 files changed, 73 insertions, 0 deletions
diff --git a/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp b/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp new file mode 100644 index 00000000000..bcfdbb75402 --- /dev/null +++ b/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// 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 quick_exit and at_quick_exit + +#include <cstdlib> + +void f() {} + +int main() +{ +#ifdef _LIBCPP_HAS_QUICK_EXIT + std::at_quick_exit(f); + std::quick_exit(0); +#endif +} diff --git a/libcxx/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp b/libcxx/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp new file mode 100644 index 00000000000..8b972937916 --- /dev/null +++ b/libcxx/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp @@ -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 +} diff --git a/libcxx/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp b/libcxx/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp new file mode 100644 index 00000000000..39591413682 --- /dev/null +++ b/libcxx/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp @@ -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 +} |