develooper Front page | perl.perl5.porters | Postings from December 2016

[perl #130393] h2xs: Support for _Bool/stdbool.h?

Thread Previous | Thread Next
From:
Hugo van der Sanden via RT
Date:
December 31, 2016 14:04
Subject:
[perl #130393] h2xs: Support for _Bool/stdbool.h?
Message ID:
rt-4.0.24-22711-1483193042-845.130393-15-0@perl.org
On Wed, 28 Dec 2016 07:13:36 -0800, davem wrote:
> When foo,h contains this:
> 
> #include <stdbool.h>
> void h2xs(bool b);
> 
> then h2xs -x foo.h, via C::Scan, is generating an XS file that looks
> like:
> 
> void
> h2xs(arg0)
> 
> which is being converted into the C code
> 
> XS_EUPXS(XS_Foo_h2xs); /* prototype to pass -Wmissing-prototypes */
> XS_EUPXS(XS_Foo_h2xs)
> {
>     dVAR; dXSARGS;
>     if (items != 1)
>        croak_xs_usage(cv,  "arg0");
>     {
> 
> h2xs(arg0);
> }
> XSRETURN_EMPTY;
> }
> 
> The issues seem to be that
> 
> 1) h2xs and/or C::Scan isn't including the variable type for arg0 in
> the
> generated XS; I assume that it should have output:
> 
> void
> h2xs(bool arg0)

I'm seeing it output this (which I believe is correct):
void
h2xs(b)
    _Bool   b

> 
> 2) that ExtUtils/xsubpp isn't seeing that as an error and is instead
> converting it onto invalid C code, by not including the line:
> 
> bool    arg0 = (bool)SvTRUE(ST(0))

For me, xsubpp is giving this:

    _Bool   b;

    if (SvROK(ST(0)) && sv_derived_from(ST(0), "_Bool")) {
        IV tmp = SvIV((SV*)SvRV(ST(0)));
        b = INT2PTR(_Bool,tmp);
    }
    else [...]

I haven't been able to reproduce the case of a missing '_Bool b' declaration in Foo.xs, so I'm stuck on this for now.

Hugo

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=130393

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About