Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Inline CPAN distribution.

Report information
The Basics
Id: 5465
Status: resolved
Priority: 0/
Queue: Inline

People
Owner: Nobody in particular
Requestors: qef [...] laxan.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Fails to detect C functions taking (void)
Hi, I'm using Inline 0.44 on Debian. The stuff which parses the function headers for C seems not to recognise functions whose argument list is (void), which explicitly declares them as taking no arguments. For example, the following works fine: SV * qefft2_library_new () { ... } But this doesn't work (the function isn't detected, so can't be called from Perl): SV * qefft2_library_new (void) { ... }
From: ingy [...] ttul.org
Date: Thu, 26 Feb 2004 15:04:46 -0800
To: Guest via RT <bug-Inline [...] rt.cpan.org>
CC: "AdminCc of cpan Ticket #5465": ;
Subject: Re: [cpan #5465] Fails to detect C functions taking (void)
RT-Send-Cc:
On 26/02/04 17:51 -0500, Guest via RT wrote: Show quoted text
> > This message about Inline was sent to you by guest <> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=5465 > > > Hi, > > I'm using Inline 0.44 on Debian. > > The stuff which parses the function headers for C seems not to recognise functions whose argument list is (void), which explicitly declares them as taking no arguments.
That is true. Inline only parses type/name pairs. The special void case may be allowed in a future release. Show quoted text
> > For example, the following works fine: > > SV * > qefft2_library_new () > { > ... > } > > But this doesn't work (the function isn't detected, so can't be called from Perl): > > SV * > qefft2_library_new (void) > { > ... > }
RT-Send-CC: sisyphus [...] cpan.org
On Thu Feb 26 18:04:18 2004, ingy@ttul.org wrote: Show quoted text
> > The stuff which parses the function headers for C seems not to
> recognise functions whose argument list is (void), which explicitly > declares them as taking no arguments. > > That is true. Inline only parses type/name pairs. The special void > case > may be allowed in a future release. >
This could possibly be addressed by the insertion of just one line into C.pm's sub get_parser. That sub currently (as of Inline-0.45) reads: sub get_parser { my $o = shift; require Inline::C::ParseRecDescent; Inline::C::ParseRecDescent::get_parser($o); } I think the 'void' argument type is catered for if we change that to: sub get_parser { my $o = shift; $o->{ILSM}{code} =~ s/\((\s+)*void(\s+)*\)/\(\)/g; require Inline::C::ParseRecDescent; Inline::C::ParseRecDescent::get_parser($o); } But, apart from the fact that doesn't work with the ParseRegExp.pm parser, I'm a little concerned about its potential to introduce other breakages. For example, a cast to void would probably break. (But do we ever cast to void in C ?) Anyway ... for mine, it's a lot easier (and safer) to leave things as they are. Cheers, Rob
Show quoted text
> > That is true. Inline only parses type/name pairs. The special void > > case > > may be allowed in a future release.
As of 0.50_01 this special case is permitted, but only if using the ParseRegExp parser. Patches that will also allow this to work with the Parse::RecDescent parser are welcome. (I think this would entail patching Parse::RecDescent itself.) Cheers, Rob
RT-Send-CC: sisyphus [...] cpan.org, ingy [...] ttul.org
I have updated C/t/14void_arg.t to use Test::More: https://github.com/mohawk2/inline-pm/commit/7403d3f187e40bc8c52374c3f41f4c360772444d And then made it also use ParseRecDescent https://github.com/mohawk2/inline-pm/commit/1592b55ec49071f5d341e864504fb3bf8658ab6e It passes, so looks like this bug is now no longer applicable.
On Sun Jun 22 22:40:39 2014, ETJ wrote: Show quoted text
> It passes, so looks like this bug is now no longer applicable.
Just for the record, the bug still stands for the ParseRecRescent parser - it was just that the particular script being run did not detect the bug. Cheers, Rob
Closing as is fixed in PRE, and tested for.