Currently they are treated in separated variables, contrary to other
<TYPE> code_props. This duplicates code (and messages for translators)
uselessly, as demonstrated by the fact that thanks to this patch, now
useless <*> and <> code_props are reported like the others.
* src/parse-gram.y (generic_symlist_item): Treat "<*>" and "<>" as regular
type tags.
* src/symlist.h, src/symlist.c (symbol_list_default_tagged_new)
(symbol_list_default_tagless_new,SYMLIST_DEFAULT_TAGGED)
(SYMLIST_DEFAULT_TAGLESS): Remove.
* src/symtab.h, src/symtab.c (default_tagged_code_props)
(default_tagless_code_props, default_tagged_code_props_set)
(default_tagless_code_props_set): Remove.
(symbol_code_props_get): Default to <*> or <>'s code_props.
* tests/actions.at: Complete expected errors: there are new warnings.
* tests/input.at: Likewise.
(Useless printers or destructors): Extend.
The logic to compute the %printer or %destructor to used (i.e., a
code_props) is implemented twice: one, of course, in
symbol_code_props_get, and another time in symbol_check_defined to
record the fact that a code_props is used (so that we can reported
unused ones). Let the former use the latter.
I would probably use "mutable" in C++ and keep these guys const,
but this is C. And casting away constness triggers warnings.
* src/scan-code.h, src/scan-code.l (code_props_none): Is not const.
* src/symtab.h, src/symtab.c (symbol_code_props_get): The symbol
is not const.
(symbol_check_defined): Use it.
Because I'm using a VPATH build with an absolute srcdir, I have
GRAM__USERS_AKIM_SRC_GNU_BISON_SRC_PARSE_GRAM_H. Before, I was using
a relative srcdir, and had GRAM_______SRC_PARSE_GRAM_H (coming from
../../). Let it be GRAM_SRC_PARSE_GRAM_H.
* tests/bison.in: Do not depend on the value of $top_srcdir for
Bison itself.
If we were to use relative paths from .c to .y, we would not have
this problem.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/lalr1.java, data/yacc.c:
Since the previous commit, b4_tokens_define and the like no longer need
b4_tokens.
* src/output.c (token_definitions_output): Remove.
output: use the token list to define the yytokentype
There are currently two systems used to pass information about tokens to
m4: the original one, and another, which is used for instance for
printers and destructors, variants etc. Move to using only the latter.
* data/bison.m4 (b4_symbol_map, b4_token_visible_if)
(b4_token_has_definition, b4_any_token_visible_if, b4_token_format): New.
* data/c++.m4, data/c.m4, data/glr.c, data/java.m4: Adjust to use them.
* origin/maint:
maint: update gnu-web-doc-update.
maint: post-release administrivia
version 2.6
maint: prepare for release 2.6
maint: post-release administrivia
version 2.5.91
maint: prepare NEWS.
maint: fix spaces.
tests: adjust to case where the C compiler is actually a C++ compiler
tests: fix dependencies
doc: fix Texinfo command
maint: Valgrind on OS X.
tests: be sure that backups are safe.
maint: dead comment.
tests: refactor for legibility.
tests: refactor the bison invocations.
maint: fix syntax-check ignore patterns.
gnulib: update
gnulib: update.
gnulib: update
* configure.ac (VALGRIND_PREBISON): New.
* tests/Makefile.am (maintainer-check-valgrind): Use it.
* etc/darwin11.4.0.supp: New.
* configure.ac, etc/Makefile.am: Use it.
* configure.ac: Disable Valgrind on Mac OS X.
* README-hacking: Explain why.
list.yy: In function 'yy::parser::symbol_type yylex()':
list.yy:107:29: error: typedef 'token' locally defined but not used
[-Werror=unused-local-typedefs]
typedef yy::parser::token token;
^
* origin/maint:
tests: headers.at: strengthen.
glr.cc: do not override C++ definitions by C macros.
YYLLOC_DEFAULT: factor, and don't export it in headers.
api.prefix: do not use #define to handle YYSTYPE_IS_TRIVIAL etc.
tests: portability fixes.
c++: fewer #includes in the headers.
glr.cc: formatting changes.
tests: more logs.
api.prefix: also rename YYDEBUG.
YYLLOC_DEFAULT: factor, and don't export it in headers.
* data/c++.m4, data/c.m4 (b4_yylloc_default_define): New.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/yacc.c: Use it.
* data/glr.cc: Do not define YYLLOC_DEFAULT in the header file,
but in the implementation one.
since, of course YYSTYPE_IS_TRIVIAL is defined. Instead we could
define YYSTYPE_IS_TRIVIAL as PREFIX_STYPE_IS_TRIVIAL only when the
later is defined, but let's avoid stacking CPP on top of M4: rather, use
* data/glr.c, data/yacc.c: Use YYSTYPE_IS_TRIVIAL, YYSTYPE_IS_DECLARED,
YYLTYPE_IS_TRIVIAL and YYLTYPE_IS_DECLARED under their api.prefix-renamed
name.
The testsuite in master has shown weird errors for the "Mulitple
Parsers" tests: the caller of p5.parse() received some apparently
random value, while tracing p5.parse() showed that the function was
consistently returning 0.
It happens when mixing several parser headers, some generated without
%debug, others with. In particular the C++ parser was generated with
%debug, i.e., with:
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
and compiled separatedly. Yet, its header was included after the one
of another parser, this time without %debug, i.e., with
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
in its header. As a result, the parser was compiled with YYDEBUG set,
but its header was used without. Since the layout of the objects are
then completely different, boom.
Therefore, do not change the value of YYDEBUG. Rather, use it as a
default value for <API.PREFIX>DEBUG.
* data/c.m4 (b4_YYDEBUG_define): New.
(b4_declare_yydebug): Rename as...
(b4_yydebug_declare): this, for consistency.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/yacc.c: Use it.
* NEWS: Document it.
Victor Santet [Fri, 29 Jun 2012 13:22:09 +0000 (15:22 +0200)]
warnings: be ready to print warnings categories
A function to print warnings categories, like -Wyacc, -Wother, etc.
* src/complain.h, src/complain.c (print_warning_categories): New function.
* src/output.c (ARRAY_CARDINALITY): Move it to file 'src/system.h'.
* src/complain.h (enum warnings): New value, 'silent', "complain"
must not display the warning type.
Akim Demaille [Thu, 28 Jun 2012 13:29:18 +0000 (15:29 +0200)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
tests: use the generalized default yylex.
tests: AT_YYERROR_DEFINE: prepare for list of ints.
skeletons: no longer define YYLSP_NEEDED.
c++: do not export YYTOKEN_TABLE and YYERROR_VERBOSE.
Akim Demaille [Tue, 26 Jun 2012 14:43:22 +0000 (16:43 +0200)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
tests: do not output m4 set up.
tests: use the generic yyerror function.
tests: use assert instead of plain abort.
tests: improve the generic yylex implementation.
tests: generalize the compilation macros.
tests: fix confusion between api.prefix and name-prefix.
maint: gitignores.
yacc: work around the ylwrap limitation.
Victor Santet [Thu, 14 Jun 2012 12:20:07 +0000 (14:20 +0200)]
warnings: raise warning for useless printers or destructors
* src/scan-code.h (code_props): Add field 'is_used'.
(CODE_PROPS_NONE_INIT): Adjust.
* src/scan-code.l (code_props_plain_init, code_props_symbol_action_init)
(code_props_rule_action_init): Instead of implementing several
times the initialization of the code_props structures,
use code_props_none_init.
* src/symtab.c (symbol_check_defined): If a symbol does not have a
destructor (resp. printer) but has a type which has a destructor (resp.
printer), then set field 'is_used' to true.
(semantic_type_check_defined): If a type has a destructor (resp. printer)
but all symbols of this type have already a destructor (resp. printer),
then raise a warning.
* tests/input.at (Useless printers or destructors): New.
Akim Demaille [Tue, 26 Jun 2012 12:05:56 +0000 (14:05 +0200)]
tests: do not output m4 set up.
* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
Use a diversion to avoid outputting comments etc.
Removes 17k lines from testsuite (10% of the number of lines).
Akim Demaille [Tue, 26 Jun 2012 09:54:13 +0000 (11:54 +0200)]
tests: use the generic yyerror function.
* tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Factor.
Use AT_YYERROR_DEFINE.
Therefore, instead of using stdout, use and check stderr.
* tests/glr-regression.at (Uninitialized location when reporting ambiguity):
Use AT_YYERROR_DEFINE.
Akim Demaille [Mon, 25 Jun 2012 14:37:18 +0000 (16:37 +0200)]
tests: generalize the compilation macros.
* tests/local.at (AT_COMPILE, AT_COMPILE_CXX): If OUTPUT ends with ".o",
then append the "natural" extension for the input file (.c or .cc).
If there is no source, pass -c.
* tests/headers.at, tests/input.at, tests/regression.at: Adjust.
Akim Demaille [Tue, 26 Jun 2012 07:35:31 +0000 (09:35 +0200)]
tests: fix confusion between api.prefix and name-prefix.
* tests/local.at (AT_NAME_PREFIX): Take api.prefix into account.
(AT_API_PREFIX): Rename as...
(AT_API_prefix): this.
Do not take %name-prefix into account.
Fix misuses.
Victor Santet [Mon, 18 Jun 2012 13:44:38 +0000 (15:44 +0200)]
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.
Akim Demaille [Mon, 25 Jun 2012 08:15:44 +0000 (10:15 +0200)]
yacc: work around the ylwrap limitation.
* data/yacc.c (b4_shared_declarations): Include the header guards.
Do not include the header in the *.c file, duplicate it.
* NEWS (Future Changes): Extend, and announce the forthcoming change
about the use of the parser header.