# HG changeset patch # User Markus Mützel # Date 1668873311 -3600 # Node ID 2ec625c0494738c6ac6b497b02c3734d836f423c # Parent 8acc0fd58ba2ac9d16acd9eeccdd130a660c2a19 Mark exceptions with default visibility also where they are used (bug #61704). For exceptions that are thrown across library borders to work correctly, the definition of those exceptions needs to be attributed with default visibility both in the library where they are defined and in the code where they are caught. * oct-conf-post-public.in.h: Add new preprocessor macros for visibility attributes of exception classes. * liboctave/util/quit.h (execution_exception), liboctave/util/lo-array-errwarn.h (index_exception): Use new preprocessor macro to flag exception classes that are thrown across library borders. diff -r 8acc0fd58ba2 -r 2ec625c04947 liboctave/util/lo-array-errwarn.h --- a/liboctave/util/lo-array-errwarn.h Sat Nov 19 17:17:33 2022 +0100 +++ b/liboctave/util/lo-array-errwarn.h Sat Nov 19 16:55:11 2022 +0100 @@ -41,7 +41,7 @@ // Typically, this should be caught after any call to // octave_value_list::index_vector() - class index_exception : public execution_exception + class OCTAVE_EXCEPTION_API index_exception : public execution_exception { public: diff -r 8acc0fd58ba2 -r 2ec625c04947 liboctave/util/quit.h --- a/liboctave/util/quit.h Sat Nov 19 17:17:33 2022 +0100 +++ b/liboctave/util/quit.h Sat Nov 19 16:55:11 2022 +0100 @@ -89,7 +89,7 @@ && a.column () == b.column ()); } - class OCTAVE_API execution_exception : public std::runtime_error + class OCTAVE_EXCEPTION_API execution_exception : public std::runtime_error { public: diff -r 8acc0fd58ba2 -r 2ec625c04947 oct-conf-post-public.in.h --- a/oct-conf-post-public.in.h Sat Nov 19 17:17:33 2022 +0100 +++ b/oct-conf-post-public.in.h Sat Nov 19 16:55:11 2022 +0100 @@ -137,6 +137,7 @@ /* API macros for liboctave */ #if defined (OCTAVE_DLL) # define OCTAVE_API OCTAVE_EXPORT +# define OCTAVE_EXCEPTION_API OCTAVE_EXPORT # if defined (_WIN32) || defined (__CYGWIN__) # define OCTAVE_TEMPLATE_API # if defined(__MINGW32__) @@ -155,6 +156,11 @@ # endif #else # define OCTAVE_API OCTAVE_IMPORT +# if defined (_WIN32) || defined (__CYGWIN__) +# define OCTAVE_EXCEPTION_API OCTAVE_IMPORT +# else +# define OCTAVE_EXCEPTION_API OCTAVE_EXPORT +# endif # define OCTAVE_TEMPLATE_API # define OCTAVE_EXTERN_TEMPLATE_API OCTAVE_IMPORT # define OCTAVE_CLASS_TEMPLATE_INSTANTIATION_API @@ -164,6 +170,7 @@ /* API macros for liboctinterp */ #if defined (OCTINTERP_DLL) # define OCTINTERP_API OCTAVE_EXPORT +# define OCTINTERP_EXCEPTION_API OCTAVE_EXPORT # if defined (_WIN32) || defined (__CYGWIN__) # define OCTINTERP_TEMPLATE_API # if defined(__MINGW32__) @@ -182,6 +189,11 @@ # endif #else # define OCTINTERP_API OCTAVE_IMPORT +# if defined (_WIN32) || defined (__CYGWIN__) +# define OCTINTERP_EXCEPTION_API OCTAVE_IMPORT +# else +# define OCTINTERP_EXCEPTION_API OCTAVE_EXPORT +# endif # define OCTINTERP_TEMPLATE_API # define OCTINTERP_EXTERN_TEMPLATE_API OCTAVE_IMPORT # define OCTINTERP_CLASS_TEMPLATE_INSTANTIATION_API @@ -191,6 +203,7 @@ /* API macros for the Array class in liboctave and liboctinterp */ #if (defined (OCTAVE_DLL) || defined (OCTINTERP_DLL)) # define OCTARRAY_API OCTAVE_EXPORT +# define OCTARRAY_EXCEPTION_API OCTAVE_EXPORT # if defined (_WIN32) || defined (__CYGWIN__) # define OCTARRAY_TEMPLATE_API # if defined(__MINGW32__) @@ -209,6 +222,11 @@ # endif #else # define OCTARRAY_API OCTAVE_IMPORT +# if defined (_WIN32) || defined (__CYGWIN__) +# define OCTARRAY_EXCEPTION_API OCTAVE_IMPORT +# else +# define OCTARRAY_EXCEPTION_API OCTAVE_EXPORT +# endif # define OCTARRAY_TEMPLATE_API # define OCTARRAY_EXTERN_TEMPLATE_API OCTAVE_IMPORT # define OCTARRAY_CLASS_TEMPLATE_INSTANTIATION_API @@ -218,6 +236,7 @@ /* API macros for libinterp/graphics */ #if defined (OCTGRAPHICS_DLL) # define OCTGRAPHICS_API OCTAVE_EXPORT +# define OCTGRAPHICS_EXCEPTION_API OCTAVE_EXPORT # if defined (_WIN32) || defined (__CYGWIN__) # define OCTGRAPHICS_TEMPLATE_API # if defined(__MINGW32__) @@ -236,6 +255,11 @@ # endif #else # define OCTGRAPHICS_API OCTAVE_IMPORT +# if defined (_WIN32) || defined (__CYGWIN__) +# define OCTGRAPHICS_EXCEPTION_API OCTAVE_IMPORT +# else +# define OCTGRAPHICS_EXCEPTION_API OCTAVE_EXPORT +# endif # define OCTGRAPHICS_TEMPLATE_API # define OCTGRAPHICS_EXTERN_TEMPLATE_API OCTAVE_IMPORT # define OCTGRAPHICS_CLASS_TEMPLATE_INSTANTIATION_API @@ -245,6 +269,7 @@ /* API macros for libgui */ #if defined (OCTGUI_DLL) # define OCTGUI_API OCTAVE_EXPORT +# define OCTGUI_EXCEPTION_API OCTAVE_EXPORT # if defined (_WIN32) || defined (__CYGWIN__) # define OCTGUI_TEMPLATE_API # if defined(__MINGW32__) @@ -263,6 +288,11 @@ # endif #else # define OCTGUI_API OCTAVE_IMPORT +# if defined (_WIN32) || defined (__CYGWIN__) +# define OCTGUI_EXCEPTION_API OCTAVE_IMPORT +# else +# define OCTGUI_EXCEPTION_API OCTAVE_EXPORT +# endif # define OCTGUI_TEMPLATE_API # define OCTGUI_EXTERN_TEMPLATE_API OCTAVE_IMPORT # define OCTGUI_CLASS_TEMPLATE_INSTANTIATION_API