diff options
Diffstat (limited to 'src/util/safe_print.h')
-rw-r--r-- | src/util/safe_print.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/util/safe_print.h b/src/util/safe_print.h index cb3f46721..dd66ed41b 100644 --- a/src/util/safe_print.h +++ b/src/util/safe_print.h @@ -42,6 +42,8 @@ #include <cstring> #include <string> +#include "cvc4_export.h" + namespace CVC4 { /** @@ -49,7 +51,8 @@ namespace CVC4 { * signal handler. */ template <size_t N> -void CVC4_PUBLIC safe_print(int fd, const char (&msg)[N]) { +void CVC4_EXPORT safe_print(int fd, const char (&msg)[N]) +{ ssize_t nb = N - 1; if (write(fd, msg, nb) != nb) { abort(); @@ -92,7 +95,7 @@ auto toStringImpl(const T& obj, int) -> decltype(toString(obj)) * @param obj The object to print */ template <typename T> -void CVC4_PUBLIC safe_print(int fd, const T& obj) +void CVC4_EXPORT safe_print(int fd, const T& obj) { const char* s = toStringImpl(obj, /* prefer the method that uses `toString()` */ 0); @@ -104,25 +107,25 @@ void CVC4_PUBLIC safe_print(int fd, const T& obj) } template <> -void CVC4_PUBLIC safe_print(int fd, const std::string& msg); +void CVC4_EXPORT safe_print(int fd, const std::string& msg); template <> -void CVC4_PUBLIC safe_print(int fd, const int64_t& _i); +void CVC4_EXPORT safe_print(int fd, const int64_t& _i); template <> -void CVC4_PUBLIC safe_print(int fd, const int32_t& i); +void CVC4_EXPORT safe_print(int fd, const int32_t& i); template <> -void CVC4_PUBLIC safe_print(int fd, const uint64_t& _i); +void CVC4_EXPORT safe_print(int fd, const uint64_t& _i); template <> -void CVC4_PUBLIC safe_print(int fd, const uint32_t& i); +void CVC4_EXPORT safe_print(int fd, const uint32_t& i); template <> -void CVC4_PUBLIC safe_print(int fd, const double& _d); +void CVC4_EXPORT safe_print(int fd, const double& _d); template <> -void CVC4_PUBLIC safe_print(int fd, const float& f); +void CVC4_EXPORT safe_print(int fd, const float& f); template <> -void CVC4_PUBLIC safe_print(int fd, const bool& b); +void CVC4_EXPORT safe_print(int fd, const bool& b); template <> -void CVC4_PUBLIC safe_print(int fd, void* const& addr); +void CVC4_EXPORT safe_print(int fd, void* const& addr); template <> -void CVC4_PUBLIC safe_print(int fd, const timespec& t); +void CVC4_EXPORT safe_print(int fd, const timespec& t); /** Prints an integer in hexadecimal. Safe to use in a signal handler. */ void safe_print_hex(int fd, uint64_t i); |