You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2023/01/15 03:01:16 UTC

[logging-log4cxx] branch fix_msys2_gcc_compilation created (now 7b43bf5c)

This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a change to branch fix_msys2_gcc_compilation
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


      at 7b43bf5c Prevent compilation error in a MSYS2 environment using GCC

This branch includes the following new commits:

     new 7b43bf5c Prevent compilation error in a MSYS2 environment using GCC

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[logging-log4cxx] 01/01: Prevent compilation error in a MSYS2 environment using GCC

Posted by sw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch fix_msys2_gcc_compilation
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit 7b43bf5c44684970f13a832e86dca7843d2439bc
Author: Stephen Webb <st...@sabreautonomous.com.au>
AuthorDate: Sun Jan 15 14:00:53 2023 +1100

    Prevent compilation error in a MSYS2 environment using GCC
---
 src/main/include/log4cxx/log4cxx.h.in | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/main/include/log4cxx/log4cxx.h.in b/src/main/include/log4cxx/log4cxx.h.in
index 6bc4239c..d22e97a0 100644
--- a/src/main/include/log4cxx/log4cxx.h.in
+++ b/src/main/include/log4cxx/log4cxx.h.in
@@ -63,7 +63,7 @@
 #define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N
 #define LOG4CXX_PRIVATE_PTR(T) std::unique_ptr<T>
 
-#if _WIN32
+#if defined(_MSC_VER)
 #define LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(T, V) \
 __pragma( warning( push ) ) \
 __pragma( warning( disable : 4251 ) ) \
@@ -76,23 +76,24 @@ __pragma( warning( disable : 4251 ) ) \
     T V; \
 __pragma( warning( pop ) )
 
-//  definitions used when using static library
-#if defined(LOG4CXX_STATIC)
-#define LOG4CXX_EXPORT
-//   definitions used when building DLL
-#elif defined(LOG4CXX)
-#define LOG4CXX_EXPORT __declspec(dllexport)
-#else
-//    definitions used when using DLL
-#define LOG4CXX_EXPORT __declspec(dllimport)
-#endif
 #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
-#else
-#define LOG4CXX_EXPORT
+#else // !defined(_MSC_VER)
 #define LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(T, V) struct T; LOG4CXX_PRIVATE_PTR(T) V;
 #define LOG4CXX_DECLARE_PRIVATE_MEMBER(T, V) T V;
 #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T)
-#endif /* WIN32 */
+#endif // defined(_MSC_VER)
+
+#if defined(_WIN32) && defined(_MSC_VER)
+#if defined(LOG4CXX_STATIC)     // Linking a static library?
+#define LOG4CXX_EXPORT
+#elif defined(LOG4CXX)          // Building a DLL?
+#define LOG4CXX_EXPORT __declspec(dllexport)
+#else                          // Linking against a DLL?
+define LOG4CXX_EXPORT __declspec(dllimport)
+#endif // !LOG4CXX_STATIC
+#else // !defined(_WIN32) || !defined(_MSC_VER)
+#define LOG4CXX_EXPORT
+#endif // !defined(_WIN32) || !defined(_MSC_VER)
 
 namespace log4cxx {