OSDN Git Service

compiler: Verify types of sink variables.
[pf3gnuchains/gcc-fork.git] / gcc / opt-functions.awk
index 19bdf3a..1f582fb 100644 (file)
@@ -110,6 +110,11 @@ function switch_flags (flags)
 # Return bit-field initializers for option flags FLAGS.
 function switch_bit_fields (flags)
 {
+       vn = var_name(flags);
+       if (host_wide_int[vn] == "yes")
+               hwi = "Host_Wide_Int"
+       else
+               hwi = ""
        result = ""
        sep_args = opt_args("Args", flags)
        if (sep_args == "")
@@ -126,6 +131,8 @@ function switch_bit_fields (flags)
          flag_init("RejectNegative", flags) \
          flag_init("JoinedOrMissing", flags) \
          flag_init("UInteger", flags) \
+         flag_init("Host_Wide_Int", hwi) \
+         flag_init("ToLower", flags) \
          flag_init("Report", flags)
 
        sub(", $", "", result)
@@ -139,6 +146,17 @@ function var_name(flags)
        return nth_arg(0, opt_args("Var", flags))
 }
 
+# Return the name of the variable if FLAGS has a HOST_WIDE_INT variable. 
+# Return the empty string otherwise.
+function host_wide_int_var_name(flags)
+{
+       split (flags, array, "[ \t]+")
+       if (array[1] == "HOST_WIDE_INT")
+               return array[2]
+       else
+               return ""
+}
+
 # Return true if the option described by FLAGS has a globally-visible state.
 function global_state_p(flags)
 {
@@ -191,9 +209,17 @@ function var_type_struct(flags)
 {
        if (flag_set_p("UInteger", flags))
                return "int "
+       else if (flag_set_p("Enum.*", flags)) {
+               en = opt_args("Enum", flags);
+               return enum_type[en] " "
+       }
        else if (!flag_set_p("Joined.*", flags) && !flag_set_p("Separate", flags)) {
-               if (flag_set_p(".*Mask.*", flags))
-                       return "int "
+               if (flag_set_p(".*Mask.*", flags)) {
+                       if (host_wide_int[var_name(flags)] == "yes")
+                               return "HOST_WIDE_INT "
+                       else
+                               return "int "
+               }
                else
                        return "signed char "
        }