-
Notifications
You must be signed in to change notification settings - Fork 589
Document assert_(), combine with __ASSERT_; fixup Perl_assert() #23543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
when was this? I do the Coverity builds with |
Presumably you meant |
This comment is not true; it may have been true once. assert.h is always included, and assert() is always supposed to be defined, since at least C89. But the code acts like it is possible to not be defined; it's not a big deal to retain that check, so I'm leaving it in.
PERL_DEB2 is too obscure for me. Simply use #ifdef DEBUGGING
This changes the white space in preparation for the next commit
Source code line numbers now have a typedef and format so that they work on a variety of platforms.
This makes the next commits smaller.
They have the same conditional, and the next commit will change that conditional and want it to apply to both.
Some assertions have caused Coverity to complain in the past, or overflowed for some platforms, so the definition of __ASSERT_ in handy.h expands to a no-op if under Coverity or the system doesn't have a normal sized macro buffer. Bring that definition here to also be the same for Perl_assert().
And fix up the documentation, adding a caution that their use can easily lead to differing behavior in DEBUGGING vs non-DEBUGGING builds. These two macros are synonymous. This documents assert_() for the first time and clarifies their usage. Thanks to Tony Cook for clarifying this for me.
Fixed via a285955 |
The combined documentation now cautions about macro parameters being evaluated more than once.
Perl_assert now works correctly on platforms where LINE is not an int., and expands to a no-op under Coverity, or on systems without adequate macro buffer space.