aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2012-10-23 04:31:11 +0000
committerIan Lance Taylor <iant@google.com>2012-10-23 04:31:11 +0000
commitb7a328fd6128352af7f343487e28f422399eb9f7 (patch)
tree46bb86f514fbf6bad82da48e69a18fb09d878834 /gcc/go
parent13230cd85c318c0923cecda117980e06b9d0d40e (diff)
libgo: Update to current sources.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@192704 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/gogo.cc3
-rw-r--r--gcc/go/gofrontend/runtime.cc7
-rw-r--r--gcc/go/gofrontend/runtime.def13
-rw-r--r--gcc/go/gofrontend/statements.cc5
4 files changed, 20 insertions, 8 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index fa61808ec3c..defa208a582 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -1251,6 +1251,7 @@ Gogo::clear_file_scope()
this->package_->bindings()->clear_file_scope();
// Warn about packages which were imported but not used.
+ bool quiet = saw_errors();
for (Packages::iterator p = this->packages_.begin();
p != this->packages_.end();
++p)
@@ -1260,7 +1261,7 @@ Gogo::clear_file_scope()
&& package->is_imported()
&& !package->used()
&& !package->uses_sink_alias()
- && !saw_errors())
+ && !quiet)
error_at(package->location(), "imported and not used: %s",
Gogo::message_name(package->package_name()).c_str());
package->clear_is_imported();
diff --git a/gcc/go/gofrontend/runtime.cc b/gcc/go/gofrontend/runtime.cc
index 9d190302057..3da2f3dae26 100644
--- a/gcc/go/gofrontend/runtime.cc
+++ b/gcc/go/gofrontend/runtime.cc
@@ -32,6 +32,8 @@ enum Runtime_function_type
RFT_BOOLPTR,
// Go type int, C type int.
RFT_INT,
+ // Go type int32, C type int32_t.
+ RFT_INT32,
// Go type int64, C type int64_t.
RFT_INT64,
// Go type uint64, C type uint64_t.
@@ -102,6 +104,10 @@ runtime_function_type(Runtime_function_type bft)
t = Type::lookup_integer_type("int");
break;
+ case RFT_INT32:
+ t = Type::lookup_integer_type("int32");
+ break;
+
case RFT_INT64:
t = Type::lookup_integer_type("int64");
break;
@@ -206,6 +212,7 @@ convert_to_runtime_function_type(Runtime_function_type bft, Expression* e,
case RFT_BOOL:
case RFT_BOOLPTR:
case RFT_INT:
+ case RFT_INT32:
case RFT_INT64:
case RFT_UINT64:
case RFT_UINTPTR:
diff --git a/gcc/go/gofrontend/runtime.def b/gcc/go/gofrontend/runtime.def
index 7dda5398cfb..b9492dc8af2 100644
--- a/gcc/go/gofrontend/runtime.def
+++ b/gcc/go/gofrontend/runtime.def
@@ -148,27 +148,28 @@ DEF_GO_RUNTIME(CHANRECV2, "runtime.chanrecv2", P3(TYPE, CHAN, POINTER),
// Start building a select statement.
-DEF_GO_RUNTIME(NEWSELECT, "runtime.newselect", P1(INT), R1(POINTER))
+DEF_GO_RUNTIME(NEWSELECT, "runtime.newselect", P1(INT32), R1(POINTER))
// Add a default clause to a select statement.
-DEF_GO_RUNTIME(SELECTDEFAULT, "runtime.selectdefault", P2(POINTER, INT), R0())
+DEF_GO_RUNTIME(SELECTDEFAULT, "runtime.selectdefault",
+ P2(POINTER, INT32), R0())
// Add a send clause to a select statement.
DEF_GO_RUNTIME(SELECTSEND, "runtime.selectsend",
- P4(POINTER, CHAN, POINTER, INT), R0())
+ P4(POINTER, CHAN, POINTER, INT32), R0())
// Add a receive clause to a select statement, for a clause which does
// not check whether the channel is closed.
DEF_GO_RUNTIME(SELECTRECV, "runtime.selectrecv",
- P4(POINTER, CHAN, POINTER, INT), R0())
+ P4(POINTER, CHAN, POINTER, INT32), R0())
// Add a receive clause to a select statement, for a clause which does
// check whether the channel is closed.
DEF_GO_RUNTIME(SELECTRECV2, "runtime.selectrecv2",
- P5(POINTER, CHAN, POINTER, BOOLPTR, INT), R0())
+ P5(POINTER, CHAN, POINTER, BOOLPTR, INT32), R0())
// Run a select, returning the index of the selected clause.
-DEF_GO_RUNTIME(SELECTGO, "runtime.selectgo", P1(POINTER), R1(INT))
+DEF_GO_RUNTIME(SELECTGO, "runtime.selectgo", P1(POINTER), R1(INT32))
// Panic.
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index af34670aee0..ad249f6ac57 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -4841,6 +4841,8 @@ Select_clauses::get_backend(Translate_context* context,
std::vector<std::vector<Bexpression*> > cases(count);
std::vector<Bstatement*> clauses(count);
+ Type* int32_type = Type::lookup_integer_type("int32");
+
int i = 0;
for (Clauses::iterator p = this->clauses_.begin();
p != this->clauses_.end();
@@ -4849,7 +4851,8 @@ Select_clauses::get_backend(Translate_context* context,
int index = p->index();
mpz_t ival;
mpz_init_set_ui(ival, index);
- Expression* index_expr = Expression::make_integer(&ival, NULL, location);
+ Expression* index_expr = Expression::make_integer(&ival, int32_type,
+ location);
mpz_clear(ival);
cases[i].push_back(tree_to_expr(index_expr->get_tree(context)));