Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: df8581b2ed4f95d0aeec6a25c1590ed27ed32437
      
https://github.com/Perl/perl5/commit/df8581b2ed4f95d0aeec6a25c1590ed27ed32437
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-02 (Fri, 02 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

Reply via email to