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]

--target-help prints error message


It came to my attention that running gcc --target-help ends with:

cc1: error: unrecognized option `--target-help'

even though target-specific options are printed.  The problem is that
independent_decode_option() doesn't return status indicating that it
has recognized the option, even though it obviously has.  Other
options, such as --help and --version, have the same problem, it just
isn't apparent because --help is recognized as a language-specific
option.  I haven't investigated --version, but I thought it wouldn't
hurt to fix it as well (it never matches in the rest of the function,
so it's ok to return early).  Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva at redhat dot com>

	* toplev.c (independent_decode_option): Return success for --help,
	--target-help and --version.

Index: gcc/toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.731
diff -u -p -r1.731 toplev.c
--- gcc/toplev.c 5 Mar 2003 22:19:32 -0000 1.731
+++ gcc/toplev.c 7 Mar 2003 23:22:04 -0000
@@ -4403,18 +4403,21 @@ independent_decode_option (argc, argv)
     {
       display_help ();
       exit_after_options = 1;
+      return 1;
     }
 
   if (!strcmp (arg, "-target-help"))
     {
       display_target_options ();
       exit_after_options = 1;
+      return 1;
     }
 
   if (!strcmp (arg, "-version"))
     {
       print_version (stderr, "");
       exit_after_options = 1;
+      return 1;
     }
 
   /* Handle '--param <name>=<value>'.  */
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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