-
Notifications
You must be signed in to change notification settings - Fork 589
Change ARGS_ASSERT to use ASSUME(), and __attribute__nonnull() #23641
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
base: blead
Are you sure you want to change the base?
Conversation
... instead of assert(). ASSUME() is a drop-in replacement for assert() and gives more hints to the compiler.
This got duplicated in recent rebasing
The next commit will want this to be available earlier.
proto.h contains a generated PERL_ARGS_ASSERT macro for every function. Prior to this commit, each such macro will assert that each such parameter isn't NULL. Some compilers allow a compile-time assertion to be made for this situation. This commit uses that instead when available, but only for functions that don't have a thread context. The reason for that is it gets more complicated; so I'm starting with this.
f27e796
to
bb147b4
Compare
tried
Looks like a bug with POSIX Perl's Imagine is the wrong word b/c I've done this b4 for private biz XS. So lets imagine, I am a CPAN XS module running on ithread-ed WinPerl, with only 1 Perl thread ( So I am an XS->PP event handler executing inside a TP Thd, The root thread is frozen (blocked until I release control back to the root thread manually). At the end of my TP thread runner, after the I'm avoiding an accident if some enumeration API gets smart (not really) and runs my C callback fn ptr asynchronously, in parallel, on multiple cores on multiple TP OS threads. Bad hygiene to leave your de allocated void ptrs in TLS. So I would definitely want Or this is an optimization to const fold away all machine code associated with PERL_SET_CONTEXT() on single-threaded perls builds. But then the question is, why was You also wrote, or were the last person to clean it up. but the null test existed before the commit above, ill stop git blaming at this point.
|
Instead of using assert() , use ASSUME(). It is a drop-in replacement for assert() and gives more hints to the compiler.
Further, when available, this arranges to instead use
__attribute__nonnull__
to make sure a parameter being passed is non-NULL. This is compile-time, not run-time. It only does this for functions that don't have a thread context parameter, deferring those to a potential future p.r.Doing this showed a small issue
in which the compiler now catches that
t
can't be NULL. I don't know the best way to resolve this.