summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-06-09 07:48:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:51 -0500
commit0f247a39a65cb435ccb3f44fe446026648e20780 (patch)
tree1e13951410c7b5426b05522eae229d83761cd331 /source4/build
parent0b119901d8d948e62d46f760b2dd40ba5331afc9 (diff)
downloadsamba-0f247a39a65cb435ccb3f44fe446026648e20780.tar.gz
samba-0f247a39a65cb435ccb3f44fe446026648e20780.tar.bz2
samba-0f247a39a65cb435ccb3f44fe446026648e20780.zip
r7424: add --uint-enums option to pidl to generate
defines for the enum members (this hopefully will fix the build on AIX) metze (This used to be commit 9d4d5163de8b78c5a03348a10ceedb220c92f7b2)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/ndr_header.pm39
-rwxr-xr-xsource4/build/pidl/pidl.pl23
-rw-r--r--source4/build/pidl/util.pm11
3 files changed, 59 insertions, 14 deletions
diff --git a/source4/build/pidl/ndr_header.pm b/source4/build/pidl/ndr_header.pm
index 429f603f88..e3e6022ded 100644
--- a/source4/build/pidl/ndr_header.pm
+++ b/source4/build/pidl/ndr_header.pm
@@ -120,17 +120,44 @@ sub HeaderEnum($$)
my($name) = shift;
my $first = 1;
- pidl "\nenum $name {\n";
- $tab_depth++;
- foreach my $e (@{$enum->{ELEMENTS}}) {
+ if (not util::useUintEnums()) {
+ pidl "\nenum $name {\n";
+ $tab_depth++;
+ foreach my $e (@{$enum->{ELEMENTS}}) {
unless ($first) { pidl ",\n"; }
$first = 0;
tabs();
pidl $e;
+ }
+ pidl "\n";
+ $tab_depth--;
+ pidl "}";
+ } else {
+ my $count = 0;
+ pidl "\nenum $name { __donnot_use_enum_$name=0x7FFFFFFF};\n";
+ my $with_val = 0;
+ my $without_val = 0;
+ foreach my $e (@{$enum->{ELEMENTS}}) {
+ my $t = "$e";
+ my $name;
+ my $value;
+ if ($t =~ /(.*)=(.*)/) {
+ $name = $1;
+ $value = $2;
+ $with_val = 1;
+ die ("you can't mix enum member with values and without values when using --uint-enums!")
+ unless ($without_val == 0);
+ } else {
+ $name = $t;
+ $value = $count++;
+ $without_val = 1;
+ die ("you can't mix enum member with values and without values when using --uint-enums!")
+ unless ($with_val == 0);
+ }
+ pidl "#define $name ( $value )\n";
+ }
+ pidl "\n";
}
- pidl "\n";
- $tab_depth--;
- pidl "}";
}
#####################################################################
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index fcc58de51e..169b5ea6c6 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -36,6 +36,7 @@ use pidl::esp;
my($opt_help) = 0;
my($opt_parse) = 0;
my($opt_dump) = 0;
+my($opt_uint_enums) = 0;
my($opt_diff) = 0;
my($opt_header);
my($opt_template) = 0;
@@ -70,6 +71,7 @@ Options:
--output=OUTNAME put output in OUTNAME.*
--parse parse a idl file to a .pidl file
--dump dump a pidl file back to idl
+ --uint-enums don't use C enums, instead use uint* types
--header[=OUTFILE] create a C NDR header file
--parser[=OUTFILE] create a C NDR parser
--esp[=OUTFILE] create esp wrapper file
@@ -96,22 +98,23 @@ GetOptions (
'output=s' => \$opt_output,
'parse' => \$opt_parse,
'dump' => \$opt_dump,
+ 'uint-enums' => \$opt_uint_enums,
'header:s' => \$opt_header,
'server' => \$opt_server,
'template' => \$opt_template,
'parser:s' => \$opt_parser,
- 'client' => \$opt_client,
+ 'client' => \$opt_client,
'eth-parser:s' => \$opt_eth_parser,
- 'eth-header:s' => \$opt_eth_header,
- 'esp:s' => \$opt_esp,
+ 'eth-header:s' => \$opt_eth_header,
+ 'esp:s' => \$opt_esp,
'diff' => \$opt_diff,
- 'odl' => \$opt_odl,
+ 'odl' => \$opt_odl,
'keep' => \$opt_keep,
'swig' => \$opt_swig,
- 'dcom-proxy' => \$opt_dcom_proxy,
- 'com-header' => \$opt_com_header,
- 'quiet' => \$opt_quiet,
- 'warn-compat' => \$opt_warn_compat
+ 'dcom-proxy' => \$opt_dcom_proxy,
+ 'com-header' => \$opt_com_header,
+ 'quiet' => \$opt_quiet,
+ 'warn-compat' => \$opt_warn_compat
);
if ($opt_help) {
@@ -151,6 +154,10 @@ sub process_file($)
defined $pidl || die "Failed to load $pidl_file - maybe you need --parse\n";
}
+ if ($opt_uint_enums) {
+ util::setUseUintEnums(1);
+ }
+
if ($opt_dump) {
print IdlDump::Dump($pidl);
}
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm
index c26ab2dd04..26c940c02a 100644
--- a/source4/build/pidl/util.pm
+++ b/source4/build/pidl/util.pm
@@ -204,4 +204,15 @@ sub make_str($)
return "\"" . $str . "\"";
}
+# a hack to build on platforms that don't like negative enum values
+my $useUintEnums = 0;
+sub setUseUintEnums($)
+{
+ $useUintEnums = shift;
+}
+sub useUintEnums()
+{
+ return $useUintEnums;
+}
+
1;