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]

RFA: Fix -mno-* options for ports that use .opt files


Sigh.  When writing the target .opt patch, I obviously tested the implicit
-mno-* options before realising that I needed special handling for things
like -mno-mips16 and -mno-mips3d.  It turns out that the fix for the latter
broke the former.  Sorry for the stupidity.

As intended, handle_option now always tries the original, unmodified
option before removing any "no-" prefix.  This works fine for "-fno-"
and "-Wno-", but it doesn't work for "-mno-".

The problem is that common.opt defines a catch-all -m* flag, the handler
for which passes the option to the TARGET_SWITCHES/OPTIONS code.  Thus
if a -mno-* option is not listed explicitly, the lookup will find the
-m* switch instead, and will pass it on to the old-style code.

The patch below fixes this by removing the -m entry and getting
handle_option to handle 'm' switches specially.  This #ifdeffed
code can obviously go away if (when ;) all targets move over to
the new scheme.

Bootstrapped & regression tested on i686-pc-linux-gnu.  I also checked
the -mno-* options work as expected on that target and on mips64-elf and
(.opt-patched) avr-elf crosses.  OK to install?

Richard


	* common.opt (m): Remove.
	* opts.c (handle_option): Pass 'm' options to set_target_switch if
	table lookup fails.
	(common_handle_option): Remove OPT_m case.

Index: common.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/common.opt,v
retrieving revision 1.64
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.64 common.opt
*** common.opt	13 Mar 2005 00:45:49 -0000	1.64
--- common.opt	17 Mar 2005 23:11:39 -0000
*************** gxcoff+
*** 999,1007 ****
  Common JoinedOrMissing
  Generate debug information in extended XCOFF format
  
- m
- Common Joined
- 
  o
  Common Joined Separate
  -o <file>	Place output into <file>
--- 999,1004 ----
Index: opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/opts.c,v
retrieving revision 1.97
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.97 opts.c
*** opts.c	14 Mar 2005 20:18:38 -0000	1.97
--- opts.c	17 Mar 2005 23:11:39 -0000
*************** handle_option (const char **argv, unsign
*** 294,300 ****
      }
  
    if (opt_index == cl_options_count)
!     goto done;
  
    option = &cl_options[opt_index];
  
--- 294,309 ----
      }
  
    if (opt_index == cl_options_count)
!     {
! #if defined (TARGET_OPTIONS) || defined (TARGET_SWITCHES)
!       if (opt[1] == 'm')
! 	{
! 	  set_target_switch (argv[0] + 2);
! 	  result = 1;
! 	}
! #endif
!       goto done;
!     }
  
    option = &cl_options[opt_index];
  
*************** common_handle_option (size_t scode, cons
*** 1016,1025 ****
        set_debug_level (XCOFF_DEBUG, code == OPT_gxcoff_, arg);
        break;
  
-     case OPT_m:
-       set_target_switch (arg);
-       break;
- 
      case OPT_o:
        asm_file_name = arg;
        break;
--- 1025,1030 ----


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