From a7df6bae0326968a886685f27a9fa8ff24befd42 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 29 Jul 2017 06:36:18 +0200 Subject: compat: fix Linux build Issue: #661 --- compat/check-visible.cpp | 6 +++--- compat/linkage-macros.hpp | 5 ++++- compat/shm.cpp | 17 +++++++++++++++-- compat/util.hpp | 2 +- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/compat/check-visible.cpp b/compat/check-visible.cpp index 436e1fdd..a47af156 100644 --- a/compat/check-visible.cpp +++ b/compat/check-visible.cpp @@ -53,12 +53,12 @@ bool check_is_visible() #else -force_inline OTR_COMPAT_EXPORT -void set_is_visible(const QWidget&) +never_inline OTR_COMPAT_EXPORT +void set_is_visible(const QWidget&, bool) { } -force_inline OTR_COMPAT_EXPORT +never_inline OTR_COMPAT_EXPORT bool check_is_visible() { return true; diff --git a/compat/linkage-macros.hpp b/compat/linkage-macros.hpp index a4c4b351..9e71ac8c 100644 --- a/compat/linkage-macros.hpp +++ b/compat/linkage-macros.hpp @@ -1,8 +1,11 @@ #pragma once -#if defined _MSC_VER || defined _WIN32 +#if defined _MSC_VER # define OTR_GENERIC_EXPORT __declspec(dllexport) # define OTR_GENERIC_IMPORT __declspec(dllimport) +#elif defined _WIN32 && !defined(__WINE__) +# define OTR_GENERIC_EXPORT __attribute__((dllexport, visibility ("default"))) +# define OTR_GENERIC_IMPORT __attribute__((dllimport)) #else # define OTR_GENERIC_EXPORT __attribute__ ((visibility ("default"))) # define OTR_GENERIC_IMPORT diff --git a/compat/shm.cpp b/compat/shm.cpp index 88a2811d..a933f7f9 100644 --- a/compat/shm.cpp +++ b/compat/shm.cpp @@ -7,10 +7,12 @@ #include "shm.h" -#include - #if defined(_WIN32) +#if !defined __WINE__ +# include +#endif + #include #include @@ -114,7 +116,9 @@ PortableLockedShm::PortableLockedShm(const char* shmName, const char* mutexName, if (!hMutex) { +#if !defined __WINE__ qDebug() << "CreateMutexA:" << (int) GetLastError(); +#endif return; } @@ -128,7 +132,9 @@ PortableLockedShm::PortableLockedShm(const char* shmName, const char* mutexName, if (!hMapFile) { +#if !defined __WINE__ qDebug() << "CreateFileMappingA:", (int) GetLastError(); +#endif return; } @@ -140,7 +146,11 @@ PortableLockedShm::PortableLockedShm(const char* shmName, const char* mutexName, mapSize); if (!mem) + { +#if !defined __WINE__ qDebug() << "MapViewOfFile:" << (int) GetLastError(); +#endif + } } PortableLockedShm::~PortableLockedShm() @@ -157,7 +167,10 @@ PortableLockedShm::~PortableLockedShm() return; fail: + (void)0; +#if !defined __WINE__ qDebug() << "failed to close mapping"; +#endif } bool PortableLockedShm::lock() diff --git a/compat/util.hpp b/compat/util.hpp index 88bff96c..5ae87632 100644 --- a/compat/util.hpp +++ b/compat/util.hpp @@ -118,7 +118,7 @@ template using qshared = QSharedPointer; #if defined _MSC_VER # define force_inline __forceinline #elif defined __GNUG__ -# define force_inline __attribute__((always_inline, gnu_inline)) +# define force_inline __attribute__((always_inline, gnu_inline)) inline #else # define force_inline inline #endif -- cgit v1.2.3