Rev 11276: Simplify handling of systems that don't support negative enum values by using an ifdef rather than a pidl argument. in file:///home/jelmer/bzr.samba/SAMBA_4_0/

Jelmer Vernooij jelmer at samba.org
Mon Jan 22 00:00:36 GMT 2007


------------------------------------------------------------
revno: 11276
revision-id: jelmer at samba.org-20070122000024-q911packyrjk69ud
parent: svn-v2:20941 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: SAMBA_4_0
timestamp: Mon 2007-01-22 01:00:24 +0100
message:
  Simplify handling of systems that don't support negative enum values by using an ifdef rather than a pidl argument.
modified:
  source/build/m4/check_cc.m4    svn-v2:7274 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fbuild%2fm4%2fcheck_cc.m4
  source/build/m4/check_perl.m4  svn-v2:7274 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fbuild%2fm4%2fcheck_perl.m4
  source/build/smb_build/makefile.pm svn-v2:3690 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fbuild%2fsmb_build%2fmakefile.pm
  source/main.mk                 svn-v2:8991 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fmain.mk
  source/pidl/lib/Parse/Pidl/Samba4/Header.pm svn-v2:12463 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fSamba4%2fHeader.pm
  source/pidl/lib/Parse/Pidl/Util.pm svn-v2:9460 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fUtil.pm
  source/pidl/pidl               svn-v2:9459 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2fpidl
=== modified file 'source/build/m4/check_cc.m4'
--- a/source/build/m4/check_cc.m4	2007-01-12 03:05:31 +0000
+++ b/source/build/m4/check_cc.m4	2007-01-22 00:00:24 +0000
@@ -47,8 +47,7 @@
 ],
 	SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes,SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=no)])
 if test x"$SMB_BUILD_CC_NEGATIVE_ENUM_VALUES" != x"yes"; then
-	AC_MSG_WARN([using --unit-enums for pidl])
-	PIDL_ARGS="$PIDL_ARGS --uint-enums"
+	AC_DEFINE(USE_UINT_ENUMS, 1, [Whether the compiler has uint enum support])
 fi
 
 AC_MSG_CHECKING([for test routines])

=== modified file 'source/build/m4/check_perl.m4'
--- a/source/build/m4/check_perl.m4	2006-03-30 10:29:41 +0000
+++ b/source/build/m4/check_perl.m4	2007-01-22 00:00:24 +0000
@@ -26,6 +26,3 @@
 export PERL
 
 AC_PATH_PROG(YAPP, yapp, false)
-
-PIDL_ARGS=""
-AC_SUBST(PIDL_ARGS)

=== modified file 'source/build/smb_build/makefile.pm'
--- a/source/build/smb_build/makefile.pm	2007-01-15 10:49:02 +0000
+++ b/source/build/smb_build/makefile.pm	2007-01-22 00:00:24 +0000
@@ -154,7 +154,6 @@
 LEX=$self->{config}->{LEX}
 YACC=$self->{config}->{YACC}
 YAPP=$self->{config}->{YAPP}
-PIDL_ARGS=$self->{config}->{PIDL_ARGS}
 
 GCOV=$self->{config}->{GCOV}
 

=== modified file 'source/main.mk'
--- a/source/main.mk	2007-01-15 07:34:04 +0000
+++ b/source/main.mk	2007-01-22 00:00:24 +0000
@@ -208,10 +208,10 @@
 	$(IDL_NDR_EJS_C_FILES) $(IDL_NDR_EJS_H_FILES): idl
 
 idl_full: pidl/lib/Parse/Pidl/IDL.pm pidl/lib/Parse/Pidl/Expr.pm 
-	@CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh FULL $(PIDL_ARGS)
+	@CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh FULL
 
 idl: pidl/lib/Parse/Pidl/IDL.pm pidl/lib/Parse/Pidl/Expr.pm 
