options.texi (SeparateAlias): Document.

* doc/options.texi (SeparateAlias): Document.
	* opt-functions.awk (switch_flags): Handle SeparateAlias.
	* opth-gen.awk: Generate enumeration names for options marked
	SeparateAlias, but not for those marked Ignore.
	* opts-common.c (generate_canonical_option): Don't output separate
	argument for options marked CL_SEPARATE_ALIAS.
	(decode_cmdline_option): Handle CL_SEPARATE_ALIAS.
	* opts.h (CL_SEPARATE_ALIAS): New.
	(CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_DRIVER, CL_TARGET,
	CL_COMMON): Adjust definitions.
	* config/i386/darwin.opt, config/mips/sde.opt: New.
	* common.opt (fdump-final-insns): New.
	* config.gcc (i[34567]86-*-darwin*, x86_64-*-darwin*): Add
	i386/darwin.opt.
	(mips*-sde-elf*): Add mips/sde.opt.
	* config/mips/sde.h (DRIVER_SELF_SPECS): Don't handle
	-mno-data-in-code and -mcode-xonly here.
	* defaults.h (DEFAULT_SWITCH_TAKES_ARG): Add 'd'.
	* gcc.c (option_map): Add "j" to --dump entry.
	(translate_options): Don't translate -d to -foutput-class-dir=
	here.

java:
	* lang.opt (d): New.

testsuite:
	* gcc.dg/opts-4.c: New test.

From-SVN: r163844
This commit is contained in:
Joseph Myers 2010-09-03 22:00:05 +01:00 committed by Joseph Myers
parent e6bc4de90d
commit d158303227
17 changed files with 131 additions and 29 deletions

View File

@ -1,3 +1,27 @@
2010-09-03 Joseph Myers <joseph@codesourcery.com>
* doc/options.texi (SeparateAlias): Document.
* opt-functions.awk (switch_flags): Handle SeparateAlias.
* opth-gen.awk: Generate enumeration names for options marked
SeparateAlias, but not for those marked Ignore.
* opts-common.c (generate_canonical_option): Don't output separate
argument for options marked CL_SEPARATE_ALIAS.
(decode_cmdline_option): Handle CL_SEPARATE_ALIAS.
* opts.h (CL_SEPARATE_ALIAS): New.
(CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_DRIVER, CL_TARGET,
CL_COMMON): Adjust definitions.
* config/i386/darwin.opt, config/mips/sde.opt: New.
* common.opt (fdump-final-insns): New.
* config.gcc (i[34567]86-*-darwin*, x86_64-*-darwin*): Add
i386/darwin.opt.
(mips*-sde-elf*): Add mips/sde.opt.
* config/mips/sde.h (DRIVER_SELF_SPECS): Don't handle
-mno-data-in-code and -mcode-xonly here.
* defaults.h (DEFAULT_SWITCH_TAKES_ARG): Add 'd'.
* gcc.c (option_map): Add "j" to --dump entry.
(translate_options): Don't translate -d to -foutput-class-dir=
here.
2010-09-03 Sebastian Pop <sebastian.pop@amd.com> 2010-09-03 Sebastian Pop <sebastian.pop@amd.com>
* tree-data-ref.c (dr_may_alias_p): Replace !DR_IS_READ with * tree-data-ref.c (dr_may_alias_p): Replace !DR_IS_READ with

View File

@ -543,6 +543,9 @@ fdump-
Common Joined RejectNegative Common Joined RejectNegative
-fdump-<type> Dump various compiler internals to a file -fdump-<type> Dump various compiler internals to a file
fdump-final-insns
Driver RejectNegative
fdump-final-insns= fdump-final-insns=
Common RejectNegative Joined Var(flag_dump_final_insns) Common RejectNegative Joined Var(flag_dump_final_insns)
-fdump-final-insns=filename Dump to filename the insns at the end of translation -fdump-final-insns=filename Dump to filename the insns at the end of translation

View File

