Bug#320286: [PATCH] h2xs incorrectly treats enum values like macros

Rafael Garcia-Suarez rgarciasuarez at gmail.com
Wed Apr 8 07:37:35 UTC 2009


2008/10/19 Niko Tyni <ntyni at debian.org>:
> Patch and description by Rainer Weikusat, forwarded from
> http://bugs.debian.org/502297 :
>
>  The h2xs program scans C headers for 'constants' either defined
>  as preprocessor macros or via enum and builds a sorted list of names
>  containing the macros and enum values found in this way. This list
>  is then passed to ExtUtils::Constant::WriteConstants, which generates
>  the corresponding const-c.inc and const-xs.inc files when perl Makefile.PL
>  is executed. By default, ie when just processing a constant name, this
>  function assumes that the name refers to a preprocessor macro and
>  the generated C-code in const-c.inc contains conditional compilation
>  directives to either return the macro value or Perl_constant_NOTDEF,
>  depending on the defined'ness of the macro. This causes constants
>  defined as enumeration values to never be available to module users,
>  because they are not visible to the preprocessor.
>
>  Instead of passing just a name to the WriteConstants-routine, a
>  hashref (members documented in ExtUtils::Constant::Base(3perl))
>  can be used to specify more details regarding what code
>  should be generated for a particular constant. For an enumeration
>  value, a hashref constructed as
>
>     { name => <name of the constant>, macro => 1 }
>
>  could be used to get rid of the inappropriate preprocessor
>  directives.
>
> ( Another version of the same fix was also submitted by Daniel Burr in
>  http://bugs.debian.org/320286 )

Thanks, applied as 36d7a91d2021ad52ce172e2c75a7bc5fa07e6354 to bleadperl.






More information about the Perl-maintainers mailing list