OSDN Git Service

* doc/install.texi (Specific, i?86-*-solaris2.10): Fix grammar.
[pf3gnuchains/gcc-fork.git] / gcc / opt-functions.awk
index 3e4c805..4eeb67b 100644 (file)
@@ -1,10 +1,11 @@
-#  Copyright (C) 2003,2004 Free Software Foundation, Inc.
+#  Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010
+#  Free Software Foundation, Inc.
 #  Contributed by Kelley Cook, June 2004.
 #  Original code from Neil Booth, May 2003.
 #
 # This program 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
+# Free Software Foundation; either version 3, or (at your option) any
 # later version.
 # 
 # This program is distributed in the hope that it will be useful,
@@ -13,8 +14,8 @@
 # GNU General Public License for more details.
 # 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
 
 # Some common subroutines for use by opt[ch]-gen.awk.
 
@@ -41,7 +42,13 @@ function opt_args(name, flags)
        if (flags !~ " " name "\\(")
                return ""
        sub(".* " name "\\(", "", flags)
-       sub("\\).*", "", flags)
+       if (flags ~ "^{")
+       {
+               sub ("^{", "", flags)
+               sub("}\\).*", "", flags)
+       }
+       else
+               sub("\\).*", "", flags)
 
        return flags
 }
@@ -71,12 +78,15 @@ function switch_flags (flags)
        result = result \
          test_flag("Common", flags, " | CL_COMMON") \
          test_flag("Target", flags, " | CL_TARGET") \
+         test_flag("Save", flags, " | CL_SAVE") \
          test_flag("Joined", flags, " | CL_JOINED") \
          test_flag("JoinedOrMissing", flags, " | CL_JOINED | CL_MISSING_OK") \
          test_flag("Separate", flags, " | CL_SEPARATE") \
          test_flag("RejectNegative", flags, " | CL_REJECT_NEGATIVE") \
          test_flag("UInteger", flags, " | CL_UINTEGER") \
          test_flag("Undocumented", flags,  " | CL_UNDOCUMENTED") \
+         test_flag("Warning", flags,  " | CL_WARNING") \
+         test_flag("Optimization", flags,  " | CL_OPTIMIZATION") \
          test_flag("Report", flags, " | CL_REPORT")
        sub( "^0 \\| ", "", result )
        return result
@@ -126,6 +136,23 @@ function var_type(flags)
                return "const char *"
 }
 
+# Return the type of variable that should be associated with the given flags
+# for use within a structure.  Simple variables are changed to signed char
+# type instead of int to save space.
+function var_type_struct(flags)
+{
+       if (flag_set_p("UInteger", flags))
+               return "int "
+       else if (!flag_set_p("Joined.*", flags)) {
+               if (flag_set_p(".*Mask.*", flags))
+                       return "int "
+               else
+                       return "signed char "
+       }
+       else
+               return "const char *"
+}
+
 # Given that an option has flags FLAGS, return an initializer for the
 # "var_cond" and "var_value" fields of its cl_options[] entry.
 function var_set(flags)
@@ -167,3 +194,21 @@ function var_ref(name, flags)
                return "&target_flags"
        return "0"
 }
+
+# Given the option called NAME return a sanitized version of its name.
+function opt_sanitized_name(name)
+{
+       if (name == "finline-limit=" || name == "Wlarger-than=" \
+           || name == "ftemplate-depth=")
+               name = name "eq"
+       if (name == "gdwarf+")
+               name = "gdwarfplus"
+       gsub ("[^A-Za-z0-9]", "_", name)
+       return name
+}
+
+# Given the option called NAME return the appropriate enum for it.
+function opt_enum(name)
+{
+       return "OPT_" opt_sanitized_name(name)
+}