summaryrefslogtreecommitdiff
path: root/src/symlist.c
diff options
context:
space:
mode:
authorVictor Santet <victor.santet@epita.fr>2012-06-18 15:44:38 +0200
committerAkim Demaille <akim@lrde.epita.fr>2012-06-25 11:29:14 +0200
commit9641b918bae9eb8d0bb9099ab6d9d46383ba8bc9 (patch)
tree4ee3a0879cea8f81c0f52cf3a199fd06d30ac638 /src/symlist.c
parent423ca9b50e4321c078cc6fe7903b10ed4907d269 (diff)
downloadbison-9641b918bae9eb8d0bb9099ab6d9d46383ba8bc9.tar.gz
warnings: useless semantic types
* src/symtab.h (symbol_list): Represent semantic types as structure 'semantic_type'. * src/symlist.c (symbol_list_type_new): Allocate this structure. (symbol_list_code_props_set): Set this semantic type's status to used if it was not declared. * src/symtab.c (semantic_types_sorted): New. (semantic_type_new): Set the new semantic type's location appropriately. (symbol_check_defined): If a symbol has a type, then set this type's status to "declared". (semantic_type_check_defined, semantic_type_check_defined_processor): Same as symbol_check_defined and symbol_check_defined_processor, but for semantic types. (symbol_check_defined): Check semantic types usefulness. * src/symtab.h (semantic_type): New fields 'location' and 'status'. * src/symtab.h, src/symtab.c (semantic_type_new) (semantic_type_from_uniqstr, semantic_type_get): Accept a location as a supplementary argument. * tests/input.at (Unassociated types used for printer of destructor): New. * tests/c++.at (AT_CHECK_VARIANTS): Fix an error caught by this commit.
Diffstat (limited to 'src/symlist.c')
-rw-r--r--src/symlist.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/symlist.c b/src/symlist.c
index abea6ce7..48828315 100644
--- a/src/symlist.c
+++ b/src/symlist.c
@@ -66,7 +66,11 @@ symbol_list_type_new (uniqstr type_name, location loc)
symbol_list *res = xmalloc (sizeof *res);
res->content_type = SYMLIST_TYPE;
- res->content.type_name = type_name;
+ res->content.sem_type = xmalloc (sizeof (semantic_type));
+ res->content.sem_type->tag = type_name;
+ res->content.sem_type->location = loc;
+ res->content.sem_type->status = undeclared;
+
res->location = res->sym_loc = loc;
res->named_ref = NULL;
res->next = NULL;
@@ -238,8 +242,11 @@ symbol_list_code_props_set (symbol_list *node, code_props_type kind,
break;
case SYMLIST_TYPE:
semantic_type_code_props_set
- (semantic_type_get (node->content.type_name),
+ (semantic_type_get (node->content.sem_type->tag,
+ &node->content.sem_type->location),
kind, &cprops);
+ if (node->content.sem_type->status == undeclared)
+ node->content.sem_type->status = used;
break;
case SYMLIST_DEFAULT_TAGGED:
default_tagged_code_props_set (kind, &cprops);