aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts-common.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-08-16 11:17:07 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2010-08-16 11:17:07 +0100
commitc878765bbf32e3c3505417771f94015da69a33b8 (patch)
tree62c0d7f7821118115c0a4344974133ad19963247 /gcc/opts-common.c
parent603349bf3ddd56a90ad8091a41038f0c38eb4838 (diff)
downloadgcc-c878765bbf32e3c3505417771f94015da69a33b8.zip
gcc-c878765bbf32e3c3505417771f94015da69a33b8.tar.gz
gcc-c878765bbf32e3c3505417771f94015da69a33b8.tar.bz2
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
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 f7c1040..1296653 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. */