#105: Enforce NULL checks on C function arguments
------------------------+---------------------------------------------------
Reporter: Infinoid | Owner: infinoid
Type: cage | Status: closed
Priority: normal | Milestone:
Component: core | Version:
Severity: medium | Resolution: fixed
Keywords: headerizer | Lang:
Patch: | Platform:
------------------------+---------------------------------------------------
Changes (by Infinoid):
* status: new => closed
* resolution: => fixed
Comment:
Replying to [comment:5 Infinoid]:
> I've just tested headerizer-asserts-as-local-variable-decl.patch, and
the assertions crash when they're supposed to. So that means it's a
viable solution, and definitely preferred in the long run. Unfortunately,
when the assertions fail, the resulting message talks about it crashing in
the file and line number of PARROT_ARG_ASSERT, not in the caller. So I'm
going to have to add some __FILE__ and __LINE__ magic here; I should have
an updated patch for that tonight.
Done.
> I've whipped up a perl regex script to automatically perform this
change, which works in the majority of cases. So I think this conversion
won't take too long, and shouldn't slow down additional tagging in the
meantime.
Done.
And now that ASSERT_ARGS() always appears directly after a function's
opening brace, that made it trivial to write a perl script to tag the rest
of the functions automatically. So that's done too, and the
c_arg_assert.t test is passing.
So I've finished this work and tested everything and fixed up all of the
issues and everything's looking good here. I've merged the branch work
back into trunk and gotten everything looking nice there, too, so I
removed the branch (and its tag).
We'll see whether it works on all platforms and compilers. Other than
that, the only points I can see for future work on this are:
* automatic argument checking inserted by pmc2c
* automatic argument checking inserted by ops2c
* move the ASSERT_ARGS_* macros to the .c file's static section... there's
no reason for them to be in the global headers.
Since we've accomplished the goal of this ticket, I am closing it. Andy++
and kid51++ for their help and feedback.
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/105#comment:6>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets