aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/lang-specs.h
AgeCommit message (Collapse)AuthorFilesLines
2020-05-26do not skip validation of switch after %<optAlexandre Oliva1-3/+7
After the patch that revamped dump and aux outputs, GCC compilation drivers built without Ada would reject -d* options. Such options would only be validated because of the %{d*} in Ada lang specs, though other languages had it as well. Other languages had %< specs that had to be there before %{d*} %:dumps(), while Ada was missing them. Adding them to Ada brought the same problem to compilers that had Ada enabled. The reason validation failed was that they mishandled %< specs, advancing past the beginning of the next spec, causing it not to be handled. Since %{d*} appeared after an odd %<, it was thus ignored. The logic of validate_switches originally skipped the closing brace that matched the opening brace, but this shouldn't happen for %<. Fixed by letting validate_switches know whether it is handling a braced group or a single atom, and behaving accordingly. gcc/ChangeLog: * gcc.c (validate_switches): Add braced parameter. Adjust all callers. Expected and skip trailing brace only if braced. Return after handling one atom otherwise. (DUMPS_OPTIONS): New. (cpp_debug_options): Define in terms of it. gcc/ada/ChangeLog: * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Define in terms of DUMPS_OPTIONS. Replace occurrences of %{d*} %:dumps with it.
2020-05-26revamp dump and aux output namesAlexandre Oliva1-11/+5
This patch simplifies (!!!) the logic governing the naming of dump files and auxiliary output files in the driver, in the compiler, and in the LTO wrapper. No changes are made to the naming of primary outputs, there are often ways to restore past behavior, and a number of inconsistencies are fixed. Some internal options are removed (-auxbase and -auxbase-strip), sensible existing uses of -dumpdir and -dumpbase options remain unchanged, additional useful cases are added, making for what is still admittedly quite complex. Extensive documentation and testcases provide numerous examples, from normal to corner cases. The most visible changes are: - aux and dump files now always go in the same directory, that defaults to the directory of the primary output, but that can be overridden with -dumpdir, -save-temps=*, or, preserving past behavior, with a -dumpbase with a directory component. - driver and compiler now have the same notion of naming of auxiliary outputs, e.g. .dwo files will no longer be in one location while the debug info suggests they are elsewhere, and -save-temps and .dwo auxiliary outputs now go in the same location as .su, .ci and coverage data, with consistent naming. - explicitly-specified primary output names guide not only the location of aux and dump outputs: the output base name is also used in their base name, as a prefix when also linking (e.g. foo.c bar.c -o foobar creates foobar-foo.dwo and foobar-bar.dwo with -gsplit-dwarf), or as the base name instead of the input name (foo.c -c -o whatever.o creates whatever.su rather than foo.su with -fstack-usage). The preference for the input file base name, quite useful for our testsuite, can be restored with -dumpbase "". When compiling and linking tests in the testsuite with additional inputs, we now use this flag. Files named in dejagnu board ldflags, libs, and ldscripts are now quoted in the gcc testsuite with -Wl, so that they are not counted as additional inputs by the compiler driver. - naming a -dumpbase when compiling multiple sources used to cause dumps from later compiles to overwrite those of earlier ones; it is now used as a prefix when compiling multiple sources, like an executable name above. - the dumpbase, explicitly specified or computed from output or input names, now also governs the naming of aux outputs; since aux outputs usually replaced the suffix from the input name, while dump outputs append their own additional suffixes, a -dumpbase-ext option is introduced to enable a chosen suffix to be dropped from dumpbase to form aux output names. - LTO dump and aux outputs were quite a mess, sometimes leaking temporary output names into -save-temps output names, sometimes conversely generating desirable aux outputs in temporary locations. They now obey the same logic of compiler aux and dump outputs, landing in the expected location and taking the linker output name or an explicit dumpbase overrider into account. - Naming of -fdump-final-insns outputs now follows the dump file naming logic for the .gkd files, and the .gk dump files generated in the second -fcompare-debug compilation get the .gk inserted before the suffix that -dumpbase-ext drops in aux outputs. gcc/ChangeLog: * common.opt (aux_base_name): Define. (dumpbase, dumpdir): Mark as Driver options. (-dumpbase, -dumpdir): Likewise. (dumpbase-ext, -dumpbase-ext): New. (auxbase, auxbase-strip): Drop. * doc/invoke.texi (-dumpbase, -dumpbase-ext, -dumpdir): Document. (-o): Introduce the notion of primary output, mention it influences auxiliary and dump output names as well, add examples. (-save-temps): Adjust, move examples into -dump*. (-save-temps=cwd, -save-temps=obj): Likewise. (-fdump-final-insns): Adjust. * dwarf2out.c (gen_producer_string): Drop auxbase and auxbase_strip; add dumpbase_ext. * gcc.c (enum save_temps): Add SAVE_TEMPS_DUMP. (save_temps_prefix, save_temps_length): Drop. (save_temps_overrides_dumpdir): New. (dumpdir, dumpbase, dumpbase_ext): New. (dumpdir_length, dumpdir_trailing_dash_added): New. (outbase, outbase_length): New. (The Specs Language): Introduce %". Adjust %b and %B. (ASM_FINAL_SPEC): Use %b.dwo for an aux output name always. Precede object file with %w when it's the primary output. (cpp_debug_options): Do not pass on incoming -dumpdir, -dumpbase and -dumpbase-ext options; recompute them with %:dumps. (cc1_options): Drop auxbase with and without compare-debug; use cpp_debug_options instead of dumpbase. Mark asm output with %w when it's the primary output. (static_spec_functions): Drop %:compare-debug-auxbase-opt and %:replace-exception. Add %:dumps. (driver_handle_option): Implement -save-temps=*/-dumpdir mutual overriding logic. Save dumpdir, dumpbase and dumpbase-ext options. Do not save output_file in save_temps_prefix. (adds_single_suffix_p): New. (single_input_file_index): New. (process_command): Combine output dir, output base name, and dumpbase into dumpdir and outbase. (set_collect_gcc_options): Pass a possibly-adjusted -dumpdir. (do_spec_1): Optionally dumpdir instead of save_temps_prefix, and outbase instead of input_basename in %b, %B and in -save-temps aux files. Handle empty argument %". (driver::maybe_run_linker): Adjust dumpdir and auxbase. (compare_debug_dump_opt_spec_function): Adjust gkd dump file naming. Spec-quote the computed -fdump-final-insns file name. (debug_auxbase_opt): Drop. (compare_debug_self_opt_spec_function): Drop auxbase-strip computation. (compare_debug_auxbase_opt_spec_function): Drop. (not_actual_file_p): New. (replace_extension_spec_func): Drop. (dumps_spec_func): New. (convert_white_space): Split-out parts into... (quote_string, whitespace_to_convert_p): ... these. New. (quote_spec_char_p, quote_spec, quote_spec_arg): New. (driver::finalize): Release and reset new variables; drop removed ones. * lto-wrapper.c (HAVE_TARGET_EXECUTABLE_SUFFIX): Define if... (TARGET_EXECUTABLE_SUFFIX): ... is defined; define this to the empty string otherwise. (DUMPBASE_SUFFIX): Drop leading period. (debug_objcopy): Use concat. (run_gcc): Recognize -save-temps=* as -save-temps too. Obey -dumpdir. Pass on empty dumpdir and dumpbase with a directory component. Simplify temp file names. * opts.c (finish_options): Drop aux base name handling. (common_handle_option): Drop auxbase-strip handling. * toplev.c (print_switch_values): Drop auxbase, add dumpbase-ext. (process_options): Derive aux_base_name from dump_base_name and dump_base_ext. (lang_dependent_init): Compute dump_base_ext along with dump_base_name. Disable stack usage and callgraph-info during lto generation and compare-debug recompilation. gcc/fortran/ChangeLog: * options.c (gfc_get_option_string): Drop auxbase, add dumpbase_ext. gcc/ada/ChangeLog: * gcc-interface/lang-specs.h: Drop auxbase and auxbase-strip. Use %:dumps instead of -dumpbase. Add %w for implicit .s primary output. * switch.adb (Is_Internal_GCC_Switch): Recognize dumpdir and dumpbase-ext. Drop auxbase and auxbase-strip. lto-plugin/ChangeLog: * lto-plugin.c (skip_in_suffix): New. (exec_lto_wrapper): Use skip_in_suffix and concat to build non-temporary output names. (onload): Look for -dumpdir in COLLECT_GCC_OPTIONS, and override link_output_name with it. contrib/ChangeLog: * compare-debug: Adjust for .gkd files named as dump files, with the source suffix rather than the object suffix. gcc/testsuite/ChangeLog: * gcc.misc-tests/outputs.exp: New. * gcc.misc-tests/outputs-0.c: New. * gcc.misc-tests/outputs-1.c: New. * gcc.misc-tests/outputs-2.c: New. * lib/gcc-defs.exp (gcc_adjusted_linker_flags): New. (gcc_adjust_linker_flags): New. (dg-additional-files-options): Call it. Pass -dumpbase "" when there are additional sources. * lib/profopt.exp (profopt-execute): Pass the executable suffix with -dumpbase-ext. * lib/scandump.exp (dump-base): Mention -dumpbase "" use. * lib/scanltranstree.exp: Adjust dump suffix expectation. * lib/scanwpaipa.exp: Likewise.
2020-05-09Update copyright yearEric Botcazou1-1/+1
2018-10-22trans.c (Pragma_to_gnu): Use a simple memory constraint in all cases.Eric Botcazou1-1/+1
* gcc-interface/trans.c (Pragma_to_gnu) <Pragma_Inspection_Point>: Use a simple memory constraint in all cases. * gcc-interface/lang-specs.h: Bump copyright year. From-SVN: r265378
2018-10-01[Ada] use -gnatd_A to disable .ali on -fcompare-debug recompileAlexandre Oliva1-1/+2
for gcc/ada/ChangeLog * gcc-interface/lang-specs.h (default_compilers): When given fcompare-debug-second, adjust auxbase like cc1, and pass gnatd_A. * gcc-interface/misc.c (flag_compare_debug): Remove variable. (gnat_post_options): Do not set it. * lib-writ.adb (flag_compare_debug): Remove import. (Write_ALI): Do not test it. From-SVN: r264732
2015-10-02lang.opt (fbuiltin-printf): Accept.Doug Rupp1-6/+6
* gcc-interface/lang.opt (fbuiltin-printf): Accept. * gcc-interface/misc.c (gnat_handle_option): Ignore it. * gcc-interface/lang-specs.h (@ada, @adawhy, @adascil): Propagate -f* flags as -g* and -m* flags past -gnatez. Co-Authored-By: Olivier Hainque <hainque@adacore.com> From-SVN: r228381
2015-06-01lang-specs.h (TARGET_VXWORKS_RTP): Simplify and add trailing space.Eric Botcazou1-1/+1
* gcc-interface/lang-specs.h (TARGET_VXWORKS_RTP): Simplify and add trailing space. From-SVN: r223917
2015-06-01lang-specs.h (TARGET_VXWORKS_RTP): Move substitution to before first -gnatez ↵Eric Botcazou1-2/+2
switch. * gcc-interface/lang-specs.h (TARGET_VXWORKS_RTP): Move substitution to before first -gnatez switch. From-SVN: r223916
2012-12-05Make-lang.in: Update dependencies.Arnaud Charlet1-1/+14
* gcc-interface/Make-lang.in: Update dependencies. * gcc-interface/lang.opt: New language AdaSCIL. * gcc-interface/lang-specs.h: Add specs for adascil language. From-SVN: r194216
2011-10-15lang-specs.h: Ensure -mrtp switch is passed when using either rtp-smp or ↵Nicolas Roche1-1/+1
ravenscar-cert-rtp... 2011-10-15 Nicolas Roche <roche@adacore.com> * gcc-interface/lang-specs.h: Ensure -mrtp switch is passed when using either rtp-smp or ravenscar-cert-rtp runtimes. From-SVN: r180026
2011-08-04lang.opt: Add AdaWhy language, simimlar to Ada.Arnaud Charlet1-1/+14
* gcc-interface/lang.opt: Add AdaWhy language, simimlar to Ada. * gcc-interface/lang-specs.h: Add handling of AdaWhy specs (calls gnat1why). From-SVN: r177396
2010-08-03alpha.h (SWITCH_TAKES_ARG): Define.Joseph Myers1-1/+1
* config/alpha/alpha.h (SWITCH_TAKES_ARG): Define. * config/alpha/osf5.h (LIB_SPEC): Don't handle -a. * config/bfin/bfin.h (ASM_SPEC, LINK_SPEC): Don't pass -G* options. * config/darwin.h (WORD_SWITCH_TAKES_ARG): Handle -iframework. * config/ia64/ia64.h (SWITCH_TAKES_ARG): Define. * config/iq2000/iq2000.h (SWITCH_TAKES_ARG): Remove. * config/rs6000/sysv4.h (SWITCH_TAKES_ARG): Define using DEFAULT_SWITCH_TAKES_ARG. * config/rx/rx.opt (-patch=): Remove option. * config/rx/rx.c (rx_handle_option): Don't handle OPT_patch_. * defaults.h (DEFAULT_WORD_SWITCH_TAKES_ARG): Handle -imultilib. * doc/invoke.texi (RX Options): Remove -patch=. * gcc.c (cc1_options): Pass -aux-info* instead of -a* options. (option_map): Remove --profile-blocks, --quiet and --silent. ada: * gcc-interface/lang-specs.h: Don't pass -a options. c-family: * c.opt (-print-pch-checksum): Remove option. * c-opts.c (c_common_handle_option): Don't handle OPT_print_pch_checksum. From-SVN: r162838
2010-06-04gnatlink.adb (gnatlink): Remove support for -fsjlj switch.Eric Botcazou1-4/+1
* gnatlink.adb (gnatlink): Remove support for -fsjlj switch. * gcc-interface/lang-specs.h: Likewise. From-SVN: r160257
2009-06-30utils2.c (build_binary_op): Do not use the type of the left operand if...Eric Botcazou1-1/+1
* gcc-interface/utils2.c (build_binary_op) <MODIFY_EXPR>: Do not use the type of the left operand if it pads a self-referential type when the right operand is a constructor. * gcc-interface/lang-specs.h: Fix copyright date. From-SVN: r149115
2009-05-24switch.adb (Is_Internal_GCC_Switch, [...]): Bodies of ...Olivier Hainque1-0/+1
* switch.adb (Is_Internal_GCC_Switch, Switch_Last): Bodies of ... * switch.ads (Is_Internal_GCC_Switch, Switch_Last): New functions. Add -auxbase variants to the list of recognized internal switches. * back_end.adb (Scan_Back_End_Switches): Use the new functions and adjust comments. * lib.ads: Make comment on internal GCC switches more general. * gcc-interface/lang-specs.h (specs for Ada): Pass -auxbase variants as for C. From-SVN: r147830
2008-11-15gcc.c (cc1_options): Fix comment.Eric Botcazou1-5/+6
* gcc.c (cc1_options): Fix comment. ada/ * gcc-interface/lang-specs.h: Expand -coverage and reorder switches. From-SVN: r141884
2008-11-07re PR ada/34289 (gnatmake -s doesn't work)Bechir Zalila1-1/+2
PR ada/34289 * lib.ads: (Enable_Switch_Storing): Declare. * lib.adb: (Enable_Switch_Storing): New procedure. * switch-c.adb (Scan_Front_End_Switches): Add support for -gnatea. * make.adb: (Compile_Sources.Compile): Add -gnatea as first option. (Display): Never display -gnatea * gcc-interface/lang-specs.h: If -gnatea is present, pass -gnatez. Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com> From-SVN: r141673
2008-07-29gcc-interface: New directory.Arnaud Charlet1-0/+48
* gcc-interface: New directory. * ada-tree.def, cuintp.c, gigi.h, Makefile.in, targtyps.c, ada.h, utils.c, ada-tree.h, decl.c, lang.opt, Make-lang.in, trans.c, config-lang.in, deftarg.c, lang-specs.h, misc.c, utils2.c: Moved to gcc-interface subdirectory. From-SVN: r138246