New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
h2xs: Support for _Bool/stdbool.h? #15777
Comments
From tauner@technikum-wien.atHi, I have used h2xs for the first time today to start the creation of a error: ‘arg1’ undeclared (first use in this function) The generated code in the .xs is: XS_EUPXS(XS_function_name) Note that there is no variable definition for "arg1" (whose name is When I change the library to use int instead of bool (or _Bool) then XS_EUPXS(XS_function_name) _Bool is a C type introduced in C99, bool is a typedef declared by KR University of Applied Sciences Technikum Wien |
From @iabynOn Fri, Dec 23, 2016 at 07:10:27AM -0800, Stefan Tauner wrote:
Can you show us: 1) the command-line your are invoking h2xs with; Thanks. -- |
The RT System itself - Status changed from 'new' to 'open' |
From tauner@technikum-wien.atOn Sun, 25 Dec 2016 11:21:10 -0800
h2xs -x booltest.h
booltest.h: #include <stdbool.h> With a trivial implementation in booltest.c: #include "booltest.h" However, the same thing works fine with _Bool instead of bool+stdbool.h.
See attached perl.V KR University of Applied Sciences Technikum Wien |
From @jkeenanOn Wed, 28 Dec 2016 06:00:21 GMT, tauner@technikum-wien.at wrote:
What happens if you do not use the '-x' option and thereby avoid C::Scan? (When I did that, 'make' completed -- but since I've rarely attempted to write XS I don't know whether that's meaningful or not.) Thank you very much. -- |
From @iabynOn Wed, Dec 28, 2016 at 05:37:04AM -0800, James E Keenan via RT wrote:
When foo,h contains this: #include <stdbool.h> then h2xs -x foo.h, via C::Scan, is generating an XS file that looks like: void which is being converted into the C code XS_EUPXS(XS_Foo_h2xs); /* prototype to pass -Wmissing-prototypes */ h2xs(arg0); The issues seem to be that 1) h2xs and/or C::Scan isn't including the variable type for arg0 in the void 2) that ExtUtils/xsubpp isn't seeing that as an error and is instead bool arg0 = (bool)SvTRUE(ST(0)) Does anyone here more familiar with XS want to comment? -- |
From tauner@technikum-wien.atOn Wed, 28 Dec 2016 05:37:04 -0800
Yes, then it succeeds because the functions are not wrapped at all :) KR University of Applied Sciences Technikum Wien |
From @LeontOn Fri, Dec 23, 2016 at 4:10 PM, Stefan Tauner <perlbug-followup@perl.org>
_Bool is indeed a C99 built-in type, but bool is a *macro* to _Bool, not a I would recommend using _Bool instead of bool, that seems to generate Leon |
From @hvdsOn Wed, 28 Dec 2016 07:13:36 -0800, davem wrote:
I'll try to take a look later this week at the C::Scan side, to see if this is fixable; I don't have stdbool.h here, but I'm guessing that something like <http://clang.llvm.org/doxygen/stdbool_8h_source.html> should be close enough. Hugo |
From @iabynOn Wed, Dec 28, 2016 at 11:56:11PM -0800, Hugo van der Sanden via RT wrote:
It seems very sensitive. I tried as small a change as replacing this line: #include <stdbool.h> with this this line #include "/usr/lib/gcc/x86_64-redhat-linux/5.3.1/include/stdbool.h" (which from stracing the h2xs command appears to be the file it reads) That file is attached. -- |
From @iabyn/* Copyright (C) 1998-2015 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify GCC is distributed in the hope that it will be useful, Under Section 7 of GPL version 3, you are granted additional You should have received a copy of the GNU General Public License and /* #ifndef _STDBOOL_H #ifndef __cplusplus #define bool _Bool #else /* __cplusplus */ /* Supporting _Bool in C++ is a GCC extension. */ #if __cplusplus < 201103L #endif /* __cplusplus */ /* Signal that all the definitions are present. */ #endif /* stdbool.h */ |
From @hvdsOn Wed, 28 Dec 2016 07:13:36 -0800, davem wrote:
I'm seeing it output this (which I believe is correct):
For me, xsubpp is giving this: _Bool b; if (SvROK(ST(0)) && sv_derived_from(ST(0), "_Bool")) { 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 |
From @LeontOn Sat, Dec 31, 2016 at 3:04 PM, Hugo van der Sanden via RT <
It seems to assume _Bool is some kind of object type, for some reason, Leon |
Migrated from rt.perl.org#130393 (status was 'open')
Searchable as RT130393$
The text was updated successfully, but these errors were encountered: