die if multiple macros in regexp.h attempt to use the same flag bit.
authorNicholas Clark <nick@ccl4.org>
Sat, 29 Dec 2007 13:29:37 +0000 (13:29 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 29 Dec 2007 13:29:37 +0000 (13:29 +0000)
p4raw-id: //depot/perl@32762

regcomp.pl

index 17472cc..defbb5f 100644 (file)
@@ -197,11 +197,17 @@ EOP
 
 open my $fh,"<","regexp.h" or die "Can't read regexp.h: $!";
 my %rxfv;
-my $val;
+my $val = 0;
+my %reverse;
 while (<$fh>) {
     if (/#define\s+(RXf_\w+)\s+(0x[A-F\d]+)/i) {
-        $rxfv{$1}= eval $2;
-        $val|=$rxfv{$1};
+       my $newval = eval $2;
+       if($val & $newval) {
+           die sprintf "Both $1 and $reverse{$newval} use %08X", $newval;
+       }
+        $val|=$newval;
+        $rxfv{$1}= $newval;
+       $reverse{$newval} = $1;
     }
 }    
 my %vrxf=reverse %rxfv;