diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-09-09 16:23:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:38:01 -0500 |
commit | 6635e7b2ad97d482f74d696cfb1b277d62d949c1 (patch) | |
tree | 6ea3b7eeb0d6fe5665226f6e7831b2853a11405f /source4/pidl | |
parent | 13f7e6a0c6d3cc4c0cff59827f49a245712d99b9 (diff) | |
download | samba-6635e7b2ad97d482f74d696cfb1b277d62d949c1.tar.gz samba-6635e7b2ad97d482f74d696cfb1b277d62d949c1.tar.bz2 samba-6635e7b2ad97d482f74d696cfb1b277d62d949c1.zip |
r10116: Print out a couple more warnings.
(This used to be commit 0628dfa5c3c74614a86b4f61b8d1555ef41c41bb)
Diffstat (limited to 'source4/pidl')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm | 7 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm | 54 |
2 files changed, 57 insertions, 4 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm b/source4/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm index 9e6147b166..47107b5969 100644 --- a/source4/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm +++ b/source4/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm @@ -57,7 +57,12 @@ sub handle_hf_rename($$$$) return; } - $data->{hf_renames}->{$old} = $new; + $data->{hf_renames}->{$old} = { + OLDNAME => $old, + NEWNAME => $new, + POS => $pos, + USED => 0 + }; } sub handle_param_value($$$$) diff --git a/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm b/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm index 119dc46707..de936eb97d 100644 --- a/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm +++ b/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm @@ -18,6 +18,9 @@ use Parse::Pidl::Ethereal::Conformance qw(ReadConformance); my %types; my @ett; +my %hf_used = (); +my %dissector_used = (); + my $conformance = undef; my %ptrtype_mappings = ( @@ -196,6 +199,8 @@ sub Bitmap($$$) my ($en,$ev) = ($1,$2); my $hf_bitname = "hf_$ifname\_$name\_$en"; my $filtername = "$ifname\.$name\.$en"; + + $hf_used{$hf_bitname} = 1; register_hf_field($hf_bitname, field2name($en), $filtername, "FT_BOOLEAN", $e->{ALIGN} * 8, "TFS(&$name\_$en\_tfs)", $ev, ""); @@ -321,6 +326,7 @@ sub Element($$$) my $call_code = "offset = $dissectorname(tvb, offset, pinfo, tree, drep);"; my $hf = register_hf_field("hf_$ifname\_$pn\_$e->{NAME}", field2name($e->{NAME}), "$ifname.$pn.$e->{NAME}", type2ft($e->{TYPE}), "BASE_HEX", "NULL", 0, ""); + $hf_used{$hf} = 1; my $eltname = StripPrefixes($pn) . ".$e->{NAME}"; if (defined($conformance->{noemit}->{$eltname})) { @@ -378,9 +384,14 @@ sub Function($$$) if (not defined($fn->{RETURN_TYPE})) { } elsif ($fn->{RETURN_TYPE} eq "NTSTATUS") { pidl_code "offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, hf\_$ifname\_status, NULL);"; + $hf_used{"hf\_$ifname\_status"} = 1; } elsif ($fn->{RETURN_TYPE} eq "WERROR") { pidl_code "offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf\_$ifname\_werror, NULL);"; + $hf_used{"hf\_$ifname\_werror"} = 1; + } else { + print "$fn->{FILE}:$fn->{LINE}: error: return type `$fn->{RETURN_TYPE}' not yet supported\n"; } + pidl_code "return offset;"; deindent; @@ -587,6 +598,8 @@ sub RegisterInterfaceHandoff($) pidl_code "\t$x->{NAME}_dissectors, hf_$x->{NAME}_opnum);"; deindent; pidl_code "}"; + + $hf_used{"hf_$x->{NAME}_opnum"} = 1; } } @@ -611,8 +624,6 @@ sub ProcessInterface($) pidl_def "static gint proto_dcerpc_$x->{NAME} = -1;"; register_ett("ett_dcerpc_$x->{NAME}"); register_hf_field("hf_$x->{NAME}_opnum", "Operation", "$x->{NAME}.opnum", "FT_UINT16", "BASE_DEC", "NULL", 0, ""); - register_hf_field("hf_$x->{NAME}_status", "Status", "$x->{NAME}.status", "FT_UINT32", "BASE_HEX", "VALS(NT_errors)", 0, ""); - register_hf_field("hf_$x->{NAME}_werror", "Windows Error", "$x->{NAME}.werror", "FT_UINT32", "BASE_HEX", "NULL", 0, ""); if (defined($x->{UUID})) { my $if_uuid = $x->{UUID}; @@ -643,6 +654,15 @@ sub ProcessInterface($) pidl_code "\n".DumpFunctionTable($x); + # Only register these two return types if they were actually used + if (defined($hf_used{"hf_$x->{NAME}_status"})) { + register_hf_field("hf_$x->{NAME}_status", "Status", "$x->{NAME}.status", "FT_UINT32", "BASE_HEX", "VALS(NT_errors)", 0, ""); + } + + if (defined($hf_used{"hf_$x->{NAME}_werror"})) { + register_hf_field("hf_$x->{NAME}_werror", "Windows Error", "$x->{NAME}.werror", "FT_UINT32", "BASE_HEX", "NULL", 0, ""); + } + RegisterInterface($x); RegisterInterfaceHandoff($x); @@ -770,6 +790,8 @@ sub Parse($$$$) my $header = "/* autogenerated by pidl */\n\n"; $header.=$res{hdr}; + + CheckUsed($conformance); return ($parser,$header); } @@ -813,7 +835,10 @@ sub register_hf_field($$$$$$$$) { my ($index,$name,$filter_name,$ft_type,$base_type,$valsstring,$mask,$blurb) = @_; - return $conformance->{hf_renames}->{$index} if defined ($conformance->{hf_renames}->{$index}); + if (defined ($conformance->{hf_renames}->{$index})) { + $conformance->{hf_renames}->{$index}->{USED} = 1; + return $conformance->{hf_renames}->{$index}->{NEWNAME}; + } $conformance->{header_fields}->{$index} = { INDEX => $index, @@ -885,4 +910,27 @@ sub DumpFunctionTable($) return "$res};\n"; } +sub CheckUsed($) +{ + my $conformance = shift; + foreach (values %{$conformance->{header_fields}}) { + if (not defined($hf_used{$_->{INDEX}})) { + print "$_->{POS}: warning: hf field `$_->{INDEX}' not used\n"; + } + } + + foreach (values %{$conformance->{hf_renames}}) { + if (not $_->{USED}) { + print "$_->{POS}: warning: hf field `$_->{OLDNAME}' not used\n"; + } + } + + #FIXME: PARAM_VALUE's + #FIXME: TYPE + #FIXME: FIELDDESCRIPTION + #FIXME: Import +} + + + 1; |