develooper Front page | perl.perl5.porters | Postings from February 2003

Re: [perl #20636] ExtUtils:: Constant trying to make empty #defines accessible

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
February 1, 2003 03:30
Subject:
Re: [perl #20636] ExtUtils:: Constant trying to make empty #defines accessible
Message ID:
20030201113021.1872.10@bactrian.ni-s.u-net.com
Tassilo.Parseval@Post.Rwth-Aachen.De <perl5-porters@perl.org> writes:
># New Ticket Created by  tassilo.parseval@post.rwth-aachen.de 
># Please include the string:  [perl #20636]
># in the subject line of all future correspondence about this issue. 
># <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=20636 >
>
>
>
>This is a bug report for perl from tassilo.parseval@post.rwth-aachen.de,
>generated with the help of perlbug 1.34 running under perl v5.8.0.
>
>
>-----------------------------------------------------------------
>[Please enter your report here]
>
>When creating an extension skeleton using
>
>    h2xs -O -b <version> -n Module::Name header.h
>
>it appears as though ExtUtils::Constant tries to make symbols exportable
>that are merely #defined but have no value.
>
>An excerpt from the header I've been using:
>
>    #ifndef __MPLIB_H
>    #define __MPLIB_H
>    #undef __BEGIN_DECLS
>    #undef __END_DECLS
>    #ifdef __cplusplus
>    # define __BEGIN_DECLS extern "C" {
>    # define __END_DECLS }
>    #else
>    # define __BEGIN_DECLS /* empty */
>    # define __END_DECLS /* empty */
>    #endif
>
>and from the resulting constant-c.inc:
>
>        case 'L':
>          if (memEQ(name, "__END_DECLS", 11)) {
>          /*                        ^        */
>    #ifdef __END_DECLS
>            *iv_return = __END_DECLS;
>            return PERL_constant_ISIV;
>    #else
>            return PERL_constant_NOTDEF;
>    #endif
>          }
>          break;
>
>Running this with 'gcc -E' this is preprocessed into:
>
>        case 'L':
>          if (memEQ(name, "__END_DECLS", 11)) {
>           
>
>            *iv_return =  ;
>            return 3 ;
>
>
>
>          }
>          break;
>
>and will render the whole project uncompilable:
>
>    In file included from Mplib.xs:9:
>    const-c.inc: In function `constant':
>    const-c.inc:284: parse error before `;'
>    ...
>
>The above problem remains when removing the two offending symbols
>(__BEGIN_DECLS and __END_DECLS) from the NAMES-list in
>ExtUtils::Constant::WriteConstants() in Makefile.PL.

Hmm - this smells like a GCC/cpp bug to me I thought that 

#define FOO

Was supposed to set FOO to 1 
the fact you have trailing /* empty */ there should not make any difference
as comments are equivalent to whitespace.

However I agree h2xs is very naive ...

-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/


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