From 3477d1b4ee662df09fe7a17e147dba9fbb747d20 Mon Sep 17 00:00:00 2001 From: Lyashenko Arsenii Maksimovich Date: Mon, 20 Aug 2018 20:29:05 +0300 Subject: [PATCH 1/3] Fix "redeclared without dllimport attribute..." warning for MinGW --- CppParser/include/Poco/CppParser/CppParser.h | 2 +- CppUnit/include/Poco/CppUnit/CppUnit.h | 2 +- Crypto/include/Poco/Crypto/Crypto.h | 12 +++++------- Encodings/include/Poco/Encodings.h | 2 +- Foundation/include/Poco/Foundation.h | 2 +- JSON/include/Poco/JSON/JSON.h | 2 +- MongoDB/include/Poco/MongoDB/MongoDB.h | 2 +- Net/include/Poco/Net/Net.h | 2 +- NetSSL_OpenSSL/include/Poco/Net/NetSSL.h | 12 +++++------- NetSSL_Win/include/Poco/Net/NetSSL.h | 2 +- PDF/include/Poco/PDF/PDF.h | 2 +- Redis/include/Poco/Redis/Redis.h | 2 +- SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h | 2 +- SQL/ODBC/include/Poco/SQL/ODBC/ODBC.h | 2 +- .../include/Poco/SQL/PostgreSQL/PostgreSQL.h | 2 +- SQL/SQLite/include/Poco/SQL/SQLite/SQLite.h | 2 +- SQL/include/Poco/SQL/SQL.h | 2 +- SevenZip/include/Poco/SevenZip/SevenZip.h | 2 +- Util/include/Poco/Util/Util.h | 2 +- XML/include/Poco/XML/XML.h | 2 +- Zip/include/Poco/Zip/Zip.h | 2 +- 21 files changed, 29 insertions(+), 33 deletions(-) diff --git a/CppParser/include/Poco/CppParser/CppParser.h b/CppParser/include/Poco/CppParser/CppParser.h index ea7125e900..1252d29fa5 100644 --- a/CppParser/include/Poco/CppParser/CppParser.h +++ b/CppParser/include/Poco/CppParser/CppParser.h @@ -31,7 +31,7 @@ // CppParser_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL) +#if (defined(_MSC_VER) || defined(__CYGWIN__)) && defined(POCO_DLL) #if defined(CppParser_EXPORTS) #define CppParser_API __declspec(dllexport) #else diff --git a/CppUnit/include/Poco/CppUnit/CppUnit.h b/CppUnit/include/Poco/CppUnit/CppUnit.h index e45fa28862..1f32bbe811 100644 --- a/CppUnit/include/Poco/CppUnit/CppUnit.h +++ b/CppUnit/include/Poco/CppUnit/CppUnit.h @@ -25,7 +25,7 @@ // CppUnit_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(CppUnit_EXPORTS) #define CppUnit_API __declspec(dllexport) #else diff --git a/Crypto/include/Poco/Crypto/Crypto.h b/Crypto/include/Poco/Crypto/Crypto.h index f63736e86c..344bb5844b 100644 --- a/Crypto/include/Poco/Crypto/Crypto.h +++ b/Crypto/include/Poco/Crypto/Crypto.h @@ -63,13 +63,11 @@ enum RSAPaddingMode // Crypto_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) - #if defined(POCO_DLL) - #if defined(Crypto_EXPORTS) - #define Crypto_API __declspec(dllexport) - #else - #define Crypto_API __declspec(dllimport) - #endif +#if defined(_MSC_VER) && defined(POCO_DLL) + #if defined(Crypto_EXPORTS) + #define Crypto_API __declspec(dllexport) + #else + #define Crypto_API __declspec(dllimport) #endif #endif diff --git a/Encodings/include/Poco/Encodings.h b/Encodings/include/Poco/Encodings.h index 7f324d27cf..078aece44c 100644 --- a/Encodings/include/Poco/Encodings.h +++ b/Encodings/include/Poco/Encodings.h @@ -31,7 +31,7 @@ // Encodings_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(Encodings_EXPORTS) #define Encodings_API __declspec(dllexport) #else diff --git a/Foundation/include/Poco/Foundation.h b/Foundation/include/Poco/Foundation.h index e9455298ef..999c6f3149 100644 --- a/Foundation/include/Poco/Foundation.h +++ b/Foundation/include/Poco/Foundation.h @@ -44,7 +44,7 @@ // Foundation_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if (defined(_WIN32) || defined(_WIN32_WCE)) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(Foundation_EXPORTS) #define Foundation_API __declspec(dllexport) #else diff --git a/JSON/include/Poco/JSON/JSON.h b/JSON/include/Poco/JSON/JSON.h index 36d7623756..a9724f924f 100644 --- a/JSON/include/Poco/JSON/JSON.h +++ b/JSON/include/Poco/JSON/JSON.h @@ -31,7 +31,7 @@ // JSON_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(JSON_EXPORTS) #define JSON_API __declspec(dllexport) #else diff --git a/MongoDB/include/Poco/MongoDB/MongoDB.h b/MongoDB/include/Poco/MongoDB/MongoDB.h index 615f50d9c5..86d0db6752 100644 --- a/MongoDB/include/Poco/MongoDB/MongoDB.h +++ b/MongoDB/include/Poco/MongoDB/MongoDB.h @@ -31,7 +31,7 @@ // MongoDB_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(MongoDB_EXPORTS) #define MongoDB_API __declspec(dllexport) #else diff --git a/Net/include/Poco/Net/Net.h b/Net/include/Poco/Net/Net.h index 4f901d7b95..2aa03c9b63 100644 --- a/Net/include/Poco/Net/Net.h +++ b/Net/include/Poco/Net/Net.h @@ -31,7 +31,7 @@ // Net_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(Net_EXPORTS) #define Net_API __declspec(dllexport) #else diff --git a/NetSSL_OpenSSL/include/Poco/Net/NetSSL.h b/NetSSL_OpenSSL/include/Poco/Net/NetSSL.h index 9a21987b00..1d6ef5aa8f 100644 --- a/NetSSL_OpenSSL/include/Poco/Net/NetSSL.h +++ b/NetSSL_OpenSSL/include/Poco/Net/NetSSL.h @@ -31,13 +31,11 @@ // NetSSL_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) - #if defined(POCO_DLL) - #if defined(NetSSL_EXPORTS) - #define NetSSL_API __declspec(dllexport) - #else - #define NetSSL_API __declspec(dllimport) - #endif +#if defined(_MSC_VER) && defined(POCO_DLL) + #if defined(NetSSL_EXPORTS) + #define NetSSL_API __declspec(dllexport) + #else + #define NetSSL_API __declspec(dllimport) #endif #endif diff --git a/NetSSL_Win/include/Poco/Net/NetSSL.h b/NetSSL_Win/include/Poco/Net/NetSSL.h index 870e9fb899..98921f703c 100644 --- a/NetSSL_Win/include/Poco/Net/NetSSL.h +++ b/NetSSL_Win/include/Poco/Net/NetSSL.h @@ -31,7 +31,7 @@ // NetSSL_Win_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL) +#if (defined(_MSC_VER) || defined(__CYGWIN__)) && defined(POCO_DLL) #if defined(NetSSL_Win_EXPORTS) #define NetSSL_Win_API __declspec(dllexport) #else diff --git a/PDF/include/Poco/PDF/PDF.h b/PDF/include/Poco/PDF/PDF.h index c591540c48..fbcc80adc8 100644 --- a/PDF/include/Poco/PDF/PDF.h +++ b/PDF/include/Poco/PDF/PDF.h @@ -40,7 +40,7 @@ // PDF_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(PDF_EXPORTS) #define PDF_API __declspec(dllexport) #else diff --git a/Redis/include/Poco/Redis/Redis.h b/Redis/include/Poco/Redis/Redis.h index b39db2b9b6..afc145e991 100644 --- a/Redis/include/Poco/Redis/Redis.h +++ b/Redis/include/Poco/Redis/Redis.h @@ -31,7 +31,7 @@ // Redis_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(Redis_EXPORTS) #define Redis_API __declspec(dllexport) #else diff --git a/SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h b/SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h index 0580035bd8..b168961c83 100644 --- a/SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h +++ b/SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h @@ -29,7 +29,7 @@ // ODBC_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(MySQL_EXPORTS) #define MySQL_API __declspec(dllexport) #else diff --git a/SQL/ODBC/include/Poco/SQL/ODBC/ODBC.h b/SQL/ODBC/include/Poco/SQL/ODBC/ODBC.h index 6e22925da0..db60612a41 100644 --- a/SQL/ODBC/include/Poco/SQL/ODBC/ODBC.h +++ b/SQL/ODBC/include/Poco/SQL/ODBC/ODBC.h @@ -34,7 +34,7 @@ // ODBC_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(ODBC_EXPORTS) #define ODBC_API __declspec(dllexport) #else diff --git a/SQL/PostgreSQL/include/Poco/SQL/PostgreSQL/PostgreSQL.h b/SQL/PostgreSQL/include/Poco/SQL/PostgreSQL/PostgreSQL.h index 1ff1b8823c..b7b86fb82c 100644 --- a/SQL/PostgreSQL/include/Poco/SQL/PostgreSQL/PostgreSQL.h +++ b/SQL/PostgreSQL/include/Poco/SQL/PostgreSQL/PostgreSQL.h @@ -29,7 +29,7 @@ // ODBC_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(PostgreSQL_EXPORTS) #define PostgreSQL_API __declspec(dllexport) #else diff --git a/SQL/SQLite/include/Poco/SQL/SQLite/SQLite.h b/SQL/SQLite/include/Poco/SQL/SQLite/SQLite.h index db3e235a2b..4cf0a993bb 100644 --- a/SQL/SQLite/include/Poco/SQL/SQLite/SQLite.h +++ b/SQL/SQLite/include/Poco/SQL/SQLite/SQLite.h @@ -31,7 +31,7 @@ // SQLite_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(SQLite_EXPORTS) #define SQLite_API __declspec(dllexport) #else diff --git a/SQL/include/Poco/SQL/SQL.h b/SQL/include/Poco/SQL/SQL.h index d30effdfa9..328d28372e 100644 --- a/SQL/include/Poco/SQL/SQL.h +++ b/SQL/include/Poco/SQL/SQL.h @@ -31,7 +31,7 @@ // Poco_SQL_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(SQL_EXPORTS) #define Poco_SQL_API __declspec(dllexport) #else diff --git a/SevenZip/include/Poco/SevenZip/SevenZip.h b/SevenZip/include/Poco/SevenZip/SevenZip.h index 5bd4009e2d..2909b0362c 100644 --- a/SevenZip/include/Poco/SevenZip/SevenZip.h +++ b/SevenZip/include/Poco/SevenZip/SevenZip.h @@ -31,7 +31,7 @@ // SevenZip_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(SevenZip_EXPORTS) #define SevenZip_API __declspec(dllexport) #else diff --git a/Util/include/Poco/Util/Util.h b/Util/include/Poco/Util/Util.h index 39546032ba..40013267de 100644 --- a/Util/include/Poco/Util/Util.h +++ b/Util/include/Poco/Util/Util.h @@ -31,7 +31,7 @@ // Util_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(Util_EXPORTS) #define Util_API __declspec(dllexport) #else diff --git a/XML/include/Poco/XML/XML.h b/XML/include/Poco/XML/XML.h index 83fc94c619..1dd53cede6 100644 --- a/XML/include/Poco/XML/XML.h +++ b/XML/include/Poco/XML/XML.h @@ -31,7 +31,7 @@ // XML_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(XML_EXPORTS) #define XML_API __declspec(dllexport) #else diff --git a/Zip/include/Poco/Zip/Zip.h b/Zip/include/Poco/Zip/Zip.h index 1f1d781f31..8927f4e1a7 100644 --- a/Zip/include/Poco/Zip/Zip.h +++ b/Zip/include/Poco/Zip/Zip.h @@ -31,7 +31,7 @@ // Zip_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_WIN32) && defined(POCO_DLL) +#if defined(_MSC_VER) && defined(POCO_DLL) #if defined(Zip_EXPORTS) #define Zip_API __declspec(dllexport) #else From afe56ea7b6d04d07fc07db7758ea6e79372e4c36 Mon Sep 17 00:00:00 2001 From: Lyashenko Arsenii Maksimovich Date: Wed, 29 Aug 2018 19:54:54 +0300 Subject: [PATCH 2/3] Use 'POCO_COMPILER_MSVC' instead of '_MSC_VER'. * Define 'POCO_COMPILER_MINGW' with 'POCO_COMPILER_GCC' too --- CppParser/include/Poco/CppParser/CppParser.h | 4 ++-- CppUnit/include/Poco/CppUnit/CppUnit.h | 9 +++++--- Crypto/include/Poco/Crypto/Crypto.h | 14 ++++++------ Encodings/include/Poco/Encodings.h | 4 ++-- Foundation/include/Poco/Foundation.h | 22 +++++++++---------- Foundation/include/Poco/Platform.h | 7 +++--- JSON/include/Poco/JSON/JSON.h | 4 ++-- MongoDB/include/Poco/MongoDB/MongoDB.h | 4 ++-- Net/include/Poco/Net/Net.h | 7 +++--- NetSSL_OpenSSL/include/Poco/Net/NetSSL.h | 4 ++-- NetSSL_Win/include/Poco/Net/NetSSL.h | 4 ++-- PDF/include/Poco/PDF/PDF.h | 12 ++++++---- Redis/include/Poco/Redis/Redis.h | 4 ++-- SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h | 4 ++-- SQL/ODBC/include/Poco/SQL/ODBC/ODBC.h | 4 ++-- .../include/Poco/SQL/PostgreSQL/PostgreSQL.h | 4 ++-- SQL/SQLite/include/Poco/SQL/SQLite/SQLite.h | 4 ++-- SQL/include/Poco/SQL/SQL.h | 5 +++-- SevenZip/include/Poco/SevenZip/SevenZip.h | 4 ++-- Util/include/Poco/Util/Util.h | 4 ++-- XML/include/Poco/XML/XML.h | 4 ++-- Zip/include/Poco/Zip/Zip.h | 4 ++-- 22 files changed, 72 insertions(+), 64 deletions(-) diff --git a/CppParser/include/Poco/CppParser/CppParser.h b/CppParser/include/Poco/CppParser/CppParser.h index 1252d29fa5..3157687ad1 100644 --- a/CppParser/include/Poco/CppParser/CppParser.h +++ b/CppParser/include/Poco/CppParser/CppParser.h @@ -31,7 +31,7 @@ // CppParser_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if (defined(_MSC_VER) || defined(__CYGWIN__)) && defined(POCO_DLL) +#if (defined(POCO_COMPILER_MSVC) || POCO_OS == POCO_OS_CYGWIN) && defined(POCO_DLL) #if defined(CppParser_EXPORTS) #define CppParser_API __declspec(dllexport) #else @@ -48,7 +48,7 @@ // // Automatically link CppParser library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(CppParser_EXPORTS) #pragma comment(lib, "PocoCppParser" POCO_LIB_SUFFIX) #endif diff --git a/CppUnit/include/Poco/CppUnit/CppUnit.h b/CppUnit/include/Poco/CppUnit/CppUnit.h index 1f32bbe811..7249739176 100644 --- a/CppUnit/include/Poco/CppUnit/CppUnit.h +++ b/CppUnit/include/Poco/CppUnit/CppUnit.h @@ -7,6 +7,9 @@ #define Poco_CppUnit__CppUnitINCLUDED +#include "Poco/Platform.h" + + // // Ensure that POCO_DLL is default unless POCO_STATIC is defined // @@ -25,7 +28,7 @@ // CppUnit_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(CppUnit_EXPORTS) #define CppUnit_API __declspec(dllexport) #else @@ -45,7 +48,7 @@ // // Automatically link CppUnit library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if defined(POCO_DLL) #if defined(_DEBUG) #define POCO_LIB_SUFFIX "d.lib" @@ -73,7 +76,7 @@ // Turn off some annoying warnings -#ifdef _MSC_VER +#ifdef POCO_COMPILER_MSVC #pragma warning(disable:4786) // identifier truncation warning #pragma warning(disable:4503) // decorated name length exceeded - mainly a problem with STLPort #pragma warning(disable:4018) // signed/unsigned comparison diff --git a/Crypto/include/Poco/Crypto/Crypto.h b/Crypto/include/Poco/Crypto/Crypto.h index 344bb5844b..ef97a13734 100644 --- a/Crypto/include/Poco/Crypto/Crypto.h +++ b/Crypto/include/Poco/Crypto/Crypto.h @@ -20,7 +20,11 @@ #define Crypto_Crypto_INCLUDED -#if defined(__APPLE__) +#include "Poco/Foundation.h" +#include + + +#if POCO_OS == POCO_OS_MAC_OS_X // OS X 10.7 deprecates some OpenSSL functions #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif @@ -30,10 +34,6 @@ #define POCO_EXTERNAL_OPENSSL_SLPRO 2 -#include "Poco/Foundation.h" -#include - - enum RSAPaddingMode /// The padding mode used for RSA public key encryption. { @@ -63,7 +63,7 @@ enum RSAPaddingMode // Crypto_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(Crypto_EXPORTS) #define Crypto_API __declspec(dllexport) #else @@ -84,7 +84,7 @@ enum RSAPaddingMode // // Automatically link Crypto and OpenSSL libraries. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) #if defined(POCO_INTERNAL_OPENSSL_MSVC_VER) #if defined(POCO_EXTERNAL_OPENSSL) diff --git a/Encodings/include/Poco/Encodings.h b/Encodings/include/Poco/Encodings.h index 078aece44c..e21435809c 100644 --- a/Encodings/include/Poco/Encodings.h +++ b/Encodings/include/Poco/Encodings.h @@ -31,7 +31,7 @@ // Encodings_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(Encodings_EXPORTS) #define Encodings_API __declspec(dllexport) #else @@ -52,7 +52,7 @@ // // Automatically link Encodings library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Encodings_EXPORTS) #pragma comment(lib, "PocoEncodings" POCO_LIB_SUFFIX) #endif diff --git a/Foundation/include/Poco/Foundation.h b/Foundation/include/Poco/Foundation.h index 999c6f3149..d635d8ef91 100644 --- a/Foundation/include/Poco/Foundation.h +++ b/Foundation/include/Poco/Foundation.h @@ -26,6 +26,12 @@ #include "Poco/Config.h" +// +// Include platform-specific definitions +// +#include "Poco/Platform.h" + + // // Ensure that POCO_DLL is default unless POCO_STATIC is defined // @@ -44,7 +50,7 @@ // Foundation_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(Foundation_EXPORTS) #define Foundation_API __declspec(dllexport) #else @@ -65,7 +71,7 @@ // // Automatically link Foundation library. // -#if defined(_MSC_VER) +#ifdef POCO_COMPILER_MSVC #if defined(POCO_DLL) #if defined(_DEBUG) #define POCO_LIB_SUFFIX "d.lib" @@ -92,10 +98,6 @@ #endif -// -// Include platform-specific definitions -// -#include "Poco/Platform.h" #if defined(_WIN32) #include "Poco/Platform_WIN32.h" #elif defined(POCO_VXWORKS) @@ -133,13 +135,11 @@ // #if defined(POCO_NO_DEPRECATED) #define POCO_DEPRECATED -#elif defined(_GNUC_) -#define POCO_DEPRECATED __attribute__((deprecated)) -#elif defined(__clang__) +#elif defined(POCO_COMPILER_GCC) #define POCO_DEPRECATED __attribute__((deprecated)) -#elif defined(__MINGW32__) +#elif defined(POCO_COMPILER_CLANG) #define POCO_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) +#elif defined(POCO_COMPILER_MSVC) #define POCO_DEPRECATED __declspec(deprecated) #else #define POCO_DEPRECATED diff --git a/Foundation/include/Poco/Platform.h b/Foundation/include/Poco/Platform.h index f2c0ea2bf1..95f1864f65 100644 --- a/Foundation/include/Poco/Platform.h +++ b/Foundation/include/Poco/Platform.h @@ -243,8 +243,9 @@ #define POCO_COMPILER_MSVC #elif defined (__GNUC__) #define POCO_COMPILER_GCC -#elif defined (__MINGW32__) || defined (__MINGW64__) - #define POCO_COMPILER_MINGW + #if defined (__MINGW32__) || defined (__MINGW64__) + #define POCO_COMPILER_MINGW + #endif #elif defined (__INTEL_COMPILER) || defined(__ICC) || defined(__ECC) || defined(__ICL) #define POCO_COMPILER_INTEL #elif defined (__SUNPRO_CC) @@ -268,7 +269,7 @@ #endif -#ifdef __GNUC__ +#ifdef POCO_COMPILER_GCC #define POCO_UNUSED __attribute__((unused)) #else #define POCO_UNUSED diff --git a/JSON/include/Poco/JSON/JSON.h b/JSON/include/Poco/JSON/JSON.h index a9724f924f..34785136b9 100644 --- a/JSON/include/Poco/JSON/JSON.h +++ b/JSON/include/Poco/JSON/JSON.h @@ -31,7 +31,7 @@ // JSON_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(JSON_EXPORTS) #define JSON_API __declspec(dllexport) #else @@ -52,7 +52,7 @@ // // Automatically link JSON library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(JSON_EXPORTS) #pragma comment(lib, "PocoJSON" POCO_LIB_SUFFIX) #endif diff --git a/MongoDB/include/Poco/MongoDB/MongoDB.h b/MongoDB/include/Poco/MongoDB/MongoDB.h index 86d0db6752..2f4a96857f 100644 --- a/MongoDB/include/Poco/MongoDB/MongoDB.h +++ b/MongoDB/include/Poco/MongoDB/MongoDB.h @@ -31,7 +31,7 @@ // MongoDB_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(MongoDB_EXPORTS) #define MongoDB_API __declspec(dllexport) #else @@ -52,7 +52,7 @@ // // Automatically link MongoDB library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(MongoDB_EXPORTS) #pragma comment(lib, "PocoMongoDB" POCO_LIB_SUFFIX) #endif diff --git a/Net/include/Poco/Net/Net.h b/Net/include/Poco/Net/Net.h index 2aa03c9b63..94ec70a4a1 100644 --- a/Net/include/Poco/Net/Net.h +++ b/Net/include/Poco/Net/Net.h @@ -31,7 +31,7 @@ // Net_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(Net_EXPORTS) #define Net_API __declspec(dllexport) #else @@ -52,7 +52,7 @@ // // Automatically link Net library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Net_EXPORTS) #pragma comment(lib, "PocoNet" POCO_LIB_SUFFIX) #endif @@ -105,9 +105,8 @@ void Net_API uninitializeNetwork(); #endif #endif // Net_EXPORTS #else // __GNUC__ - #define POCO_NET_FORCE_SYMBOL(s) extern "C" const struct NetworkInitializer s; + extern "C" const struct NetworkInitializer pocoNetworkInitializer; #endif // !__GNUC__ - POCO_NET_FORCE_SYMBOL(pocoNetworkInitializer) #endif // POCO_OS_FAMILY_WINDOWS diff --git a/NetSSL_OpenSSL/include/Poco/Net/NetSSL.h b/NetSSL_OpenSSL/include/Poco/Net/NetSSL.h index 1d6ef5aa8f..fa6e1ab2f0 100644 --- a/NetSSL_OpenSSL/include/Poco/Net/NetSSL.h +++ b/NetSSL_OpenSSL/include/Poco/Net/NetSSL.h @@ -31,7 +31,7 @@ // NetSSL_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(NetSSL_EXPORTS) #define NetSSL_API __declspec(dllexport) #else @@ -52,7 +52,7 @@ // // Automatically link NetSSL // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) #if defined(POCO_INTERNAL_OPENSSL_MSVC_VER) #if defined(POCO_EXTERNAL_OPENSSL) diff --git a/NetSSL_Win/include/Poco/Net/NetSSL.h b/NetSSL_Win/include/Poco/Net/NetSSL.h index 98921f703c..a24f9bb932 100644 --- a/NetSSL_Win/include/Poco/Net/NetSSL.h +++ b/NetSSL_Win/include/Poco/Net/NetSSL.h @@ -31,7 +31,7 @@ // NetSSL_Win_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if (defined(_MSC_VER) || defined(__CYGWIN__)) && defined(POCO_DLL) +#if (defined(POCO_COMPILER_MSVC) || defined(__CYGWIN__)) && defined(POCO_DLL) #if defined(NetSSL_Win_EXPORTS) #define NetSSL_Win_API __declspec(dllexport) #else @@ -58,7 +58,7 @@ // // Automatically link NetSSL library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(NetSSL_Win_EXPORTS) #pragma comment(lib, "PocoNetSSLWin" POCO_LIB_SUFFIX) #endif diff --git a/PDF/include/Poco/PDF/PDF.h b/PDF/include/Poco/PDF/PDF.h index fbcc80adc8..3d7043aa2e 100644 --- a/PDF/include/Poco/PDF/PDF.h +++ b/PDF/include/Poco/PDF/PDF.h @@ -19,7 +19,11 @@ #ifndef PDF_PDF_INCLUDED #define PDF_PDF_INCLUDED -#if defined(_MSC_VER) && !defined(POCO_MSVC_SECURE_WARNINGS) && (!defined(_CRT_SECURE_NO_WARNINGS) || !defined(_CRT_SECURE_NO_DEPRECATE)) + +#include "Poco/Foundation.h" + + +#if defined(POCO_COMPILER_MSVC) && !defined(POCO_MSVC_SECURE_WARNINGS) && (!defined(_CRT_SECURE_NO_WARNINGS) || !defined(_CRT_SECURE_NO_DEPRECATE)) #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS #endif @@ -28,7 +32,7 @@ #endif #endif -#include "Poco/Foundation.h" + #include "hpdf.h" @@ -40,7 +44,7 @@ // PDF_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(PDF_EXPORTS) #define PDF_API __declspec(dllexport) #else @@ -61,7 +65,7 @@ // // Automatically link PDF library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(PDF_EXPORTS) #pragma comment(lib, "PocoPDF" POCO_LIB_SUFFIX) #endif diff --git a/Redis/include/Poco/Redis/Redis.h b/Redis/include/Poco/Redis/Redis.h index afc145e991..e0bf77f8e8 100644 --- a/Redis/include/Poco/Redis/Redis.h +++ b/Redis/include/Poco/Redis/Redis.h @@ -31,7 +31,7 @@ // Redis_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(Redis_EXPORTS) #define Redis_API __declspec(dllexport) #else @@ -52,7 +52,7 @@ // // Automatically link Redis library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Redis_EXPORTS) #pragma comment(lib, "PocoRedis" POCO_LIB_SUFFIX) #endif diff --git a/SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h b/SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h index b168961c83..fa8514f867 100644 --- a/SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h +++ b/SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h @@ -29,7 +29,7 @@ // ODBC_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(MySQL_EXPORTS) #define MySQL_API __declspec(dllexport) #else @@ -50,7 +50,7 @@ // // Automatically link Data library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(MySQL_EXPORTS) #pragma comment(lib, "PocoSQLMySQL" POCO_LIB_SUFFIX) #endif diff --git a/SQL/ODBC/include/Poco/SQL/ODBC/ODBC.h b/SQL/ODBC/include/Poco/SQL/ODBC/ODBC.h index db60612a41..d42935e94a 100644 --- a/SQL/ODBC/include/Poco/SQL/ODBC/ODBC.h +++ b/SQL/ODBC/include/Poco/SQL/ODBC/ODBC.h @@ -34,7 +34,7 @@ // ODBC_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(ODBC_EXPORTS) #define ODBC_API __declspec(dllexport) #else @@ -59,7 +59,7 @@ // // Automatically link Data library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(ODBC_EXPORTS) #pragma comment(lib, "PocoSQLODBC" POCO_LIB_SUFFIX) #endif diff --git a/SQL/PostgreSQL/include/Poco/SQL/PostgreSQL/PostgreSQL.h b/SQL/PostgreSQL/include/Poco/SQL/PostgreSQL/PostgreSQL.h index b7b86fb82c..40be892216 100644 --- a/SQL/PostgreSQL/include/Poco/SQL/PostgreSQL/PostgreSQL.h +++ b/SQL/PostgreSQL/include/Poco/SQL/PostgreSQL/PostgreSQL.h @@ -29,7 +29,7 @@ // ODBC_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(PostgreSQL_EXPORTS) #define PostgreSQL_API __declspec(dllexport) #else @@ -50,7 +50,7 @@ // // Automatically link Data library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(PostgreSQL_EXPORTS) #pragma comment(lib, "PocoSQLPostgreSQL" POCO_LIB_SUFFIX) #endif diff --git a/SQL/SQLite/include/Poco/SQL/SQLite/SQLite.h b/SQL/SQLite/include/Poco/SQL/SQLite/SQLite.h index 4cf0a993bb..d34891eae6 100644 --- a/SQL/SQLite/include/Poco/SQL/SQLite/SQLite.h +++ b/SQL/SQLite/include/Poco/SQL/SQLite/SQLite.h @@ -31,7 +31,7 @@ // SQLite_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(SQLite_EXPORTS) #define SQLite_API __declspec(dllexport) #else @@ -52,7 +52,7 @@ // // Automatically link SQLite library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(SQLite_EXPORTS) #pragma comment(lib, "PocoSQLSQLite" POCO_LIB_SUFFIX) #endif diff --git a/SQL/include/Poco/SQL/SQL.h b/SQL/include/Poco/SQL/SQL.h index 328d28372e..739fafcf6e 100644 --- a/SQL/include/Poco/SQL/SQL.h +++ b/SQL/include/Poco/SQL/SQL.h @@ -31,7 +31,7 @@ // Poco_SQL_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(SQL_EXPORTS) #define Poco_SQL_API __declspec(dllexport) #else @@ -48,10 +48,11 @@ #endif #endif + // // Automatically link SQL library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(SQL_EXPORTS) #pragma comment(lib, "PocoSQL" POCO_LIB_SUFFIX) #endif diff --git a/SevenZip/include/Poco/SevenZip/SevenZip.h b/SevenZip/include/Poco/SevenZip/SevenZip.h index 2909b0362c..d9d710a645 100644 --- a/SevenZip/include/Poco/SevenZip/SevenZip.h +++ b/SevenZip/include/Poco/SevenZip/SevenZip.h @@ -31,7 +31,7 @@ // SevenZip_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(SevenZip_EXPORTS) #define SevenZip_API __declspec(dllexport) #else @@ -52,7 +52,7 @@ // // Automatically link SevenZip library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(SevenZip_EXPORTS) #pragma comment(lib, "PocoSevenZip" POCO_LIB_SUFFIX) #endif diff --git a/Util/include/Poco/Util/Util.h b/Util/include/Poco/Util/Util.h index 40013267de..8a2a0b60be 100644 --- a/Util/include/Poco/Util/Util.h +++ b/Util/include/Poco/Util/Util.h @@ -31,7 +31,7 @@ // Util_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(Util_EXPORTS) #define Util_API __declspec(dllexport) #else @@ -72,7 +72,7 @@ // // Automatically link Util library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Util_EXPORTS) #pragma comment(lib, "PocoUtil" POCO_LIB_SUFFIX) #endif diff --git a/XML/include/Poco/XML/XML.h b/XML/include/Poco/XML/XML.h index 1dd53cede6..9768d2dd57 100644 --- a/XML/include/Poco/XML/XML.h +++ b/XML/include/Poco/XML/XML.h @@ -31,7 +31,7 @@ // XML_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(XML_EXPORTS) #define XML_API __declspec(dllexport) #else @@ -52,7 +52,7 @@ // // Automatically link XML library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(XML_EXPORTS) #pragma comment(lib, "PocoXML" POCO_LIB_SUFFIX) #endif diff --git a/Zip/include/Poco/Zip/Zip.h b/Zip/include/Poco/Zip/Zip.h index 8927f4e1a7..2ac6d561ff 100644 --- a/Zip/include/Poco/Zip/Zip.h +++ b/Zip/include/Poco/Zip/Zip.h @@ -31,7 +31,7 @@ // Zip_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. // -#if defined(_MSC_VER) && defined(POCO_DLL) +#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) #if defined(Zip_EXPORTS) #define Zip_API __declspec(dllexport) #else @@ -52,7 +52,7 @@ // // Automatically link Zip library. // -#if defined(_MSC_VER) +#if defined(POCO_COMPILER_MSVC) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Zip_EXPORTS) #pragma comment(lib, "PocoZip" POCO_LIB_SUFFIX) #endif From 903723e7088e03b12ebcfd0847857195ca8f737c Mon Sep 17 00:00:00 2001 From: Lyashenko Arsenii Maksimovich Date: Sat, 8 Sep 2018 21:37:53 +0300 Subject: [PATCH 3/3] Define 'POCO_UNUSED' for Clang too --- Foundation/include/Poco/Platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Foundation/include/Poco/Platform.h b/Foundation/include/Poco/Platform.h index 95f1864f65..3f26008dbe 100644 --- a/Foundation/include/Poco/Platform.h +++ b/Foundation/include/Poco/Platform.h @@ -269,7 +269,7 @@ #endif -#ifdef POCO_COMPILER_GCC +#if defined(POCO_COMPILER_GCC) || defined(POCO_COMPILER_CLANG) #define POCO_UNUSED __attribute__((unused)) #else #define POCO_UNUSED