@ -1135,12 +1135,14 @@ i[34567]86-*-darwin*)
# support. # support.
with_cpu=${with_cpu:-generic} with_cpu=${with_cpu:-generic}
tmake_file="${tmake_file} t-slibgcc-darwin i386/t-crtpc i386/t-crtfm" tmake_file="${tmake_file} t-slibgcc-darwin i386/t-crtpc i386/t-crtfm"
extra_options="${extra_options} i386/darwin.opt"
lto_binary_reader=lto-macho lto_binary_reader=lto-macho
;; ;;
x86_64-*-darwin*) x86_64-*-darwin*)
with_cpu=${with_cpu:-generic} with_cpu=${with_cpu:-generic}
tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc-darwin i386/t-crtpc i386/t-crtfm" tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc-darwin i386/t-crtpc i386/t-crtfm"
tm_file="${tm_file} ${cpu_type}/darwin64.h" tm_file="${tm_file} ${cpu_type}/darwin64.h"
extra_options="${extra_options} i386/darwin.opt"
lto_binary_reader=lto-macho lto_binary_reader=lto-macho
;; ;;
i[34567]86-*-elf*) i[34567]86-*-elf*)
@ -1811,6 +1813,7 @@ mips*-*-openbsd*)
mips*-sde-elf*) mips*-sde-elf*)
tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h" tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h"
tmake_file="mips/t-sde mips/t-libgcc-mips16" tmake_file="mips/t-sde mips/t-libgcc-mips16"
extra_options="${extra_options} mips/sde.opt"
case "${with_newlib}" in case "${with_newlib}" in
yes) yes)
# newlib / libgloss. # newlib / libgloss.

View File

@ -0,0 +1,22 @@
; Darwin options for IA32 port.
;
; Copyright (C) 2010 Free Software Foundation, Inc.
;
; This file is part of GCC.
;
; GCC is free software; you can redistribute it and/or modify it under
; the terms of the GNU General Public License as published by the Free
; Software Foundation; either version 3, or (at your option) any later
; version.
;
; GCC is distributed in the hope that it will be useful, but WITHOUT
; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
; License for more details.
;
; You should have received a copy of the GNU General Public License
; along with GCC; see the file COPYING3. If not see
; <http://www.gnu.org/licenses/>.
mdynamic-no-pic
Target RejectNegative Ignore

View File

@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler. /* Definitions of target machine for GNU compiler.
MIPS SDE version. MIPS SDE version.
Copyright (C) 2003, 2004, 2007, 2008, 2009 Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
@ -42,13 +42,6 @@ along with GCC; see the file COPYING3. If not see
things like LINK_SPEC easier to write. */ \ things like LINK_SPEC easier to write. */ \
"%{!EB:%{!EL:%(endian_spec)}}", \ "%{!EB:%{!EL:%(endian_spec)}}", \
\ \
/* -mcode-xonly is a traditional alias for -mcode-readable=pcrel and \
-mno-data-in-code is a traditional alias for -mcode-readable=no. \
The latter trumps the former. */ \
"%{mno-data-in-code: -mcode-readable=no}", \
"%{!mcode-readable=no: %{mcode-xonly: -mcode-readable=pcrel}}", \
"%<mno-data-in-code %<mcode-xonly", \
\
/* Configuration-independent MIPS rules. */ \ /* Configuration-independent MIPS rules. */ \
BASE_DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS

28
gcc/config/mips/sde.opt Normal file
View File

@ -0,0 +1,28 @@
; MIPS SDE options.
;
; Copyright (C) 2010 Free Software Foundation, Inc.
;
; This file is part of GCC.
;
; GCC is free software; you can redistribute it and/or modify it under
; the terms of the GNU General Public License as published by the Free
; Software Foundation; either version 3, or (at your option) any later
; version.
;
; GCC is distributed in the hope that it will be useful, but WITHOUT
; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
; License for more details.
;
; You should have received a copy of the GNU General Public License
; along with GCC; see the file COPYING3. If not see
; <http://www.gnu.org/licenses/>.
; -mcode-xonly is a traditional alias for -mcode-readable=pcrel and
; -mno-data-in-code is a traditional alias for -mcode-readable=no.
mno-data-in-code
Target RejectNegative Alias(mcode-readable=, no)
mcode-xonly
Target RejectNegative Alias(mcode-readable=, pcrel)

View File

@ -39,7 +39,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|| (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
|| (CHAR) == 'I' || (CHAR) == 'J' || (CHAR) == 'm' \ || (CHAR) == 'I' || (CHAR) == 'J' || (CHAR) == 'm' \
|| (CHAR) == 'x' || (CHAR) == 'L' || (CHAR) == 'A' \ || (CHAR) == 'x' || (CHAR) == 'L' || (CHAR) == 'A' \
|| (CHAR) == 'B' ) || (CHAR) == 'B' || (CHAR) == 'd')
/* This defines which multi-letter switches take arguments. */ /* This defines which multi-letter switches take arguments. */

View File

