Need a way to make PR_ASSERT work in optimized builds.
This is a good idea. In hindsight, I shouldn't have used the DEBUG macro to control the expansion of PR_ASSERT. I should have used NDEBUG (which controls the libc 'assert' macro) or some other macro such as PR_NDEBUG. If we want to use NDEBUG, this must be done in the next NSPR major release. If we are willing to use a new macro (PR_NDEBUG) for this purpose, we can do this in the next NSPR minor release (4.2).
Severity: major → enhancement
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → Future
Version: 4.1.3 → 4.1.2
We don't really have to have PR_ASSERT's inside of NSPR working in optimized builds. Would be fine if PR_ASSERT will work when used and certain debug define is set (say PR_USE_ASSERT_ALWAYS or smth like that). Why do we need to wait for a major release for this?
Ruslan, you are right. If we are just going to add another macro (FORCE_PR_ASSERT, following the naming convention of similar macros) that would also enable PR_ASSERT, this does not need to be done in a major release. That is, we would say: #if defined(DEBUG) || defined(FORCE_PR_ASSERT) #define PR_ASSERT(expr) a-working-definition #else #define PR_ASSERT(expr) ((void) 0) #endif What I wanted to do was to use only one macro, NDEBUG or PR_NDEBUG (what I said about PR_NDEBUG was actually wrong), to control PR_ASSERT. This would need to be done in a major release. That is, we would say: #if !defined(PR_NDEBUG) #define PR_ASSERT(expr) a-working-definition #else #define PR_ASSERT(expr) ((void) 0) #endif
Created attachment 62780 [details] [diff] [review] Proposed patch. PR_ASSERT is enabled if DEBUG or FORCE_PR_ASSERT is defined. Ruslan, please give this patch a try.
Comment on attachment 62780 [details] [diff] [review] Proposed patch. PR_ASSERT is enabled if DEBUG or FORCE_PR_ASSERT is defined. I checked in the patch on the tip and client branch of NSPR. It will be in NSPR 4.2 Beta.
Marked the bug fixed.
Status: ASSIGNED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.