summaryrefslogtreecommitdiff
path: root/gcc/opts-common.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-16 10:17:07 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-16 10:17:07 +0000
commit89c698921de18725963b2c4061894ac4bc0b1a8a (patch)
tree62c0d7f7821118115c0a4344974133ad19963247 /gcc/opts-common.c
parente28aa11462a447d3a30e8a53a7058d1158e33e5f (diff)
downloadgcc-89c698921de18725963b2c4061894ac4bc0b1a8a.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163280 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/opts-common.c')
-rw-r--r--gcc/opts-common.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index f7c10407c38..1296653ece5 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -145,6 +145,8 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
char *p;
const struct cl_option *option;
int errors = 0;
+ bool separate_arg_flag;
+ bool joined_arg_flag;
opt = argv[0];
@@ -186,8 +188,15 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
if (option->flags & CL_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. */
- if (option->flags & CL_JOINED)
+ if (joined_arg_flag)
{
/* Have arg point to the original switch. This is because
some code, such as disable_builtin_function, expects its
@@ -198,7 +207,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
if (*arg == '\0' && !(option->flags & CL_MISSING_OK))
{
- if (option->flags & CL_SEPARATE)
+ if (separate_arg_flag)
{
arg = argv[1];
result = 2;
@@ -210,7 +219,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
arg = NULL;
}
}
- else if (option->flags & CL_SEPARATE)
+ else if (separate_arg_flag)
{
arg = argv[1];
result = 2;
@@ -228,7 +237,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
are specified. */
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;
/* If the switch takes an integer, convert it. */