From 39f1cc0238f22fc3bd6a1b9ded1a74c62910bf74 Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Tue, 17 Jul 2018 14:00:08 +0000 Subject: [PATCH] resolve some warnings --- include/boost/regex/concepts.hpp | 5 +++-- src/fileiter.cpp | 2 +- src/icu.cpp | 2 +- test/c_compiler_checks/posix_api_check.c | 4 ++-- test/c_compiler_checks/wide_posix_api_check.c | 4 ++-- test/captures/captures_test.cpp | 4 ++-- test/test_macros.hpp | 4 ++-- test/unicode/unicode_iterator_test.cpp | 8 ++++++++ 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/include/boost/regex/concepts.hpp b/include/boost/regex/concepts.hpp index 8cd5d995..276e63f7 100644 --- a/include/boost/regex/concepts.hpp +++ b/include/boost/regex/concepts.hpp @@ -437,7 +437,8 @@ struct BaseRegexConcept ignore_unused_variable_warning(bi); sub_diff_type diff = m_sub.length(); ignore_unused_variable_warning(diff); - // match_results tests: + // match_results tests - some typedefs are not used, however these + // guarante that they exist (some compilers may warn on non-usage) typedef typename match_results_type::value_type mr_value_type; typedef typename match_results_type::const_reference mr_const_reference; typedef typename match_results_type::reference mr_reference; @@ -483,7 +484,7 @@ struct BaseRegexConcept mrci = m_cresults.end(); ignore_unused_variable_warning(mrci); - mr_allocator_type at2 = m_cresults.get_allocator(); + (void) m_cresults.get_allocator(); m_results.swap(m_results); global_regex_namespace::swap(m_results, m_results); diff --git a/src/fileiter.cpp b/src/fileiter.cpp index c48ed657..c80459b8 100644 --- a/src/fileiter.cpp +++ b/src/fileiter.cpp @@ -832,7 +832,7 @@ bool iswild(const char* mask, const char* name) ++mask; continue; } - // fall through: + // fall through default: if(BOOST_REGEX_FI_TRANSLATE(*mask) != BOOST_REGEX_FI_TRANSLATE(*name)) return false; diff --git a/src/icu.cpp b/src/icu.cpp index d101d65d..5f249e2d 100644 --- a/src/icu.cpp +++ b/src/icu.cpp @@ -481,7 +481,7 @@ icu_regex_traits::string_type icu_regex_traits::lookup_collatename(const char_ty bool icu_regex_traits::isctype(char_type c, char_class_type f) const { // check for standard catagories first: - char_class_type m = char_class_type(1uLL << u_charType(c)); + char_class_type m = char_class_type(static_cast(1) << u_charType(c)); if((m & f) != 0) return true; // now check for special cases: diff --git a/test/c_compiler_checks/posix_api_check.c b/test/c_compiler_checks/posix_api_check.c index c12525c8..34abca14 100644 --- a/test/c_compiler_checks/posix_api_check.c +++ b/test/c_compiler_checks/posix_api_check.c @@ -39,7 +39,7 @@ int main() { char buf[256]; regerrorA(result, &re, buf, sizeof(buf)); - printf(buf); + puts(buf); return result; } assert(re.re_nsub == 0); @@ -50,7 +50,7 @@ int main() { char buf[256]; regerrorA(result, &re, buf, sizeof(buf)); - printf(buf); + puts(buf); regfreeA(&re); return result; } diff --git a/test/c_compiler_checks/wide_posix_api_check.c b/test/c_compiler_checks/wide_posix_api_check.c index 096d929a..cd1a287d 100644 --- a/test/c_compiler_checks/wide_posix_api_check.c +++ b/test/c_compiler_checks/wide_posix_api_check.c @@ -50,7 +50,7 @@ int main() regerror(result, &re, buf, sizeof(buf)); for(i = 0; i < 256; ++i) nbuf[i] = (char)(buf[i]); - printf(nbuf); + puts(nbuf); return result; } if(re.re_nsub != 0) @@ -66,7 +66,7 @@ int main() regerror(result, &re, buf, sizeof(buf)); for(i = 0; i < 256; ++i) nbuf[i] = (char)(buf[i]); - printf(nbuf); + puts(nbuf); regfree(&re); return result; } diff --git a/test/captures/captures_test.cpp b/test/captures/captures_test.cpp index 63f58c9c..641d1b9b 100644 --- a/test/captures/captures_test.cpp +++ b/test/captures/captures_test.cpp @@ -29,9 +29,9 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) template -int array_size(const char* (&p)[N]) +size_t array_size(const char* (&p)[N]) { - for(int i = 0; i < N; ++i) + for(size_t i = 0; i < N; ++i) if(p[i] == 0) return i; return N; diff --git a/test/test_macros.hpp b/test/test_macros.hpp index d8772965..ef28fe0a 100644 --- a/test/test_macros.hpp +++ b/test/test_macros.hpp @@ -65,8 +65,8 @@ void report_unexpected_exception(const E& e, int severity, const char* file, int } #define BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity) \ - catch(const std::exception& e) \ - { report_unexpected_exception(e, severity, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); }\ + catch(const std::exception& __e) \ + { report_unexpected_exception(__e, severity, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); }\ catch(...)\ { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Exception of unknown type was thrown" << std::endl; report_severity(severity); } diff --git a/test/unicode/unicode_iterator_test.cpp b/test/unicode/unicode_iterator_test.cpp index 243ef742..2e6bcec1 100644 --- a/test/unicode/unicode_iterator_test.cpp +++ b/test/unicode/unicode_iterator_test.cpp @@ -157,22 +157,30 @@ void spot_checks() void test(const std::vector< ::boost::uint32_t>& v) { typedef std::vector< ::boost::uint32_t> vector32_type; +#ifdef TEST_UTF16 typedef std::vector< ::boost::uint16_t> vector16_type; +#endif typedef std::vector< ::boost::uint8_t> vector8_type; +#ifdef TEST_UTF16 typedef boost::u32_to_u16_iterator u32to16type; typedef boost::u16_to_u32_iterator u16to32type; #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) typedef std::reverse_iterator ru32to16type; typedef std::reverse_iterator ru16to32type; #endif +#endif // TEST_UTF16 +#ifdef TEST_UTF8 typedef boost::u32_to_u8_iterator u32to8type; typedef boost::u8_to_u32_iterator u8to32type; #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) typedef std::reverse_iterator ru32to8type; typedef std::reverse_iterator ru8to32type; #endif +#endif // TEST_UTF8 vector8_type v8; +#ifdef TEST_UTF16 vector16_type v16; +#endif vector32_type v32; vector32_type::const_iterator i, j, k;