Commit c878765b by Joseph Myers Committed by Joseph Myers

options.texi (NoDriverArg): Document.

	* doc/options.texi (NoDriverArg): Document.
	* gcc.c (cpp_unique_options): Generate -MD and -MMD instead of
	-MDX and -MMDX.
	* opt-functions.awk (switch_flags): Handle NoDriverArg.
	* opts-common.c (decode_cmdline_option): Ignore CL_SEPARATE
	marking for CL_NO_DRIVER_ARG options when in the driver.
	* opts.h (CL_NO_DRIVER_ARG): Define.
	(CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_DRIVER, CL_TARGET,
	CL_COMMON): Update values.

c-family:
	* c.opt (MDX): Change back to MD.  Mark NoDriverArg instead of
	RejectDriver.
	(MMDX): Change back to MMD.  Mark NoDriverArg instead of
	RejectDriver.
	* c-opts.c (c_common_handle_option): Use OPT_MD and OPT_MMD
	instead of OPT_MDX and OPT_MMDX.

fortran:
	* lang.opt (MDX): Change back to MD.  Mark NoDriverArg instead of
	RejectDriver.
	(MMDX): Change back to MMD.  Mark NoDriverArg instead of
	RejectDriver.
	* cpp.c (gfc_cpp_handle_option): Use OPT_MD and OPT_MMD instead of
	OPT_MDX and OPT_MMDX.

