From: Ian Jackson Date: Wed, 25 Sep 2019 14:14:21 +0000 (+0200) Subject: tools/ocaml: abi check: Cope with consecutive relevant enums X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8d8db5a4ad267bca663bc1e41dccb53e072d73d2;p=people%2Fiwj%2Fxen.git tools/ocaml: abi check: Cope with consecutive relevant enums If the end of one enum is the `type' line for the next enum, we would not notice it. Fix this by reordering the code, and getting rid of the else: now if the "we are within an enum" branch decides that it's the end of the enum, it unsets $ei and we then immediately process the line as a "not within an enum" line - ie as the start of the next one. Reported-by: Paul Durrant Signed-off-by: Ian Jackson Signed-off-by: Paul Durrant Acked-by: Christian Lindig --- diff --git a/tools/ocaml/libs/xc/abi-check b/tools/ocaml/libs/xc/abi-check index d532f37271..3cbdec582f 100755 --- a/tools/ocaml/libs/xc/abi-check +++ b/tools/ocaml/libs/xc/abi-check @@ -70,14 +70,7 @@ my $cval; $ei = undef; my $bitnum = 0; while () { - if (!$ei) { - if (m{^type \s+ (\w+) \s* \= \s* $}x && $enums{$1}) { - print "// found ocaml type $1 at $o:$.\n" or die $!; - $ei = $enums{$1}; - $cval = ''; - $bitnum = 0; - } - } else { + if ($ei) { if (m{^\s+ \| \s* $ei->{OPrefix} (\w+) \s*$}x) { $cval = $1; if ($ei->{Mangle} eq 'lc') { @@ -104,6 +97,14 @@ while () { die "$_ ?"; } } + if (!$ei) { + if (m{^type \s+ (\w+) \s* \= \s* $}x && $enums{$1}) { + print "// found ocaml type $1 at $o:$.\n" or die $!; + $ei = $enums{$1}; + $cval = ''; + $bitnum = 0; + } + } } foreach $ei (values %enums) {