Branch: refs/heads/davem/st0_hack Home: https://github.com/Perl/perl5 Commit: 454f2c1975a58821824e2c137f9d4091f4ec2a1f https://github.com/Perl/perl5/commit/454f2c1975a58821824e2c137f9d4091f4ec2a1f Author: David Mitchell <da...@iabyn.com> Date: 2024-08-01 (Thu, 01 Aug 2024)
Changed paths: M ext/DynaLoader/DynaLoader_pm.PL M ext/DynaLoader/dl_dlopen.xs Log Message: ----------- Dynaloader: in XS avoid setting ST(0) in void XSUB A historical quirk of XS, which was fixed in 1996, allowed code along the lines of: void foo(...) CODE: ... ST(0) = ...; This is wrong, because the code is declared as returning nothing, but still puts something on the stack. xsubpp has hacky logic to work around this. Normally it would emit 'XSRETURN_EMPTY', but if it sees text like 'ST(n) = ' in the body of an XSUB, it emits 'XSRETURN(1)' instead. The docs were fixed in 1996, but this anti-pattern continues to reproduce. Eventually I want to make xsubpp emit a warning if it has to apply this hack, but in the meantime, this commit is the start of an effort to eliminate this code style. This change shouldn't affect functionality. Note that this commit only updates the xs file which is used on my Linux system. There are bunch of other OS-specific variant .xs files such as dl_win32.xs, which I haven't attempted to fix up as I can't test the result. To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications