From 2a13a7f09fdf273a913b649b2e47962be0fc8138 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 30 Apr 2006 23:11:59 +0000 Subject: r15367: Fix unused function warnings in generated EJS code. (This used to be commit 946a80298ad58e7b8ba9608a840154ee4a790da7) --- source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm | 56 +++++++++++++++---------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'source4/pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm index e1a8feb1cd..218b882323 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm @@ -422,15 +422,13 @@ sub EjsPullFunction($) # on the non-array elements foreach my $e (@{$d->{ELEMENTS}}) { next unless (grep(/in/, @{$e->{DIRECTION}})); - next if (has_property($e, "length_is") || - has_property($e, "size_is")); + next if (has_property($e, "length_is") || has_property($e, "size_is")); EjsPullElementTop($e, $env); } foreach my $e (@{$d->{ELEMENTS}}) { next unless (grep(/in/, @{$e->{DIRECTION}})); - next unless (has_property($e, "length_is") || - has_property($e, "size_is")); + next unless (has_property($e, "length_is") || has_property($e, "size_is")); EjsPullElementTop($e, $env); } @@ -760,7 +758,7 @@ sub EjsInterface($$) foreach my $d (@{$interface->{FUNCTIONS}}) { next if not defined($d->{OPNUM}); - next if Parse::Pidl::Util::has_property($d, "noejs"); + next if has_property($d, "noejs"); EjsPullFunction($d); EjsPushFunction($d); @@ -846,14 +844,17 @@ sub Parse($$) sub NeededFunction($$) { my ($fn,$needed) = @_; + $needed->{"pull_$fn->{NAME}"} = 1; $needed->{"push_$fn->{NAME}"} = 1; - foreach my $e (@{$fn->{ELEMENTS}}) { - if (grep (/in/, @{$e->{DIRECTION}})) { - $needed->{"pull_$e->{TYPE}"} = 1; + + foreach (@{$fn->{ELEMENTS}}) { + next if (has_property($_, "subcontext")); #FIXME: Support subcontexts + if (grep(/in/, @{$_->{DIRECTION}})) { + $needed->{"pull_$_->{TYPE}"} = 1; } - if (grep (/out/, @{$e->{DIRECTION}})) { - $needed->{"push_$e->{TYPE}"} = 1; + if (grep(/out/, @{$_->{DIRECTION}})) { + $needed->{"push_$_->{TYPE}"} = 1; } } } @@ -861,20 +862,22 @@ sub NeededFunction($$) sub NeededTypedef($$) { my ($t,$needed) = @_; - if (Parse::Pidl::Util::has_property($t, "public")) { - $needed->{"pull_$t->{NAME}"} = not Parse::Pidl::Util::has_property($t, "noejs"); - $needed->{"push_$t->{NAME}"} = not Parse::Pidl::Util::has_property($t, "noejs"); - } - if ($t->{DATA}->{TYPE} ne "STRUCT" && - $t->{DATA}->{TYPE} ne "UNION") { - return; + + if (has_property($t, "public")) { + $needed->{"pull_$t->{NAME}"} = not has_property($t, "noejs"); + $needed->{"push_$t->{NAME}"} = not has_property($t, "noejs"); } - for my $e (@{$t->{DATA}->{ELEMENTS}}) { - if ($needed->{"pull_$t->{NAME}"}) { - $needed->{"pull_$e->{TYPE}"} = 1; + + return if (($t->{DATA}->{TYPE} ne "STRUCT") and + ($t->{DATA}->{TYPE} ne "UNION")); + + foreach (@{$t->{DATA}->{ELEMENTS}}) { + next if (has_property($_, "subcontext")); #FIXME: Support subcontexts + unless (defined($needed->{"pull_$_->{TYPE}"})) { + $needed->{"pull_$_->{TYPE}"} = $needed->{"pull_$t->{NAME}"}; } - if ($needed->{"push_$t->{NAME}"}) { - $needed->{"push_$e->{TYPE}"} = 1; + unless (defined($needed->{"push_$_->{TYPE}"})) { + $needed->{"push_$_->{TYPE}"} = $needed->{"push_$t->{NAME}"}; } } } @@ -884,12 +887,9 @@ sub NeededTypedef($$) sub NeededInterface($$) { my ($interface,$needed) = @_; - foreach my $d (@{$interface->{FUNCTIONS}}) { - NeededFunction($d, $needed); - } - foreach my $d (reverse @{$interface->{TYPES}}) { - NeededTypedef($d, $needed); - } + + NeededFunction($_, $needed) foreach (@{$interface->{FUNCTIONS}}); + NeededTypedef($_, $needed) foreach (reverse @{$interface->{TYPES}}); } 1; -- cgit