mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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.
This commit is contained in:
committed by
Akim Demaille
parent
423ca9b50e
commit
9641b918ba
@@ -294,6 +294,35 @@ input.y:1.13-15: warning: symbol foo is used, but is not defined as a token and
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ----------------------------------------------------- ##
|
||||
## Unassociated types used for a printer or destructor. ##
|
||||
## ----------------------------------------------------- ##
|
||||
|
||||
AT_SETUP([Unassociated types used for a printer or destructor])
|
||||
|
||||
AT_DATA([[input.y]],
|
||||
[[%token <type1> tag1
|
||||
%type <type2> tag2
|
||||
|
||||
%printer { } <type1> <type3>
|
||||
%destructor { } <type2> <type4>
|
||||
|
||||
%%
|
||||
|
||||
exp: tag1 { $1; }
|
||||
| tag2 { $1; }
|
||||
|
||||
tag2: "a" { $$; }
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([input.y], [0], [],
|
||||
[[input.y:4.22-28: warning: type <type3> is used, but is not associated to any symbol
|
||||
input.y:5.25-31: warning: type <type4> is used, but is not associated to any symbol
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ---------------------------------------- ##
|
||||
## Unused values with default %destructor. ##
|
||||
## ---------------------------------------- ##
|
||||
|
||||
Reference in New Issue
Block a user