[ 
https://issues.apache.org/jira/browse/LOGCXX-490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16091706#comment-16091706
 ] 

Sebastian Geiger commented on LOGCXX-490:
-----------------------------------------

As I understand this issue is fixed in Visual Studio 2015 and above. So it 
should be enough to just disable the warning for that file and only in earlier 
versions than 2015.

I would suggest to check if the _MSC_VER (see \[2\]) is less than Visual Studio 
2015. Which according to CMake and Wikipedia \[1,3\] has the version 1900, e.g.:

bq. MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)

something like this should do it:
{code}
#if (_MSC_VER < 1900)
#pragma warning ( push )
#pragma warning ( disable: 4127 )
#endif
{code}

\[1\]: https://cmake.org/cmake/help/v3.8/variable/MSVC_VERSION.html
\[2\]: https://msdn.microsoft.com/en-us/library/b0084kay.aspx
\[3\]: https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B

> conditional expression is constant
> ----------------------------------
>
>                 Key: LOGCXX-490
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-490
>             Project: Log4cxx
>          Issue Type: Improvement
>            Reporter: Sebastian Geiger
>            Priority: Minor
>
> When I activate the /W4 warning level in MSVC 2013 I get the following 
> warning:
>  warning C4127: conditional expression is constant 
> The warning appears for all statements that use the LOG4CXX_* macros suchas 
> LOG4CXX_ERROR. I currently get more than 500 if these warnings, which makes 
> identifying more important warnings rather difficult.
> Of course I could disable the warning, but if this is something that could be 
> fixed in the log4cxx code then I think that would be a better solution.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to