Your message dated Sun, 19 Oct 2008 23:25:10 +0300
with message-id <[EMAIL PROTECTED]>
has caused the   report #502297,
regarding h2xs incorrectly treats enum values like macros
to be marked as having been forwarded to the upstream software
author(s) [EMAIL PROTECTED]

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)


-- 
502297: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502297
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
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 )
---
 utils/h2xs.PL |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/utils/h2xs.PL b/utils/h2xs.PL
index 4bb7897..125dbf4 100644
--- a/utils/h2xs.PL
+++ b/utils/h2xs.PL
@@ -913,7 +913,7 @@ if( @path_h ){
                 my ($key, $declared_val) = $item =~ /(\w+)\s*(?:=\s*(.*))?/;
                 $val = defined($declared_val) && length($declared_val) ? 
$declared_val : 1 + $val;
                 $seen_define{$key} = $val;
-                $const_names{$key}++;
+                $const_names{$key} = { name => $key, macro => 1 };
             }
         } # while (...)
       } # if (!defined $opt_e or $opt_e)
@@ -1077,7 +1077,14 @@ if( ! $opt_X ){  # use XS, unless it was disabled
     }
   }
 }
-my @const_names = sort keys %const_names;
+my (@const_specs, @const_names);
+
+for (sort(keys(%const_names))) {
+    my $v = $const_names{$_};
+    
+    push(@const_specs, ref($v) ? $v : $_);
+    push(@const_names, $_);
+}
 
 -d $modpmdir || mkpath([$modpmdir], 0, 0775);
 open(PM, ">$modpmname") || die "Can't create $ext$modpname/$modpmname: $!\n";
@@ -1466,7 +1473,7 @@ if( ! $opt_c ) {
                    XS_FILE =>      $xsfallback,
                    DEFAULT_TYPE => $opt_t,
                    NAME =>         $module,
-                   NAMES =>        [EMAIL PROTECTED],
+                   NAMES =>        [EMAIL PROTECTED],
                  );
   print XS "#include \"$constscfname\"\n";
 }
@@ -1951,7 +1958,7 @@ if (!$opt_c) {
                            XS_FILE =>      $constsxsfname,
                            DEFAULT_TYPE => $opt_t,
                            NAME =>         $module,
-                           NAMES =>        [EMAIL PROTECTED],
+                           NAMES =>        [EMAIL PROTECTED],
                  );
   print PL <<"END";
 if  (eval {require ExtUtils::Constant; 1}) {
-- 
1.5.6.5



--- End Message ---

Reply via email to