Skip to contentSkip to conversation

tools/ocaml: abi check: Cope with consecutive relevant enums

PATCH In review Paul Durrant 2 participants 3 messages Sep 18, 2019 – Sep 23, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v13 3/4 tools/ocaml: abi check: Cope with consecutive relevant enums

From: Ian Jackson <[email protected]>

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.

v13:
- New in this version

---
 tools/ocaml/libs/xc/abi-check | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
tools/ocaml/libs/xc/abi-check +9 -8
index d532f37271..3cbdec582f 100755
@@ -70,14 +70,7 @@ my $cval;
 $ei = undef;
 my $bitnum = 0;
 while (<OCAML_FILE>) {
-    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 (<OCAML_FILE>) {
             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) {
Signature · 7 lines
2.20.1.2.gb21ebb671


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

Ping? I think this is the only remaining patch in this series that still needs an ack.

Paul

Quoted 66 lines

-----Original Message-----
From: Paul Durrant <[email protected]>
Sent: 18 September 2019 11:47
To: [email protected]
Cc: Ian Jackson <[email protected]>; Paul Durrant <[email protected]>; Christian Lindig <[email protected]>; David Scott <[email protected]>
Subject: [PATCH REPOST v13 3/4] tools/ocaml: abi check: Cope with consecutive relevant enums

From: Ian Jackson <[email protected]>

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.

v13:
- New in this version

---
 tools/ocaml/libs/xc/abi-check | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
tools/ocaml/libs/xc/abi-check +9 -9
index d532f37271..3cbdec582f 100755
@@ -70,14 +70,7 @@ my $cval;
 $ei = undef;
 my $bitnum = 0;
 while (<OCAML_FILE>) {
-    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 (<OCAML_FILE>) {
             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) {
--
Quoted 1 line

2.20.1.2.gb21ebb671

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel