PATCH: Factorization of some code (updated version).

Jeffrey A Law law@hurl.cygnus.com
Tue Feb 2 21:44:00 GMT 1999


  In message <199901201214.NAA19914@mururoa.inria.fr>you write:
  > 
  > OK, I think I've taken account of all the remarks I got so here is an
  > updated version.
  > 
  > This trivial patch just factorizes the code needed to decode options 
  > with a trailing integer parameter (currently -ftemplate-depth-<n>
  > and -fmangling-version-<n>). The factorized code is in a new function
  > named read_integral_parameter. The code for decoding -Oxxx can also
  > benefit from this function with little work (This is a little less
  > trivial. I will do the work if this patch gets accepted and if no-one
  > finds objections to do so.).
  > 
  > ChangeLog
  > 
  > Fri Jan  8 17:45:23 1999  Theodore Papadopoulo <Theodore.Papadopoulo@sophia
  > .inria.fr>
  > 
  > 	* toplev.h (read_integral_parameter): Declare.
  > 	* toplev.c (read_integral_parameter): New function.
  > 
  > cp/ChangeLog:
  > 
  > 1999-01-08  Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
  > 
  > 	* decl2.c (lang_decode_option): Use read_integral_parameter.
Installed.

You might want to do a grep for atoi for other places that could use this
patch.  For example there's a couple places which deal with -Wblah-blah-N
in toplev.c and one hunk of code in haifa-sched.c.  There may be others, I
didn't look too closely.

Those atoi calls don't to any error checking right now, so using
read_integral_parameter would be an improvement to the user interface.

Thanks!
jeff


More information about the Gcc-patches mailing list