From 30bfba96d3b7007aa47e037328ea0f2b8e7d1d6e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 22 Jan 2007 00:04:59 +0000 Subject: r20942: Simplify handling of systems that don't support negative enum values by using an ifdef rather than a pidl argument. (This used to be commit 6bada0dcf0c7915d366c7917189375dbabecdd4f) --- source4/pidl/lib/Parse/Pidl/Samba4/Header.pm | 15 ++++++++------- source4/pidl/lib/Parse/Pidl/Util.pm | 11 ----------- 2 files changed, 8 insertions(+), 18 deletions(-) (limited to 'source4/pidl/lib') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm index da7d39a238..96f695d1cd 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm @@ -118,8 +118,8 @@ sub HeaderEnum($$) my($enum,$name) = @_; my $first = 1; - if (not Parse::Pidl::Util::useUintEnums()) { - pidl "enum $name {\n"; + pidl "#ifndef USE_UINT_ENUMS\n"; + pidl "enum $name {\n"; $tab_depth++; foreach my $e (@{$enum->{ELEMENTS}}) { unless ($first) { pidl ",\n"; } @@ -129,9 +129,9 @@ sub HeaderEnum($$) } pidl "\n"; $tab_depth--; - pidl "}"; - } else { - my $count = 0; + pidl "};\n"; + pidl "#else\n"; + my $count = 0; pidl "enum $name { __donnot_use_enum_$name=0x7FFFFFFF};\n"; my $with_val = 0; my $without_val = 0; @@ -154,8 +154,8 @@ sub HeaderEnum($$) } pidl "#define $name ( $value )\n"; } + pidl "#endif\n"; pidl "\n"; - } } ##################################################################### @@ -220,7 +220,8 @@ sub HeaderTypedef($) { my($typedef) = shift; HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME}); - pidl ";\n\n" unless ($typedef->{DATA}->{TYPE} eq "BITMAP"); + pidl ";\n\n" unless ($typedef->{DATA}->{TYPE} eq "BITMAP" or + $typedef->{DATA}->{TYPE} eq "ENUM"); } ##################################################################### diff --git a/source4/pidl/lib/Parse/Pidl/Util.pm b/source4/pidl/lib/Parse/Pidl/Util.pm index 35e25286f5..3ca79b6c1c 100644 --- a/source4/pidl/lib/Parse/Pidl/Util.pm +++ b/source4/pidl/lib/Parse/Pidl/Util.pm @@ -87,17 +87,6 @@ sub print_uuid($) "{".join(',', map {"0x$_"} @node)."}}"; } -# a hack to build on platforms that don't like negative enum values -my $useUintEnums = 0; -sub setUseUintEnums($) -{ - $useUintEnums = shift; -} -sub useUintEnums() -{ - return $useUintEnums; -} - sub ParseExpr($$$) { my($expr, $varlist, $e) = @_; -- cgit