This is the mail archive of the 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]

Re: [PATCH 2/6] Andes nds32: machine description of nds32 porting (2).

On Mon, 8 Jul 2013, Chung-Ju Wu wrote:

> +/* This is used to identify used ISA when doing code generation.
> +   Initialize it with macro TARGET_DEFAULT_ISA,
> +   which is defined in nds32-isa-xxx.h file.
> +   User can specify it by using '-misa=X' option.  */
> +enum nds32_isa nds32_selected_isa = TARGET_DEFAULT_ISA;

Rather than using global state, put this in the gcc_options structure 
using a Variable entry in your .opt file.

> +	  warning (0, "For the option -misr-vector-size=X, the valid X "
> +		      "must be: 4 or 16");

The diagnostics in this function should all not start with a capital 
letter.  Invalid arguments to an option should be errors, not warnings.  
Since you have a location passed to this function, use error_at rather 
than the legacy functions that implicitly use input_location.

> +    case OPT_misa_:
> +      /* Check valid ISA: v2 v3 v3m.  */
> +      if (strcmp (arg, "v2") == 0)

Use Enum in the .opt file and get all the conversion from strings to 
integer values, and errors for unknown values, done automatically.

Joseph S. Myers

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