From a4761b7d75ca8491b4e7978a127fedbc542ac0a6 Mon Sep 17 00:00:00 2001 From: marco <marco@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Tue, 23 Mar 2010 16:08:19 +0000 Subject: [PATCH] Properly set the visibility of exceptions Exception where the declaration and definition is available in the header file need to be exported with __attribute__(visibility("default")) all the time. git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1874 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/base/src/message.hh | 4 ++-- modules/base/src/ptr_observer.hh | 6 +++--- modules/db/src/sqlite_wrap.hh | 2 +- modules/geom/src/exc.hh | 6 +++--- modules/geom/src/exception.hh | 3 +-- modules/img/alg/src/custom_transformer.hh | 2 +- modules/img/alg/src/fft.hh | 4 +--- modules/img/alg/src/histogram.hh | 2 +- modules/img/base/src/data_observer.hh | 2 +- modules/img/base/src/extent.hh | 2 +- modules/img/base/src/image_handle.cc | 4 ---- modules/img/base/src/image_handle.hh | 4 ++-- modules/img/base/src/image_state/dispatch.hh | 2 +- modules/img/base/src/image_state/image_state_visitor.hh | 2 +- modules/img/base/src/pixel_sampling.hh | 2 +- modules/info/src/info_error.hh | 5 +++-- modules/io/src/io_exception.hh | 6 +++--- modules/mol/base/src/not_connected_error.hh | 2 +- modules/mol/base/src/property_id.hh | 2 +- modules/seq/base/src/invalid_sequence.hh | 4 ++-- 20 files changed, 30 insertions(+), 36 deletions(-) diff --git a/modules/base/src/message.hh b/modules/base/src/message.hh index 30098a169..77bd64080 100644 --- a/modules/base/src/message.hh +++ b/modules/base/src/message.hh @@ -31,7 +31,7 @@ namespace ost { -struct DLLEXPORT_OST_BASE Message: public std::exception { +struct DLLEXPORT Message: public std::exception { Message(const String& mesg,const String& prefix=""): _prefix(prefix), _mesg(mesg) {} virtual ~Message() throw() {} @@ -45,7 +45,7 @@ struct DLLEXPORT_OST_BASE Message: public std::exception { String _mesg; }; -struct DLLEXPORT_OST_BASE Error: public Message { +struct DLLEXPORT Error: public Message { Error(const String& m): Message(m,"Error") {} }; diff --git a/modules/base/src/ptr_observer.hh b/modules/base/src/ptr_observer.hh index d36399916..6bcbf4a4e 100644 --- a/modules/base/src/ptr_observer.hh +++ b/modules/base/src/ptr_observer.hh @@ -22,14 +22,14 @@ #define OST_PTR_OBSERVER_HH #include <ost/message.hh> - +#include <ost/module_config.hh> /* ptr observer concept Author: Ansgar Philippsen */ -class DLLEXPORT InvalidatedPointer: public ost::Error { +class DLLEXPORT_OST_BASE InvalidatedPointer: public ost::Error { public: InvalidatedPointer(): ost::Error("access attempt on invalidated Pointer") @@ -37,7 +37,7 @@ public: }; template <class T> -class DLLEXPORT PtrObserver { +class TEMPLATE_EXPORT PtrObserver { public: PtrObserver(T* t): observed_(t), diff --git a/modules/db/src/sqlite_wrap.hh b/modules/db/src/sqlite_wrap.hh index fc5584516..cc0559d8d 100644 --- a/modules/db/src/sqlite_wrap.hh +++ b/modules/db/src/sqlite_wrap.hh @@ -81,7 +81,7 @@ private: sqlite3_stmt* statement_; }; -class DLLEXPORT_OST_DB DatabaseError : public Error { +class DLLEXPORT DatabaseError : public Error { public: DatabaseError(const String& msg): Error(msg) diff --git a/modules/geom/src/exc.hh b/modules/geom/src/exc.hh index d67e4c8e8..406ee977a 100644 --- a/modules/geom/src/exc.hh +++ b/modules/geom/src/exc.hh @@ -33,19 +33,19 @@ namespace geom { code may choose to catch exceptions from the geom library undifferentiatedly */ -class DLLEXPORT_OST_GEOM GeomException: public std::runtime_error { +class DLLEXPORT GeomException: public std::runtime_error { public: GeomException(const String& m): std::runtime_error(m) {} }; -class DLLEXPORT_OST_GEOM DivideByZeroException: public GeomException { +class DLLEXPORT DivideByZeroException: public GeomException { public: DivideByZeroException(const String& m="Divide By Zero"): GeomException(m) {} }; -class DLLEXPORT_OST_GEOM OutOfRangeException: public GeomException { +class DLLEXPORT OutOfRangeException: public GeomException { public: OutOfRangeException(const String& m="Out Of Range"): GeomException(m) {} diff --git a/modules/geom/src/exception.hh b/modules/geom/src/exception.hh index be60a295b..b36f4cddf 100644 --- a/modules/geom/src/exception.hh +++ b/modules/geom/src/exception.hh @@ -19,13 +19,12 @@ #ifndef GEOM_EXCEPTION_HH #define GEOM_EXCEPTION_HH -#include <ost/message.hh> #include <string> #include <ost/message.hh> namespace geom { -class GeomException: public Error +class DLLEXPORT GeomException: public Error { public: GeomException(const String& m): diff --git a/modules/img/alg/src/custom_transformer.hh b/modules/img/alg/src/custom_transformer.hh index d96cb17ed..b5199aa58 100644 --- a/modules/img/alg/src/custom_transformer.hh +++ b/modules/img/alg/src/custom_transformer.hh @@ -33,7 +33,7 @@ namespace ost { namespace img { namespace alg { -class DLLEXPORT_IMG_ALG CustomTransformerException: public Error { +class DLLEXPORT CustomTransformerException: public Error { public: virtual ~CustomTransformerException() throw() {} CustomTransformerException(const String& s): diff --git a/modules/img/alg/src/fft.hh b/modules/img/alg/src/fft.hh index 465a6e58b..120f045ed 100644 --- a/modules/img/alg/src/fft.hh +++ b/modules/img/alg/src/fft.hh @@ -27,12 +27,10 @@ #include <ost/img/image_state.hh> #include <ost/img/image_state/image_state_algorithm.hh> #include <ost/img/value_util.hh> -#include <ost/message.hh> - namespace ost { namespace img { namespace alg { -struct FFTException: public Error { +struct DLLEXPORT FFTException: public Error { FFTException(const String& m): Error(m) {} }; diff --git a/modules/img/alg/src/histogram.hh b/modules/img/alg/src/histogram.hh index e8d7210af..f974247da 100644 --- a/modules/img/alg/src/histogram.hh +++ b/modules/img/alg/src/histogram.hh @@ -31,7 +31,7 @@ namespace ost { namespace img { namespace alg { -class DLLEXPORT_IMG_ALG HistogramError: public Error { +class DLLEXPORT HistogramError: public Error { public: virtual ~HistogramError() throw() {} // required for typeinfo visibility HistogramError(const String& s): diff --git a/modules/img/base/src/data_observer.hh b/modules/img/base/src/data_observer.hh index 72e72271f..0d5feca72 100644 --- a/modules/img/base/src/data_observer.hh +++ b/modules/img/base/src/data_observer.hh @@ -34,7 +34,7 @@ namespace ost { namespace img { -class DLLEXPORT_OST_IMG_BASE InvalidObserver: public Error { +class DLLEXPORT InvalidObserver: public Error { public: InvalidObserver(const String& s = String("unknown")): Error(String("InvalidObserver exception occured: ") + s) diff --git a/modules/img/base/src/extent.hh b/modules/img/base/src/extent.hh index 5f89c5ee8..362dc4945 100644 --- a/modules/img/base/src/extent.hh +++ b/modules/img/base/src/extent.hh @@ -44,7 +44,7 @@ namespace ost { namespace img { -struct DLLEXPORT_OST_IMG_BASE InvalidExtentException: public Error +struct DLLEXPORT InvalidExtentException: public Error { InvalidExtentException(const String& m= String("") ): Error(String("an invalid extent occured ("+m+String(")"))) diff --git a/modules/img/base/src/image_handle.cc b/modules/img/base/src/image_handle.cc index 125aac114..712868a31 100644 --- a/modules/img/base/src/image_handle.cc +++ b/modules/img/base/src/image_handle.cc @@ -43,10 +43,6 @@ namespace ost { namespace img { -InvalidImageHandle::InvalidImageHandle(): - Error("Attempt to use invalid ImageHandle") -{} - // ImageHandle // construction/deconstruction/assignement diff --git a/modules/img/base/src/image_handle.hh b/modules/img/base/src/image_handle.hh index 611939255..d85bbc583 100644 --- a/modules/img/base/src/image_handle.hh +++ b/modules/img/base/src/image_handle.hh @@ -72,9 +72,9 @@ class ModOPAlgorithm; class ConstModOPAlgorithm; //! Exception thrown upon invalid image handle usage -class DLLEXPORT_OST_IMG_BASE InvalidImageHandle: public Error { +class DLLEXPORT InvalidImageHandle: public Error { public: - InvalidImageHandle(); + InvalidImageHandle(): Error("Attempt to use invalid ImageHandle") {} }; // fw diff --git a/modules/img/base/src/image_state/dispatch.hh b/modules/img/base/src/image_state/dispatch.hh index b788cc8d4..758494bec 100644 --- a/modules/img/base/src/image_state/dispatch.hh +++ b/modules/img/base/src/image_state/dispatch.hh @@ -35,7 +35,7 @@ namespace ost { namespace img { namespace image_state { -class DispatchException: public Error { +class DLLEXPORT DispatchException: public Error { public: DispatchException(const String& m): Error(m) diff --git a/modules/img/base/src/image_state/image_state_visitor.hh b/modules/img/base/src/image_state/image_state_visitor.hh index 0f08c745e..7fc7c7e50 100644 --- a/modules/img/base/src/image_state/image_state_visitor.hh +++ b/modules/img/base/src/image_state/image_state_visitor.hh @@ -32,7 +32,7 @@ namespace ost { namespace img { namespace image_state { //! ImageStateVisitor general exception -class DLLEXPORT_OST_IMG_BASE InvalidImageStateVisitor: public Error { +class DLLEXPORT InvalidImageStateVisitor: public Error { public: InvalidImageStateVisitor(const String& m): Error(m) {} }; diff --git a/modules/img/base/src/pixel_sampling.hh b/modules/img/base/src/pixel_sampling.hh index 02da611b7..05882f365 100644 --- a/modules/img/base/src/pixel_sampling.hh +++ b/modules/img/base/src/pixel_sampling.hh @@ -38,7 +38,7 @@ namespace ost { namespace img { class Extent; class Point; -class DLLEXPORT_OST_IMG_BASE InvalidSampling: public Error { +class DLLEXPORT InvalidSampling: public Error { public: InvalidSampling(): Error("invalid sampling value used, must be >0") diff --git a/modules/info/src/info_error.hh b/modules/info/src/info_error.hh index c587c88d9..d6a374d51 100644 --- a/modules/info/src/info_error.hh +++ b/modules/info/src/info_error.hh @@ -26,10 +26,11 @@ #ifndef OST_INFO_ERROR_HH #define OST_INFO_ERROR_HH -#include <ost/message.hh> - #include <ost/base.hh> #include <ost/message.hh> +#include <ost/info/module_config.hh> + + namespace ost { namespace info { diff --git a/modules/io/src/io_exception.hh b/modules/io/src/io_exception.hh index 6d8db50cb..d1e4782d9 100644 --- a/modules/io/src/io_exception.hh +++ b/modules/io/src/io_exception.hh @@ -26,19 +26,19 @@ namespace ost { namespace io { -class IOException: public Error { +class DLLEXPORT IOException: public Error { public: IOException(const String& m): Error(m) {} }; -class IOUnknownFormatException: public Error { +class DLLEXPORT IOUnknownFormatException: public Error { public: IOUnknownFormatException(const String& m): Error(m) {} }; -class IOFileAlreadyLoadedException: public Error { +class DLLEXPORT IOFileAlreadyLoadedException: public Error { public: IOFileAlreadyLoadedException(const String& m): Error(m) {} diff --git a/modules/mol/base/src/not_connected_error.hh b/modules/mol/base/src/not_connected_error.hh index 6671782a6..d33892147 100644 --- a/modules/mol/base/src/not_connected_error.hh +++ b/modules/mol/base/src/not_connected_error.hh @@ -26,7 +26,7 @@ namespace ost { namespace mol { /// \brief Error to indicate that two atoms that are supposed to be connected /// are not. -class NotConnectedError : public Error { +class DLLEXPORT_OST_MOL NotConnectedError : public Error { public: NotConnectedError(AtomHandle one, AtomHandle two); virtual ~NotConnectedError() throw() {} diff --git a/modules/mol/base/src/property_id.hh b/modules/mol/base/src/property_id.hh index 2f635d798..6c06e7ef3 100644 --- a/modules/mol/base/src/property_id.hh +++ b/modules/mol/base/src/property_id.hh @@ -86,7 +86,7 @@ Prop::ID DLLEXPORT_OST_MOL PropertyIDFromString(const String& prop); Prop DLLEXPORT_OST_MOL PropertyFromString(const String& prop); -struct DLLEXPORT_OST_MOL PropertyError: public std::exception +struct DLLEXPORT PropertyError: public std::exception { PropertyError(ost::mol::Prop::ID prop): prop_(prop) diff --git a/modules/seq/base/src/invalid_sequence.hh b/modules/seq/base/src/invalid_sequence.hh index a95a4f573..b112df8f3 100644 --- a/modules/seq/base/src/invalid_sequence.hh +++ b/modules/seq/base/src/invalid_sequence.hh @@ -25,14 +25,14 @@ #include <ost/seq/module_config.hh> namespace ost { namespace seq { -class DLLEXPORT_OST_SEQ InvalidSequence : public Error { +class DLLEXPORT InvalidSequence : public Error { public: InvalidSequence() : Error("Sequence String contains illegal characters. Must " "be one of [A-Za-z?-].") { } }; -class DLLEXPORT_OST_SEQ InvalidAlignment : public Error { +class DLLEXPORT InvalidAlignment : public Error { public: InvalidAlignment() : Error("Sequences have different lengths") { } -- GitLab