develooper Front page | perl.perl5.porters | Postings from July 2001

[ID 20010710.004] h2ph and unions

From:
Michael Shalayeff
Date:
July 10, 2001 11:15
Subject:
[ID 20010710.004] h2ph and unions
Message ID:
200107101815.f6AIFRW11952@mail.lucifier.net

This is a bug report for perl from mickey@lucifier.net,
generated with the help of perlbug 1.33 running under perl v5.6.1.


-----------------------------------------------------------------
[Please enter your report here]

h2ph.PL mishandles the unions and causes wrong output produced
for contructs like:
#define DVD_READ_STRUCT         _IOWR('d', 0, union dvd_struct)

this was originally reported in openbsd pr/1918
(see http://cvs.openbsd.org/cgi-bin/wwwgnats.pl)

this diff seems to fix it:

Index: utils/h2ph.PL
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/utils/h2ph.PL,v
retrieving revision 1.9
diff -u -r1.9 h2ph.PL
--- utils/h2ph.PL	2001/05/24 18:36:26	1.9
+++ utils/h2ph.PL	2001/07/10 17:57:14
@@ -351,7 +351,7 @@
 	# Eliminate typedefs
 	/\(([\w\s]+)[\*\s]*\)\s*[\w\(]/ && do {
 	    foreach (split /\s+/, $1) {  # Make sure all the words are types,
-		last unless ($isatype{$_} or $_ eq 'struct');
+		last unless ($isatype{$_} or $_ eq 'struct' or $_ eq 'union');
 	    }
 	    s/\([\w\s]+[\*\s]*\)// && next;      # then eliminate them.
 	};
@@ -374,7 +374,7 @@
 	};
 	s/^([_a-zA-Z]\w*)//	&& do {
 	    my $id = $1;
-	    if ($id eq 'struct') {
+	    if ($id eq 'struct' || $id eq 'union') {
 		s/^\s+(\w+)//;
 		$id .= ' ' . $1;
 		$isatype{$id} = 1;



[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=utilities
    severity=critical
---
Site configuration information for perl v5.6.1:

Configured by root at Tue Jul 10 13:58:29 EDT 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=openbsd, osvers=2.9, archname=i386-openbsd
    uname='openbsd'
    config_args='-Dopenbsd_distribution=defined -dsE'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='2.95.3 20010125 (prerelease)', gccosandvers='openbsd2.9'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =''
    libpth=/usr/lib
    libs=-lm -lc -lutil
    perllibs=-lm -lc -lutil
    libc=/usr/lib/libc.so.27.0, so=so, useshrplib=true, libperl=libperl.so.6.1
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=define, ccdlflags=' '
    cccdlflags='-DPIC -fPIC ', lddlflags='-shared -fPIC '

Locally applied patches:
    

---
@INC for perl v5.6.1:
    /usr/libdata/perl5/i386-openbsd/5.6.1
    /usr/local/libdata/perl5/i386-openbsd/5.6.1
    /usr/libdata/perl5
    /usr/local/libdata/perl5
    /usr/local/libdata/perl5/site_perl/i386-openbsd
    /usr/libdata/perl5/site_perl/i386-openbsd
    /usr/local/libdata/perl5/site_perl
    /usr/libdata/perl5/site_perl
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl v5.6.1:
    HOME=/home/mickey
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/usr/X11R6/lib:/usr/X11R6/xview/lib
    LOGDIR (unset)
    PATH=/home/mickey/bin/i386:/home/mickey/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/usr/X11/xview/bin:/usr/bin/X11:/usr/games:/usr/hosts:/usr/cross/hppa/usr/bin:/usr/cross/tahoe/usr/bin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/tcsh




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