Make h2ph generate constant subs
>> Shouldn't these:
>> eval 'sub RUN_LVL {1;}';
>> be:
>> eval 'sub RUN_LVL() {1;}';
>
> I'd say so. Who can tell us whether h2ph is easily changeable?
It is, here's a patch. It could still use changes so that it emits new
style sub invocations so that more constant folding happens, but that's
trickier. Additional changes in the patch are removal of a "chdir
/usr/include" (which prevented you from converting files in other
directories and wasn't needed for the standard invocation) and addition
of a -d switch to specify output directory (so I could test my changes
more easily).
Somewhere around here I've got the start of regression suite for h2ph,
remind me to dust it off for _50.
Another bug in h2ph it would be nice to fix:
$ echo "
#define FOO (BAR || BAZ)
#if FOO
#endif" | h2ph | perl
Undefined subroutine &main::BAR called at - line 1.
I can't regenerate my vendor's current headers due to this one.
p5p-msgid: pz2088w5ot.fsf@eeyore.ibcinc.com