]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: document comp_template_args's default args
authorPatrick Palka <ppalka@redhat.com>
Tue, 31 May 2022 12:17:27 +0000 (08:17 -0400)
committerPatrick Palka <ppalka@redhat.com>
Tue, 31 May 2022 12:17:27 +0000 (08:17 -0400)
In passing, use bool for its return type.

gcc/cp/ChangeLog:

* cp-tree.h (comp_template_args): Change return type to bool.
* pt.cc (comp_template_args): Document default arguments.
Change return type to bool and adjust returns accordingly.

gcc/cp/cp-tree.h
gcc/cp/pt.cc

index d77fd1eb8a93c963cc77f48d2e6f10ea4bf30da5..da8898155e0fad071484a0072b0583a2f11c2358 100644 (file)
@@ -7327,7 +7327,7 @@ extern tree get_template_info                     (const_tree);
 extern int template_class_depth                        (tree);
 extern int is_specialization_of                        (tree, tree);
 extern bool is_specialization_of_friend                (tree, tree);
-extern int comp_template_args                  (tree, tree, tree * = NULL,
+extern bool comp_template_args                 (tree, tree, tree * = NULL,
                                                 tree * = NULL, bool = false);
 extern int template_args_equal                  (tree, tree, bool = false);
 extern tree maybe_process_partial_specialization (tree);
index f573ca834b2aa3984b5e78944b28715ce221596c..1568cf9ff7119096fbb90a9943eea0c3d8e56140 100644 (file)
@@ -9367,27 +9367,25 @@ template_args_equal (tree ot, tree nt, bool partial_order /* = false */)
     }
 }
 
-/* Returns 1 iff the OLDARGS and NEWARGS are in fact identical sets of
-   template arguments.  Returns 0 otherwise, and updates OLDARG_PTR and
+/* Returns true iff the OLDARGS and NEWARGS are in fact identical sets of
+   template arguments.  Returns false otherwise, and updates OLDARG_PTR and
    NEWARG_PTR with the offending arguments if they are non-NULL.  */
 
-int
+bool
 comp_template_args (tree oldargs, tree newargs,
-                   tree *oldarg_ptr, tree *newarg_ptr,
-                   bool partial_order)
+                   tree *oldarg_ptr /* = NULL */, tree *newarg_ptr /* = NULL */,
+                   bool partial_order /* = false */)
 {
-  int i;
-
   if (oldargs == newargs)
-    return 1;
+    return true;
 
   if (!oldargs || !newargs)
-    return 0;
+    return false;
 
   if (TREE_VEC_LENGTH (oldargs) != TREE_VEC_LENGTH (newargs))
-    return 0;
+    return false;
 
-  for (i = 0; i < TREE_VEC_LENGTH (oldargs); ++i)
+  for (int i = 0; i < TREE_VEC_LENGTH (oldargs); ++i)
     {
       tree nt = TREE_VEC_ELT (newargs, i);
       tree ot = TREE_VEC_ELT (oldargs, i);
@@ -9398,10 +9396,10 @@ comp_template_args (tree oldargs, tree newargs,
            *oldarg_ptr = ot;
          if (newarg_ptr != NULL)
            *newarg_ptr = nt;
-         return 0;
+         return false;
        }
     }
-  return 1;
+  return true;
 }
 
 inline bool