Comments

This patch is relative to a tree with
<http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01968.html>,
<http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02150.html> and
<http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02260.html> applied.
The first of these patches needs C++ and Ada pieces approved; the
second needs C++ pieces approved; the third needs approval for
everything except c-family, Fortran and Java pieces.
The driver handles some options solely on the basis of specs and the
target macros SWITCH_TAKES_ARG and WORD_SWITCH_TAKES_ARG with no more
structured information about these options. Although I plan to move
to .opt files having structured information about all options for all
targets (since some such unstructured specs-only options are used in
multilib selection, so such changes are required when multilib
selection ceases to be textually based), an intermediate stage
involved in reaching that point incrementally will have the driver
using shared option processing code for some purposes but still
passing through specs-only options for use in existing
specs-processing code.
Thus the shared option processing code should be able to handle
unknown options using SWITCH_TAKES_ARG and WORD_SWITCH_TAKES_ARG,
until more structured information eliminates those macros, and this
patch implements this. (Right now it should only have any effect when
cc1 etc. are called directly, since it does nothing for options known
to the core compiler and the other options should not get passed
through to the core compiler.)
One complication is that SWITCH_TAKES_ARG and WORD_SWITCH_TAKES_ARG
can specify options taking more than one argument, a concept not yet
known to the .opt machinery. Thus, some common options code is
adjusted to handle such options to the extent of storing multiple argv
elements appropriately in the decoded option structure.
Bootstrapped with no regressions on x86_64-unknown-linux-gnu. OK to
commit?
2010-06-23 Joseph Myers <joseph@codesourcery.com>
* config/darwin-driver.c (SWITCH_TAKES_ARG,
WORD_SWITCH_TAKES_ARG): Remove.
* cppspec.c (SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG): Remove.
* defaults.h (DEFAULT_SWITCH_TAKES_ARG,
DEFAULT_WORD_SWITCH_TAKES_ARG): Move from gcc.h.
(SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG): Move default
definitions from gcc.c.
* gcc.c (SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG): Move to
defaults.h.
* gcc.h (DEFAULT_SWITCH_TAKES_ARG, DEFAULT_WORD_SWITCH_TAKES_ARG):
Move to defaults.h.
* opts-common.c: Include tm.h.
(decode_cmdline_option): Use SWITCH_TAKES_ARG and
WORD_SWITCH_TAKES_ARG to count arguments to unknown options.
Handle more than one argument. Set canonical_option_num_elements.
(decode_cmdline_options_to_array): Set
canonical_option_num_elements and trailing elements of
canonical_option.
* opts.h (struct cl_decoded_option): Allow four elements in
canonical_option. Add field canonical_option_num_elements.
* Makefile.in (opts-common.o): Update dependencies.
ada:
2010-06-23 Joseph Myers <joseph@codesourcery.com>
* gcc-interface/misc.c (gnat_init_options): Ignore erroneous
options. Check canonical_option_num_elements on options copied.
fortran:
2010-06-23 Joseph Myers <joseph@codesourcery.com>
* gfortranspec.c (SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG):
Remove.