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
# 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);