diff options
author | Eric Fiselier <eric@efcs.ca> | 2019-01-06 00:37:31 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2019-01-06 00:37:31 +0000 |
commit | b168a7c6604857e507c7da90cdb7c2bc683adf2e (patch) | |
tree | edbd4ed7da70cfbb164e95cffbd348a27243cac5 /libcxx/test | |
parent | 9dabf6ac70dafbdcbfbc3b6401de92731897e958 (diff) |
Fix PR39749 - Headers containing just #error harm __has_include.
This patch changes <experimental/foo> to use #warning instead of
is harmful to common feature detection idioms.
We should also consider only emitting the warning when __DEPRECATED is
defined, like we do in the <ext/foo> headers. Users may want to specify
"-Werror=-W#warnings" while still ignoring the libc++ warnings.
llvm-svn: 350485
Diffstat (limited to 'libcxx/test')
16 files changed, 312 insertions, 0 deletions
diff --git a/libcxx/test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp b/libcxx/test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp new file mode 100644 index 000000000000..074a9c58c614 --- /dev/null +++ b/libcxx/test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: verify-support + +// <experimental/system_error> + +#include <experimental/system_error> + +// expected-error@experimental/system_error:* {{"<experimental/system_error> has been removed. Use <system_error> instead."}} + +int main() {} diff --git a/libcxx/test/libcxx/experimental/diagnostics/syserr/version.pass.cpp b/libcxx/test/libcxx/experimental/diagnostics/syserr/version.pass.cpp new file mode 100644 index 000000000000..c4fb9593a9ee --- /dev/null +++ b/libcxx/test/libcxx/experimental/diagnostics/syserr/version.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// <experimental/system_error> + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-W#warnings" +#endif +#include <experimental/system_error> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() {} diff --git a/libcxx/test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp b/libcxx/test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp new file mode 100644 index 000000000000..32fd0527d482 --- /dev/null +++ b/libcxx/test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: verify-support + +// <experimental/numeric> + +#include <experimental/numeric> + +// expected-error@experimental/numeric:* {{"<experimental/numeric> has been removed. Use <numeric> instead."}} + +int main() {} diff --git a/libcxx/test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp b/libcxx/test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp new file mode 100644 index 000000000000..37ac584a7cd4 --- /dev/null +++ b/libcxx/test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// <experimental/numeric> + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-W#warnings" +#endif +#include <experimental/numeric> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() {} diff --git a/libcxx/test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp b/libcxx/test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp new file mode 100644 index 000000000000..64f73742099b --- /dev/null +++ b/libcxx/test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: verify-support + +// <experimental/string_view> + +#include <experimental/string_view> + +// expected-error@experimental/string_view:* {{"<experimental/string_view> has been removed. Use <string_view> instead."}} + +int main() {} diff --git a/libcxx/test/libcxx/experimental/strings/string.view/version.pass.cpp b/libcxx/test/libcxx/experimental/strings/string.view/version.pass.cpp new file mode 100644 index 000000000000..417982e36696 --- /dev/null +++ b/libcxx/test/libcxx/experimental/strings/string.view/version.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// <experimental/string_view> + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-W#warnings" +#endif +#include <experimental/string_view> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() {} diff --git a/libcxx/test/libcxx/experimental/utilities/any/use_header_warning.fail.cpp b/libcxx/test/libcxx/experimental/utilities/any/use_header_warning.fail.cpp new file mode 100644 index 000000000000..0bcda7056b4d --- /dev/null +++ b/libcxx/test/libcxx/experimental/utilities/any/use_header_warning.fail.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: verify-support + +// <experimental/any> + +#include <experimental/any> + +// expected-error@experimental/any:* {{"<experimental/any> has been removed. Use <any> instead."}} + +int main() {} diff --git a/libcxx/test/libcxx/experimental/utilities/any/version.pass.cpp b/libcxx/test/libcxx/experimental/utilities/any/version.pass.cpp new file mode 100644 index 000000000000..bc37d8b4dbfa --- /dev/null +++ b/libcxx/test/libcxx/experimental/utilities/any/version.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// <experimental/any> + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-W#warnings" +#endif +#include <experimental/any> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() {} diff --git a/libcxx/test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp b/libcxx/test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp new file mode 100644 index 000000000000..1711d2f03742 --- /dev/null +++ b/libcxx/test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: verify-support + +// <experimental/optional> + +#include <experimental/optional> + +// expected-error@experimental/optional:* {{"<experimental/optional> has been removed. Use <optional> instead."}} + +int main() {} diff --git a/libcxx/test/libcxx/experimental/utilities/optional/version.pass.cpp b/libcxx/test/libcxx/experimental/utilities/optional/version.pass.cpp new file mode 100644 index 000000000000..ef011bbe4506 --- /dev/null +++ b/libcxx/test/libcxx/experimental/utilities/optional/version.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// <experimental/optional> + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-W#warnings" +#endif +#include <experimental/optional> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() {} diff --git a/libcxx/test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp b/libcxx/test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp new file mode 100644 index 000000000000..d9a01337a936 --- /dev/null +++ b/libcxx/test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: verify-support + +// <experimental/ratio> + +#include <experimental/ratio> + +// expected-error@experimental/ratio:* {{"<experimental/ratio> has been removed. Use <ratio> instead."}} + +int main() {} diff --git a/libcxx/test/libcxx/experimental/utilities/ratio/version.pass.cpp b/libcxx/test/libcxx/experimental/utilities/ratio/version.pass.cpp new file mode 100644 index 000000000000..8ebb347a44ba --- /dev/null +++ b/libcxx/test/libcxx/experimental/utilities/ratio/version.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// <experimental/ratio> + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-W#warnings" +#endif +#include <experimental/ratio> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() {} diff --git a/libcxx/test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp b/libcxx/test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp new file mode 100644 index 000000000000..9f3d679fc2ab --- /dev/null +++ b/libcxx/test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: verify-support + +// <experimental/chrono> + +#include <experimental/chrono> + +// expected-error@experimental/chrono:* {{"<experimental/chrono> has been removed. Use <chrono> instead."}} + +int main() {} diff --git a/libcxx/test/libcxx/experimental/utilities/time/version.pass.cpp b/libcxx/test/libcxx/experimental/utilities/time/version.pass.cpp new file mode 100644 index 000000000000..5544a3f0e14b --- /dev/null +++ b/libcxx/test/libcxx/experimental/utilities/time/version.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// <experimental/chrono> + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-W#warnings" +#endif +#include <experimental/chrono> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() {} diff --git a/libcxx/test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp b/libcxx/test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp new file mode 100644 index 000000000000..520e9fbb42f0 --- /dev/null +++ b/libcxx/test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: verify-support + +// <experimental/tuple> + +#include <experimental/tuple> + +// expected-error@experimental/tuple:* {{"<experimental/tuple> has been removed. Use <tuple> instead."}} + +int main() {} diff --git a/libcxx/test/libcxx/experimental/utilities/tuple/version.pass.cpp b/libcxx/test/libcxx/experimental/utilities/tuple/version.pass.cpp new file mode 100644 index 000000000000..c7c9e572856d --- /dev/null +++ b/libcxx/test/libcxx/experimental/utilities/tuple/version.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// <experimental/tuple> + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-W#warnings" +#endif +#include <experimental/tuple> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() {} |