Suppress clang warnings in some tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246399 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -15,6 +15,12 @@
|
|||||||
// RUN: %cxx -o %t.exe %t.first.o %t.second.o %flags %link_flags
|
// RUN: %cxx -o %t.exe %t.first.o %t.second.o %flags %link_flags
|
||||||
// RUN: %run
|
// RUN: %run
|
||||||
|
|
||||||
|
|
||||||
|
// Prevent <ext/hash_map> from generating deprecated warnings for this test.
|
||||||
|
#if defined(__DEPRECATED)
|
||||||
|
#undef __DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
@@ -50,6 +56,7 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <experimental/algorithm>
|
#include <experimental/algorithm>
|
||||||
|
#include <experimental/any>
|
||||||
#include <experimental/chrono>
|
#include <experimental/chrono>
|
||||||
#include <experimental/dynarray>
|
#include <experimental/dynarray>
|
||||||
#include <experimental/optional>
|
#include <experimental/optional>
|
||||||
|
@@ -578,6 +578,10 @@ class Configuration(object):
|
|||||||
self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
|
self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
|
||||||
self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
|
self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
|
||||||
self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals')
|
self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals')
|
||||||
|
# TODO(EricWF) Remove the unused warnings once the test suite
|
||||||
|
# compiles clean with them.
|
||||||
|
self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
|
||||||
|
self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
|
||||||
std = self.get_lit_conf('std', None)
|
std = self.get_lit_conf('std', None)
|
||||||
if std in ['c++98', 'c++03']:
|
if std in ['c++98', 'c++03']:
|
||||||
# The '#define static_assert' provided by libc++ in C++03 mode
|
# The '#define static_assert' provided by libc++ in C++03 mode
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
// Source Licenses. See LICENSE.TXT for details.
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// UNSUPPORTED: c++98, c++03, c++11
|
||||||
|
|
||||||
// <optional>
|
// <optional>
|
||||||
|
|
||||||
@@ -15,8 +17,6 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
using std::experimental::optional;
|
using std::experimental::optional;
|
||||||
|
|
||||||
class X
|
class X
|
||||||
@@ -39,18 +39,14 @@ public:
|
|||||||
|
|
||||||
class Z
|
class Z
|
||||||
{
|
{
|
||||||
int i_;
|
|
||||||
public:
|
public:
|
||||||
Z(int i) : i_(i) {}
|
Z(int) {}
|
||||||
Z(const Z&) {throw 6;}
|
Z(const Z&) {throw 6;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
{
|
{
|
||||||
typedef int T;
|
typedef int T;
|
||||||
constexpr T t(5);
|
constexpr T t(5);
|
||||||
@@ -113,5 +109,4 @@ int main()
|
|||||||
assert(i == 6);
|
assert(i == 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // _LIBCPP_STD_VER > 11
|
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
// Source Licenses. See LICENSE.TXT for details.
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// UNSUPPORTED: c++98, c++03, c++11
|
||||||
|
|
||||||
// <optional>
|
// <optional>
|
||||||
|
|
||||||
@@ -16,7 +18,6 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
using std::experimental::optional;
|
using std::experimental::optional;
|
||||||
using std::experimental::in_place_t;
|
using std::experimental::in_place_t;
|
||||||
@@ -52,17 +53,13 @@ public:
|
|||||||
|
|
||||||
class Z
|
class Z
|
||||||
{
|
{
|
||||||
int i_;
|
|
||||||
public:
|
public:
|
||||||
Z(int i) : i_(i) {throw 6;}
|
Z(int i) {throw 6;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
{
|
{
|
||||||
constexpr optional<int> opt(in_place, 5);
|
constexpr optional<int> opt(in_place, 5);
|
||||||
static_assert(static_cast<bool>(opt) == true, "");
|
static_assert(static_cast<bool>(opt) == true, "");
|
||||||
@@ -141,5 +138,4 @@ int main()
|
|||||||
assert(i == 6);
|
assert(i == 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // _LIBCPP_STD_VER > 11
|
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
// Source Licenses. See LICENSE.TXT for details.
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// UNSUPPORTED: c++98, c++03, c++11
|
||||||
|
|
||||||
// <optional>
|
// <optional>
|
||||||
|
|
||||||
@@ -15,8 +17,6 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
using std::experimental::optional;
|
using std::experimental::optional;
|
||||||
|
|
||||||
class X
|
class X
|
||||||
@@ -41,17 +41,14 @@ public:
|
|||||||
|
|
||||||
class Z
|
class Z
|
||||||
{
|
{
|
||||||
int i_;
|
|
||||||
public:
|
public:
|
||||||
Z(int i) : i_(i) {}
|
Z(int) {}
|
||||||
Z(Z&&) {throw 6;}
|
Z(Z&&) {throw 6;}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
{
|
{
|
||||||
typedef int T;
|
typedef int T;
|
||||||
constexpr optional<T> opt(T(5));
|
constexpr optional<T> opt(T(5));
|
||||||
@@ -106,5 +103,4 @@ int main()
|
|||||||
assert(i == 6);
|
assert(i == 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // _LIBCPP_STD_VER > 11
|
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,10 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wliteral-conversion"
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@@ -52,6 +52,24 @@ void test_comparisons()
|
|||||||
assert(!(nullptr > p));
|
assert(!(nullptr > p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma diagnostic ignored "-Wnull-conversion"
|
||||||
|
#endif
|
||||||
|
void test_nullptr_conversions() {
|
||||||
|
{
|
||||||
|
bool b = nullptr;
|
||||||
|
assert(!b);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
bool b(nullptr);
|
||||||
|
assert(!b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -72,8 +90,5 @@ int main()
|
|||||||
test_comparisons<A*>();
|
test_comparisons<A*>();
|
||||||
test_comparisons<void(*)()>();
|
test_comparisons<void(*)()>();
|
||||||
}
|
}
|
||||||
{
|
test_nullptr_conversions();
|
||||||
bool b = nullptr;
|
|
||||||
assert(!b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -38,8 +38,6 @@ int move_only_constructed = 0;
|
|||||||
#if TEST_STD_VER >= 11
|
#if TEST_STD_VER >= 11
|
||||||
class move_only
|
class move_only
|
||||||
{
|
{
|
||||||
int data;
|
|
||||||
|
|
||||||
move_only(const move_only&) = delete;
|
move_only(const move_only&) = delete;
|
||||||
move_only& operator=(const move_only&)= delete;
|
move_only& operator=(const move_only&)= delete;
|
||||||
|
|
||||||
@@ -49,6 +47,10 @@ public:
|
|||||||
|
|
||||||
move_only() {++move_only_constructed;}
|
move_only() {++move_only_constructed;}
|
||||||
~move_only() {--move_only_constructed;}
|
~move_only() {--move_only_constructed;}
|
||||||
|
|
||||||
|
public:
|
||||||
|
int data; // unused other than to make sizeof(move_only) == sizeof(int).
|
||||||
|
// but public to suppress "-Wunused-private-field"
|
||||||
};
|
};
|
||||||
#endif // TEST_STD_VER >= 11
|
#endif // TEST_STD_VER >= 11
|
||||||
|
|
||||||
|
@@ -13,6 +13,14 @@
|
|||||||
|
|
||||||
// Test the fallback implementation.
|
// Test the fallback implementation.
|
||||||
|
|
||||||
|
// libc++ provides a fallback implementation of the compiler trait
|
||||||
|
// `__is_convertible` with the same name when clang doesn't.
|
||||||
|
// Because this test forces the use of the fallback even when clang provides
|
||||||
|
// it causing a keyword incompatibility.
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wkeyword-compat"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _LIBCPP_USE_IS_CONVERTIBLE_FALLBACK
|
#define _LIBCPP_USE_IS_CONVERTIBLE_FALLBACK
|
||||||
#include "is_convertible.pass.cpp"
|
#include "is_convertible.pass.cpp"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user