[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] tools/ocaml: abi-check: Check properly.



commit 8a0aa3878da4092a9b503dfbce0de4db4f85b148
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Tue Sep 10 12:27:45 2019 +0100
Commit:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CommitDate: Tue Sep 10 14:44:33 2019 +0100

    tools/ocaml: abi-check: Check properly.
    
    Fix a broken regexp which would mention `$/' when it ought to have
    mentioned `$'.  The result would be that it would match lines like
        type some_ocaml_type = Thing | Other_Thing
    but ignore everything but the type name, giving wrong answers.
    
    Check that we check mentioned types.  Otherwise if we fail to spot
    some suitable thing in the ocaml, we would just omit checking this
    type !
    
    Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Acked-by: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
    Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
---
 tools/ocaml/libs/xc/abi-check | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/abi-check b/tools/ocaml/libs/xc/abi-check
index abcd6ce6f1..d532f37271 100755
--- a/tools/ocaml/libs/xc/abi-check
+++ b/tools/ocaml/libs/xc/abi-check
@@ -47,6 +47,7 @@ while (<C_FILE>) {
         } elsif ($cline == 1 && @vals == 1) {
             my ($otype) = @vals;
             die "reference to undefined OType $otype" unless $enums{$otype};
+            $cline = -1;
         } elsif ($cline == 1 && @vals == 3) {
             $ei->{$_} = shift @vals foreach qw(OType OPrefix Mangle);
         } elsif ($cline == 2 && @vals == 3) {
@@ -70,7 +71,7 @@ $ei = undef;
 my $bitnum = 0;
 while (<OCAML_FILE>) {
     if (!$ei) {
-        if (m{^type \s+ (\w+) \s* \= \s* $/}x && $enums{$1}) {
+        if (m{^type \s+ (\w+) \s* \= \s* $}x && $enums{$1}) {
             print "// found ocaml type $1 at $o:$.\n" or die $!;
             $ei = $enums{$1};
             $cval = '';
@@ -96,6 +97,7 @@ while (<OCAML_FILE>) {
             } else {
                 die Dumper($ei)." ?";
             }
+            $ei->{Checked} = 1;
             $ei = undef;
         } elsif (!m{\S}) {
         } else {
@@ -104,4 +106,9 @@ while (<OCAML_FILE>) {
     }
 }
 
+foreach $ei (values %enums) {
+    next if $ei->{Checked};
+    die "did not find ocaml type definition for $ei->{OType} in $o";
+}
+
 close STDOUT or die $!;
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.