You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Stephen Webb (Jira)" <lo...@logging.apache.org> on 2022/08/16 02:23:00 UTC

[jira] [Updated] (LOGCXX-558) Prevent MSVC compilation warnings "needs to have dll-interface"

     [ https://issues.apache.org/jira/browse/LOGCXX-558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Webb updated LOGCXX-558:
--------------------------------
    Description: 
The private data of classes do not prevent Microsoft compiler warning messages.

 

As the private data is inaccessible by client application it should be safe to ignore the warning. This can be done using a macro 

```

#if _WIN32
#define LOG4CXX_DECLARE_PRIVATE_STRUCT(T, V) \
__pragma( warning( push ) ) \
__pragma( warning( disable : 4251 ) ) \
    struct T; std::unique_ptr<T> V; \
__pragma( warning( pop ) )

#else

#define LOG4CXX_DECLARE_PRIVATE_STRUCT(T, V) struct T; std::unique_ptr<T> V;
#endif /* WIN32 */

```

  was:
The private data of classes do not prevent Microsoft compiler warning messages.

 

As the private data is inaccessible by client application it should be safe to ignore the warnning. This can be done using a macro 

```

#if _WIN32
#define LOG4CXX_DECLARE_PRIVATE_STRUCT(T, V) \
__pragma( warning( push ) ) \
__pragma( warning( disable : 4251 ) ) \
    struct T; std::unique_ptr<T> V; \
__pragma( warning( pop ) )

#else

#define LOG4CXX_DECLARE_PRIVATE_STRUCT(T, V) struct T; std::unique_ptr<T> V;
#endif /* WIN32 */

```


> Prevent MSVC compilation warnings "needs to have dll-interface"
> ---------------------------------------------------------------
>
>                 Key: LOGCXX-558
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-558
>             Project: Log4cxx
>          Issue Type: Improvement
>            Reporter: Stephen Webb
>            Priority: Minor
>
> The private data of classes do not prevent Microsoft compiler warning messages.
>  
> As the private data is inaccessible by client application it should be safe to ignore the warning. This can be done using a macro 
> ```
> #if _WIN32
> #define LOG4CXX_DECLARE_PRIVATE_STRUCT(T, V) \
> __pragma( warning( push ) ) \
> __pragma( warning( disable : 4251 ) ) \
>     struct T; std::unique_ptr<T> V; \
> __pragma( warning( pop ) )
> #else
> #define LOG4CXX_DECLARE_PRIVATE_STRUCT(T, V) struct T; std::unique_ptr<T> V;
> #endif /* WIN32 */
> ```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)