aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@alumni.cmu.edu>2004-11-29 00:37:54 +0000
committerMatt Kraai <kraai@gcc.gnu.org>2004-11-29 00:37:54 +0000
commita2163d83a300310199ae507af05691166a8287dd (patch)
treec7bfd8aba2f8ca93263b770a18023dfb54d9a4c1 /gcc/opts.c
parent77109b506986bd02bd9ba811e270407bf3b9470c (diff)
downloadgcc-a2163d83a300310199ae507af05691166a8287dd.zip
gcc-a2163d83a300310199ae507af05691166a8287dd.tar.gz
gcc-a2163d83a300310199ae507af05691166a8287dd.tar.bz2
re PR other/17594 (GCC does not error about unknown options which starts with a valid option)
(gcc) PR diagnostic/17594 * opts.c (find_opt): Require that the input match a switch exactly or that the switch take a joined option to be interpreted as a match for another language. (gcc/testsuite) * gcc.dg/funroll-loops-all.c: New. From-SVN: r91444
Diffstat (limited to 'gcc/opts.c')
-rw-r--r--gcc/opts.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/opts.c b/gcc/opts.c
index 188ad29..e930c44 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -176,13 +176,13 @@ find_opt (const char *input, int lang_mask)
{
const struct cl_option *opt = &cl_options[mn];
- /* Is this switch a prefix of the input? */
- if (!strncmp (input, opt->opt_text + 1, opt->opt_len))
+ /* Is the input either an exact match or a prefix that takes a
+ joined argument? */
+ if (!strncmp (input, opt->opt_text + 1, opt->opt_len)
+ && (input[opt->opt_len] == '\0' || (opt->flags & CL_JOINED)))
{
- /* If language is OK, and the match is exact or the switch
- takes a joined argument, return it. */
- if ((opt->flags & lang_mask)
- && (input[opt->opt_len] == '\0' || (opt->flags & CL_JOINED)))
+ /* If language is OK, return it. */
+ if (opt->flags & lang_mask)
return mn;
/* If we haven't remembered a prior match, remember this