This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Move short enums target hook
- From: Paul Brook <paul at codesourcery dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 11 May 2004 16:56:10 +0100
- Subject: Move short enums target hook
- Organization: CodeSourcery
The patch below moves use of the default_short_enums target hook after
override_options. I have a followup patch that will actually use this hook
(on arm).
Tested on i686-linux.
Ok?
Paul
2004-05-11 Paul Brook <paul@codesourcery.com>
* flags.h (flag_short_enums): Update comment.
* opts.c (decode_options): Set flag_short_enums to 2.
* toplev.c (flag_short_enums): Update comment.
(process_options): Call default_short_enums target hook.
Index: flags.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/flags.h,v
retrieving revision 1.136
diff -u -p -r1.136 flags.h
--- a/flags.h 30 Apr 2004 05:29:22 -0000 1.136
+++ b/flags.h 11 May 2004 13:33:43 -0000
@@ -244,7 +244,8 @@ extern int flag_print_asm_name;
extern int flag_signed_char;
-/* Nonzero means give an enum type only as many bytes as it needs. */
+/* Nonzero means give an enum type only as many bytes as it needs. A value
+ of 2 means it has not yet been initialized. */
extern int flag_short_enums;
Index: opts.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/opts.c,v
retrieving revision 1.66
diff -u -p -r1.66 opts.c
--- a/opts.c 30 Apr 2004 05:29:22 -0000 1.66
+++ b/opts.c 11 May 2004 12:17:44 -0000
@@ -604,8 +604,9 @@ decode_options (unsigned int argc, const
/* Initialize whether `char' is signed. */
flag_signed_char = DEFAULT_SIGNED_CHAR;
- /* Initialize how much space enums occupy, by default. */
- flag_short_enums = targetm.default_short_enums ();
+ /* Set this to a special "uninitialized" value. The actual default is set
+ after target options have been processed. */
+ flag_short_enums = 2;
/* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
modify it. */
Index: toplev.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/toplev.c,v
retrieving revision 1.895
diff -u -p -r1.895 toplev.c
--- a/toplev.c 20 Apr 2004 09:27:41 -0000 1.895
+++ b/toplev.c 11 May 2004 13:33:34 -0000
@@ -314,7 +314,8 @@ unsigned local_tick;
int flag_signed_char;
-/* Nonzero means give an enum type only as many bytes as it needs. */
+/* Nonzero means give an enum type only as many bytes as it needs. A value
of
+ 2 means it has not yet been initialized. */
int flag_short_enums;
@@ -2232,6 +2233,9 @@ process_options (void)
OVERRIDE_OPTIONS;
#endif
+ if (flag_short_enums)
+ flag_short_enums = targetm.default_short_enums ();
+
/* Set aux_base_name if not already set. */
if (aux_base_name)
;