On 23/07/2019 16:05, Marco Pivetta wrote:
Would it be too aggressive to have (in the php-src test suite, as a first step) something that ensures that a stub exists for each exposed userland symbol?
That's an interesting point, at the risk of flogging a dead horse with my ignorance of internals, what about using the unit tests as a means of enumerating the arguments, their names and their return types?
If there's nothing that meets the requirements of php-src, what about php-src itself? As almost all arg are handled via zpp, and almost all the return values are handled by RETURN_XXX etc, what about a one-off build that modifies those macros to report their usage to a global state, which can be read back after and used to build the docs?
Something like a dozen years ago, I wrote a scripting language in C++ for my undergraduate thesis, and hit across a similar problem. I too used macros to define functions arguments, what their types were, copied them into native variables and so forth. When it came to documenting all the functions I was quickly losing my sanity, and so modified my macros so that if ran with a certain define active, they would dump all of their information into a global store that I could dump after.
Obviously PHP's use of quasi-overloading doesn't help its situation here, and Z_PARAM_ZVAL and friends could cause quite a headache, as it would need to track what types were extracted through such macros as Z_LVAL_XX.
Certainly not a catch-all situation, but might present an opportunity for doing some of the leg work automatically.
Mark Randall -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php