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]

Compiler options as string?


I wonder what is the best way to obtain the compiler options as string in a front end.

Background: Fortran 2008 offers an intrinsic function called "compiler_options", which returns "a processor-dependent value which describes the options that controlled the translation phase of program execution." (Cf. PR 40569)

So far I found -frecord-gcc-switches, -fverbose-asm (cf. toplev.c's print_switch_values and init_asm_output).

The bare strings are only available in toplev.c: toplev_main directly gets (argc, argv), calls decode_options and saves them in static variable save_decoded_options, which is used for print_switch_values.

Thus, one needs to modify toplev to make them somehow available. Any suggestions how this should be done?

Tobias

PS: Some options such as FE specific options end up in gfc_handle_option (alias lang_hooks.handle_option) but those to not contain options such as "-march=native", "-O3" or "-m32" which users presumably would like to see recorded. -- I think most users would prefer to have the options to the driver ("gfortran") rather than the one to the compiler ("f951").


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