-	@CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh PARTIAL $(PIDL_ARGS)
+	@CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh PARTIAL 
 
 pidl/lib/Parse/Pidl/IDL.pm: pidl/idl.yp
 	-$(YAPP) -m 'Parse::Pidl::IDL' -o pidl/lib/Parse/Pidl/IDL.pm pidl/idl.yp ||\

=== modified file 'source/pidl/lib/Parse/Pidl/Samba4/Header.pm'
--- a/source/pidl/lib/Parse/Pidl/Samba4/Header.pm	2006-11-16 22:13:44 +0000
+++ b/source/pidl/lib/Parse/Pidl/Samba4/Header.pm	2007-01-22 00:00:24 +0000
@@ -118,8 +118,8 @@
     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 @@
 	}
 	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 @@
 	    }
 	    pidl "#define $name ( $value )\n";
 	}
+	pidl "#endif\n";
 	pidl "\n";
-    }
 }
 
 #####################################################################
@@ -220,7 +220,8 @@
 {
     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");
 }
 
 #####################################################################

=== modified file 'source/pidl/lib/Parse/Pidl/Util.pm'
--- a/source/pidl/lib/Parse/Pidl/Util.pm	2007-01-09 23:41:25 +0000
+++ b/source/pidl/lib/Parse/Pidl/Util.pm	2007-01-22 00:00:24 +0000
@@ -87,17 +87,6 @@
 		"{".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) = @_;

=== modified file 'source/pidl/pidl'
--- a/source/pidl/pidl	2007-01-11 22:47:29 +0000
+++ b/source/pidl/pidl	2007-01-22 00:00:24 +0000
@@ -17,7 +17,7 @@
 
 pidl --help
 
-pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--swig[=OUTPUT]] [--uint-enums] [--ndr-parser[=OUTPUT]] [--client] [--server] [--dcom-proxy] [--com-header] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [<idlfile>.idl]...
+pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--swig[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server] [--dcom-proxy] [--com-header] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [<idlfile>.idl]...
 
 =head1 DESCRIPTION
 
@@ -451,7 +451,6 @@
 my($opt_dump_idl_tree);
 my($opt_dump_ndr_tree);
 my($opt_dump_idl) = 0;
-my($opt_uint_enums) = 0;
 my($opt_diff) = 0;
 my($opt_header);
 my($opt_samba3_header);
@@ -501,7 +500,6 @@
 
 Samba 4 output:
  --header[=OUTFILE]      create generic header file [BASENAME.h]
- --uint-enums            don't use C enums, instead use uint* types
  --ndr-parser[=OUTFILE]  create a C NDR parser [ndr_BASENAME.c]
  --client[=OUTFILE]      create a C NDR client [ndr_BASENAME_c.c]
  --tdr-parser[=OUTFILE]  create a C TDR parser [tdr_BASENAME.c]
@@ -532,7 +530,6 @@
 		'dump-idl-tree:s' => \$opt_dump_idl_tree,
 		'parse-idl-tree' => \$opt_parse_idl_tree,
 		'dump-ndr-tree:s' => \$opt_dump_ndr_tree,
-	    'uint-enums' => \$opt_uint_enums,
 		'samba3-ndr-client:s' => \$opt_samba3_ndr_client,
 		'samba3-ndr-server:s' => \$opt_samba3_ndr_server,
 		'header:s' => \$opt_header,
@@ -590,10 +587,6 @@
 		SaveStructure($pidl_file, $pidl) or die "Failed to save $pidl_file\n";
 	}
 
-	if ($opt_uint_enums) {
-		Parse::Pidl::Util::setUseUintEnums(1);
-	}
-
 	if ($opt_dump_idl) {
 		require Parse::Pidl::Dump;
 		print Parse::Pidl::Dump($pidl);
@@ -606,7 +599,6 @@
 		unlink($tempfile);
 	}
 
-
 	my $comh_filename = ($opt_com_header or "$outputdir/com_$basename.h");
 	if (defined($opt_com_header)) {
 		require Parse::Pidl::Samba4::COM::Header;



More information about the samba-cvs mailing list