This patch to the Go frontend renames "requires" to "needs" to avoid
the C++20 keyword.  Bootstrapped on x86_64-pc-linux-gnu.  Committed to
mainline.

Ian
9d44418664ec8c3e59365901e3ec02e488d9e01c
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 0d49e9e70c6..65f64e0fbfb 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-548720bca6bff21ebc9aba22249d9ce45bbd90c7
+ac438edc5335f69c95df9342f43712ad2f61ad66
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index e13df0da22b..67b91fab4ca 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -5302,16 +5302,16 @@ Gogo::write_c_header()
       Named_object* no = types.front();
       types.pop_front();
 
-      std::vector<const Named_object*> requires;
+      std::vector<const Named_object*> needs;
       std::vector<const Named_object*> declare;
-      if (!no->type_value()->struct_type()->can_write_to_c_header(&requires,
+      if (!no->type_value()->struct_type()->can_write_to_c_header(&needs,
                                                                  &declare))
        continue;
 
       bool ok = true;
       for (std::vector<const Named_object*>::const_iterator pr
-            = requires.begin();
-          pr != requires.end() && ok;
+            = needs.begin();
+          pr != needs.end() && ok;
           ++pr)
        {
          for (std::list<Named_object*>::const_iterator pt = types.begin();
@@ -5342,10 +5342,10 @@ Gogo::write_c_header()
          if (*pd == no)
            continue;
 
-         std::vector<const Named_object*> drequires;
+         std::vector<const Named_object*> dneeds;
          std::vector<const Named_object*> ddeclare;
          if (!(*pd)->type_value()->struct_type()->
-             can_write_to_c_header(&drequires, &ddeclare))
+             can_write_to_c_header(&dneeds, &ddeclare))
            continue;
 
          bool done = false;
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index e82be6840aa..4995283bb60 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -6967,7 +6967,7 @@ Struct_type::do_import(Import* imp)
 
 bool
 Struct_type::can_write_to_c_header(
-    std::vector<const Named_object*>* requires,
+    std::vector<const Named_object*>* needs,
     std::vector<const Named_object*>* declare) const
 {
   const Struct_field_list* fields = this->fields_;
@@ -6978,7 +6978,7 @@ Struct_type::can_write_to_c_header(
        p != fields->end();
        ++p)
     {
-      if (!this->can_write_type_to_c_header(p->type(), requires, declare))
+      if (!this->can_write_type_to_c_header(p->type(), needs, declare))
        return false;
       if (Gogo::message_name(p->field_name()) == "_")
        sinks++;
@@ -6993,7 +6993,7 @@ Struct_type::can_write_to_c_header(
 bool
 Struct_type::can_write_type_to_c_header(
     const Type* t,
-    std::vector<const Named_object*>* requires,
+    std::vector<const Named_object*>* needs,
     std::vector<const Named_object*>* declare) const
 {
   t = t->forwarded();
@@ -7027,13 +7027,13 @@ Struct_type::can_write_type_to_c_header(
       return true;
 
     case TYPE_STRUCT:
-      return t->struct_type()->can_write_to_c_header(requires, declare);
+      return t->struct_type()->can_write_to_c_header(needs, declare);
 
     case TYPE_ARRAY:
       if (t->is_slice_type())
        return true;
       return this->can_write_type_to_c_header(t->array_type()->element_type(),
-                                             requires, declare);
+                                             needs, declare);
 
     case TYPE_NAMED:
       {
@@ -7049,10 +7049,10 @@ Struct_type::can_write_type_to_c_header(
            // We will accept empty struct fields, but not print them.
            if (t->struct_type()->total_field_count() == 0)
              return true;
-           requires->push_back(no);
-           return t->struct_type()->can_write_to_c_header(requires, declare);
+           needs->push_back(no);
+           return t->struct_type()->can_write_to_c_header(needs, declare);
          }
-       return this->can_write_type_to_c_header(t->base(), requires, declare);
+       return this->can_write_type_to_c_header(t->base(), needs, declare);
       }
 
     case TYPE_CALL_MULTIPLE_RESULT:
@@ -7150,9 +7150,9 @@ Struct_type::write_field_to_c_header(std::ostream& os, 
const std::string& name,
 
     case TYPE_POINTER:
       {
-       std::vector<const Named_object*> requires;
+       std::vector<const Named_object*> needs;
        std::vector<const Named_object*> declare;
-       if (!this->can_write_type_to_c_header(t->points_to(), &requires,
+       if (!this->can_write_type_to_c_header(t->points_to(), &needs,
                                              &declare))
          os << "void*";
        else

Reply via email to