Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "redeclared without dllimport attribute..." warning for MinGW #2433

Merged
merged 3 commits into from
Sep 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CppParser/include/Poco/CppParser/CppParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(POCO_COMPILER_MSVC) || POCO_OS == POCO_OS_CYGWIN) && defined(POCO_DLL)
#if defined(CppParser_EXPORTS)
#define CppParser_API __declspec(dllexport)
#else
Expand All @@ -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
Expand Down
9 changes: 6 additions & 3 deletions CppUnit/include/Poco/CppUnit/CppUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#define Poco_CppUnit__CppUnitINCLUDED


#include "Poco/Platform.h"


//
// Ensure that POCO_DLL is default unless POCO_STATIC is defined
//
Expand All @@ -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(_WIN32) && defined(POCO_DLL)
#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(CppUnit_EXPORTS)
#define CppUnit_API __declspec(dllexport)
#else
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
24 changes: 11 additions & 13 deletions Crypto/include/Poco/Crypto/Crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
#define Crypto_Crypto_INCLUDED


#if defined(__APPLE__)
#include "Poco/Foundation.h"
#include <openssl/opensslv.h>


#if POCO_OS == POCO_OS_MAC_OS_X
// OS X 10.7 deprecates some OpenSSL functions
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
Expand All @@ -30,10 +34,6 @@
#define POCO_EXTERNAL_OPENSSL_SLPRO 2


#include "Poco/Foundation.h"
#include <openssl/opensslv.h>


enum RSAPaddingMode
/// The padding mode used for RSA public key encryption.
{
Expand Down Expand Up @@ -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(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(Crypto_EXPORTS)
#define Crypto_API __declspec(dllexport)
#else
#define Crypto_API __declspec(dllimport)
#endif
#endif

Expand All @@ -86,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)
Expand Down
4 changes: 2 additions & 2 deletions Encodings/include/Poco/Encodings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(Encodings_EXPORTS)
#define Encodings_API __declspec(dllexport)
#else
Expand All @@ -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
Expand Down
22 changes: 11 additions & 11 deletions Foundation/include/Poco/Foundation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand All @@ -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(_WIN32) || defined(_WIN32_WCE)) && defined(POCO_DLL)
#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(Foundation_EXPORTS)
#define Foundation_API __declspec(dllexport)
#else
Expand All @@ -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"
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions Foundation/include/Poco/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -268,7 +269,7 @@
#endif


#ifdef __GNUC__
#if defined(POCO_COMPILER_GCC) || defined(POCO_COMPILER_CLANG)
#define POCO_UNUSED __attribute__((unused))
#else
#define POCO_UNUSED
Expand Down
4 changes: 2 additions & 2 deletions JSON/include/Poco/JSON/JSON.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(JSON_EXPORTS)
#define JSON_API __declspec(dllexport)
#else
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions MongoDB/include/Poco/MongoDB/MongoDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(MongoDB_EXPORTS)
#define MongoDB_API __declspec(dllexport)
#else
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions Net/include/Poco/Net/Net.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(Net_EXPORTS)
#define Net_API __declspec(dllexport)
#else
Expand All @@ -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
Expand Down Expand Up @@ -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


Expand Down
14 changes: 6 additions & 8 deletions NetSSL_OpenSSL/include/Poco/Net/NetSSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(NetSSL_EXPORTS)
#define NetSSL_API __declspec(dllexport)
#else
#define NetSSL_API __declspec(dllimport)
#endif
#endif

Expand All @@ -54,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)
Expand Down
4 changes: 2 additions & 2 deletions NetSSL_Win/include/Poco/Net/NetSSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(POCO_COMPILER_MSVC) || defined(__CYGWIN__)) && defined(POCO_DLL)
#if defined(NetSSL_Win_EXPORTS)
#define NetSSL_Win_API __declspec(dllexport)
#else
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions PDF/include/Poco/PDF/PDF.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,7 +32,7 @@
#endif
#endif

#include "Poco/Foundation.h"

#include "hpdf.h"


Expand All @@ -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(_WIN32) && defined(POCO_DLL)
#if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(PDF_EXPORTS)
#define PDF_API __declspec(dllexport)
#else
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Redis/include/Poco/Redis/Redis.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(Redis_EXPORTS)
#define Redis_API __declspec(dllexport)
#else
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions SQL/MySQL/include/Poco/SQL/MySQL/MySQL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(POCO_COMPILER_MSVC) && defined(POCO_DLL)
#if defined(MySQL_EXPORTS)
#define MySQL_API __declspec(dllexport)
#else
Expand All @@ -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
Expand Down
Loading