From: Wolfgang Bangerth Date: Sun, 19 Apr 2015 20:47:01 +0000 (-0500) Subject: Suppress a warning inside boost. X-Git-Tag: v8.3.0-rc1~240^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db41f21228735a9ed8f741502a40daf63a74ff5f;p=dealii.git Suppress a warning inside boost. Specifically, suppress the following warning: In file included from /u/bangerth/p/deal.II/1/dealii/bundled/boost-1.56.0/include/boost/property_tree/json_parser.hpp:15:0, from /u/bangerth/p/deal.II/1/dealii/source/base/parameter_handler.cc:25: /u/bangerth/p/deal.II/1/dealii/bundled/boost-1.56.0/include/boost/property_tree/detail/json_parser_write.hpp: In function âstd::basic_string<_CharT> boost::property_tree::json_parser::create_escapes(const std::basic_string<_CharT>&) [with Ch = char]â :/u/bangerth/p/deal.II/1/dealii/bundled/boost-1.56.0/include/boost/property_tree/detail/json_parser_write.hpp:79:67: instantiated from âvoid boost::property_tree::json_parser::write_json_helper(std::basic_ostream&, const Ptree&, int, bool) [with Ptree = boost::property_tree::basic_ptree, std::basic_string >, typename Ptree::key_type::value_type = char] â/u/bangerth/p/deal.II/1/dealii/bundled/boost-1.56.0/include/boost/property_tree/detail/json_parser_write.hpp:159:9: instantiated from âvoid boost::property_tree::json_parser::write_json_internal(std::basic_ostream&, const Ptree&, const string&, bool) [with Ptree = boost::property_tree::basic_ptree, std::basic_string >, typename Ptree::key_type::value_type = char, std::string = std::basic_string] â/u/bangerth/p/deal.II/1/dealii/bundled/boost-1.56.0/include/boost/property_tree/json_parser.hpp:98:9: instantiated from âvoid boost::property_tree::json_parser::write_json(std::basic_ostream&, const Ptree&, bool) [with Ptree = boost::property_tree::basic_ptree, std::basic_string >, typename Ptree::key_type::value_type = char] â/u/bangerth/p/deal.II/1/dealii/source/base/parameter_handler.cc:1921:32: instantiated from here /u/bangerth/p/deal.II/1/dealii/bundled/boost-1.56.0/include/boost/property_tree/detail/json_parser_write.hpp:35:13: warning: comparison is always true due to limited range of data type [-Wtype-limits] --- diff --git a/bundled/boost-1.56.0/include/boost/property_tree/detail/json_parser_write.hpp b/bundled/boost-1.56.0/include/boost/property_tree/detail/json_parser_write.hpp index b52c8eac6f..6445392165 100644 --- a/bundled/boost-1.56.0/include/boost/property_tree/detail/json_parser_write.hpp +++ b/bundled/boost-1.56.0/include/boost/property_tree/detail/json_parser_write.hpp @@ -19,6 +19,17 @@ namespace boost { namespace property_tree { namespace json_parser { + inline bool is_ascii (char) + { + return true; + } + + template + inline bool is_ascii (Ch b) + { + return b <= 0xFF; + } + // Create necessary escape sequences from illegal characters template @@ -33,7 +44,7 @@ namespace boost { namespace property_tree { namespace json_parser // We escape everything outside ASCII, because this code can't // handle high unicode characters. if (*b == 0x20 || *b == 0x21 || (*b >= 0x23 && *b <= 0x2E) || - (*b >= 0x30 && *b <= 0x5B) || (*b >= 0x5D && *b <= 0xFF)) + (*b >= 0x30 && *b <= 0x5B) || (*b >= 0x5D && is_ascii(*b))) result += *b; else if (*b == Ch('\b')) result += Ch('\\'), result += Ch('b'); else if (*b == Ch('\f')) result += Ch('\\'), result += Ch('f');