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 | 55684ae945f36746bb3e58d8135d439fab01f969 (patch) | |
tree | 22583f9c631a0e995919a83c3ce7e05ea731a9f6 /libcxx/test | |
parent | a7e60d4797b7b4ef5ffa7ca1a790a83dc1c581d3 (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.
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 00000000000..074a9c58c61 --- /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 00000000000..c4fb9593a9e --- /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 00000000000..32fd0527d48 --- /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 00000000000..37ac584a7cd --- /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 00000000000..64f73742099 --- /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 00000000000..417982e3669 --- /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 00000000000..0bcda7056b4 --- /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 00000000000..bc37d8b4dbf --- /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 00000000000..1711d2f0374 --- /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 00000000000..ef011bbe450 --- /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 00000000000..d9a01337a93 --- /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 00000000000..8ebb347a44b --- /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 00000000000..9f3d679fc2a --- /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 00000000000..5544a3f0e14 --- /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 00000000000..520e9fbb42f --- /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 00000000000..c7c9e572856 --- /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() {} |