@ -278,6 +278,13 @@ This option is ignored apart from printing any warning specified using
@code{Warn}. The option will not be seen by specs and no @samp{OPT_} @code{Warn}. The option will not be seen by specs and no @samp{OPT_}
enumeration value is defined for it. enumeration value is defined for it.
@item SeparateAlias
For an option marked with @code{Joined}, @code{Separate} and
@code{Alias}, the option only acts as an alias when passed a separate
argument; with a joined argument it acts as a normal option, with an
@samp{OPT_} enumeration value. This is for compatibility with the
Java @option{-d} option and should not be used for new options.
@item Warn(@var{message}) @item Warn(@var{message})
If this option is used, output the warning @var{message}. If this option is used, output the warning @var{message}.
@var{message} is a format string, either taking a single operand with @var{message} is a format string, either taking a single operand with

View File

@ -1085,7 +1085,7 @@ static const struct option_map option_map[] =
{"--debug", "-g", "oj"}, {"--debug", "-g", "oj"},
{"--define-macro", "-D", "aj"}, {"--define-macro", "-D", "aj"},
{"--dependencies", "-M", 0}, {"--dependencies", "-M", 0},
{"--dump", "-d", "a"}, {"--dump", "-d", "aj"},
{"--dumpbase", "-dumpbase", "a"}, {"--dumpbase", "-dumpbase", "a"},
{"--dumpdir", "-dumpdir", "a"}, {"--dumpdir", "-dumpdir", "a"},
{"--encoding", "-fencoding=", "aj"}, {"--encoding", "-fencoding=", "aj"},
@ -1368,16 +1368,6 @@ translate_options (int *argcp, const char *const **argvp)
if (nskip + i > argc) if (nskip + i > argc)
nskip = argc - i; nskip = argc - i;
/* Convert -d with a separate argument to
-foutput-class-dir= for Java. */
if (c == 'd' && p[1] == 0 && argv[i + 1] != NULL)
{
newv[newindex++] = concat ("-foutput-class-dir=", argv[i + 1],
NULL);
nskip = 0;
i += 2;
}
while (nskip > 0) while (nskip > 0)
{ {
newv[newindex++] = argv[i++]; newv[newindex++] = argv[i++];

View File

@ -1,3 +1,7 @@
2010-09-03 Joseph Myers <joseph@codesourcery.com>
* lang.opt (d): New.
2010-09-03 H.J. Lu <hongjiu.lu@intel.com> 2010-09-03 H.J. Lu <hongjiu.lu@intel.com>
PR java/45504 PR java/45504

View File

@ -93,6 +93,10 @@ Java Separate Alias(fbootclasspath=)
classpath classpath
Java Separate Alias(fclasspath=) Java Separate Alias(fclasspath=)
d
Java Separate SeparateAlias Alias(foutput-class-dir=)
; Different from language-independent -d with joined argument.
encoding encoding
Java Separate Alias(fencoding=) Java Separate Alias(fencoding=)

View File

@ -81,6 +81,7 @@ function switch_flags (flags)
test_flag("Driver", flags, " | CL_DRIVER") \ test_flag("Driver", flags, " | CL_DRIVER") \
test_flag("RejectDriver", flags, " | CL_REJECT_DRIVER") \ test_flag("RejectDriver", flags, " | CL_REJECT_DRIVER") \
test_flag("NoDriverArg", flags, " | CL_NO_DRIVER_ARG") \ test_flag("NoDriverArg", flags, " | CL_NO_DRIVER_ARG") \
test_flag("SeparateAlias", flags, " | CL_SEPARATE_ALIAS") \
test_flag("Save", flags, " | CL_SAVE") \ test_flag("Save", flags, " | CL_SAVE") \
test_flag("Joined", flags, " | CL_JOINED") \ test_flag("Joined", flags, " | CL_JOINED") \
test_flag("JoinedOrMissing", flags, " | CL_JOINED | CL_MISSING_OK") \ test_flag("JoinedOrMissing", flags, " | CL_JOINED | CL_MISSING_OK") \

View File

@ -334,7 +334,9 @@ for (i = 0; i < n_opts; i++) {
enum_string = enum " = " enum_value "," enum_string = enum " = " enum_value ","
# Aliases do not get enumeration names. # Aliases do not get enumeration names.
if (flag_set_p("Alias.*", flags[i])) { if ((flag_set_p("Alias.*", flags[i]) \
&& !flag_set_p("SeparateAlias", flags[i])) \
|| flag_set_p("Ignore", flags[i])) {
enum_string = "/* " enum_string " */" enum_string = "/* " enum_string " */"
} }

View File

@ -174,7 +174,8 @@ generate_canonical_option (size_t opt_index, const char *arg, int value,
if (arg) if (arg)
{ {
if (option->flags & CL_SEPARATE) if ((option->flags & CL_SEPARATE)
&& !(option->flags & CL_SEPARATE_ALIAS))
{ {
decoded->canonical_option[0] = opt_text; decoded->canonical_option[0] = opt_text;
decoded->canonical_option[1] = arg; decoded->canonical_option[1] = arg;
@ -217,6 +218,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
const char *warn_message = NULL; const char *warn_message = NULL;
bool separate_arg_flag; bool separate_arg_flag;
bool joined_arg_flag; bool joined_arg_flag;
bool have_separate_arg = false;
opt = argv[0]; opt = argv[0];
@ -286,6 +288,8 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
result = 2; result = 2;
if (arg == NULL) if (arg == NULL)
result = 1; result = 1;
else
have_separate_arg = true;
} }
else else
/* Missing argument. */ /* Missing argument. */
@ -298,6 +302,8 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
result = 2; result = 2;
if (arg == NULL) if (arg == NULL)
result = 1; result = 1;
else
have_separate_arg = true;
} }
if (arg == NULL && (separate_arg_flag || joined_arg_flag)) if (arg == NULL && (separate_arg_flag || joined_arg_flag))
@ -305,7 +311,8 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
/* Is this option an alias (or an ignored option, marked as an alias /* Is this option an alias (or an ignored option, marked as an alias
of OPT_SPECIAL_ignore)? */ of OPT_SPECIAL_ignore)? */
if (option->alias_target != N_OPTS) if (option->alias_target != N_OPTS
&& (!(option->flags & CL_SEPARATE_ALIAS) || have_separate_arg))
{ {
size_t new_opt_index = option->alias_target; size_t new_opt_index = option->alias_target;

View File

@ -71,12 +71,12 @@ extern const unsigned int cl_options_count;
extern const char *const lang_names[]; extern const char *const lang_names[];
extern const unsigned int cl_lang_count; extern const unsigned int cl_lang_count;
#define CL_PARAMS (1 << 14) /* Fake entry. Used to display --param info with --help. */ #define CL_PARAMS (1 << 13) /* Fake entry. Used to display --param info with --help. */
#define CL_WARNING (1 << 15) /* Enables an (optional) warning message. */ #define CL_WARNING (1 << 14) /* Enables an (optional) warning message. */
#define CL_OPTIMIZATION (1 << 16) /* Enables an (optional) optimization. */ #define CL_OPTIMIZATION (1 << 15) /* Enables an (optional) optimization. */
#define CL_DRIVER (1 << 17) /* Driver option. */ #define CL_DRIVER (1 << 16) /* Driver option. */
#define CL_TARGET (1 << 18) /* Target-specific option. */ #define CL_TARGET (1 << 17) /* Target-specific option. */
#define CL_COMMON (1 << 19) /* Language-independent. */ #define CL_COMMON (1 << 18) /* Language-independent. */
#define CL_MIN_OPTION_CLASS CL_PARAMS #define CL_MIN_OPTION_CLASS CL_PARAMS
#define CL_MAX_OPTION_CLASS CL_COMMON #define CL_MAX_OPTION_CLASS CL_COMMON
@ -86,6 +86,7 @@ extern const unsigned int cl_lang_count;
This distinction is important because --help will not list options This distinction is important because --help will not list options
which only have these higher bits set. */ which only have these higher bits set. */
#define CL_SEPARATE_ALIAS (1 << 19) /* Option is an alias when used with separate argument. */
#define CL_NO_DRIVER_ARG (1 << 20) /* Option takes no argument in the driver. */ #define CL_NO_DRIVER_ARG (1 << 20) /* Option takes no argument in the driver. */
#define CL_REJECT_DRIVER (1 << 21) /* Reject this option in the driver. */ #define CL_REJECT_DRIVER (1 << 21) /* Reject this option in the driver. */
#define CL_SAVE (1 << 22) /* Target-specific option for attribute. */ #define CL_SAVE (1 << 22) /* Target-specific option for attribute. */

View File

@ -1,3 +1,7 @@
2010-09-03 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/opts-4.c: New test.
2010-09-03 Steve Ellcey <sje@cup.hp.com> 2010-09-03 Steve Ellcey <sje@cup.hp.com>
* gcc.dg/vect/vect-peel-3.c: XFAIL if vect_no_align. * gcc.dg/vect/vect-peel-3.c: XFAIL if vect_no_align.

View File

@ -0,0 +1,9 @@
/* --dump= should translate to -d with joined operand. */
/* { dg-do compile } */
/* { dg-options "--dump=a" } */
void f (void)
{
}
/* { dg-final { cleanup-rtl-dump "*" } } */