]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/opt-functions.awk
Update copyright years.
[thirdparty/gcc.git] / gcc / opt-functions.awk
index 43e223c3cc763f6d54d3467b9a8ac391d9cd3b39..2f0442dc5633a0ca7e3e86c523f333d0ff847b66 100644 (file)
@@ -1,4 +1,4 @@
-#  Copyright (C) 2003-2016 Free Software Foundation, Inc.
+#  Copyright (C) 2003-2020 Free Software Foundation, Inc.
 #  Contributed by Kelley Cook, June 2004.
 #  Original code from Neil Booth, May 2003.
 #
@@ -105,7 +105,8 @@ function switch_flags (flags)
          test_flag("Undocumented", flags,  " | CL_UNDOCUMENTED") \
          test_flag("NoDWARFRecord", flags,  " | CL_NO_DWARF_RECORD") \
          test_flag("Warning", flags,  " | CL_WARNING") \
-         test_flag("Optimization", flags,  " | CL_OPTIMIZATION")
+         test_flag("(Optimization|PerFunction)", flags,  " | CL_OPTIMIZATION") \
+         test_flag("Param", flags,  " | CL_PARAMS")
        sub( "^0 \\| ", "", result )
        return result
 }
@@ -113,9 +114,14 @@ function switch_flags (flags)
 # Return bit-field initializers for option flags FLAGS.
 function switch_bit_fields (flags)
 {
+       uinteger_flag = ""
        vn = var_name(flags);
        if (host_wide_int[vn] == "yes")
                hwi = "Host_Wide_Int"
+       else if (flag_set_p("Host_Wide_Int", flags)) {
+               hwi = "Host_Wide_Int"
+               uinteger_flag = flag_init("UInteger", flags)
+       }
        else
                hwi = ""
        result = ""
@@ -126,6 +132,20 @@ function switch_bit_fields (flags)
                sep_args--
        result = result sep_args ", "
 
+       if (uinteger_flag == "")
+               uinteger_flag = flag_init("UInteger", flags)
+
+       hwi_flag = flag_init("Host_Wide_Int", hwi)
+       byte_size_flag = flag_init("ByteSize", flags)
+
+       if (substr(byte_size_flag, 1, 1) != "0" \
+           && substr(uinteger_flag, 1, 1) == "0" \
+           && substr(hwi_flag, 1, 1) == "0")
+         print "#error only UInteger amd Host_Wide_Int options can specify a ByteSize suffix"
+
+       # The following flags need to be in the same order as
+       # the corresponding members of struct cl_option defined
+       # in gcc/opts.h.
        result = result \
          flag_init("SeparateAlias", flags) \
          flag_init("NegativeAlias", flags) \
@@ -133,10 +153,11 @@ function switch_bit_fields (flags)
          flag_init("RejectDriver", flags) \
          flag_init("RejectNegative", flags) \
          flag_init("JoinedOrMissing", flags) \
-         flag_init("UInteger", flags) \
-         flag_init("Host_Wide_Int", hwi) \
+         uinteger_flag \
+         hwi_flag \
          flag_init("ToLower", flags) \
-         flag_init("Report", flags)
+         flag_init("Report", flags) \
+         byte_size_flag
 
        sub(", $", "", result)
        return result
@@ -199,6 +220,8 @@ function var_type(flags)
        }
        else if (!flag_set_p("Joined.*", flags) && !flag_set_p("Separate", flags))
                return "int "
+       else if (flag_set_p("Host_Wide_Int", flags))
+               return "HOST_WIDE_INT "
        else if (flag_set_p("UInteger", flags))
                return "int "
        else
@@ -210,8 +233,13 @@ function var_type(flags)
 # type instead of int to save space.
 function var_type_struct(flags)
 {
-       if (flag_set_p("UInteger", flags))
-               return "int "
+       if (flag_set_p("UInteger", flags)) {
+               if (host_wide_int[var_name(flags)] == "yes")
+                       return "HOST_WIDE_INT ";
+               if (flag_set_p("ByteSize", flags))
+                       return "HOST_WIDE_INT "
+         return "int "
+       }
        else if (flag_set_p("Enum.*", flags)) {
                en = opt_args("Enum", flags);
                return enum_type[en] " "
@@ -221,7 +249,7 @@ function var_type_struct(flags)
                        if (host_wide_int[var_name(flags)] == "yes")
                                return "HOST_WIDE_INT "
                        else
-                               return "int "
+                               return "/* - */ int "
                }
                else
                        return "signed char "
@@ -261,6 +289,8 @@ function var_set(flags)
        }
        if (var_type(flags) == "const char *")
                return "0, CLVC_STRING, 0"
+       if (flag_set_p("ByteSize", flags))
+               return "0, CLVC_SIZE, 0"
        return "0, CLVC_BOOLEAN, 0"
 }
 
@@ -275,7 +305,7 @@ function var_ref(name, flags)
                return "offsetof (struct gcc_options, x_target_flags)"
        if (opt_args("InverseMask", flags) != "")
                return "offsetof (struct gcc_options, x_target_flags)"
-       return "-1"
+       return "(unsigned short) -1"
 }
 
 # Given the option called NAME return a sanitized version of its name.
@@ -314,6 +344,20 @@ function search_var_name(name, opt_numbers, opts, flags, n_opts)
     return ""
 }
 
+function integer_range_info(range_option, init, option)
+{
+    if (range_option != "") {
+       ival = init + 0;
+       start = nth_arg(0, range_option) + 0;
+       end = nth_arg(1, range_option) + 0;
+       if (init != "" && init != "-1" && (ival < start || ival > end))
+         print "#error initial value " init " of '" option "' must be in range [" start "," end "]"
+       return start ", " end
+    }
+    else
+        return "-1, -1"
+}
+
 # Handle LangEnabledBy(ENABLED_BY_LANGS, ENABLEDBY_NAME, ENABLEDBY_POSARG,
 # ENABLEDBY_NEGARG). This function does not return anything.
 function lang_enabled_by(enabledby_langs, enabledby_name, enabledby_posarg, enabledby_negarg)