]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Suppress a warning inside boost. 838/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 19 Apr 2015 20:47:01 +0000 (15:47 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 19 Apr 2015 20:47:01 +0000 (15:47 -0500)
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<typename Ptree::key_type::value_type>&, const Ptree&, int, bool) [with Ptree = boost::property_tree::basic_ptree<std::basic_string<char>, std::basic_string<char> >, 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<typename Ptree::key_type::value_type>&, const Ptree&, const string&, bool) [with Ptree = boost::property_tree::basic_ptree<std::basic_string<char>, std::basic_string<char> >, typename Ptree::key_type::value_type = char, std::string = std::basic_string<char>]
â/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<typename Ptree::key_type::value_type>&, const Ptree&, bool) [with Ptree = boost::property_tree::basic_ptree<std::basic_string<char>, std::basic_string<char> >, 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]

bundled/boost-1.56.0/include/boost/property_tree/detail/json_parser_write.hpp

index b52c8eac6f316e5c3b42029c87068544d1ccf94c..64453921652b60029779415744125a60732094fe 100644 (file)
 
 namespace boost { namespace property_tree { namespace json_parser
 {
+  inline bool is_ascii (char) 
+  {
+    return true;
+  }
+
+  template <class Ch>
+  inline bool is_ascii (Ch b)
+  {
+    return b <= 0xFF;
+  }
+  
 
     // Create necessary escape sequences from illegal characters
     template<class Ch>
@@ -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');

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.