From 1d113d45fc53b988f9ab148eb4e23bf5e696857c Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Mon, 3 Apr 2017 16:32:20 +0100 Subject: [PATCH] Re-enable compilation using GCC version 4.9 Java support will be incomplete as reported by the exception thrown if that code path is hit. --- src/util/unicode.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/util/unicode.cpp b/src/util/unicode.cpp index 1e280783aff..fcd1af1c9c3 100644 --- a/src/util/unicode.cpp +++ b/src/util/unicode.cpp @@ -6,9 +6,17 @@ Author: Daniel Kroening, kroening@kroening.com \*******************************************************************/ +#ifndef __GNUC__ +# define HAVE_CODECVT +#elif(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 50000 +# define HAVE_CODECVT +#endif + #include #include -#include +#ifdef HAVE_CODECVT +# include +#endif #include #include @@ -277,8 +285,12 @@ Function: utf8_to_utf16_big_endian std::wstring utf8_to_utf16_big_endian(const std::string& in) { +#ifdef HAVE_CODECVT std::wstring_convert > converter; return converter.from_bytes(in); +#else + throw "compiled without UTF16 support"; +#endif } /*******************************************************************\ @@ -295,6 +307,7 @@ Function: utf8_to_utf16_little_endian std::wstring utf8_to_utf16_little_endian(const std::string& in) { +#ifdef HAVE_CODECVT const std::codecvt_mode mode=std::codecvt_mode::little_endian; // default largest value codecvt_utf8_utf16 reads without error is 0x10ffff @@ -304,6 +317,9 @@ std::wstring utf8_to_utf16_little_endian(const std::string& in) typedef std::codecvt_utf8_utf16 codecvt_utf8_utf16t; std::wstring_convert converter; return converter.from_bytes(in); +#else + throw "compiled without UTF16 support"; +#endif } /*******************************************************************\