[gcc/devel/c++-modules] Prepare ovl_using for merge

Nathan Sidwell nathan@gcc.gnu.org
Wed Sep 30 20:27:06 GMT 2020


https://gcc.gnu.org/g:852d73592c7485e44caefcb04c3317b17cb33630

commit 852d73592c7485e44caefcb04c3317b17cb33630
Author: Nathan Sidwell <nathan@acm.org>
Date:   Wed Sep 30 09:35:15 2020 -0700

    Prepare ovl_using for merge
    
            gcc/cp/
            * tree.h (ovl_insert): Make usingness unsigned.
            * tree.c (ovl_insert): Make usingness unsigned, change semantics.
            * name-lookup.c (do_nonmember_using_decl): Adjust ovl_insert call.

Diff:
---
 ChangeLog.modules    | 5 +++++
 gcc/cp/cp-tree.h     | 2 +-
 gcc/cp/name-lookup.c | 2 +-
 gcc/cp/tree.c        | 6 +++---
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/ChangeLog.modules b/ChangeLog.modules
index 458e4b72e64..8f18657793f 100644
--- a/ChangeLog.modules
+++ b/ChangeLog.modules
@@ -1,5 +1,10 @@
 2020-09-30  Nathan Sidwell  <nathan@acm.org>
 
+	gcc/cp/
+	* tree.h (ovl_insert): Make usingness unsigned.
+	* tree.c (ovl_insert): Make usingness unsigned, change semantics.
+	* name-lookup.c (do_nonmember_using_decl): Adjust ovl_insert call.
+
 	Merge trunk 00aaae03db2
 	c++: Replace tag_scope with TAG_how
 
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index b3e5939335f..eacc459da92 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -7677,7 +7677,7 @@ inline tree ovl_first				(tree) ATTRIBUTE_PURE;
 extern tree ovl_make				(tree fn,
 						 tree next = NULL_TREE);
 extern tree ovl_insert				(tree fn, tree maybe_ovl,
-						 int usingness = 0);
+						 unsigned usingness = 0);
 extern tree ovl_skip_hidden			(tree) ATTRIBUTE_PURE;
 extern void lookup_mark				(tree lookup, bool val);
 extern tree lookup_add				(tree fns, tree lookup);
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 72016f1034f..0cac59d4a0d 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -5115,7 +5115,7 @@ do_nonmember_using_decl (name_lookup &lookup, bool fn_scope_p,
 	    /* Unlike the decl-pushing case we don't drop anticipated
 	       builtins here.  They don't cause a problem, and we'd
 	       like to match them with a future declaration.  */
-	    value = ovl_insert (new_fn, value, exporting ? -1 : +1);
+	    value = ovl_insert (new_fn, value, 1 + exporting);
 	}
     }
   else if (value
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 66b4f016518..c2816dd5321 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2263,12 +2263,12 @@ ovl_make (tree fn, tree next)
 }
 
 /* Add FN to the (potentially NULL) overload set OVL.  USINGNESS is
-   non-zero if this is a using-decl.  It is < if we're exporting the
+   > zero if this is a using-decl.  It is > 1 if we're exporting the
    using decl.  We also pay attention to DECL_HIDDEN.  We keep the
    hidden decls first, but remaining ones are unordered.  */
 
 tree
-ovl_insert (tree fn, tree maybe_ovl, int usingness)
+ovl_insert (tree fn, tree maybe_ovl, unsigned usingness)
 {
   tree result = maybe_ovl;
   tree insert_after = NULL_TREE;
@@ -2291,7 +2291,7 @@ ovl_insert (tree fn, tree maybe_ovl, int usingness)
       if (usingness)
 	{
 	  OVL_DEDUP_P (maybe_ovl) = OVL_USING_P (maybe_ovl) = true;
-	  if (usingness < 0)
+	  if (usingness > 1)
 	    OVL_EXPORT_P (maybe_ovl) = true;
 	}
     }


More information about the Gcc-cvs mailing list