RFA: Add -frecord-gcc-switches command line switch

Mark Mitchell mark@codesourcery.com
Mon Dec 4 19:31:00 GMT 2006


Nick Clifton wrote:

>   This is a resubmission of an old patch which adds a new command line
>   switch to gcc:  -frecord-gcc-switches.

I like this patch.  I have some nits, but I'll review & approve a
revised version.

> 	* common.opt (record-gcc-switches): New command line switch.
> 	* target.h (print_switch_type): New enum.
> 	(print_fn_type): New typedef for a function pointer.

I think that should be print_switch_fn_type; lots of other things can be
printed, but not with these functions. :-)

> 	* target-def.h (TARGET_ASM_RECORD_GCC_SWITCHES): Provide a default
> 	definition.

I think the default should be NULL for this hook, and then turned on
selectively for platforms where we know they work.  It's a bad thing if
the compiler has switches that don't cause "I'm unsupported" error
messages, but do not work.

> 	(TARGET_ASM_GCC_SWITCHES_RECORDING_SECTION): Provide a default
> 	definition.

I would name this TARGET_ASM_RECORD_GCC_SWITCHES_SECTION.

> (For example the way the @option{-O2} switch
> +enables various different individual optimization passes).

This is ungrammatical; I think you want:

  For example, the @option{-O2} switch ...

> +@var{text} is either NULL or some descriptive text which can usually
> +be ignored.

I think you should say "should" rather than "can usually".  There's not
much point in writing out "options passed".  NULL and
SWITCH_TYPE_DESCRIPTIVE have appropriate texinfo markup.

> +This is a request to emit a line start sequence.  This can be ignored
> +by this target hook.

To many "this"es; Use: "This option can be ignored by the hook" here and
in the for the LINE_END value as well.

> +The hook's return value is ignored by the caller.

We should mandate that the hook return some known value (zero?) so that
we can add some additional behavior later.

> This section
> +is only created however if the @option{-fverbose-asm2} switch has been
> +enabled.

Why?  Why does -frecord-gcc-switches have interdependency with
-fverbose-asm2?

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list