summaryrefslogtreecommitdiff
path: root/src/base/exception.h
diff options
context:
space:
mode:
authorMathias Preiner <mathias.preiner@gmail.com>2021-03-16 10:56:01 -0700
committerGitHub <noreply@github.com>2021-03-16 10:56:01 -0700
commitd6890791897ddebf1212d3e3147bf7aeb2415b27 (patch)
tree51c69ba48a7550b6a7660e2488b4b39cbedba539 /src/base/exception.h
parent0d3ea6f2dcaf80d386c7765ee8a708c18e3ed574 (diff)
cmake: Generate cvc4_export.h and set visibility to hidden. (#6139)
The build system (cmake) will automatically generate an export header cvc4_export.h, which makes sure that the correct export features are defined depending on the compiler and target platform. The macro CVC4_EXPORT replaces CVC4_PUBLIC and its usage is reduced by 2/3. Co-authored-by: Gereon Kremer <nafur42@gmail.com>
Diffstat (limited to 'src/base/exception.h')
-rw-r--r--src/base/exception.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/base/exception.h b/src/base/exception.h
index f2b1b919e..d9bf83f44 100644
--- a/src/base/exception.h
+++ b/src/base/exception.h
@@ -23,9 +23,12 @@
#include <iosfwd>
#include <string>
+#include "cvc4_export.h"
+
namespace CVC4 {
-class CVC4_PUBLIC Exception : public std::exception {
+class Exception : public std::exception
+{
protected:
std::string d_msg;
@@ -66,10 +69,11 @@ class CVC4_PUBLIC Exception : public std::exception {
*/
virtual void toStream(std::ostream& os) const { os << d_msg; }
-};/* class Exception */
+}; /* class Exception */
-class CVC4_PUBLIC IllegalArgumentException : public Exception {
-protected:
+class CVC4_EXPORT IllegalArgumentException : public Exception
+{
+ protected:
IllegalArgumentException() : Exception() {}
void construct(const char* header, const char* extra,
@@ -104,34 +108,34 @@ public:
*/
static std::string formatVariadic();
static std::string formatVariadic(const char* format, ...);
-};/* class IllegalArgumentException */
+}; /* class IllegalArgumentException */
-inline std::ostream& operator<<(std::ostream& os,
- const Exception& e) CVC4_PUBLIC;
+inline std::ostream& operator<<(std::ostream& os, const Exception& e);
inline std::ostream& operator<<(std::ostream& os, const Exception& e)
{
e.toStream(os);
return os;
}
-template <class T> inline void CheckArgument(bool cond, const T& arg,
- const char* tail) CVC4_PUBLIC;
+template <class T>
+inline void CheckArgument(bool cond, const T& arg, const char* tail);
template <class T> inline void CheckArgument(bool cond, const T& arg CVC4_UNUSED,
const char* tail CVC4_UNUSED) {
if(__builtin_expect( ( !cond ), false )) { \
throw ::CVC4::IllegalArgumentException("", "", tail); \
} \
}
-template <class T> inline void CheckArgument(bool cond, const T& arg)
- CVC4_PUBLIC;
+template <class T>
+inline void CheckArgument(bool cond, const T& arg);
template <class T> inline void CheckArgument(bool cond, const T& arg CVC4_UNUSED) {
if(__builtin_expect( ( !cond ), false )) { \
throw ::CVC4::IllegalArgumentException("", "", ""); \
} \
}
-class CVC4_PUBLIC LastExceptionBuffer {
-public:
+class CVC4_EXPORT LastExceptionBuffer
+{
+ public:
LastExceptionBuffer();
~LastExceptionBuffer();
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback