From: Jelte Jansen Date: Wed, 13 Mar 2013 15:53:53 +0000 (-0700) Subject: [master] fix clang issue with exception in unnamed namespace X-Git-Tag: bind10-1.1.0beta1-release~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b47eafefecf38d32013bc7377aa4eebf531c49f6;p=thirdparty%2Fkea.git [master] fix clang issue with exception in unnamed namespace --- diff --git a/src/lib/util/encode/base_n.cc b/src/lib/util/encode/base_n.cc index f5f930af4f..8c813c39c3 100644 --- a/src/lib/util/encode/base_n.cc +++ b/src/lib/util/encode/base_n.cc @@ -40,6 +40,15 @@ namespace isc { namespace util { namespace encode { +// Some versions of clang cannot handle exceptions in unnamed namespaces +// so this exception is defined in an 'internal' namespace +namespace clang_unnamed_namespace_workaround { +// An internally caught exception to unify a few possible cases of the same +// error. +class IncompleteBaseInput : public std::exception { +}; +} // end namespace internal + // In the following anonymous namespace, we provide a generic framework // to encode/decode baseN format. We use the following tools: // - boost base64_from_binary/binary_from_base64: provide mapping table for @@ -144,11 +153,6 @@ private: bool in_pad_; }; -// An internally caught exception to unify a few possible cases of the same -// error. -class IncompleteBaseInput : public std::exception { -}; - // DecodeNormalizer is an input iterator intended to be used as a filter // between the encoded baseX stream and binary_from_baseXX. // A DecodeNormalizer object is configured with three string iterators @@ -217,7 +221,9 @@ public: // but in that case we need to catch incomplete baseX input in // a different way. It's done via char_count_ and after the // completion of decoding. - throw IncompleteBaseInput(); // throw this now and convert it + + // throw this now and convert it + throw clang_unnamed_namespace_workaround::IncompleteBaseInput(); } if (*base_ == BASE_PADDING_CHAR) { // Padding can only happen at the end of the input string. We can @@ -378,9 +384,10 @@ BaseNTransformer::decode( // a multiple of 8; otherwise the decoder reaches the end of input // with some incomplete bits of data, which is invalid. if (((char_count * BitsPerChunk) % 8) != 0) { - throw IncompleteBaseInput(); // catch this immediately below + // catch this immediately below + throw clang_unnamed_namespace_workaround::IncompleteBaseInput(); } - } catch (const IncompleteBaseInput&) { + } catch (const clang_unnamed_namespace_workaround::IncompleteBaseInput&) { // we unify error handling for incomplete input here. isc_throw(BadValue, "Incomplete input for " << algorithm << ": " << input);