[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] tools/ocaml: abi-check: Improve output and error messages
commit e6816b4363ffa997f28ceef658d70a36ac2b4356 Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> AuthorDate: Tue Sep 10 12:34:38 2019 +0100 Commit: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> CommitDate: Tue Sep 10 14:44:33 2019 +0100 tools/ocaml: abi-check: Improve output and error messages In the generated C, add some comments saying where we found the ocaml type. This helps with debugging. (I considered emitting #line directives but decided this would be more confusing than helpful.) Improve two dies. Use better-named filehandles (perl prints thier names when it dies). 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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/ocaml/libs/xc/abi-check b/tools/ocaml/libs/xc/abi-check index a470c05e0b..9450676429 100755 --- a/tools/ocaml/libs/xc/abi-check +++ b/tools/ocaml/libs/xc/abi-check @@ -15,7 +15,7 @@ our %enums; @ARGV == 2 or die; our ($c, $o) = @ARGV; -open STDIN, "<", $c or die $!; +open C_FILE, "<", $c or die $!; our $cline = -1; our $ei; @@ -29,7 +29,7 @@ our $ei; # /* ! CPrefix CFinal CFinalHow */ # # The function definitions use /* ! */ which simply skips that instance. -while (<>) { +while (<C_FILE>) { if ($cline == -1) { if (m/c_bitmap_to_ocaml_list|ocaml_list_to_c_bitmap/) { $cline = 0; @@ -37,7 +37,8 @@ while (<>) { } } else { $cline++; - m{^\s+/\* \s+ ! \s+ (.*?) \s* \*/\s*$}x or die "$cline $_ ?"; + m{^\s+/\* \s+ ! \s+ (.*?) \s* \*/\s*$}x or + die "at line $cline of annotation, did not expect $_ ?"; my @vals = split /\s+/, $1; if ($cline == 1 && !@vals) { $cline = -1; @@ -45,7 +46,7 @@ while (<>) { $ei->{$_} = shift @vals foreach qw(OType OPrefix Mangle); } elsif ($cline == 2 && @vals == 3) { $ei->{$_} = shift @vals foreach qw(CPrefix CFinal CFinalHow); - die if $enums{ $ei->{OType} }; + die "redefining OType $ei->{OType}" if $enums{ $ei->{OType} }; $enums{ $ei->{OType} } = $ei; $cline = -1; } else { @@ -58,13 +59,14 @@ sub expect ($$) { printf "BUILD_BUG_ON( %-30s != %-10s );\n", @_ or die $!; } -open STDIN, "<", $o or die $!; +open OCAML_FILE, "<", $o or die $!; my $cval; $ei = undef; my $bitnum = 0; -while (<>) { +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; -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |