This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] DEFAULT_SIGNED_BITFIELDS Macro
- To: <egcs-patches at egcs dot cygnus dot com>
- Subject: [PATCH] DEFAULT_SIGNED_BITFIELDS Macro
- From: "Eric Raskin" <ehr at listworks dot com>
- Date: Wed, 2 Jun 1999 11:02:13 -0400
- Reply-To: <ehr at listworks dot com>
This patch, per Jeffrey's request, allows a particular port to define whether bitfields are signed or unsigned by default. The DG/UX port needs to default to unsigned bitfields for backwards compatibility. If undefined, it defaults to signed bitfields. To use it:
#define DEFAULT_SIGNED_BITFIELDS 1 default to signed bitfields (or leave it undefined)
#define DEFAULT_SIGNED_BITFIELDS 0 default to unsigned bitfields
*** Where should this be documented, (besides the code, of course :-) )?
02 Jun 1999 11:00:15 Eric Raskin (ehr@listworks.com)
* decl.c: Add DEFAULT_SIGNED_BITFIELDS
* c-decl.c: Add DEFAULT_SIGNED_BITFIELDS
* decl2.c: Add DEFAULT_SIGNED_BITFIELDS
--- /lw/downloads/egcs-19990524-orig/gcc/ch/decl.c Sun Jan 31 12:46:27 1999
+++ /lw/downloads/egcs-19990524/gcc/ch/decl.c Fri May 28 10:12:43 1999
@@ -593,7 +593,11 @@ int flag_allow_single_precision = 0;
/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */
-int flag_signed_bitfields = 1;
+#ifndef DEFAULT_SIGNED_BITFIELDS
+#define DEFAULT_SIGNED_BITFIELDS 1
+#endif
+
+int flag_signed_bitfields = DEFAULT_SIGNED_BITFIELDS;
int explicit_flag_signed_bitfields = 0;
/* Nonzero means warn about implicit declarations. */
--- /lw/downloads/egcs-19990524-orig/gcc/cp/decl2.c Wed May 19 08:44:46 1999
+++ /lw/downloads/egcs-19990524/gcc/cp/decl2.c Fri May 28 10:14:32 1999
@@ -178,7 +178,11 @@ int flag_traditional;
/* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
-int flag_signed_bitfields = 1;
+#ifndef DEFAULT_SIGNED_BITFIELDS
+#define DEFAULT_SIGNED_BITFIELDS 1
+#endif
+
+int flag_signed_bitfields = DEFAULT_SIGNED_BITFIELDS;
/* Nonzero means enable obscure ANSI features and disable GNU extensions
that might cause ANSI-compliant code to be miscompiled. */
--- /lw/downloads/egcs-19990524-orig/gcc/c-decl.c Mon Apr 12 10:05:29 1999
+++ /lw/downloads/egcs-19990524/gcc/c-decl.c Fri May 28 10:13:32 1999
@@ -480,7 +480,11 @@ int flag_allow_single_precision = 0;
/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */
-int flag_signed_bitfields = 1;
+#ifndef DEFAULT_SIGNED_BITFIELDS
+#define DEFAULT_SIGNED_BITFIELDS 1
+#endif
+
+int flag_signed_bitfields = DEFAULT_SIGNED_BITFIELDS;
int explicit_flag_signed_bitfields = 0;
/* Nonzero means warn about use of implicit int. */
------------------------------------------------------------------------
Eric H. Raskin Voice: 914-769-7100 x321
President, CSC Division Fax: 914-769-8070
The Listworks Corp. E-Mail: ehr@listworks.com
1 Campus Drive
Pleasantville, NY 10570