aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-06-21 17:56:49 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-06-21 17:56:49 +0000
commit2b4171c331d0875e411ea19b63b04a41a263c10c (patch)
tree20a8b74bc4292f765ed786f8f9254c9a2702c51b
parentb0ad3635b63e6786a8216aa8ec3d4436fa9ae9ac (diff)
downloadgcc-2b4171c331d0875e411ea19b63b04a41a263c10c.zip
gcc-2b4171c331d0875e411ea19b63b04a41a263c10c.tar.gz
gcc-2b4171c331d0875e411ea19b63b04a41a263c10c.tar.bz2
compiler: do not skip compilation of blank-named functions.
Fixes issue 22. From-SVN: r200316
-rw-r--r--gcc/go/gofrontend/gogo-tree.cc8
-rw-r--r--gcc/go/gofrontend/gogo.cc7
-rw-r--r--gcc/go/gofrontend/gogo.h10
3 files changed, 22 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc
index cd54f2b..06fd4f0 100644
--- a/gcc/go/gofrontend/gogo-tree.cc
+++ b/gcc/go/gofrontend/gogo-tree.cc
@@ -829,6 +829,14 @@ Gogo::write_globals()
}
}
+ // Skip blank named functions.
+ if (no->is_function() && no->func_value()->is_sink())
+ {
+ --i;
+ --count;
+ continue;
+ }
+
if (!no->is_variable())
{
vec[i] = no->get_tree(this, NULL);
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index d005fb8..948b11f 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -819,7 +819,8 @@ Gogo::start_function(const std::string& name, Function_type* type,
char buf[30];
snprintf(buf, sizeof buf, ".$sink%d", sink_count);
++sink_count;
- ret = Named_object::make_function(buf, NULL, function);
+ ret = this->package_->bindings()->add_function(buf, NULL, function);
+ ret->func_value()->set_is_sink();
}
else if (!type->is_method())
{
@@ -3253,8 +3254,8 @@ Function::Function(Function_type* type, Function* enclosing, Block* block,
: type_(type), enclosing_(enclosing), results_(NULL),
closure_var_(NULL), block_(block), location_(location), labels_(),
local_type_count_(0), descriptor_(NULL), fndecl_(NULL), defer_stack_(NULL),
- results_are_named_(false), nointerface_(false), calls_recover_(false),
- is_recover_thunk_(false), has_recover_thunk_(false),
+ is_sink_(false), results_are_named_(false), nointerface_(false),
+ calls_recover_(false), is_recover_thunk_(false), has_recover_thunk_(false),
in_unique_section_(false), is_descriptor_wrapper_(false)
{
}
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 4a84075..7f55470 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -911,6 +911,14 @@ class Function
result_variables()
{ return this->results_; }
+ bool
+ is_sink() const
+ { return this->is_sink_; }
+
+ void
+ set_is_sink()
+ { this->is_sink_ = true; }
+
// Whether the result variables have names.
bool
results_are_named() const
@@ -1167,6 +1175,8 @@ class Function
// distinguish the defer stack for one function from another. This
// is NULL unless we actually need a defer stack.
Temporary_statement* defer_stack_;
+ // True if this function is sink-named. No code is generated.
+ bool is_sink_ : 1;
// True if the result variables are named.
bool results_are_named_ : 1;
// True if this method should not be included in the type descriptor.