diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-28 14:24:36 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-28 14:24:36 +0300 |
commit | d7a7f9d9b05c3e3a9728bb1644a556527a721afd (patch) | |
tree | e5616f2572c0fcaf9a122cb5852e95c5e5083ab3 /um/service/include/libservice | |
parent | service: fix compiler warnings & code style (diff) | |
download | windows7-drivers-d7a7f9d9b05c3e3a9728bb1644a556527a721afd.tar.gz windows7-drivers-d7a7f9d9b05c3e3a9728bb1644a556527a721afd.zip |
CMakeLists.txt updates
Strip symbols, link the runtime statically, fix MinGW-w64 builds, etc.
Diffstat (limited to 'um/service/include/libservice')
-rw-r--r-- | um/service/include/libservice/windows_error.hpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/um/service/include/libservice/windows_error.hpp b/um/service/include/libservice/windows_error.hpp index f7ac90e..13d7f47 100644 --- a/um/service/include/libservice/windows_error.hpp +++ b/um/service/include/libservice/windows_error.hpp @@ -8,6 +8,7 @@ #include "common.hpp" #include "singleton.hpp" +#include <sstream> #include <string> #include <system_error> @@ -25,7 +26,29 @@ namespace libservice private: friend class Singleton<WindowsErrorCategory>; }; + + namespace error + { + inline std::string build_what( + const char* function, + const char* file, + int line) + { + std::ostringstream oss; + oss << "Error in function '" << function + << "' at file '" << file + << "', line " << line; + return oss.str(); + } + } } +#if defined(_MSC_VER) #define LIBSERVICE_ERROR_PREFIX \ "Error in function '" LIBSERVICE_FUNCTION_NAME "' at file '" LIBSERVICE_FILE_PATH "', line " LIBSERVICE_LINE_NUMBER_STRING +#elif defined(__GNUC__) +#define LIBSERVICE_ERROR_PREFIX \ + libservice::error::build_what(LIBSERVICE_FUNCTION_NAME, LIBSERVICE_FILE_PATH, LIBSERVICE_LINE_NUMBER) +#else +#define LIBSERVICE_ERROR_PREFIX "Error" +#endif |