Opened 10 years ago

Last modified 10 years ago

#8278 reopened Bugs

BOOST_ASSERT_MSG prerocessed out if NDEBUG is defined regardless of BOOST_ENABLE_ASSERT_HANDLER

Reported by: Eric Niebler Owned by: Beman Dawes
Milestone: To Be Determined Component: utility
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:

Description

There is an inconsistency in boost/assert.hpp. The macros BOOST_ASSERT and BOOST_VERIFY are *not* preprocessed out when BOOST_ENABLE_ASSERT_HANDLER is defined, but BOOST_ASSERT_MSG is. The inconsistency should be resolved one way or the other, and I think making BOOST_ASSERT_MSG behave like the other two makes the most sense.

Assigning to you, Peter, since you created this file. Please reassign as appropriate.

Attachments (1)

assert.patch (605 bytes ) - added by Eric Niebler 10 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Peter Dimov, 10 years ago

Owner: changed from Peter Dimov to Beman Dawes

I think that Beman added the _MSG variants. I agree that ASSERT_MSG should follow ASSERT.

comment:2 by viboes, 10 years ago

Resolution: duplicate
Status: newclosed

duplicated of #7028

comment:3 by Eric Niebler, 10 years ago

Resolution: duplicate
Status: closedreopened

I don't believe this issue is a dupe of #7028. That issue (which I disagree with) suggests that all the assert macros be processed out when NDEBUG is defined, even when BOOST_ENABLE_ASSERT_HANDLER is defined. This issue is specifically about making BOOST_ASSERT_MSG consistent with the other macros, which are currently left in always when BOOST_ENABLE_ASSERT_HANDLER is defined.

comment:4 by viboes, 10 years ago

#7028 patch makes the 3 macros uniform. Could you provide a patch that clarifies what do you expect?

in reply to:  4 comment:5 by viboes, 10 years ago

Replying to viboes:

#7028 patch makes the 3 macros uniform. Could you provide a patch that clarifies what do you expect?

Oh, I think I understand the issue now. See #7028.

by Eric Niebler, 10 years ago

Attachment: assert.patch added

comment:6 by Eric Niebler, 10 years ago

I've attached a patch that addressed the problem the way I think it should be addressed, and the way that is least surprising for existing users of BOOST_ASSERT. It should be applied to trunk as it is as of [83430].

Note: See TracTickets for help on using tickets.