+{
+ struct cp_abi_ops *abi;
+
+ abi = find_cp_abi (short_name);
+ if (abi == NULL)
+ return 0;
+
+ current_cp_abi = *abi;
+ return 1;
+}
+
+/* Add ABI to the list of supported C++ ABI's. */
+
+int
+register_cp_abi (struct cp_abi_ops *abi)
+{
+ if (num_cp_abis == CP_ABI_MAX)
+ internal_error (__FILE__, __LINE__,
+ _("Too many C++ ABIs, please increase CP_ABI_MAX in cp-abi.c"));
+
+ cp_abis[num_cp_abis++] = abi;
+
+ return 1;
+}
+
+/* Set the ABI to use in "auto" mode to SHORT_NAME. */
+
+void
+set_cp_abi_as_auto_default (const char *short_name)
+{
+ char *new_longname, *new_doc;
+ struct cp_abi_ops *abi = find_cp_abi (short_name);
+
+ if (abi == NULL)
+ internal_error (__FILE__, __LINE__,
+ _("Cannot find C++ ABI \"%s\" to set it as auto default."),
+ short_name);
+
+ if (auto_cp_abi.longname != NULL)
+ xfree ((char *) auto_cp_abi.longname);
+ if (auto_cp_abi.doc != NULL)
+ xfree ((char *) auto_cp_abi.doc);
+
+ auto_cp_abi = *abi;
+
+ auto_cp_abi.shortname = "auto";
+ new_longname = xstrprintf ("currently \"%s\"", abi->shortname);
+ auto_cp_abi.longname = new_longname;
+
+ new_doc = xstrprintf ("Automatically selected; currently \"%s\"",
+ abi->shortname);
+ auto_cp_abi.doc = new_doc;
+
+ /* Since we copy the current ABI into current_cp_abi instead of
+ using a pointer, if auto is currently the default, we need to
+ reset it. */
+ if (strcmp (current_cp_abi.shortname, "auto") == 0)
+ switch_to_cp_abi ("auto");
+}
+
+/* Return the ABI operations associated with SHORT_NAME. */
+
+static struct cp_abi_ops *
+find_cp_abi (const char *short_name)