OSDN Git Service

2009-05-13 Jonathan Wakely <jwakely.gcc@gmail.com>
[pf3gnuchains/gcc-fork.git] / gcc / opts-common.c
index f3f6542..d3cefe8 100644 (file)
@@ -1,11 +1,11 @@
 /* Command line option handling.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
 GCC is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
 version.
 
 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -14,9 +14,8 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
 #include "system.h"
@@ -39,7 +38,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
    before having tested "-g".  This doesn't match, and as "-gen-decls"
    is less than "-gstabs", it will become the lower bound of the
    binary search range, and "-g" will never be seen.  To resolve this
-   issue, opts.sh makes "-gen-decls" point, via the back_chain member,
+   issue, 'optc-gen.awk' makes "-gen-decls" point, via the back_chain member,
    to "-g" so that failed searches that end between "-gen-decls" and
    the lexicographically subsequent switch know to go back and see if
    "-g" causes a match (which it does in this example).
@@ -132,8 +131,8 @@ void
 prune_options (int *argcp, char ***argvp)
 {
   int argc = *argcp;
-  int *options = xmalloc (argc * sizeof (*options));
-  char **argv = xmalloc (argc * sizeof (char *));
+  int *options = XNEWVEC (int, argc);
+  char **argv = XNEWVEC (char *, argc);
   int i, arg_count, need_prune = 0;
   const struct cl_option *option;
   size_t opt_index;
@@ -175,6 +174,10 @@ cont:
       if (option->neg_index < 0)
        goto cont;
 
+      /* Skip joined switches.  */
+      if ((option->flags & CL_JOINED))
+       goto cont;
+
       /* Reject negative form of switches that don't take negatives as
         unrecognized.  */
       if (!value && (option->flags & CL_REJECT_NEGATIVE))