use strict;
use warnings;
use Parse::Pidl qw(fatal);
-use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
+use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference scalarTypeUsed);
use Parse::Pidl::Util qw(has_property is_constant unmake_str ParseExpr);
use Parse::Pidl::Samba4 qw(is_intree ElementStars ArrayBrackets choose_header);
$res = "";
%headerstructs = ();
- pidl "/* header auto-generated by pidl */\n\n";
my $ifacename = "";
}
}
+ foreach (@{$ndr}) {
+ ($_->{TYPE} eq "CPP_QUOTE") && HeaderQuote($_);
+ ($_->{TYPE} eq "INTERFACE") && HeaderInterface($_);
+ ($_->{TYPE} eq "IMPORT") && HeaderImport(@{$_->{PATHS}});
+ ($_->{TYPE} eq "INCLUDE") && HeaderInclude(@{$_->{PATHS}});
+ }
+
+ my $res2 = $res;
+ $res = "";
+ pidl "/* header auto-generated by pidl */\n\n";
+
pidl "#ifndef _PIDL_HEADER_$ifacename\n";
pidl "#define _PIDL_HEADER_$ifacename\n\n";
}
pidl "#include <stdint.h>\n";
pidl "\n";
- # FIXME: Include this only if NTSTATUS was actually used
- pidl choose_header("libcli/util/ntstatus.h", "core/ntstatus.h") . "\n";
+ if (scalarTypeUsed("NTSTATUS")) {
+ pidl choose_header("libcli/util/ntstatus.h", "core/ntstatus.h") . "\n";
+ }
pidl "\n";
- foreach (@{$ndr}) {
- ($_->{TYPE} eq "CPP_QUOTE") && HeaderQuote($_);
- ($_->{TYPE} eq "INTERFACE") && HeaderInterface($_);
- ($_->{TYPE} eq "IMPORT") && HeaderImport(@{$_->{PATHS}});
- ($_->{TYPE} eq "INCLUDE") && HeaderInclude(@{$_->{PATHS}});
- }
+ $res .= $res2;
pidl "#endif /* _PIDL_HEADER_$ifacename */\n";