From 7b388e5cbf4952b31e5011bd1da473827a8c86e4 Mon Sep 17 00:00:00 2001 From: Chris Frey Date: Fri, 1 Oct 2010 01:13:07 -0400 Subject: [PATCH] lib: cleaned up missing BXEXPORT / BXLOCAL flags for exceptions See http://gcc.gnu.org/wiki/Visibility All exceptions must be BXEXPORT, and any static functions that are BXLOCAL must be used and defined in the .cc file. --- ChangeLog | 3 +++ src/error.cc | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/error.h | 37 +++++++++---------------------------- src/j_jdwp.h | 4 ++-- 4 files changed, 62 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 030dcc6d..02b6face 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ Release: version 0.17 - 2010/01/?? ------------------------------------------------------------------------------ +2010/10/01 + - lib: cleaned up missing BXEXPORT / BXLOCAL flags for exceptions + http://gcc.gnu.org/wiki/Visibility 2010/09/30 - merged build fixes from Toby Gray - merged UnroutableReadError exception patch from Toby Gray diff --git a/src/error.cc b/src/error.cc index 6df20f6a..0e0d4ed0 100644 --- a/src/error.cc +++ b/src/error.cc @@ -27,6 +27,28 @@ using namespace std; namespace Barry { +////////////////////////////////////////////////////////////////////////////// +// BadSize exception + +BadSize::BadSize(const char *msg, unsigned int data_size, + unsigned int required_size) + : Barry::Error(GetMsg(msg, data_size, required_size)) + , m_packet_size(0) + , m_data_buf_size(data_size) + , m_required_size(required_size) +{ +} + +BadSize::BadSize(unsigned int packet_size, + unsigned int data_buf_size, + unsigned int required_size) + : Barry::Error(GetMsg(packet_size, data_buf_size, required_size)) + , m_packet_size(packet_size) + , m_data_buf_size(data_buf_size) + , m_required_size(required_size) +{ +} + std::string BadSize::GetMsg(const char *msg, unsigned int d, unsigned int r) { std::ostringstream oss; @@ -44,6 +66,22 @@ std::string BadSize::GetMsg(unsigned int p, unsigned int d, unsigned int r) return oss.str(); } + +////////////////////////////////////////////////////////////////////////////// +// ErrnoError exception + +ErrnoError::ErrnoError(const std::string &msg) + : Barry::Error(msg) + , m_errno(0) +{ +} + +ErrnoError::ErrnoError(const std::string &msg, int err) + : Barry::Error(GetMsg(msg, err)) + , m_errno(err) +{ +} + std::string ErrnoError::GetMsg(const std::string &msg, int err) { std::ostringstream oss; @@ -51,6 +89,16 @@ std::string ErrnoError::GetMsg(const std::string &msg, int err) return oss.str(); } + +////////////////////////////////////////////////////////////////////////////// +// UnroutableReadError exception + +UnroutableReadError::UnroutableReadError(unsigned int read_size, + unsigned int min_size) + : Barry::Error(GetMsg(read_size, min_size)) +{ +} + std::string UnroutableReadError::GetMsg(unsigned int read_size, unsigned int min_size) { diff --git a/src/error.h b/src/error.h index 30d46c49..1711776d 100644 --- a/src/error.h +++ b/src/error.h @@ -103,20 +103,10 @@ class BXEXPORT BadSize : public Barry::Error BXLOCAL static std::string GetMsg(unsigned int p, unsigned int d, unsigned int r); public: - BadSize(const char *msg, unsigned int data_size, unsigned int required_size) - : Barry::Error(GetMsg(msg, data_size, required_size)) - , m_packet_size(0) - , m_data_buf_size(data_size) - , m_required_size(required_size) - {} + BadSize(const char *msg, unsigned int data_size, unsigned int required_size); BadSize(unsigned int packet_size, unsigned int data_buf_size, - unsigned int required_size) - : Barry::Error(GetMsg(packet_size, data_buf_size, required_size)) - , m_packet_size(packet_size) - , m_data_buf_size(data_buf_size) - , m_required_size(required_size) - {} + unsigned int required_size); unsigned int packet_size() const { return m_packet_size; } unsigned int data_buf_size() const { return m_data_buf_size; } unsigned int required_size() const { return m_required_size; } @@ -131,19 +121,13 @@ class BXEXPORT ErrnoError : public Barry::Error { int m_errno; - static std::string GetMsg(const std::string &msg, int err); + BXLOCAL static std::string GetMsg(const std::string &msg, int err); protected: - ErrnoError(const std::string &msg) // for derived classes - : Barry::Error(msg) - , m_errno(0) - {} + ErrnoError(const std::string &msg); // for derived classes public: - ErrnoError(const std::string &msg, int err) - : Barry::Error(GetMsg(msg, err)) - , m_errno(err) - {} + ErrnoError(const std::string &msg, int err); int error_code() const { return m_errno; } }; @@ -154,7 +138,7 @@ public: /// Thrown by the ConfigFile class when encountering a serious system /// error while loading the global config file for a given PIN. /// -class ConfigFileError : public Barry::ErrnoError +class BXEXPORT ConfigFileError : public Barry::ErrnoError { public: ConfigFileError(const char *msg) : Barry::ErrnoError(msg) {} @@ -208,7 +192,7 @@ public: // /// Thrown by the vformat related barrysync library classes. /// -class ConvertError : public Barry::Error +class BXEXPORT ConvertError : public Barry::Error { public: ConvertError(const std::string &msg) : Barry::Error(msg) {} @@ -220,15 +204,12 @@ public: /// Thrown by SocketRoutingQueue when a read is too small to determine /// the socket, so is unroutable. /// -class UnroutableReadError : public Barry::Error +class BXEXPORT UnroutableReadError : public Barry::Error { BXLOCAL static std::string GetMsg(unsigned int read_size, unsigned int min_size); public: - UnroutableReadError(unsigned int read_size, - unsigned int min_size) - : Barry::Error(GetMsg(read_size, min_size)) - {} + UnroutableReadError(unsigned int read_size, unsigned int min_size); }; /// @} diff --git a/src/j_jdwp.h b/src/j_jdwp.h index 2a7797cb..4c3d9b3d 100644 --- a/src/j_jdwp.h +++ b/src/j_jdwp.h @@ -35,7 +35,7 @@ namespace JDWP { /// @{ /// Thrown on low level JDWP errors. -class Error : public Barry::Error +class BXEXPORT Error : public Barry::Error { int m_errcode; @@ -47,7 +47,7 @@ public: int errcode() const { return m_errcode; } }; -class Timeout : public Error +class BXEXPORT Timeout : public Error { public: Timeout(const std::string &str) : Error(str) {} -- 2.11.4.GIT