OSDN Git Service

2009-12-14 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
[pf3gnuchains/gcc-fork.git] / gcc / optc-gen.awk
index 845efb4..992e4d3 100644 (file)
@@ -1,4 +1,4 @@
-#  Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+#  Copyright (C) 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
 #  Contributed by Kelley Cook, June 2004.
 #  Original code from Neil Booth, May 2003.
 #
@@ -53,6 +53,8 @@ BEGIN {
                                opts[n_opts]  = $1
                                flags[n_opts] = $2
                                help[n_opts]  = $3
+                               for (i = 4; i <= NF; i++)
+                                       help[n_opts] = help[n_opts] " " $i
                                n_opts++;
                        }
                }
@@ -145,6 +147,12 @@ for (i = 0; i < n_opts; i++) {
        # ends, for example.
        while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
                flags[i + 1] = flags[i] " " flags[i + 1];
+               if (help[i + 1] == "")
+                       help[i + 1] = help[i]
+               else if (help[i] != "" && help[i + 1] != help[i])
+                       print "warning: multiple different help strings for " \
+                               opts[i] ":\n\t" help[i] "\n\t" help[i + 1] \
+                               | "cat 1>&2"
                i++;
                back_chain[i] = "N_OPTS";
                indices[opts[i]] = j;
@@ -153,11 +161,10 @@ for (i = 0; i < n_opts; i++) {
 }
 
 for (i = 0; i < n_opts; i++) {
-       # Combine the flags of identical switches.  Switches
-       # appear many times if they are handled by many front
-       # ends, for example.
+       # With identical flags, pick only the last one.  The
+       # earlier loop ensured that it has all flags merged,
+       # and a nonempty help text if one of the texts was nonempty.
        while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
-               flags[i + 1] = flags[i] " " flags[i + 1];
                i++;
        }
 
@@ -225,7 +232,7 @@ for (i = 0; i < n_opts; i++) {
 print "};"
 
 print "";
-print "#if !defined(GCC_DRIVER) && !defined(IN_LIBGCC2)"
+print "#if !defined(GCC_DRIVER) && !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)"
 print "";
 print "/* Save optimization variables into a structure.  */"
 print "void";
@@ -320,6 +327,7 @@ for (i = 0; i < n_opt_char; i++) {
        print "  " var_opt_char[i] " = ptr->" var_opt_char[i] ";";
 }
 
+print "  targetm.override_options_after_change ();";
 print "}";
 
 print "";