re PR other/17594 (GCC does not error about unknown options which starts with a valid...
authorMatt Kraai <kraai@alumni.cmu.edu>
Mon, 29 Nov 2004 00:37:54 +0000 (00:37 +0000)
committerMatt Kraai <kraai@gcc.gnu.org>
Mon, 29 Nov 2004 00:37:54 +0000 (00:37 +0000)
(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

gcc/ChangeLog
gcc/opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/funroll-loops-all.c [new file with mode: 0644]

index 2528870c293f9632aa3e6282efcc9ca1e4f41467..73e6ad9f1d91ecf2e62f760610aa8ba8412fbb3d 100644 (file)
@@ -1,3 +1,10 @@
+2004-11-28  Matt Kraai  <kraai@alumni.cmu.edu>
+
+       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.
+
 2004-11-28  Andrew Pinski  <pinskia@physics.uc.edu>
 
        * timevar.def (TV_TREE_REDPHI): New timevar.
index 188ad29a8ade3b1c4e3a1b0d47942bb3018a61e0..e930c44c0fc118701d1ca0b768987939dd8b0d4e 100644 (file)
@@ -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
index 8e56d03987a78416579fe3f0027539eedd894485..94174d9725948bc29efcd95343d701f22f991fe6 100644 (file)
@@ -1,3 +1,7 @@
+2004-11-28  Matt Kraai  <kraai@alumni.cmu.edu>
+
+       * gcc.dg/funroll-loops-all.c: New.
+
 2004-11-28  Hans-Peter Nilsson  <hp@bitrange.com>
 
        PR target/18489
diff --git a/gcc/testsuite/gcc.dg/funroll-loops-all.c b/gcc/testsuite/gcc.dg/funroll-loops-all.c
new file mode 100644 (file)
index 0000000..c627675
--- /dev/null
@@ -0,0 +1,4 @@
+/* PR 17594 */
+/* { dg-do compile } */
+/* { dg-options "-funroll-loops-all" } */
+/* { dg-error "unrecognized command line option \"-funroll-loops-all\"" "" { target *-*-* } 0 } */