summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm10
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm3
-rwxr-xr-xsource4/pidl/tests/parse_idl.pl13
3 files changed, 19 insertions, 7 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index fa0c97961c..24270340b9 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -11,7 +11,7 @@ use Exporter;
@EXPORT_OK = qw(check_null_pointer fn_declare TypeFunctionName);
use strict;
-use Parse::Pidl::Typelist;
+use Parse::Pidl::Typelist qw(typeHasBody);
use Parse::Pidl::CUtil qw(get_pointer_to get_value_of);
use Parse::Pidl::Util qw(has_property ParseExpr);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel);
@@ -274,6 +274,7 @@ sub EjsUnionPull($$$)
sub EjsEnumConstant($$)
{
my ($self, $d) = @_;
+ return unless (defined($d->{ELEMENTS}));
my $v = 0;
foreach my $e (@{$d->{ELEMENTS}}) {
my $el = $e;
@@ -572,6 +573,7 @@ sub EjsEnumPush($$$)
sub EjsBitmapPush($$$)
{
my ($self, $d, $varname) = @_;
+ return unless (defined($d->{ELEMENTS}));
my $type_fn = $d->{BASE_TYPE};
# put the bitmap elements in the constants array
foreach my $e (@{$d->{ELEMENTS}}) {
@@ -710,6 +712,7 @@ sub EjsInterface($$$)
$self->pidl_hdr("\n");
foreach my $d (@{$interface->{TYPES}}) {
+ next unless (typeHasBody($d));
($needed->{TypeFunctionName("ejs_push", $d)}) && $self->EjsTypePushFunction($d, $d->{NAME});
($needed->{TypeFunctionName("ejs_pull", $d)}) && $self->EjsTypePullFunction($d, $d->{NAME});
}
@@ -823,8 +826,9 @@ sub NeededType($$$)
NeededType($t->{DATA}, $needed, $req) if ($t->{TYPE} eq "TYPEDEF");
- return if (($t->{TYPE} ne "STRUCT") and
- ($t->{TYPE} ne "UNION"));
+ return unless (($t->{TYPE} eq "STRUCT") or ($t->{TYPE} eq "UNION"));
+
+ return unless(typeHasBody($t));
foreach (@{$t->{ELEMENTS}}) {
next if (has_property($_, "subcontext")); #FIXME: Support subcontexts
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index cfd16c7b40..451e899ffb 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -2543,7 +2543,8 @@ sub ParseInterface($$$)
# Typedefs
foreach my $d (@{$interface->{TYPES}}) {
- next unless typeHasBody($d);
+ next unless(typeHasBody($d));
+
($needed->{TypeFunctionName("ndr_push", $d)}) && $self->ParseTypePushFunction($d, "r");
($needed->{TypeFunctionName("ndr_pull", $d)}) && $self->ParseTypePullFunction($d, "r");
($needed->{TypeFunctionName("ndr_print", $d)}) && $self->ParseTypePrintFunction($d, "r");
diff --git a/source4/pidl/tests/parse_idl.pl b/source4/pidl/tests/parse_idl.pl
index d14c374740..93f772ef41 100755
--- a/source4/pidl/tests/parse_idl.pl
+++ b/source4/pidl/tests/parse_idl.pl
@@ -4,7 +4,7 @@
# Published under the GNU General Public License
use strict;
-use Test::More tests => 65 * 2 + 5;
+use Test::More tests => 65 * 2 + 6;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util qw(test_errors);
@@ -143,6 +143,13 @@ $x = Parse::Pidl::IDL::parse_string("interface foo { typedef struct {} y; }", "<
is_deeply($x,
[ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
- { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => {
- TYPE => 'STRUCT', ELEMENTS => [] } } ],
+ { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'STRUCT', ELEMENTS => [] } } ],
+ 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
+
+# A typedef of a bitmap with no body
+$x = Parse::Pidl::IDL::parse_string("interface foo { typedef bitmap x y; }", "<foo>");
+
+is_deeply($x,
+ [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
+ { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'BITMAP', NAME => 'x' } } ],
'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);