Clear compiler warnings

[SVN r75185]
This commit is contained in:
Beman Dawes
2011-10-31 11:21:10 +00:00
parent 5ae1de8cec
commit b899a529a5
16 changed files with 41 additions and 7 deletions

View File

@@ -14,10 +14,9 @@
namespace boost_has_ftime{ namespace boost_has_ftime{
void f() void f(FILETIME)
{ {
// this is never called, it just has to compile: // this is never called, it just has to compile:
FILETIME ft;
} }
int test() int test()

View File

@@ -13,9 +13,12 @@
namespace boost_no_char16_t { namespace boost_no_char16_t {
void quiet_warning(const char16_t*){}
int test() int test()
{ {
const char16_t* p = u"abc"; const char16_t* p = u"abc";
quiet_warning(p);
return 0; return 0;
} }

View File

@@ -12,9 +12,12 @@
namespace boost_no_char32_t { namespace boost_no_char32_t {
void quiet_warning(const char32_t*){}
int test() int test()
{ {
const char32_t* p = U"abc"; const char32_t* p = U"abc";
quiet_warning(p);
return 0; return 0;
} }

View File

@@ -12,6 +12,8 @@
namespace boost_no_constexpr { namespace boost_no_constexpr {
void quiet_warning(int){}
constexpr int square(int x) { return x * x; } // from N2235 constexpr int square(int x) { return x * x; } // from N2235
// from 5.19: // from 5.19:
@@ -37,6 +39,7 @@ X<a> xx; // OK: unique conversion to int
int test() int test()
{ {
int i = square(5); int i = square(5);
quiet_warning(i);
return 0; return 0;
} }

View File

@@ -13,6 +13,8 @@
namespace boost_no_decltype { namespace boost_no_decltype {
void quiet_warning(int){}
struct test_class struct test_class
{ {
test_class() {} test_class() {}
@@ -39,6 +41,7 @@ int test()
{ {
int i; int i;
decltype(i) j; decltype(i) j;
// quiet_warning(j);
decltype(get_test_class()) k; decltype(get_test_class()) k;
#ifndef _MSC_VER #ifndef _MSC_VER
// Although the VC++ decltype is buggy, we none the less enable support, // Although the VC++ decltype is buggy, we none the less enable support,

View File

@@ -11,7 +11,7 @@
// DESCRIPTION: The compiler does not support C++0x defaulted functions // DESCRIPTION: The compiler does not support C++0x defaulted functions
#if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(BOOST_INTEL_STDCXX0X) #if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(BOOST_INTEL_STDCXX0X)
# error Defaulted functions aren't really supported in non-C++0x mode # error Defaulted functions are not supported in non-C++0x mode
#endif #endif
namespace boost_no_defaulted_functions { namespace boost_no_defaulted_functions {

View File

@@ -11,7 +11,7 @@
// DESCRIPTION: The compiler does not support C++0x =delete functions // DESCRIPTION: The compiler does not support C++0x =delete functions
#if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(BOOST_INTEL_STDCXX0X) #if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(BOOST_INTEL_STDCXX0X)
# error Deleted functions aren't really supported in non-C++0x mode # error Deleted functions are not supported in non-C++0x mode
#endif #endif
namespace boost_no_deleted_functions { namespace boost_no_deleted_functions {

View File

@@ -11,11 +11,13 @@
// DESCRIPTION: The compiler does not support C++0x explicit conversion operators // DESCRIPTION: The compiler does not support C++0x explicit conversion operators
#if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(BOOST_INTEL_STDCXX0X) #if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(BOOST_INTEL_STDCXX0X)
# error This feature isn't really available in non-C++0x mode # error This feature is not available in non-C++0x mode
#endif #endif
namespace boost_no_explicit_conversion_operators { namespace boost_no_explicit_conversion_operators {
void quiet_warning(int){}
struct foo { struct foo {
explicit operator int() { return 1; } explicit operator int() { return 1; }
}; };
@@ -24,6 +26,7 @@ int test()
{ {
foo f; foo f;
int i = int(f); int i = int(f);
quiet_warning(i);
return 0; return 0;
} }

View File

@@ -16,6 +16,8 @@
namespace boost_no_initializer_lists { namespace boost_no_initializer_lists {
void quiet_warning(const std::initializer_list<int>&){}
void f(std::initializer_list<int>) void f(std::initializer_list<int>)
{ {
} }
@@ -25,6 +27,7 @@ int test()
std::vector<std::string> v{"once", "upon", "a", "time"}; // See C++ std 8.5.4 std::vector<std::string> v{"once", "upon", "a", "time"}; // See C++ std 8.5.4
f( { 1, 2, 3, 4 } ); f( { 1, 2, 3, 4 } );
std::initializer_list<int> x = { 1, 2 }; std::initializer_list<int> x = { 1, 2 };
quiet_warning(x);
return 0; return 0;
} }

View File

@@ -11,7 +11,7 @@
// DESCRIPTION: The compiler does not support the C++0x lambda feature // DESCRIPTION: The compiler does not support the C++0x lambda feature
#if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(BOOST_INTEL_STDCXX0X) #if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(BOOST_INTEL_STDCXX0X)
# error This feature isn't really available in non-C++0x mode # error This feature is not available in non-C++0x mode
#endif #endif
namespace boost_no_lambdas { namespace boost_no_lambdas {

View File

@@ -11,12 +11,15 @@
namespace boost_no_noexcept { namespace boost_no_noexcept {
void quiet_warning(bool){}
int f() noexcept ; int f() noexcept ;
int g() noexcept( noexcept( f() ) ) ; int g() noexcept( noexcept( f() ) ) ;
int test() int test()
{ {
bool b = noexcept( g() ); bool b = noexcept( g() );
quiet_warning(b);
return 0; return 0;
} }

View File

@@ -12,9 +12,12 @@
namespace boost_no_nullptr { namespace boost_no_nullptr {
void quiet_warning(const int*){}
int test() int test()
{ {
int * p = nullptr; int * p = nullptr;
quiet_warning(p);
return 0; return 0;
} }

View File

@@ -12,10 +12,15 @@
namespace boost_no_raw_literals { namespace boost_no_raw_literals {
void quiet_warning(const char*){}
void quiet_warning(const wchar_t*){}
int test() int test()
{ {
const char* s = R"(abc)"; const char* s = R"(abc)";
quiet_warning(s);
const wchar_t* ws = LR"(abc)"; const wchar_t* ws = LR"(abc)";
quiet_warning(ws);
return 0; return 0;
} }

View File

@@ -13,10 +13,12 @@
namespace boost_no_std_typeinfo namespace boost_no_std_typeinfo
{ {
void quiet_warning(const std::type_info*){}
int test() int test()
{ {
std::type_info * p = 0; std::type_info * p = 0;
quiet_warning(p);
return 0; return 0;
} }

View File

@@ -12,10 +12,12 @@
namespace boost_no_unicode_literals { namespace boost_no_unicode_literals {
void quiet_warning(const char*){}
int test() int test()
{ {
const char* c8 = u8""; const char* c8 = u8"";
quiet_warning(c8);
return 0; return 0;
} }

View File

@@ -49,13 +49,15 @@
namespace boost_no_variadic_macros { namespace boost_no_variadic_macros {
void quiet_warning(int){}
template<TEST_VARIADIC_MACRO_STRIP_PARENS((typename T,int))> struct test_variadic_macro_class {}; template<TEST_VARIADIC_MACRO_STRIP_PARENS((typename T,int))> struct test_variadic_macro_class {};
int test() int test()
{ {
int x = TEST_VARIADIC_MACRO_STRIP_PARENS(3); int x = TEST_VARIADIC_MACRO_STRIP_PARENS(3);
quiet_warning(x);
return 0; return 0;
} }