From-SVN: r163280
parent 603349bf
2010-08-16 Joseph Myers <joseph@codesourcery.com> 2010-08-16 Joseph Myers <joseph@codesourcery.com>
* doc/options.texi (NoDriverArg): Document.
* gcc.c (cpp_unique_options): Generate -MD and -MMD instead of
-MDX and -MMDX.
* opt-functions.awk (switch_flags): Handle NoDriverArg.
* opts-common.c (decode_cmdline_option): Ignore CL_SEPARATE
marking for CL_NO_DRIVER_ARG options when in the driver.
* opts.h (CL_NO_DRIVER_ARG): Define.
(CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_DRIVER, CL_TARGET,
CL_COMMON): Update values.
2010-08-16 Joseph Myers <joseph@codesourcery.com>
* common.opt: Add driver options. * common.opt: Add driver options.
(auxbase, auxbase-strip, quiet, version): Mark RejectDriver. (auxbase, auxbase-strip, quiet, version): Mark RejectDriver.
* doc/options.texi (Driver, RejectDriver): Document. * doc/options.texi (Driver, RejectDriver): Document.
......
2010-08-16 Joseph Myers <joseph@codesourcery.com> 2010-08-16 Joseph Myers <joseph@codesourcery.com>
* c.opt (MDX): Change back to MD. Mark NoDriverArg instead of
RejectDriver.
(MMDX): Change back to MMD. Mark NoDriverArg instead of
RejectDriver.
* c-opts.c (c_common_handle_option): Use OPT_MD and OPT_MMD
instead of OPT_MDX and OPT_MMDX.
2010-08-16 Joseph Myers <joseph@codesourcery.com>
* c.opt (MDX, MMDX, lang-asm): Mark RejectDriver. * c.opt (MDX, MMDX, lang-asm): Mark RejectDriver.
2010-08-12 Joseph Myers <joseph@codesourcery.com> 2010-08-12 Joseph Myers <joseph@codesourcery.com>
......
...@@ -398,9 +398,9 @@ c_common_handle_option (size_t scode, const char *arg, int value, ...@@ -398,9 +398,9 @@ c_common_handle_option (size_t scode, const char *arg, int value,
flag_no_output = 1; flag_no_output = 1;
break; break;
case OPT_MDX: case OPT_MD:
case OPT_MMDX: case OPT_MMD:
cpp_opts->deps.style = (code == OPT_MDX ? DEPS_SYSTEM: DEPS_USER); cpp_opts->deps.style = (code == OPT_MD ? DEPS_SYSTEM: DEPS_USER);
cpp_opts->deps.need_preprocessor_output = true; cpp_opts->deps.need_preprocessor_output = true;
deps_file = arg; deps_file = arg;
break; break;
......
...@@ -72,9 +72,9 @@ M ...@@ -72,9 +72,9 @@ M
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Generate make dependencies Generate make dependencies
MDX MD
C ObjC C++ ObjC++ RejectDriver Separate MissingArgError(missing filename after %qs) C ObjC C++ ObjC++ NoDriverArg Separate MissingArgError(missing filename after %qs)
-MD Generate make dependencies and compile Generate make dependencies and compile
MF MF
C ObjC C++ ObjC++ Joined Separate MissingArgError(missing filename after %qs) C ObjC C++ ObjC++ Joined Separate MissingArgError(missing filename after %qs)
...@@ -88,9 +88,9 @@ MM ...@@ -88,9 +88,9 @@ MM
C ObjC C++ ObjC++ C ObjC C++ ObjC++
Like -M but ignore system header files Like -M but ignore system header files
MMDX MMD
C ObjC C++ ObjC++ RejectDriver Separate MissingArgError(missing filename after %qs) C ObjC C++ ObjC++ NoDriverArg Separate MissingArgError(missing filename after %qs)
-MMD Like -MD but ignore system header files Like -MD but ignore system header files
MP MP
C ObjC C++ ObjC++ C ObjC C++ ObjC++
......
...@@ -159,6 +159,12 @@ option handler. @code{UInteger} should also be used on options like ...@@ -159,6 +159,12 @@ option handler. @code{UInteger} should also be used on options like
@code{-falign-loops}=@var{n} are supported to make sure the saved @code{-falign-loops}=@var{n} are supported to make sure the saved
options are given a full integer. options are given a full integer.
@item NoDriverArg
For an option marked @code{Separate}, the option only takes an
argument in the compiler proper, not in the driver. This is for
compatibility with existing options that are used both directly and
via @option{-Wp,}; new options should not have this property.
@item Var(@var{var}) @item Var(@var{var})
The state of this option should be stored in variable @var{var}. The state of this option should be stored in variable @var{var}.
The way that the state is stored depends on the type of option: The way that the state is stored depends on the type of option:
......
2010-08-16 Joseph Myers <joseph@codesourcery.com> 2010-08-16 Joseph Myers <joseph@codesourcery.com>
* lang.opt (MDX): Change back to MD. Mark NoDriverArg instead of
RejectDriver.
(MMDX): Change back to MMD. Mark NoDriverArg instead of
RejectDriver.
* cpp.c (gfc_cpp_handle_option): Use OPT_MD and OPT_MMD instead of
OPT_MDX and OPT_MMDX.
2010-08-16 Joseph Myers <joseph@codesourcery.com>
* lang.opt (MDX, MMDX): Mark RejectDriver. * lang.opt (MDX, MMDX): Mark RejectDriver.
2010-08-15 Janus Weil <janus@gcc.gnu.org> 2010-08-15 Janus Weil <janus@gcc.gnu.org>
......
...@@ -456,11 +456,11 @@ gfc_cpp_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED ...@@ -456,11 +456,11 @@ gfc_cpp_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED
gfc_cpp_option.deps = 1; gfc_cpp_option.deps = 1;
break; break;
case OPT_MMDX: case OPT_MMD:
gfc_cpp_option.deps_skip_system = 1; gfc_cpp_option.deps_skip_system = 1;
/* fall through */ /* fall through */
case OPT_MDX: case OPT_MD:
gfc_cpp_option.deps = 1; gfc_cpp_option.deps = 1;
gfc_cpp_option.deps_filename = arg; gfc_cpp_option.deps_filename = arg;
break; break;
......
...@@ -60,8 +60,8 @@ M ...@@ -60,8 +60,8 @@ M
Fortran Fortran
; Documented in C ; Documented in C
MDX MD
Fortran Separate RejectDriver Fortran Separate NoArgDriver
; Documented in C ; Documented in C
MF MF
...@@ -76,8 +76,8 @@ MM ...@@ -76,8 +76,8 @@ MM
Fortran Fortran
; Documented in C ; Documented in C
MMDX MMD
Fortran Separate RejectDriver Fortran Separate NoArgDriver
; Documented in C ; Documented in C
MP MP
......
...@@ -767,8 +767,8 @@ static const char *trad_capable_cpp = ...@@ -767,8 +767,8 @@ static const char *trad_capable_cpp =
file that happens to exist is up-to-date. */ file that happens to exist is up-to-date. */
static const char *cpp_unique_options = static const char *cpp_unique_options =
"%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I\ "%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I\
%{MD:-MDX %{!o:%b.d}%{o*:%.d%*}}\ %{MD:-MD %{!o:%b.d}%{o*:%.d%*}}\
%{MMD:-MMDX %{!o:%b.d}%{o*:%.d%*}}\ %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}}\
%{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\ %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
%{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}}\ %{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}}\
%{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD}\ %{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD}\
......
...@@ -80,6 +80,7 @@ function switch_flags (flags) ...@@ -80,6 +80,7 @@ function switch_flags (flags)
test_flag("Target", flags, " | CL_TARGET") \ test_flag("Target", flags, " | CL_TARGET") \
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("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") \
......
...@@ -145,6 +145,8 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, ...@@ -145,6 +145,8 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
char *p; char *p;
const struct cl_option *option; const struct cl_option *option;
int errors = 0; int errors = 0;
bool separate_arg_flag;
bool joined_arg_flag;
opt = argv[0]; opt = argv[0];
...@@ -186,8 +188,15 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, ...@@ -186,8 +188,15 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
if (option->flags & CL_DISABLED) if (option->flags & CL_DISABLED)
errors |= CL_ERR_DISABLED; errors |= CL_ERR_DISABLED;
/* Determine whether there may be a separate argument based on
whether this option is being processed for the driver. */
separate_arg_flag = ((option->flags & CL_SEPARATE)
&& !((option->flags & CL_NO_DRIVER_ARG)
&& (lang_mask & CL_DRIVER)));
joined_arg_flag = (option->flags & CL_JOINED) != 0;
/* Sort out any argument the switch takes. */ /* Sort out any argument the switch takes. */
if (option->flags & CL_JOINED) if (joined_arg_flag)
{ {
/* Have arg point to the original switch. This is because /* Have arg point to the original switch. This is because
some code, such as disable_builtin_function, expects its some code, such as disable_builtin_function, expects its
...@@ -198,7 +207,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, ...@@ -198,7 +207,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
if (*arg == '\0' && !(option->flags & CL_MISSING_OK)) if (*arg == '\0' && !(option->flags & CL_MISSING_OK))
{ {
if (option->flags & CL_SEPARATE) if (separate_arg_flag)
{ {
arg = argv[1]; arg = argv[1];
result = 2; result = 2;
...@@ -210,7 +219,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, ...@@ -210,7 +219,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
arg = NULL; arg = NULL;
} }
} }
else if (option->flags & CL_SEPARATE) else if (separate_arg_flag)
{ {
arg = argv[1]; arg = argv[1];
result = 2; result = 2;
...@@ -228,7 +237,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, ...@@ -228,7 +237,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
are specified. */ are specified. */
errors |= CL_ERR_WRONG_LANG; errors |= CL_ERR_WRONG_LANG;
if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE))) if (arg == NULL && (separate_arg_flag || joined_arg_flag))
errors |= CL_ERR_MISSING_ARG; errors |= CL_ERR_MISSING_ARG;
/* If the switch takes an integer, convert it. */ /* If the switch takes an integer, convert it. */
......
...@@ -67,12 +67,12 @@ extern const unsigned int cl_options_count; ...@@ -67,12 +67,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 << 15) /* Fake entry. Used to display --param info with --help. */ #define CL_PARAMS (1 << 14) /* Fake entry. Used to display --param info with --help. */
#define CL_WARNING (1 << 16) /* Enables an (optional) warning message. */ #define CL_WARNING (1 << 15) /* Enables an (optional) warning message. */
#define CL_OPTIMIZATION (1 << 17) /* Enables an (optional) optimization. */ #define CL_OPTIMIZATION (1 << 16) /* Enables an (optional) optimization. */
#define CL_DRIVER (1 << 18) /* Driver option. */ #define CL_DRIVER (1 << 17) /* Driver option. */
#define CL_TARGET (1 << 19) /* Target-specific option. */ #define CL_TARGET (1 << 18) /* Target-specific option. */
#define CL_COMMON (1 << 20) /* Language-independent. */ #define CL_COMMON (1 << 19) /* 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
...@@ -82,6 +82,7 @@ extern const unsigned int cl_lang_count; ...@@ -82,6 +82,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_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. */
#define CL_DISABLED (1 << 23) /* Disabled in this configuration. */ #define CL_DISABLED (1 << 23) /* Disabled in this configuration. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment