On 9/7/23 19:26, Feng Wang wrote:

  Supported ISA specs (for use with the -misa-spec= option):
diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk
index 36de4639318..cbfcf7dabcf 100644
--- a/gcc/opt-functions.awk
+++ b/gcc/opt-functions.awk
@@ -387,3 +387,14 @@ function integer_range_info(range_option, init, option, 
uinteger_used)
      else
          return "-1, -1"
  }
+
+# Find the index of target variable from extra_target_vars
+function find_index(var, var_arry, n_var_arry)
+{
+    for (var_index = 0; var_index < n_var_arry; var_index++)
+    {
+        if (var_arry[var_index] == var)
+            break
+    }
+    return var_index
+}
So if the mapping isn't found, it looks like this will return n_var_arry. It looks like the caller expects that and adds a new entry to var_arry. I would suggest a better comment. Perhaps something like

# Find the index of VAR in VAR_ARRY which as length N_VAR_ARRY.  If
# VAR is not found, return N_VAR_ARRY.

I believe there is extensive documentation of the options handling in doc/options.texi. The new functionality in this patch should be documented there. Give it your best shot and I can help polish up the language.

Thanks,
Jeff

Reply via email to