Fix code generation of enum value constants (this is a temporary fix - it will be followed by a code cleanup).
authorMario de Sousa <msousa@fe.up.pt>
Wed, 14 Nov 2012 15:25:03 +0000
changeset 730 88595935a952
parent 729 3840cb4a623a
child 731 151f0b57b4e4
Fix code generation of enum value constants (this is a temporary fix - it will be followed by a code cleanup).
stage4/generate_c/generate_c_typedecl.cc
--- a/stage4/generate_c/generate_c_typedecl.cc	Wed Nov 14 15:18:14 2012 +0000
+++ b/stage4/generate_c/generate_c_typedecl.cc	Wed Nov 14 15:25:03 2012 +0000
@@ -321,7 +321,11 @@
       debug_c::print(symbol);
       ERROR;
     }
-    symbol->datatype->accept(*basedecl);
+    symbol_c *type_name = get_datatype_info_c::get_datatype_id(symbol->datatype);
+    if (NULL == type_name) {
+      ERROR_MSG("generate_c does not support anonymous enumerated data types.");
+    } else
+    type_name->accept(*basedecl);
   }
   s4o_incl.print("__");
   symbol->value->accept(*basedecl);