# HG changeset patch # User Mario de Sousa # Date 1352918342 0 # Node ID f6a46e29853bed929278a4e365847d3663ac9c4d # Parent 151f0b57b4e4fbea7dcd70c5c6a31998f8ed07f6 Add datatype checking of enumeration data type declarations. diff -r 151f0b57b4e4 -r f6a46e29853b stage3/fill_candidate_datatypes.cc --- a/stage3/fill_candidate_datatypes.cc Wed Nov 14 18:37:42 2012 +0000 +++ b/stage3/fill_candidate_datatypes.cc Wed Nov 14 18:39:02 2012 +0000 @@ -1137,11 +1137,12 @@ /******************************************/ void *fill_candidate_datatypes_c::visit(var1_list_c *symbol) { -#if 0 /* We don't really need to set the datatype of each variable. We just check the declaration itself! */ for(int i = 0; i < symbol->n; i++) { - add_datatype_to_candidate_list(symbol->elements[i], search_varfb_instance_type->get_basetype_decl(symbol->elements[i])); /* will only add if non NULL */ + /* We don't really need to set the datatype of each variable. We just check the declaration itself! + add_datatype_to_candidate_list(symbol->elements[i], search_varfb_instance_type->get_basetype_decl(symbol->elements[i])); // will only add if non NULL + */ + symbol->elements[i]->accept(*this); // handle the extensible_input_parameter_c, etc... } -#endif return NULL; } diff -r 151f0b57b4e4 -r f6a46e29853b stage3/print_datatypes_error.cc --- a/stage3/print_datatypes_error.cc Wed Nov 14 18:37:42 2012 +0000 +++ b/stage3/print_datatypes_error.cc Wed Nov 14 18:39:02 2012 +0000 @@ -536,11 +536,6 @@ return NULL; } -void *print_datatypes_error_c::visit(data_type_declaration_c *symbol) { - // TODO !!! - /* for the moment we must return NULL so semantic analysis of remaining code is not interrupted! */ - return NULL; -} void *print_datatypes_error_c::visit(enumerated_value_c *symbol) { if (symbol->candidate_datatypes.size() == 0) @@ -648,8 +643,7 @@ /*********************/ void *print_datatypes_error_c::visit(function_declaration_c *symbol) { search_varfb_instance_type = new search_varfb_instance_type_c(symbol); - /* We do not check for data type errors in variable declarations, Skip this for now... */ -// symbol->var_declarations_list->accept(*this); + symbol->var_declarations_list->accept(*this); if (debug) printf("Print error data types list in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value); il_parenthesis_level = 0; il_error = false; @@ -664,8 +658,7 @@ /***************************/ void *print_datatypes_error_c::visit(function_block_declaration_c *symbol) { search_varfb_instance_type = new search_varfb_instance_type_c(symbol); - /* We do not check for data type errors in variable declarations, Skip this for now... */ -// symbol->var_declarations->accept(*this); + symbol->var_declarations->accept(*this); if (debug) printf("Print error data types list in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value); il_parenthesis_level = 0; il_error = false; @@ -680,7 +673,6 @@ /**********************/ void *print_datatypes_error_c::visit(program_declaration_c *symbol) { search_varfb_instance_type = new search_varfb_instance_type_c(symbol); - /* We do not check for data type errors in variable declarations, Skip this for now... */ symbol->var_declarations->accept(*this); if (debug) printf("Print error data types list in body of program %s\n", ((token_c *)(symbol->program_type_name))->value); il_parenthesis_level = 0; diff -r 151f0b57b4e4 -r f6a46e29853b stage3/print_datatypes_error.hh --- a/stage3/print_datatypes_error.hh Wed Nov 14 18:37:42 2012 +0000 +++ b/stage3/print_datatypes_error.hh Wed Nov 14 18:39:02 2012 +0000 @@ -159,7 +159,7 @@ /* B 1.3.3 - Derived data types */ /********************************/ void *visit(simple_spec_init_c *symbol); - void *visit(data_type_declaration_c *symbol); +// void *visit(data_type_declaration_c *symbol); /* use base iterator_c method! */ void *visit(enumerated_value_c *symbol); /*********************/ diff -r 151f0b57b4e4 -r f6a46e29853b stage4/generate_c/generate_c_typedecl.cc --- a/stage4/generate_c/generate_c_typedecl.cc Wed Nov 14 18:37:42 2012 +0000 +++ b/stage4/generate_c/generate_c_typedecl.cc Wed Nov 14 18:39:02 2012 +0000 @@ -323,7 +323,7 @@ } 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."); +// ERROR_MSG("generate_c does not support anonymous enumerated data types."); } else type_name->accept(*basedecl); }