stage4/generate_c/generate_c_vardecl.cc
changeset 195 66d501d7b67d
parent 189 7ca02034c4f6
child 202 da1a8186f86f
--- a/stage4/generate_c/generate_c_vardecl.cc	Thu Jun 18 19:18:54 2009 +0200
+++ b/stage4/generate_c/generate_c_vardecl.cc	Fri Jun 19 13:26:31 2009 +0200
@@ -1703,17 +1703,16 @@
 // SYM_REF2(global_var_spec_c, global_var_name, location)
 void *visit(global_var_spec_c *symbol) {
   TRACE("global_var_spec_c");
-
   /* now to produce the c equivalent... */
   switch(wanted_varformat) {
     case local_vf:
-      s4o.print(s4o.indent_spaces);
+      s4o.print("extern ");
+      this->current_var_type_symbol->accept(*this);
+      s4o.print("* ");
+      symbol->location->accept(*this);
+      s4o.print(";\n");
       if (symbol->global_var_name != NULL) {
-        s4o.print("extern ");
-        this->current_var_type_symbol->accept(*this);
-        s4o.print("* ");
-        symbol->location->accept(*this);
-        s4o.print(";\n");
+        s4o.print(s4o.indent_spaces);
         this->current_var_type_symbol->accept(*this);
         s4o.print(" *");
         if (this->resource_name != NULL) {
@@ -1723,6 +1722,7 @@
         symbol->global_var_name->accept(*this);
         s4o.print(";\n");
         if (this->resource_name != NULL) {
+            s4o.print(s4o.indent_spaces);
             s4o.print("#define ");
             symbol->global_var_name->accept(*this);
             s4o.print(" ");