Fixup generating error messages for unrecognised switches

Jeffrey A Law
Tue Nov 30 23:59:00 GMT 1999

  In message < >you write:
  > Hi Guys,
  >   The patch below fixes a bug in my recent patch to tidy up cc1's
  >   command line parsing.  If the user did invoke gcc/cc1 with a
  >   completely invalid switch then no error would be generated because
  >   the string 'option' would always be non-NULL at the end of the 
  >   loop checking to see if the switch was recognised by other
  >   languages.
  >   In a related issue the cpplib function cpp_handle_option would
  >   always claim to have successfully consumed an option starting with
  >   -f, even if it hadn't, and so no errors about unrecognised options
  >   starting with -f or -- would ever be generated.
  >   Is this patch OK to install ?
  > Cheers
  > 	Nick
  > PS. I know that the curly braces around the 'return i;' statement in
  >   the patch to cpp_handle_option are unnecessary and do not conform to 
  >   the GNU coding standard.  They are there to make merging with the
  >   internal Cygnus version of the code easier.
  > Fri Nov 12 15:31:10 1999  Nick Clifton  <>
  > 	* toplev.c (main): Correctly detect an unrecognised option.
  > 	* cppinit.c (cpp_handle_option): Do not claim to have consumed
  > 	a -f option if it has not been recognised.
This is fine.  Please install it.


ps.  Presumably this explains why I didn't get an error when I mis-typed a
-f option to the compiler this evening :-)k

More information about the Gcc-patches mailing list