perl5 icon indicating copy to clipboard operation
perl5 copied to clipboard

Add __attribute__nonnull__() for non-DEBUGGING builds

Open khwilliamson opened this issue 3 months ago • 16 comments

proto.h contains a generated PERL_ARGS_ASSERT macro for every function. It asserts that each parameter that isn't allowed to be NULL actually isn't (except there are no asserts for the aTHX parameter.)

These asserts are disabled when not DEBUGGING. But many compilers allow a compile-time assertion to be made for this situation, so we can add an extra measure of protection for free. And this gives hints to the compiler for optimizations when the asserts() aren't there.

In addition it adds a compile time assertion for the aTHX parameter.

  • This set of changes does not require a perldelta entry.

khwilliamson avatar Aug 24 '25 18:08 khwilliamson