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

[perl #34497] hp2h unable to parse macros which have variable initialization

From:
James E Keenan via RT
Date:
December 28, 2011 16:16
Subject:
[perl #34497] hp2h unable to parse macros which have variable initialization
Message ID:
rt-3.6.HEAD-14510-1325117756-220.34497-15-0@perl.org
On Sat Mar 19 09:59:21 2005, at@altlinux.ru wrote:
> This is a bug report for perl from at@solemn.turbinal.org,
> generated with the help of perlbug 1.35 running under perl v5.8.6.
> 

> I know that h2ph hardly ever will become perfect, but I am to report
>    that
> h2ph cannot produce acceptable output for the following construct
>    (found
> in Linux kernel headers):
> 
> $ cat scx200_gpio.h
> #define __SCx200_GPIO_BANK unsigned bank = index>>5
> $ h2ph -d . scx200_gpio.h
> scx200_gpio.h -> scx200_gpio.ph
> $ perl -c scx200_gpio.ph
> Can't modify constant item in scalar assignment at scx200_gpio.ph line
>    6, near "5;"
> scx200_gpio.ph had compilation errors.
> $ cat scx200_gpio.ph
> require '_h2ph_pre.ph';
> 
> no warnings 'redefine';
> 
> unless(defined(&__SCx200_GPIO_BANK)) {
>     sub __SCx200_GPIO_BANK () { 'unsigned bank' =  &index>>5;}
> }
> 1;
> $
> 

Examining this tonight using Perl 5.14.2 on Darwin/PPC, I got slightly
different output from the original poster, but still got a Perl file
that will not compile:

#####
$ h2ph -d . scx200_gpio.h 
scx200_gpio.h -> scx200_gpio.ph

$ perl -c scx200_gpio.ph 
Can't modify constant item in scalar assignment at scx200_gpio.ph line
6, near "5;"
scx200_gpio.ph had compilation errors.

$ cat scx200_gpio.ph
require '_h2ph_pre.ph';
#####

Any ideas?

Thank you very much.
Jim Keenan
no warnings qw(redefine misc);

unless(defined(&__SCx200_GPIO_BANK)) {
    sub __SCx200_GPIO_BANK () { 'unsigned bank' =  &index>>5;}
}
1;


---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=34497



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