This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[4.7] Avoid global state in microblaze_handle_option


This patch, for 4.7 and relative to a tree with
<http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01709.html> applied,
stops the Microblaze handle_option hook from using global state.
Everything the hook does - warnings and setting a variable also set by
another option - can be done using .opt features, so the hook is
removed and replaced by use of those features.

Tested building cc1 and xgcc for cross to microblaze-elf.  Will commit
to trunk for 4.7 in the absence of target maintainer objections.

2011-03-03  Joseph Myers  <joseph@codesourcery.com>

	* config/microblaze/microblaze.c: Don't include opts.h.
	(microblaze_handle_option, TARGET_HANDLE_OPTION): Remove.
	* config/microblaze/microblaze.opt (mxl-stack-check): Use Warn.
	(mno-clearbss): Use Var and Warn.

diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/microblaze/microblaze.c gcc-mainline/gcc/config/microblaze/microblaze.c
--- gcc-mainline-1/gcc/config/microblaze/microblaze.c	2011-02-23 18:23:27.000000000 -0800
+++ gcc-mainline/gcc/config/microblaze/microblaze.c	2011-03-03 19:26:55.000000000 -0800
@@ -48,7 +48,6 @@
 #include "df.h"
 #include "optabs.h"
 #include "diagnostic-core.h"
-#include "opts.h"
 
 #define MICROBLAZE_VERSION_COMPARE(VA,VB) strcasecmp (VA, VB)
 
@@ -1272,30 +1271,6 @@ microblaze_version_to_int (const char *v
   return iver;
 }
 
-static bool
-microblaze_handle_option (struct gcc_options *opts,
-			  struct gcc_options *opts_set,
-			  const struct cl_decoded_option *decoded,
-			  location_t loc ATTRIBUTE_UNUSED)
-{
-  size_t code = decoded->opt_index;
-
-  gcc_assert (opts == &global_options);
-  gcc_assert (opts_set == &global_options_set);
-
-  switch (code)
-    {
-    case OPT_mno_clearbss:
-      flag_zero_initialized_in_bss = 0;
-      warning (0, "-mno-clearbss is deprecated; use -fno-zero-initialized-in-bss");
-      break;
-    case OPT_mxl_stack_check:
-      warning (0, "-mxl_stack_check is deprecated; use -fstack-check");
-      break;
-    }
-  return true;
-}
-
 
 static void
 microblaze_option_override (void)
@@ -3007,9 +2982,6 @@ microblaze_adjust_cost (rtx insn ATTRIBU
 #define TARGET_ASM_FUNCTION_END_PROLOGUE \
                                         microblaze_function_end_prologue
 
-#undef TARGET_HANDLE_OPTION
-#define TARGET_HANDLE_OPTION		microblaze_handle_option
-
 #undef TARGET_DEFAULT_TARGET_FLAGS
 #define TARGET_DEFAULT_TARGET_FLAGS	TARGET_DEFAULT
 
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/microblaze/microblaze.opt gcc-mainline/gcc/config/microblaze/microblaze.opt
--- gcc-mainline-1/gcc/config/microblaze/microblaze.opt	2011-02-21 17:05:40.000000000 -0800
+++ gcc-mainline/gcc/config/microblaze/microblaze.opt	2011-03-03 19:26:12.000000000 -0800
@@ -72,7 +72,7 @@ Target Mask(PATTERN_COMPARE)
 Use pattern compare instructions
 
 mxl-stack-check
-Target Mask(STACK_CHECK)
+Target Mask(STACK_CHECK) Warn(%qs is deprecated; use -fstack-check)
 Check for stack overflow at runtime
 
 mxl-gp-opt
@@ -80,7 +80,7 @@ Target Mask(XLGPOPT)
 Use GP relative sdata/sbss sections
 
 mno-clearbss
-Target RejectNegative
+Target RejectNegative Var(flag_zero_initialized_in_bss, 0) Warn(%qs is deprecated; use -fno-zero-initialized-in-bss)
 Clear the BSS to zero and place zero initialized in BSS
 
 mxl-multiply-high

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]