mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-18 08:49:55 +00:00
Suppress clang warnings in some tests
llvm-svn: 246399
This commit is contained in:
parent
96425c2574
commit
d49455ef93
@ -15,6 +15,12 @@
|
||||
// RUN: %cxx -o %t.exe %t.first.o %t.second.o %flags %link_flags
|
||||
// RUN: %run
|
||||
|
||||
|
||||
// Prevent <ext/hash_map> from generating deprecated warnings for this test.
|
||||
#if defined(__DEPRECATED)
|
||||
#undef __DEPRECATED
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
@ -50,6 +56,7 @@
|
||||
#include <deque>
|
||||
#include <exception>
|
||||
#include <experimental/algorithm>
|
||||
#include <experimental/any>
|
||||
#include <experimental/chrono>
|
||||
#include <experimental/dynarray>
|
||||
#include <experimental/optional>
|
||||
|
@ -578,6 +578,10 @@ class Configuration(object):
|
||||
self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
|
||||
self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
|
||||
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)
|
||||
if std in ['c++98', 'c++03']:
|
||||
# The '#define static_assert' provided by libc++ in C++03 mode
|
||||
|
@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
|
||||
// <optional>
|
||||
|
||||
@ -15,8 +17,6 @@
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
using std::experimental::optional;
|
||||
|
||||
class X
|
||||
@ -39,18 +39,14 @@ public:
|
||||
|
||||
class Z
|
||||
{
|
||||
int i_;
|
||||
public:
|
||||
Z(int i) : i_(i) {}
|
||||
Z(int) {}
|
||||
Z(const Z&) {throw 6;}
|
||||
};
|
||||
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
int main()
|
||||
{
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
{
|
||||
typedef int T;
|
||||
constexpr T t(5);
|
||||
@ -113,5 +109,4 @@ int main()
|
||||
assert(i == 6);
|
||||
}
|
||||
}
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
|
||||
// <optional>
|
||||
|
||||
@ -16,7 +18,6 @@
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
using std::experimental::optional;
|
||||
using std::experimental::in_place_t;
|
||||
@ -52,17 +53,13 @@ public:
|
||||
|
||||
class Z
|
||||
{
|
||||
int i_;
|
||||
public:
|
||||
Z(int i) : i_(i) {throw 6;}
|
||||
Z(int i) {throw 6;}
|
||||
};
|
||||
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
int main()
|
||||
{
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
{
|
||||
constexpr optional<int> opt(in_place, 5);
|
||||
static_assert(static_cast<bool>(opt) == true, "");
|
||||
@ -141,5 +138,4 @@ int main()
|
||||
assert(i == 6);
|
||||
}
|
||||
}
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
|
||||
// <optional>
|
||||
|
||||
@ -15,8 +17,6 @@
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
using std::experimental::optional;
|
||||
|
||||
class X
|
||||
@ -41,17 +41,14 @@ public:
|
||||
|
||||
class Z
|
||||
{
|
||||
int i_;
|
||||
public:
|
||||
Z(int i) : i_(i) {}
|
||||
Z(int) {}
|
||||
Z(Z&&) {throw 6;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
int main()
|
||||
{
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
{
|
||||
typedef int T;
|
||||
constexpr optional<T> opt(T(5));
|
||||
@ -106,5 +103,4 @@ int main()
|
||||
assert(i == 6);
|
||||
}
|
||||
}
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
}
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wliteral-conversion"
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -52,6 +52,24 @@ void test_comparisons()
|
||||
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()
|
||||
{
|
||||
@ -72,8 +90,5 @@ int main()
|
||||
test_comparisons<A*>();
|
||||
test_comparisons<void(*)()>();
|
||||
}
|
||||
{
|
||||
bool b = nullptr;
|
||||
assert(!b);
|
||||
}
|
||||
test_nullptr_conversions();
|
||||
}
|
||||
|
@ -38,8 +38,6 @@ int move_only_constructed = 0;
|
||||
#if TEST_STD_VER >= 11
|
||||
class move_only
|
||||
{
|
||||
int data;
|
||||
|
||||
move_only(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;}
|
||||
|
||||
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
|
||||
|
||||
|
@ -13,6 +13,14 @@
|
||||
|
||||
// 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
|
||||
#include "is_convertible.pass.cpp"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user