diff options
author | Niko Tyni <ntyni@debian.org> | 2008-10-19 23:21:30 +0300 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-01-19 15:00:51 +0100 |
commit | c7c8b664ff1d92154d9e97e6e8ea84f7cc24991a (patch) | |
tree | 0bff334bb5780e06c468fe62b032e123bac9ca80 /utils/h2xs.PL | |
parent | ae209c08ded4e79538972a4ae3d5103a05678ba9 (diff) | |
download | perl-c7c8b664ff1d92154d9e97e6e8ea84f7cc24991a.tar.gz |
Fix h2xs enum handling with C++ comments
Contrary to the comment in the code, h2xs mishandles enums that
contain C++ style comments.
An example of a failing header:
enum {
A = -1, // negative one
// with more comments
B = -2, // negative two
C = -3 // negative two
};
which generates exported constants for 'A' and 'negative'.
The patch is slightly modified from the one by Daniel Burr in
http://bugs.debian.org/320286
Diffstat (limited to 'utils/h2xs.PL')
-rw-r--r-- | utils/h2xs.PL | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/utils/h2xs.PL b/utils/h2xs.PL index c774d62adf..4bb7897838 100644 --- a/utils/h2xs.PL +++ b/utils/h2xs.PL @@ -901,6 +901,7 @@ if( @path_h ){ # Remove C and C++ comments $src =~ s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#$2#gs; + $src =~ s#//.*$##gm; while ($src =~ /\benum\s*([\w_]*)\s*\{\s([^}]+)\}/gsc) { my ($enum_name, $enum_body) = ($1, $2); |