OSDN Git Service

2009-10-26 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / opt-functions.awk
index 213e949..98414da 100644 (file)
@@ -1,4 +1,4 @@
-#  Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+#  Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
 #  Contributed by Kelley Cook, June 2004.
 #  Original code from Neil Booth, May 2003.
 #
@@ -41,7 +41,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,6 +77,7 @@ 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") \
@@ -128,6 +135,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 unsigned 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 "unsigned 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)