Hi Roger,

Maybe there was a reason with earlier releases of Visual Studio.

Anyway, thanks for adding this to the bug-tracking system.

Regards,

Paul

From: Roger Leigh <[email protected]>
Sent: Friday, August 14, 2020 2:43 PM
To: [email protected]
Subject: Re: NDEBUG issue with xalan-c


Hi Paul,



Ticket created here: 
https://issues.apache.org/jira/browse/XALANC-812<https://issues.apache.org/jira/browse/XALANC-812>



When I was doing the CMake porting work, I noticed this and didn't fully 
understand why it existed.  I retained it for strict compatibility in case 
removing it broke something.  But if it's actually breaking things, then I 
think that's a perfectly good reason to drop it completely.

Looking at 
https://stackoverflow.com/questions/2290509/debug-vs-ndebug<https://stackoverflow.com/questions/2290509/debug-vs-ndebug>
 they seem kind-of orthogonal.  I can't see any good reason to fail the build 
if both are defined; it seems overly harsh.



Regards,

Roger
On 14/08/2020 18:11, Paul Kinnucan wrote:
Hi,

The

xalan-c\src\xalanc\Include\PlatformDefinitions.hpp.in

throws an error if the compile options _DEBUG and NDEBUG are both defined for 
the Visual Studio compiler. Unfortunately, perhaps because of a bug, cmake 
generates this combination of Visual Studio compiler command-line options for a 
Debug build, causing massive compile failures when trying to build a debug 
version of xalan-c on Windows. The only workaround for this problem I could 
find is to comment out the relevant lines in PlatformDefinitions.hpp.in:

#if defined(_MSC_VER)

#pragma warning(disable: 4127 4146 4251 4284 4345 4351 4355 4511 4512 4514 4521 
4702 4710 4711 4786 4097 4503 4786; error: 4150 4172 4238 4239 4715)
#include <basetsd.h>

// Note: this no longer seems necessary with current MSVC
#if !defined(__INTEL_COMPILER) && _MSC_VER >= 1400
#define XALAN_AUTO_PTR_REQUIRES_DEFINITION
#endif

#if defined(_DEBUG) && defined(NDEBUG)
// #error NDEBUG must not be defined when _DEBUG is defined.
#elif !defined(_DEBUG) && !defined(NDEBUG)
// #error NDEBUG must be defined when _DEBUG is not defined.
#endif

#endif // _MSC_VER

I don't see the value of this _DEBUG/NDEBUG check. It is especially irritating 
for Release builds because you have to add the NDEBUG option into the Visual 
Studio solution every time you create a new solution that depends on xalan-c.  
I suggest removing the check from PlatformDefinitions.

Paul

Reply via email to