Compare commits

..
14 Commits
Author SHA1 Message Date
Valentin Tolmer 702c92a80b warnings: sort the messages by location
Sort the warnings by location (file, line number, column). They are built
using an obstack then stored in a list, and finally sorted just before
being printed, at the end.

* src/complain.c, src/complain.h: New warning struct, obstack, and
implementation
* src/location.c, location.h (location_obstack_caret,
location_obstack_print): New
* src/main.c: Print the warnings
* src/muscle-tab.c, src/reader.c, src/scan-code.l, src/symtab.c: Adapt for
multi-part warnings
* tests/actions.at, tests/conflicts.at, tests/existing.at, tests/input.at,
* tests/reduce.at, tests/regression.at, tests/skeleton.at: Update testsuite
2013-08-29 14:06:26 +02:00
Valentin TolmerandAkim Demaille a728075710 symbols: improve symbol aliasing
Rather than having duplicate info in the symbol and the alias that has
to be resolved later on, both the symbol and the alias have a common
pointer to a separate structure containing this info.

* src/symtab.h (sym_content): New structure.
* src/symtab.c (sym_content_new, sym_content_free, symbol_free): New

* src/AnnotationList.c, src/conflicts.c, src/gram.c, src/gram.h,
* src/graphviz.c, src/ielr.c, src/output.c, src/parse-gram.y, src/print.c
* src/print-xml.c, src/print_graph.c, src/reader.c, src/reduce.c,
* src/state.h, src/symlist.c, src/symtab.c, src/symtab.h, src/tables.c:
Adjust.

* tests/input.at: Fix expectations (order changes).
2013-08-01 12:49:51 +02:00
Akim Demaille c4aa4ff541 build: ship the ASCII art figures
We don't ship the *.txt files that are used to build the info
file.
Reported by Colin Daley.

* doc/figs/example.txt: New.
* doc/local.mk (bison.info): Depend on the txt files.
And ship them.
2013-08-01 11:41:49 +02:00
Akim Demaille b97bbbaed7 doc: prefer the ".gv" extension to ".dot"
See http://marc.info/?l=graphviz-devel&m=129418103126092 for the
motivation (basically, some word processor now uses *.dot).

* doc/figs/example-reduce.dot: Rename as...
* doc/figs/example-reduce.gv: this.
* doc/figs/example-shift.dot: Rename as...
* doc/figs/example-shift.gv: this.
* doc/figs/example.dot: Rename as...
* doc/figs/example.gv: this.
* doc/local.mk: Adjust.
2013-08-01 11:20:13 +02:00
Akim Demaille e386b50f26 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-07-25 18:13:53 +02:00
Akim Demaille 534497f54b version 3.0
* NEWS: Record release date.
2013-07-25 17:55:58 +02:00
Akim Demaille a62a7b014c regen 2013-07-25 17:55:32 +02:00
Akim Demaille de1a2f20dd news: prepare 3.0
* NEWS (3.0): Reorder.
2013-07-25 17:53:59 +02:00
Akim Demaille afcc58c63e tests: fix invalid assignment when using variants in C++11
* tests/c++.at (Exception safety): In variant mode $$ is an instance
of Object.  Assigning YY_NULL in C++98 is incorrect, but behaves ok,
as it assigns YY_NULL=0 using Object::operator= (char v).  It is wrong
in C++11 as there is operator for "$$ = nullptr".
2013-07-25 17:53:59 +02:00
Akim Demaille d3ae5af6ec yacc: beware of "uninitialized uses" warnings
Again some issues with the fact that yylval is reported by GCC as
possibly not initialized in some cases.  Here, the case at hand is the
%destructor.

I am still not convinced that it is worth going all the trouble of
using pragmas to disable temporarily some warnings, instead of just
initializing the looking symbol once for all, but that's what Paul
voted for, see
<http://lists.gnu.org/archive/html/bison-patches/2012-10/msg00050.html>.

* data/c.m4 (b4_attribute_define): Define
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END,
YY_INITIAL_VALUE here, as we will need them in the generation of the
destructor function, which is defined in yacc.c before yyparse, which
was in charge of defining these macros.
* data/yacc.c (b4_declare_scanner_communication_variables): Simplify:
trying to factor the definitions of the case pure and impure is
too complex.
Actually, it is not even clear that this macro should really exist,
as even the calls are complex.
Be careful not to issue a lone ";", as this is a statement, and C90
forbids declarations after statements ; so write
"YY_INITIAL_VALUE(Decl;)", not "YY_INITIAL_VALUE(Decl);".
2013-07-25 17:53:59 +02:00
Akim Demaille 41dfa1cbf0 gnulib: update 2013-07-25 13:47:01 +02:00
Akim Demaille b7171c45f4 tests: skip C++ tests if we can't compile a simple program
There are possible conflicts between gnulib replacement functions (in
<stdio.h>) and their C++ wrappers (in <stream>).  Trying to address
these in configure seems too hard, and I don't know how to fix the issue
in gnulib.  Cowardly avoid the problem by skipping C++ tests when this
happens.
Reported by Stefano Lattarini.
http://lists.gnu.org/archive/html/bug-bison/2013-06/msg00001.html

* tests/atlocal.in (BISON_CXX_WORKS): Also set it to "skip" if we can't
compile a simple program using <stream>.
* tests/local.at: Comment changes.
2013-07-03 17:18:54 +02:00
Akim Demaille ac953ff80a tests: fix 'find' portability issues
Reported by Stefano Lattarini.
http://lists.gnu.org/archive/html/bug-bison/2013-06/msg00000.html

* tests/output.at (AT_CHECK_OUTPUT): Use Perl instead.
2013-07-03 08:39:41 +02:00
Akim Demaille facb910cbd maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-06-24 10:29:36 +02:00
49 changed files with 1212 additions and 898 deletions
+1 -1
View File
@@ -1 +1 @@
2.7.90
3.0
+5 -6
View File
@@ -1,13 +1,9 @@
GNU Bison NEWS
* Noteworthy changes in release 2.7.91 (2013-06-24) [beta]
* Noteworthy changes in release ?.? (????-??-??) [?]
** Java skeleton improvements
The Java skeleton now supports push parsing.
Contributed by Dennis Heimbigner.
* Noteworthy changes in release 2.7.90 (2013-05-30) [beta]
* Noteworthy changes in release 3.0 (2013-07-25) [stable]
** WARNING: Future backward-incompatibilities!
@@ -528,6 +524,9 @@ GNU Bison NEWS
and "%define init_throws".
Contributed by Paolo Bonzini.
The Java skeleton now supports push parsing.
Contributed by Dennis Heimbigner.
** C++ skeletons improvements
*** The parser header is no longer mandatory (lalr1.cc, glr.cc)
+1
View File
@@ -25,6 +25,7 @@ Bruce Lilly [email protected]
Bruno Haible [email protected]
Charles-Henri de Boysson [email protected]
Christian Burger [email protected]
Colin Daley [email protected]
Cris Bailiff [email protected]
Cris van Pelt [email protected]
Csaba Raduly [email protected]
+20 -13
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
scriptversion=2013-05-08.20; # UTC
scriptversion=2013-07-03.20; # UTC
# Bootstrap this package from checked-out sources.
@@ -256,12 +256,12 @@ esac
# Extra files from gnulib, which override files from other sources.
test -z "${gnulib_extra_files}" && \
gnulib_extra_files="
$build_aux/install-sh
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
$build_aux/config.guess
$build_aux/config.sub
build-aux/install-sh
build-aux/mdate-sh
build-aux/texinfo.tex
build-aux/depcomp
build-aux/config.guess
build-aux/config.sub
doc/INSTALL
"
@@ -551,7 +551,7 @@ fi
echo "$0: Bootstrapping from checked-out $package sources..."
# See if we can use gnulib's git-merge-changelog merge driver.
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
if $use_git && test -d .git && (git --version) >/dev/null 2>/dev/null ; then
if git config merge.merge-changelog.driver >/dev/null ; then
:
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
@@ -574,13 +574,17 @@ git_modules_config () {
test -f .gitmodules && git config --file .gitmodules "$@"
}
gnulib_path=$(git_modules_config submodule.gnulib.path)
test -z "$gnulib_path" && gnulib_path=gnulib
if $use_git; then
gnulib_path=$(git_modules_config submodule.gnulib.path)
test -z "$gnulib_path" && gnulib_path=gnulib
fi
# Get gnulib files.
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
# submodule, for use in the rest of the script.
case ${GNULIB_SRCDIR--} in
-)
# Note that $use_git is necessarily true in this case.
if git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..."
git submodule init || exit $?
@@ -601,8 +605,8 @@ case ${GNULIB_SRCDIR--} in
GNULIB_SRCDIR=$gnulib_path
;;
*)
# Use GNULIB_SRCDIR as a reference.
if test -d "$GNULIB_SRCDIR"/.git && \
# Use GNULIB_SRCDIR directly or as a reference.
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..."
if git submodule -h|grep -- --reference > /dev/null; then
@@ -628,6 +632,9 @@ case ${GNULIB_SRCDIR--} in
;;
esac
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
# we no longer need to use git or $gnulib_path below here.
if $bootstrap_sync; then
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
echo "$0: updating bootstrap and restarting..."
+24 -3
View File
@@ -221,6 +221,25 @@ m4_define([b4_attribute_define],
#else
# define YYUSE(E) /* empty */
#endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
])
@@ -446,7 +465,9 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
]b4_symbol_actions([destructor])[
YY_IGNORE_MAYBE_UNINITIALIZED_END
}]dnl
])
@@ -456,9 +477,9 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
# Define the "yy_symbol_print" function.
m4_define_default([b4_yy_symbol_print_define],
[[
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
/*----------------------------------------.
| Print this symbol's value on YYOUTPUT. |
`----------------------------------------*/
]b4_function_define([yy_symbol_value_print],
[static void],
+9 -26
View File
@@ -175,36 +175,19 @@ m4_define([b4_declare_scanner_communication_variables], [[
int yychar;
]b4_pure_if([[
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
/* The semantic value of the lookahead symbol. */
/* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */
static YYSTYPE yyval_default;
# define YY_INITIAL_VALUE(Value) = Value
#endif]b4_locations_if([[
static YYLTYPE yyloc_default][]b4_yyloc_default[;]])])[
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval YY_INITIAL_VALUE (yyval_default);]b4_locations_if([[
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);]b4_locations_if([[
/* Location data for the lookahead symbol. */
YYLTYPE yylloc]b4_pure_if([ = yyloc_default], [b4_yyloc_default])[;
]])b4_pure_if([], [[
static YYLTYPE yyloc_default]b4_yyloc_default[;
YYLTYPE yylloc = yyloc_default;]])],
[[/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;]b4_locations_if([[
/* Location data for the lookahead symbol. */
YYLTYPE yylloc]b4_yyloc_default[;]])[
/* Number of syntax errors so far. */
int yynerrs;]])])
+2
View File
@@ -0,0 +1,2 @@
This file is a stub, not used by the documentation. If you feel like
contributing ASCII art for example.gv, please step forward!
+14 -13
View File
@@ -23,9 +23,10 @@ doc_bison_TEXINFOS = \
# Cannot express dependencies directly on file names because of Automake.
# Obfuscate with a variable.
doc_bison = doc/bison
$(doc_bison).dvi: $(FIGS_DOT:.dot=.eps)
$(doc_bison).pdf: $(FIGS_DOT:.dot=.pdf)
$(doc_bison).html: $(FIGS_DOT:.dot=.png)
$(doc_bison).dvi: $(FIGS_GV:.gv=.eps)
$(doc_bison).info: $(FIGS_GV:.gv=.txt)
$(doc_bison).pdf: $(FIGS_GV:.gv=.pdf)
$(doc_bison).html: $(FIGS_GV:.gv=.png)
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
CLEANDIRS = doc/bison.t2d
@@ -124,25 +125,25 @@ nodist_man_MANS = doc/yacc.1
## ----------------------------- ##
CLEANDIRS += doc/figs
FIGS_DOT = \
doc/figs/example.dot \
doc/figs/example-reduce.dot doc/figs/example-shift.dot
EXTRA_DIST += \
$(FIGS_DOT) \
$(FIGS_DOT:.dot=.eps) $(FIGS_DOT:.dot=.pdf) $(FIGS_DOT:.dot=.png)
SUFFIXES += .dot .eps .pdf .png
FIGS_GV = \
doc/figs/example.gv \
doc/figs/example-reduce.gv doc/figs/example-shift.gv
EXTRA_DIST += \
$(FIGS_GV) $(FIGS_GV:.gv=.txt) \
$(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png)
SUFFIXES += .gv .eps .pdf .png
.dot.eps:
.gv.eps:
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
$(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp
$(AM_V_at) mv $@.tmp $@
.dot.pdf:
.gv.pdf:
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
$(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
$(AM_V_at) mv $@.tmp $@
.dot.png:
.gv.png:
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
$(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp
$(AM_V_at) mv $@.tmp $@
+1 -1
Submodule gnulib updated: e28fbd787c...03e96cc338
+9 -8
View File
@@ -242,7 +242,7 @@ AnnotationList__computePredecessorAnnotations (AnnotationList *self, state *s,
{
symbol_number contribution_token =
InadequacyList__getContributionToken (self->inadequacyNode, ci)
->number;
->content->number;
if (AnnotationList__isContributionAlways (self, ci))
{
annotation_node->contributions[ci] = NULL;
@@ -549,7 +549,7 @@ AnnotationList__compute_from_inadequacies (
does discard annotations in the simplest case of a S/R
conflict with no token precedence. */
aver (!bitset_test (shift_tokens, conflicted_token)
|| symbols[conflicted_token]->prec);
|| symbols[conflicted_token]->content->prec);
++annotation_counts[s->number];
if (contribution_count > *max_contributionsp)
*max_contributionsp = contribution_count;
@@ -595,7 +595,7 @@ AnnotationList__debug (AnnotationList const *self, size_t nitems, int spaces)
{
symbol_number token =
InadequacyList__getContributionToken (a->inadequacyNode, ci)
->number;
->content->number;
{
int j;
for (j = 0; j < spaces+2; ++j)
@@ -644,7 +644,7 @@ AnnotationList__computeLookaheadFilter (AnnotationList const *self,
Sbitset biter;
symbol_number token =
InadequacyList__getContributionToken (self->inadequacyNode, ci)
->number;
->content->number;
SBITSET__FOR_EACH (self->contributions[ci], nitems, biter, item)
bitset_set (lookahead_filter[item], token);
}
@@ -679,7 +679,8 @@ AnnotationList__stateMakesContribution (AnnotationList const *self,
return false;
{
symbol_number token =
InadequacyList__getContributionToken (self->inadequacyNode, ci)->number;
InadequacyList__getContributionToken (self->inadequacyNode, ci)
->content->number;
Sbitset__Index item;
Sbitset biter;
SBITSET__FOR_EACH (self->contributions[ci], nitems, biter, item)
@@ -709,7 +710,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
ContributionIndex ci;
int actioni;
ContributionIndex ci_rr_dominator = ContributionIndex__none;
int shift_precedence = token->prec;
int shift_precedence = token->content->prec;
/* If the token has no precedence set, shift is always chosen. */
if (!shift_precedence)
@@ -739,7 +740,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
if (reduce_precedence
&& (reduce_precedence < shift_precedence
|| (reduce_precedence == shift_precedence
&& token->assoc == right_assoc)))
&& token->content->assoc == right_assoc)))
continue;
if (!AnnotationList__stateMakesContribution (self, nitems, ci,
lookaheads))
@@ -747,7 +748,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
/* This uneliminated reduction contributes, so see if it can cause
an error action. */
if (reduce_precedence == shift_precedence
&& token->assoc == non_assoc)
&& token->content->assoc == non_assoc)
{
/* It's not possible to find split-stable domination over
shift after a potential %nonassoc. */
+173 -35
View File
@@ -46,11 +46,28 @@ typedef enum
} severity;
/** Struct to sort the warnings according to location. */
typedef struct
{
location *loc;
char *message;
} warning;
warning **warning_list;
struct obstack obstack_warning;
#define WARNING_LIST_INCREMENT 100
int warning_count = 0;
/** For each warning type, its severity. */
static severity warnings_flag[warnings_size];
static unsigned *indent_ptr = 0;
static const location *complain_loc;
/*------------------------.
| --warnings's handling. |
`------------------------*/
@@ -176,6 +193,9 @@ complain_init (void)
warnings_flag[b] = (1 << b & warnings_default
? severity_warning
: severity_unset);
warning_list = xmalloc (WARNING_LIST_INCREMENT * sizeof (*warning_list));
obstack_init (&obstack_warning);
}
static severity
@@ -211,7 +231,7 @@ warning_is_unset (warnings flags)
/** Display a "[-Wyacc]" like message on \a f. */
static void
warnings_print_categories (warnings warn_flags, FILE *f)
warnings_print_categories (warnings warn_flags, struct obstack *obs)
{
/* Display only the first match, the second is "-Wall". */
size_t i;
@@ -219,13 +239,79 @@ warnings_print_categories (warnings warn_flags, FILE *f)
if (warn_flags & warnings_types[i])
{
severity s = warning_severity (warnings_types[i]);
fprintf (f, " [-W%s%s]",
obstack_printf (obs, " [-W%s%s]",
s == severity_error ? "error=" : "",
warnings_args[i]);
return;
}
}
static void
start_error (const location *loc, warnings flags, const char *prefix,
const char *message, va_list args)
{
unsigned pos = 0;
if (loc)
pos += location_obstack_print (*loc, &obstack_warning);
else
pos += obstack_printf (&obstack_warning, "%s", current_file ? current_file
: program_name);
pos += obstack_printf (&obstack_warning, ": ");
if (indent_ptr)
{
if (*indent_ptr)
prefix = NULL;
if (!*indent_ptr)
*indent_ptr = pos;
else if (*indent_ptr > pos)
obstack_printf (&obstack_warning, "%*s", *indent_ptr - pos, "");
indent_ptr = 0;
}
if (prefix)
obstack_printf (&obstack_warning, "%s: ", prefix);
obstack_vprintf (&obstack_warning, message, args);
if (! (flags & silent))
warnings_print_categories (flags, &obstack_warning);
{
size_t l = strlen (message);
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')
{
obstack_1grow (&obstack_warning, '\n');
if (loc && feature_flag & feature_caret && !(flags & no_caret))
location_obstack_caret (*loc, &obstack_warning);
}
}
if (!complain_loc)
complain_loc = loc;
}
void
finish_complaint (void)
{
if (!((warning_count + 1) % WARNING_LIST_INCREMENT))
warning_list = xnrealloc (warning_list, warning_count + 1
+ WARNING_LIST_INCREMENT, sizeof (*warning_list));
warning_list[warning_count] = xmalloc (sizeof **warning_list);
warning *w = warning_list[warning_count];
if (complain_loc)
{
w->loc = xmalloc (sizeof *w->loc);
*w->loc = *complain_loc;
}
else
w->loc = NULL;
complain_loc = NULL;
w->message = obstack_finish0 (&obstack_warning);
warning_count ++;
}
/** Report an error message.
*
* \param loc the location, defaulting to the current file,
@@ -243,44 +329,38 @@ void
error_message (const location *loc, warnings flags, const char *prefix,
const char *message, va_list args)
{
unsigned pos = 0;
start_error (loc, flags, prefix, message, args);
finish_complaint ();
}
if (loc)
pos += location_print (*loc, stderr);
else
pos += fprintf (stderr, "%s", current_file ? current_file : program_name);
pos += fprintf (stderr, ": ");
if (indent_ptr)
/** Start an error message, but don't conclude it. That can be a fatal error,
an error or just a warning. */
static void
start_complains (const location *loc, warnings flags, const char *message,
va_list args)
{
severity s = warning_severity (flags);
if ((flags & complaint) && complaint_status < status_complaint)
complaint_status = status_complaint;
if (severity_warning <= s)
{
if (*indent_ptr)
prefix = NULL;
if (!*indent_ptr)
*indent_ptr = pos;
else if (*indent_ptr > pos)
fprintf (stderr, "%*s", *indent_ptr - pos, "");
indent_ptr = 0;
const char* prefix =
s == severity_fatal ? _("fatal error")
: s == severity_error ? _("error")
: _("warning");
if (severity_error <= s && ! complaint_status)
complaint_status = status_warning_as_error;
start_error (loc, flags, prefix, message, args);
}
if (prefix)
fprintf (stderr, "%s: ", prefix);
vfprintf (stderr, message, args);
if (! (flags & silent))
warnings_print_categories (flags, stderr);
{
size_t l = strlen (message);
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')
{
putc ('\n', stderr);
fflush (stderr);
if (loc && feature_flag & feature_caret && !(flags & no_caret))
location_caret (*loc, stderr);
}
}
fflush (stderr);
if (flags & fatal)
print_warnings_and_exit (stderr, EXIT_FAILURE);
}
/** Raise a complaint. That can be a fatal error, an error or just a
warning. */
@@ -304,7 +384,7 @@ complains (const location *loc, warnings flags, const char *message,
}
if (flags & fatal)
exit (EXIT_FAILURE);
print_warnings_and_exit (stderr, EXIT_FAILURE);
}
void
@@ -316,6 +396,15 @@ complain (location const *loc, warnings flags, const char *message, ...)
va_end (args);
}
void
start_complain (location const *loc, warnings flags, const char *message, ...)
{
va_list args;
va_start (args, message);
start_complains (loc, flags, message, args);
va_end (args);
}
void
complain_indent (location const *loc, warnings flags, unsigned *indent,
const char *message, ...)
@@ -327,6 +416,17 @@ complain_indent (location const *loc, warnings flags, unsigned *indent,
va_end (args);
}
void
start_complain_indent (location const *loc, warnings flags, unsigned *indent,
const char *message, ...)
{
va_list args;
indent_ptr = indent;
va_start (args, message);
start_complains (loc, flags, message, args);
va_end (args);
}
void
complain_args (location const *loc, warnings w, unsigned *indent,
int argc, char *argv[])
@@ -373,7 +473,45 @@ duplicate_directive (char const *directive,
location first, location second)
{
unsigned i = 0;
complain (&second, complaint, _("only one %s allowed per rule"), directive);
start_complain (&second, complaint, _("only one %s allowed per rule"), directive);
i += SUB_INDENT;
complain_indent (&first, complaint, &i, _("previous declaration"));
}
/** Compare warnings, to sort them. */
static int
warning_cmp (void const *a, void const *b)
{
warning *wa = *(warning * const *)a, *wb = *(warning * const *)b;
if (wa->loc && wb->loc)
return location_cmp (*wa->loc, *wb->loc);
/* Undefined location/line number at the end. */
else if (wa->loc)
return -1;
else if (wb->loc)
return 1;
return 0;
}
void
print_warnings (FILE *f)
{
if (obstack_object_size (&obstack_warning))
finish_complaint ();
qsort (warning_list, warning_count, sizeof *warning_list, warning_cmp);
for (int i = 0; i < warning_count; ++i)
{
fprintf (f, "%s", warning_list[i]->message);
free (warning_list[i]->loc);
free (warning_list[i]);
}
free (warning_list);
obstack_free (&obstack_warning, NULL);
}
void
print_warnings_and_exit (FILE *f, int exit_status)
{
print_warnings (f);
exit (exit_status);
}
+20
View File
@@ -106,6 +106,12 @@ typedef enum
(Never enabled, never disabled). */
bool warning_is_unset (warnings flags);
/** Start a complaint, with maybe a location, but don't finish it until a
normal complaint or a call to finish_complaint. */
void start_complain (location const *loc, warnings flags, char const *message,
...)
__attribute__ ((__format__ (__printf__, 3, 4)));
/** Make a complaint, with maybe a location. */
void complain (location const *loc, warnings flags, char const *message, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
@@ -114,11 +120,19 @@ void complain (location const *loc, warnings flags, char const *message, ...)
void complain_args (location const *loc, warnings w, unsigned *indent,
int argc, char *arg[]);
/** Start a complaint message with location and some indentation, but don't
finish it until a normal complaint or a call to finish_complaint. */
void start_complain_indent (location const *loc, warnings flags, unsigned *indent,
char const *message, ...)
__attribute__ ((__format__ (__printf__, 4, 5)));
/** Make a complaint with location and some indentation. */
void complain_indent (location const *loc, warnings flags, unsigned *indent,
char const *message, ...)
__attribute__ ((__format__ (__printf__, 4, 5)));
/** Finish the current complaint. */
void finish_complaint (void);
/** Report an obsolete syntax, suggest the updated one. */
void deprecated_directive (location const *loc,
@@ -141,4 +155,10 @@ typedef enum
/** Whether an error was reported. */
extern err_status complaint_status;
/** Sort and print warnings, and free them. */
void print_warnings (FILE *f);
/** Sort and print warnings, free them, then exit. */
void print_warnings_and_exit (FILE *f, int exit_status);
#endif /* !COMPLAIN_H_ */
+8 -8
View File
@@ -104,7 +104,7 @@ log_resolution (rule *r, symbol_number token,
case shift_resolution:
obstack_printf (&solved_conflicts_obstack,
" (%s < %s)",
r->prec->tag,
r->prec->symbol->tag,
symbols[token]->tag);
break;
@@ -112,7 +112,7 @@ log_resolution (rule *r, symbol_number token,
obstack_printf (&solved_conflicts_obstack,
" (%s < %s)",
symbols[token]->tag,
r->prec->tag);
r->prec->symbol->tag);
break;
case left_resolution:
@@ -176,7 +176,7 @@ log_resolution (rule *r, symbol_number token,
case shift_resolution:
obstack_printf (&solved_conflicts_xml_obstack,
"%s &lt; %s",
xml_escape_n (0, r->prec->tag),
xml_escape_n (0, r->prec->symbol->tag),
xml_escape_n (1, symbols[token]->tag));
break;
@@ -184,7 +184,7 @@ log_resolution (rule *r, symbol_number token,
obstack_printf (&solved_conflicts_xml_obstack,
"%s &lt; %s",
xml_escape_n (0, symbols[token]->tag),
xml_escape_n (1, r->prec->tag));
xml_escape_n (1, r->prec->symbol->tag));
break;
case left_resolution:
@@ -269,18 +269,18 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors, int *nerrs)
for (i = 0; i < ntokens; i++)
if (bitset_test (lookahead_tokens, i)
&& bitset_test (lookahead_set, i)
&& symbols[i]->prec)
&& symbols[i]->content->prec)
{
/* Shift-reduce conflict occurs for token number i
and it has a precedence.
The precedence of shifting is that of token i. */
if (symbols[i]->prec < redprec)
if (symbols[i]->content->prec < redprec)
{
register_precedence (redrule->prec->number, i);
log_resolution (redrule, i, reduce_resolution);
flush_shift (s, i);
}
else if (symbols[i]->prec > redprec)
else if (symbols[i]->content->prec > redprec)
{
register_precedence (i, redrule->prec->number);
log_resolution (redrule, i, shift_resolution);
@@ -294,7 +294,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors, int *nerrs)
For right associativity, keep only the shift.
For nonassociativity, keep neither. */
switch (symbols[i]->assoc)
switch (symbols[i]->content->assoc)
{
case undef_assoc:
abort ();
+8 -8
View File
@@ -65,19 +65,19 @@ rule_useless_in_parser_p (rule const *r)
}
void
rule_lhs_print (rule const *r, symbol const *previous_lhs, FILE *out)
rule_lhs_print (rule const *r, sym_content const *previous_lhs, FILE *out)
{
fprintf (out, " %3d ", r->number);
if (previous_lhs != r->lhs)
fprintf (out, "%s:", r->lhs->tag);
fprintf (out, "%s:", r->lhs->symbol->tag);
else
fprintf (out, "%*s|", (int) strlen (previous_lhs->tag), "");
fprintf (out, "%*s|", (int) strlen (previous_lhs->symbol->tag), "");
}
void
rule_lhs_print_xml (rule const *r, FILE *out, int level)
{
xml_printf (out, level, "<lhs>%s</lhs>", r->lhs->tag);
xml_printf (out, level, "<lhs>%s</lhs>", r->lhs->symbol->tag);
}
size_t
@@ -158,7 +158,7 @@ grammar_rules_partial_print (FILE *out, const char *title,
{
rule_number r;
bool first = true;
symbol *previous_lhs = NULL;
sym_content *previous_lhs = NULL;
/* rule # : LHS -> RHS */
for (r = 0; r < nrules + nuseless_productions; r++)
@@ -209,7 +209,7 @@ grammar_rules_print_xml (FILE *out, int level)
rules[r].number, usefulness);
if (rules[r].precsym)
fprintf (out, " percent_prec=\"%s\"",
xml_escape (rules[r].precsym->tag));
xml_escape (rules[r].precsym->symbol->tag));
fputs (">\n", out);
}
rule_lhs_print_xml (&rules[r], out, level + 3);
@@ -239,7 +239,7 @@ grammar_dump (FILE *out, const char *title)
for (i = ntokens; i < nsyms; i++)
fprintf (out, "%5d %5d %5d %s\n",
i,
symbols[i]->prec, symbols[i]->assoc,
symbols[i]->content->prec, symbols[i]->content->assoc,
symbols[i]->tag);
fprintf (out, "\n\n");
}
@@ -280,7 +280,7 @@ grammar_dump (FILE *out, const char *title)
rule_number r;
for (r = 0; r < nrules + nuseless_productions; r++)
{
fprintf (out, "%-5d %s:", r, rules[r].lhs->tag);
fprintf (out, "%-5d %s:", r, rules[r].lhs->symbol->tag);
rule_rhs_print (&rules[r], out);
fprintf (out, "\n");
}
+5 -4
View File
@@ -180,17 +180,17 @@ typedef struct
except if some rules are useless. */
rule_number number;
symbol *lhs;
sym_content *lhs;
item_number *rhs;
/* This symbol provides both the associativity, and the precedence. */
symbol *prec;
sym_content *prec;
int dprec;
int merger;
/* This symbol was attached to the rule via %prec. */
symbol *precsym;
sym_content *precsym;
location location;
bool useful;
@@ -220,7 +220,8 @@ bool rule_useless_in_parser_p (rule const *r);
/* Print this rule's number and lhs on OUT. If a PREVIOUS_LHS was
already displayed (by a previous call for another rule), avoid
useless repetitions. */
void rule_lhs_print (rule const *r, symbol const *previous_lhs, FILE *out);
void rule_lhs_print (rule const *r, sym_content const *previous_lhs,
FILE *out);
void rule_lhs_print_xml (rule const *r, FILE *out, int level);
/* Return the length of the RHS. */
+1 -1
View File
@@ -93,7 +93,7 @@ no_reduce_bitset_init (state const *s, bitset *no_reduce_set)
bitset_set (*no_reduce_set, TRANSITION_SYMBOL (s->transitions, n));
for (n = 0; n < s->errs->num; ++n)
if (s->errs->symbols[n])
bitset_set (*no_reduce_set, s->errs->symbols[n]->number);
bitset_set (*no_reduce_set, s->errs->symbols[n]->content->number);
}
static void
+2 -2
View File
@@ -424,7 +424,7 @@ ielr_item_has_lookahead (state *s, symbol_number lhs, size_t item,
if (item_number_is_rule_number (ritem[s->items[item] - 2]))
{
state **predecessor;
aver (lhs != accept->number);
aver (lhs != accept->content->number);
for (predecessor = predecessors[s->number];
*predecessor;
++predecessor)
@@ -580,7 +580,7 @@ typedef struct state_list {
static void
ielr_compute_goto_follow_set (bitsetv follow_kernel_items,
bitsetv always_follows, state_list *s,
symbol *n, bitset follow_set)
sym_content *n, bitset follow_set)
{
goto_number n_goto = map_goto (s->lr0Isocore->state->number, n->number);
bitset_copy (follow_set, always_follows[n_goto]);
+100
View File
@@ -137,6 +137,48 @@ location_print (location loc, FILE *out)
}
unsigned
location_obstack_print (location loc, struct obstack *obs)
{
unsigned res = 0;
int end_col = 0 != loc.end.column ? loc.end.column - 1 : 0;
res += obstack_printf (obs, "%s",
quotearg_n_style (3, escape_quoting_style, loc.start.file));
if (0 <= loc.start.line)
{
res += obstack_printf (obs, ":%d", loc.start.line);
if (0 <= loc.start.column)
res += obstack_printf (obs, ".%d", loc.start.column);
}
if (loc.start.file != loc.end.file)
{
res += obstack_printf (obs, "-%s",
quotearg_n_style (3, escape_quoting_style,
loc.end.file));
if (0 <= loc.end.line)
{
res += obstack_printf (obs, ":%d", loc.end.line);
if (0 <= end_col)
res += obstack_printf (obs, ".%d", end_col);
}
}
else if (0 <= loc.end.line)
{
if (loc.start.line < loc.end.line)
{
res += obstack_printf (obs, "-%d", loc.end.line);
if (0 <= end_col)
res += obstack_printf (obs, ".%d", end_col);
}
else if (0 <= end_col && loc.start.column < end_col)
res += obstack_printf (obs, "-%d", end_col);
}
return res;
}
/* Persistant data used by location_caret to avoid reopening and rereading the
same file all over for each error. */
struct caret_info
@@ -215,6 +257,64 @@ location_caret (location loc, FILE *out)
}
}
void
location_obstack_caret (location loc, struct obstack *obs)
{
/* FIXME: find a way to support multifile locations, and only open once each
file. That would make the procedure future-proof. */
if (! (caret_info.source
|| (caret_info.source = fopen (loc.start.file, "r")))
|| loc.start.column == -1 || loc.start.line == -1)
return;
/* If the line we want to quote is seekable (the same line as the previous
location), just seek it. If it was a previous line, we lost track of it,
so return to the start of file. */
if (caret_info.line <= loc.start.line)
fseek (caret_info.source, caret_info.offset, SEEK_SET);
else
{
caret_info.line = 1;
caret_info.offset = 0;
fseek (caret_info.source, caret_info.offset, SEEK_SET);
}
/* Advance to the line's position, keeping track of the offset. */
while (caret_info.line < loc.start.line)
caret_info.line += getc (caret_info.source) == '\n';
caret_info.offset = ftell (caret_info.source);
/* Read the actual line. Don't update the offset, so that we keep a pointer
to the start of the line. */
{
char c = getc (caret_info.source);
if (c != EOF)
{
/* Quote the file, indent by a single column. */
obstack_1grow (obs, ' ');
do
obstack_1grow (obs, c);
while ((c = getc (caret_info.source)) != EOF && c != '\n');
obstack_1grow (obs, '\n');
{
/* The caret of a multiline location ends with the first line. */
size_t len = loc.start.line != loc.end.line
? ftell (caret_info.source) - caret_info.offset
: loc.end.column;
int i;
/* Print the carets (at least one), with the same indent as above.*/
obstack_printf (obs, " %*s", loc.start.column - 1, "");
for (i = loc.start.column; i == loc.start.column || i < len; ++i)
obstack_1grow (obs, '^');
}
obstack_1grow (obs, '\n');
}
}
}
void
boundary_set_from_string (boundary *bound, char *loc_str)
{
+8
View File
@@ -24,6 +24,8 @@
# include <stdio.h>
# include <string.h> /* strcmp */
# include "system.h"
# include "uniqstr.h"
/* A boundary between two characters. */
@@ -107,6 +109,9 @@ void location_compute (location *loc,
Warning: uses quotearg's slot 3. */
unsigned location_print (location loc, FILE *out);
/* Same as location_print, only to an obstack. */
unsigned location_obstack_print (location loc, struct obstack *obs);
/* Free any allocated ressources and close any open file handles that are
left-over by the usage of location_caret. */
void cleanup_caret (void);
@@ -114,6 +119,9 @@ void cleanup_caret (void);
/* Output to OUT the line and caret corresponding to location LOC. */
void location_caret (location loc, FILE *out);
/* Same as location_caret, only with an obstack. */
void location_obstack_caret (location loc, struct obstack *obs);
/* Return -1, 0, 1, depending whether a is before, equal, or
after b. */
static inline int
+3 -1
View File
@@ -203,7 +203,6 @@ main (int argc, char *argv[])
contains things such as user actions, prologue, epilogue etc. */
gram_scanner_free ();
muscle_free ();
uniqstrs_free ();
code_scanner_free ();
skel_scanner_free ();
quotearg_free ();
@@ -218,6 +217,9 @@ main (int argc, char *argv[])
timevar_stop (TV_TOTAL);
timevar_print (stderr);
print_warnings (stderr);
uniqstrs_free ();
cleanup_caret ();
return complaint_status ? EXIT_FAILURE : EXIT_SUCCESS;
+1 -1
View File
@@ -509,7 +509,7 @@ muscle_percent_define_insert (char const *var, location variable_loc,
unsigned i = 0;
if (how_old == MUSCLE_PERCENT_DEFINE_F)
goto end;
complain_indent (&variable_loc, complaint, &i,
start_complain_indent (&variable_loc, complaint, &i,
_("%%define variable %s redefined"),
quote (variable));
i += SUB_INDENT;
+12 -10
View File
@@ -149,7 +149,7 @@ prepare_symbols (void)
MUSCLE_INSERT_INT ("tokens_number", ntokens);
MUSCLE_INSERT_INT ("nterms_number", nvars);
MUSCLE_INSERT_INT ("symbols_number", nsyms);
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number);
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->content->number);
MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number);
muscle_insert_symbol_number_table ("translate",
@@ -197,7 +197,7 @@ prepare_symbols (void)
int i;
int *values = xnmalloc (ntokens, sizeof *values);
for (i = 0; i < ntokens; ++i)
values[i] = symbols[i]->user_token_number;
values[i] = symbols[i]->content->user_token_number;
muscle_insert_int_table ("toknum", values,
values[0], 1, ntokens);
free (values);
@@ -283,9 +283,9 @@ prepare_states (void)
static int
symbol_type_name_cmp (const symbol **lhs, const symbol **rhs)
{
int res = uniqstr_cmp ((*lhs)->type_name, (*rhs)->type_name);
int res = uniqstr_cmp ((*lhs)->content->type_name, (*rhs)->content->type_name);
if (!res)
res = (*lhs)->number - (*rhs)->number;
res = (*lhs)->content->number - (*rhs)->content->number;
return res;
}
@@ -320,8 +320,9 @@ type_names_output (FILE *out)
/* The index of the first symbol of the current type-name. */
int i0 = i;
fputs (i ? ",\n[" : "[", out);
for (; i < nsyms && syms[i]->type_name == syms[i0]->type_name; ++i)
fprintf (out, "%s%d", i != i0 ? ", " : "", syms[i]->number);
for (; i < nsyms
&& syms[i]->content->type_name == syms[i0]->content->type_name; ++i)
fprintf (out, "%s%d", i != i0 ? ", " : "", syms[i]->content->number);
fputs ("]", out);
}
fputs ("])\n\n", out);
@@ -428,20 +429,21 @@ prepare_symbol_definitions (void)
MUSCLE_INSERT_STRING (key, sym->tag);
SET_KEY ("user_number");
MUSCLE_INSERT_INT (key, sym->user_token_number);
MUSCLE_INSERT_INT (key, sym->content->user_token_number);
SET_KEY ("is_token");
MUSCLE_INSERT_INT (key,
i < ntokens && sym != errtoken && sym != undeftoken);
SET_KEY ("number");
MUSCLE_INSERT_INT (key, sym->number);
MUSCLE_INSERT_INT (key, sym->content->number);
SET_KEY ("has_type");
MUSCLE_INSERT_INT (key, !!sym->type_name);
MUSCLE_INSERT_INT (key, !!sym->content->type_name);
SET_KEY ("type");
MUSCLE_INSERT_STRING (key, sym->type_name ? sym->type_name : "");
MUSCLE_INSERT_STRING (key, sym->content->type_name
? sym->content->type_name : "");
{
int j;
+282 -281
View File
File diff suppressed because it is too large Load Diff
+17 -17
View File
@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.7.90. */
/* A Bison parser, made by GNU Bison 3.0. */
/* Bison interface for Yacc-like parsers in C
@@ -48,11 +48,11 @@
extern int gram_debug;
#endif
/* "%code requires" blocks. */
#line 21 "src/parse-gram.y" /* yacc.c:1926 */
#line 21 "src/parse-gram.y" /* yacc.c:1909 */
#include "symlist.h"
#include "symtab.h"
#line 221 "src/parse-gram.y" /* yacc.c:1926 */
#line 221 "src/parse-gram.y" /* yacc.c:1909 */
typedef enum
{
@@ -61,10 +61,10 @@ extern int gram_debug;
param_parse = 1 << 1,
param_both = param_lex | param_parse
} param_type;
#line 645 "src/parse-gram.y" /* yacc.c:1926 */
#line 645 "src/parse-gram.y" /* yacc.c:1909 */
#include "muscle-tab.h"
#line 68 "src/parse-gram.h" /* yacc.c:1926 */
#line 68 "src/parse-gram.h" /* yacc.c:1909 */
/* Token type. */
#ifndef GRAM_TOKENTYPE
@@ -135,27 +135,27 @@ extern int gram_debug;
typedef union GRAM_STYPE GRAM_STYPE;
union GRAM_STYPE
{
#line 182 "src/parse-gram.y" /* yacc.c:1926 */
#line 182 "src/parse-gram.y" /* yacc.c:1909 */
unsigned char character;
#line 186 "src/parse-gram.y" /* yacc.c:1926 */
#line 186 "src/parse-gram.y" /* yacc.c:1909 */
char *code;
#line 191 "src/parse-gram.y" /* yacc.c:1926 */
#line 191 "src/parse-gram.y" /* yacc.c:1909 */
uniqstr uniqstr;
#line 199 "src/parse-gram.y" /* yacc.c:1926 */
#line 199 "src/parse-gram.y" /* yacc.c:1909 */
int integer;
#line 203 "src/parse-gram.y" /* yacc.c:1926 */
#line 203 "src/parse-gram.y" /* yacc.c:1909 */
symbol *symbol;
#line 208 "src/parse-gram.y" /* yacc.c:1926 */
#line 208 "src/parse-gram.y" /* yacc.c:1909 */
assoc assoc;
#line 211 "src/parse-gram.y" /* yacc.c:1926 */
#line 211 "src/parse-gram.y" /* yacc.c:1909 */
symbol_list *list;
#line 214 "src/parse-gram.y" /* yacc.c:1926 */
#line 214 "src/parse-gram.y" /* yacc.c:1909 */
named_ref *named_ref;
#line 241 "src/parse-gram.y" /* yacc.c:1926 */
#line 241 "src/parse-gram.y" /* yacc.c:1909 */
param_type param;
#line 409 "src/parse-gram.y" /* yacc.c:1926 */
#line 409 "src/parse-gram.y" /* yacc.c:1909 */
code_props_type code_type;
#line 647 "src/parse-gram.y" /* yacc.c:1926 */
#line 647 "src/parse-gram.y" /* yacc.c:1909 */
struct
{
@@ -163,7 +163,7 @@ code_props_type code_type;
muscle_kind kind;
} value;
#line 167 "src/parse-gram.h" /* yacc.c:1926 */
#line 167 "src/parse-gram.h" /* yacc.c:1909 */
};
# define GRAM_STYPE_IS_TRIVIAL 1
# define GRAM_STYPE_IS_DECLARED 1
+4 -4
View File
@@ -260,7 +260,7 @@ print_reductions (FILE *out, int level, state *s)
bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i));
for (i = 0; i < s->errs->num; ++i)
if (s->errs->symbols[i])
bitset_set (no_reduce_set, s->errs->symbols[i]->number);
bitset_set (no_reduce_set, s->errs->symbols[i]->content->number);
if (default_reduction)
report = true;
@@ -388,11 +388,11 @@ print_grammar (FILE *out, int level)
/* Terminals */
xml_puts (out, level + 1, "<terminals>");
for (i = 0; i < max_user_token_number + 1; i++)
if (token_translations[i] != undeftoken->number)
if (token_translations[i] != undeftoken->content->number)
{
char const *tag = symbols[token_translations[i]]->tag;
int precedence = symbols[token_translations[i]]->prec;
assoc associativity = symbols[token_translations[i]]->assoc;
int precedence = symbols[token_translations[i]]->content->prec;
assoc associativity = symbols[token_translations[i]]->content->assoc;
xml_indent (out, level + 2);
fprintf (out,
"<terminal symbol-number=\"%d\" token-number=\"%d\""
+5 -4
View File
@@ -72,7 +72,7 @@ print_core (FILE *out, state *s)
size_t i;
item_number *sitems = s->items;
size_t snritems = s->nitems;
symbol *previous_lhs = NULL;
sym_content *previous_lhs = NULL;
/* Output all the items of a state, not only its kernel. */
if (report_flag & report_itemsets)
@@ -223,7 +223,8 @@ print_reduction (FILE *out, size_t width,
if (!enabled)
fputc ('[', out);
if (r->number)
fprintf (out, _("reduce using rule %d (%s)"), r->number, r->lhs->tag);
fprintf (out, _("reduce using rule %d (%s)"), r->number,
r->lhs->symbol->tag);
else
fprintf (out, _("accept"));
if (!enabled)
@@ -257,7 +258,7 @@ print_reductions (FILE *out, state *s)
bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i));
for (i = 0; i < s->errs->num; ++i)
if (s->errs->symbols[i])
bitset_set (no_reduce_set, s->errs->symbols[i]->number);
bitset_set (no_reduce_set, s->errs->symbols[i]->content->number);
/* Compute the width of the lookahead token column. */
if (default_reduction)
@@ -408,7 +409,7 @@ print_grammar (FILE *out)
/* TERMINAL (type #) : rule #s terminal is on RHS */
fprintf (out, "%s\n\n", _("Terminals, with rules where they appear"));
for (i = 0; i < max_user_token_number + 1; i++)
if (token_translations[i] != undeftoken->number)
if (token_translations[i] != undeftoken->content->number)
{
const char *tag = symbols[token_translations[i]]->tag;
rule_number r;
+5 -4
View File
@@ -46,7 +46,7 @@ static void
print_core (struct obstack *oout, state *s)
{
item_number const *sitems = s->items;
symbol *previous_lhs = NULL;
sym_content *previous_lhs = NULL;
size_t i;
size_t snritems = s->nitems;
@@ -72,11 +72,12 @@ print_core (struct obstack *oout, state *s)
r = &rules[item_number_as_rule_number (*sp)];
obstack_printf (oout, "%3d ", r->number);
if (previous_lhs && UNIQSTR_EQ (previous_lhs->tag, r->lhs->tag))
if (previous_lhs && UNIQSTR_EQ (previous_lhs->symbol->tag,
r->lhs->symbol->tag))
obstack_printf (oout, "%*s| ",
(int) strlen (previous_lhs->tag), "");
(int) strlen (previous_lhs->symbol->tag), "");
else
obstack_printf (oout, "%s: ", escape (r->lhs->tag));
obstack_printf (oout, "%s: ", escape (r->lhs->symbol->tag));
previous_lhs = r->lhs;
for (sp = r->rhs; sp < sp1; sp++)
+28 -27
View File
@@ -129,7 +129,7 @@ record_merge_function_type (int merger, uniqstr type, location declaration_loc)
if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type))
{
unsigned indent = 0;
complain_indent (&declaration_loc, complaint, &indent,
start_complain_indent (&declaration_loc, complaint, &indent,
_("result type clash on merge function %s: "
"<%s> != <%s>"),
quote (merge_function->name), type,
@@ -240,13 +240,13 @@ grammar_current_rule_begin (symbol *lhs, location loc,
current_rule = grammar_end;
/* Mark the rule's lhs as a nonterminal if not already so. */
if (lhs->class == unknown_sym)
if (lhs->content->class == unknown_sym)
{
lhs->class = nterm_sym;
lhs->number = nvars;
lhs->content->class = nterm_sym;
lhs->content->number = nvars;
++nvars;
}
else if (lhs->class == token_sym)
else if (lhs->content->class == token_sym)
complain (&loc, complaint, _("rule given for %s, which is a token"),
lhs->tag);
}
@@ -292,15 +292,15 @@ grammar_rule_check (const symbol_list *r)
Don't worry about the default action if $$ is untyped, since $$'s
value can't be used. */
if (!r->action_props.code && r->content.sym->type_name)
if (!r->action_props.code && r->content.sym->content->type_name)
{
symbol *first_rhs = r->next->content.sym;
/* If $$ is being set in default way, report if any type mismatch. */
if (first_rhs)
{
char const *lhs_type = r->content.sym->type_name;
char const *lhs_type = r->content.sym->content->type_name;
const char *rhs_type =
first_rhs->type_name ? first_rhs->type_name : "";
first_rhs->content->type_name ? first_rhs->content->type_name : "";
if (!UNIQSTR_EQ (lhs_type, rhs_type))
complain (&r->location, Wother,
_("type clash on default action: <%s> != <%s>"),
@@ -350,7 +350,8 @@ grammar_rule_check (const symbol_list *r)
it for char literals and strings, which are always tokens. */
if (r->ruleprec
&& r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"'
&& r->ruleprec->status != declared && !r->ruleprec->prec)
&& r->ruleprec->content->status != declared
&& !r->ruleprec->content->prec)
complain (&r->location, Wother,
_("token for %%prec is not defined: %s"), r->ruleprec->tag);
}
@@ -517,8 +518,8 @@ grammar_current_rule_symbol_append (symbol *sym, location loc,
p = grammar_symbol_append (sym, loc);
if (name)
assign_named_ref (p, name);
if (sym->status == undeclared || sym->status == used)
sym->status = needed;
if (sym->content->status == undeclared || sym->content->status == used)
sym->content->status = needed;
}
/* Attach an ACTION to the current rule. */
@@ -558,11 +559,11 @@ packgram (void)
for (p = grammar; p; p = p->next)
{
symbol *ruleprec = p->ruleprec;
record_merge_function_type (p->merger, p->content.sym->type_name,
record_merge_function_type (p->merger, p->content.sym->content->type_name,
p->merger_declaration_location);
rules[ruleno].user_number = ruleno;
rules[ruleno].number = ruleno;
rules[ruleno].lhs = p->content.sym;
rules[ruleno].lhs = p->content.sym->content;
rules[ruleno].rhs = ritem + itemno;
rules[ruleno].prec = NULL;
rules[ruleno].dprec = p->dprec;
@@ -604,11 +605,11 @@ packgram (void)
/* item_number = symbol_number.
But the former needs to contain more: negative rule numbers. */
ritem[itemno++] =
symbol_number_as_item_number (p->content.sym->number);
symbol_number_as_item_number (p->content.sym->content->number);
/* A rule gets by default the precedence and associativity
of its last token. */
if (p->content.sym->class == token_sym && default_prec)
rules[ruleno].prec = p->content.sym;
if (p->content.sym->content->class == token_sym && default_prec)
rules[ruleno].prec = p->content.sym->content;
}
}
@@ -616,8 +617,8 @@ packgram (void)
the specified symbol's precedence replaces the default. */
if (ruleprec)
{
rules[ruleno].precsym = ruleprec;
rules[ruleno].prec = ruleprec;
rules[ruleno].precsym = ruleprec->content;
rules[ruleno].prec = ruleprec->content;
}
/* An item ends by the rule number (negated). */
ritem[itemno++] = rule_number_as_item_number (ruleno);
@@ -647,19 +648,19 @@ reader (void)
/* Construct the accept symbol. */
accept = symbol_get ("$accept", empty_location);
accept->class = nterm_sym;
accept->number = nvars++;
accept->content->class = nterm_sym;
accept->content->number = nvars++;
/* Construct the error token */
errtoken = symbol_get ("error", empty_location);
errtoken->class = token_sym;
errtoken->number = ntokens++;
errtoken->content->class = token_sym;
errtoken->content->number = ntokens++;
/* Construct a token that represents all undefined literal tokens.
It is always token number 2. */
undeftoken = symbol_get ("$undefined", empty_location);
undeftoken->class = token_sym;
undeftoken->number = ntokens++;
undeftoken->content->class = token_sym;
undeftoken->content->number = ntokens++;
gram_in = xfopen (grammar_file, "r");
@@ -721,10 +722,10 @@ check_and_convert_grammar (void)
if (!endtoken)
{
endtoken = symbol_get ("$end", empty_location);
endtoken->class = token_sym;
endtoken->number = 0;
endtoken->content->class = token_sym;
endtoken->content->number = 0;
/* Value specified by POSIX. */
endtoken->user_token_number = 0;
endtoken->content->user_token_number = 0;
}
/* Report any undefined symbols and consider them nonterminals. */
+9 -9
View File
@@ -163,9 +163,9 @@ inaccessable_symbols (void)
Pp = bitset_create (nrules, BITSET_FIXED);
/* If the start symbol isn't useful, then nothing will be useful. */
if (bitset_test (N, accept->number - ntokens))
if (bitset_test (N, accept->content->number - ntokens))
{
bitset_set (V, accept->number);
bitset_set (V, accept->content->number);
while (1)
{
@@ -196,9 +196,9 @@ inaccessable_symbols (void)
V = Vp;
/* Tokens 0, 1, and 2 are internal to Bison. Consider them useful. */
bitset_set (V, endtoken->number); /* end-of-input token */
bitset_set (V, errtoken->number); /* error token */
bitset_set (V, undeftoken->number); /* some undefined token */
bitset_set (V, endtoken->content->number); /* end-of-input token */
bitset_set (V, errtoken->content->number); /* error token */
bitset_set (V, undeftoken->content->number); /* some undefined token */
bitset_free (P);
P = Pp;
@@ -298,7 +298,7 @@ nonterminals_reduce (void)
if (!bitset_test (V, i))
{
nontermmap[i - ntokens] = n++;
if (symbols[i]->status != used)
if (symbols[i]->content->status != used)
complain (&symbols[i]->location, Wother,
_("nonterminal useless in grammar: %s"),
symbols[i]->tag);
@@ -310,7 +310,7 @@ nonterminals_reduce (void)
symbol **symbols_sorted = xnmalloc (nvars, sizeof *symbols_sorted);
for (i = ntokens; i < nsyms; i++)
symbols[i]->number = nontermmap[i - ntokens];
symbols[i]->content->number = nontermmap[i - ntokens];
for (i = ntokens; i < nsyms; i++)
symbols_sorted[nontermmap[i - ntokens] - ntokens] = symbols[i];
for (i = ntokens; i < nsyms; i++)
@@ -328,7 +328,7 @@ nonterminals_reduce (void)
*rhsp = symbol_number_as_item_number (nontermmap[*rhsp
- ntokens]);
}
accept->number = nontermmap[accept->number - ntokens];
accept->content->number = nontermmap[accept->content->number - ntokens];
}
nsyms -= nuseless_nonterminals;
@@ -415,7 +415,7 @@ reduce_grammar (void)
reduce_print ();
if (!bitset_test (N, accept->number - ntokens))
if (!bitset_test (N, accept->content->number - ntokens))
complain (&startsymbol_location, fatal,
_("start symbol %s does not derive any sentence"),
startsymbol->tag);
+11 -8
View File
@@ -335,7 +335,7 @@ show_sub_message (warnings warning,
const char *at_spec = get_at_spec (var->symbol_index);
if (var->err == 0)
complain_indent (&var->loc, warning, &indent,
start_complain_indent (&var->loc, warning, &indent,
_("refers to: %c%s at %s"), dollar_or_at,
var->id, at_spec);
else
@@ -372,7 +372,7 @@ show_sub_message (warnings warning,
_(", cannot be accessed from mid-rule action at $%d"),
midrule_rhs_index);
complain_indent (&id_loc, warning, &indent, "%s",
start_complain_indent (&id_loc, warning, &indent, "%s",
obstack_finish0 (&msg_buf));
obstack_free (&msg_buf, 0);
}
@@ -515,7 +515,7 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
cp_end - cp : ref_tail_fields - cp;
unsigned indent = 0;
complain_indent (&text_loc, complaint, &indent,
start_complain_indent (&text_loc, complaint, &indent,
_("invalid reference: %s"), quote (text));
indent += SUB_INDENT;
if (len == 0)
@@ -523,18 +523,18 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
location sym_loc = text_loc;
sym_loc.start.column += 1;
sym_loc.end = sym_loc.start;
complain_indent (&sym_loc, complaint, &indent,
start_complain_indent (&sym_loc, complaint, &indent,
_("syntax error after '%c', expecting integer, "
"letter, '_', '[', or '$'"),
dollar_or_at);
}
else if (midrule_rhs_index)
complain_indent (&rule->location, complaint, &indent,
start_complain_indent (&rule->location, complaint, &indent,
_("symbol not found in production before $%d: "
"%.*s"),
midrule_rhs_index, len, cp);
else
complain_indent (&rule->location, complaint, &indent,
start_complain_indent (&rule->location, complaint, &indent,
_("symbol not found in production: %.*s"),
len, cp);
@@ -542,6 +542,7 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
show_sub_messages (complaint,
cp, explicit_bracketing, midrule_rhs_index,
dollar_or_at, indent);
finish_complaint ();
return INVALID_REF;
}
case 1:
@@ -549,11 +550,12 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
unsigned indent = 0;
if (variant_count > 1)
{
complain_indent (&text_loc, Wother, &indent,
start_complain_indent (&text_loc, Wother, &indent,
_("misleading reference: %s"), quote (text));
show_sub_messages (Wother,
cp, explicit_bracketing, midrule_rhs_index,
dollar_or_at, indent + SUB_INDENT);
finish_complaint ();
}
{
unsigned symbol_index =
@@ -565,11 +567,12 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
default:
{
unsigned indent = 0;
complain_indent (&text_loc, complaint, &indent,
start_complain_indent (&text_loc, complaint, &indent,
_("ambiguous reference: %s"), quote (text));
show_sub_messages (complaint,
cp, explicit_bracketing, midrule_rhs_index,
dollar_or_at, indent + SUB_INDENT);
finish_complaint ();
return INVALID_REF;
}
}
+1 -1
View File
@@ -135,7 +135,7 @@ typedef struct
/* Is the TRANSITIONS->states[Num] labelled by the error token? */
# define TRANSITION_IS_ERROR(Transitions, Num) \
(TRANSITION_SYMBOL (Transitions, Num) == errtoken->number)
(TRANSITION_SYMBOL (Transitions, Num) == errtoken->content->number)
/* When resolving a SR conflicts, if the reduction wins, the shift is
disabled. */
+3 -3
View File
@@ -205,7 +205,7 @@ symbol_list_n_type_name_get (symbol_list *l, location loc, int n)
return NULL;
}
aver (l->content_type == SYMLIST_SYMBOL);
return l->content.sym->type_name;
return l->content.sym->content->type_name;
}
bool
@@ -223,8 +223,8 @@ symbol_list_code_props_set (symbol_list *node, code_props_type kind,
{
case SYMLIST_SYMBOL:
symbol_code_props_set (node->content.sym, kind, cprops);
if (node->content.sym->status == undeclared)
node->content.sym->status = used;
if (node->content.sym->content->status == undeclared)
node->content.sym->content->status = used;
break;
case SYMLIST_TYPE:
semantic_type_code_props_set
+140 -161
View File
@@ -58,6 +58,35 @@ static symgraph **prec_nodes;
bool *used_assoc = NULL;
/*--------------------------.
| Create a new sym_content. |
`--------------------------*/
static sym_content *
sym_content_new (symbol *s)
{
sym_content *res = xmalloc (sizeof *res);
res->symbol = s;
res->type_name = NULL;
{
int i;
for (i = 0; i < CODE_PROPS_SIZE; ++i)
code_props_none_init (&res->props[i]);
}
res->number = NUMBER_UNDEFINED;
res->prec = 0;
res->assoc = undef_assoc;
res->user_token_number = USER_NUMBER_UNDEFINED;
res->class = unknown_sym;
res->status = undeclared;
return res;
}
/*---------------------------------.
| Create a new symbol, named TAG. |
`---------------------------------*/
@@ -76,22 +105,9 @@ symbol_new (uniqstr tag, location loc)
res->tag = tag;
res->location = loc;
res->type_name = NULL;
{
int i;
for (i = 0; i < CODE_PROPS_SIZE; ++i)
code_props_none_init (&res->props[i]);
}
res->number = NUMBER_UNDEFINED;
res->prec = 0;
res->assoc = undef_assoc;
res->user_token_number = USER_NUMBER_UNDEFINED;
res->alias = NULL;
res->class = unknown_sym;
res->status = undeclared;
res->content = sym_content_new (res);
res->is_alias = false;
if (nsyms == SYMBOL_NUMBER_MAXIMUM)
complain (NULL, fatal, _("too many symbols in input grammar (limit is %d)"),
@@ -100,6 +116,30 @@ symbol_new (uniqstr tag, location loc)
return res;
}
/*--------------------.
| Free a sym_content. |
`--------------------*/
static void
sym_content_free (sym_content *sym)
{
free (sym);
}
/*---------------------------------------------------------.
| Free a symbol and its associated content if appropriate. |
`---------------------------------------------------------*/
static void
symbol_free (void *ptr)
{
symbol *sym = (symbol *)ptr;
if (!sym->is_alias)
sym_content_free (sym->content);
free (sym);
}
char const *
code_props_type_string (code_props_type kind)
{
@@ -141,12 +181,12 @@ semantic_type_new (uniqstr tag, const location *loc)
`-----------------*/
#define SYMBOL_ATTR_PRINT(Attr) \
if (s->Attr) \
fprintf (f, " %s { %s }", #Attr, s->Attr)
if (s->content->Attr) \
fprintf (f, " %s { %s }", #Attr, s->content->Attr)
#define SYMBOL_CODE_PRINT(Attr) \
if (s->props[Attr].code) \
fprintf (f, " %s { %s }", #Attr, s->props[Attr].code)
if (s->content->props[Attr].code) \
fprintf (f, " %s { %s }", #Attr, s->content->props[Attr].code)
void
symbol_print (symbol const *s, FILE *f)
@@ -193,7 +233,7 @@ is_identifier (uniqstr s)
uniqstr
symbol_id_get (symbol const *sym)
{
aver (sym->user_token_number != USER_NUMBER_HAS_STRING_ALIAS);
aver (sym->content->user_token_number != USER_NUMBER_HAS_STRING_ALIAS);
if (sym->alias)
sym = sym->alias;
return is_identifier (sym->tag) ? sym->tag : 0;
@@ -210,7 +250,7 @@ symbol_redeclaration (symbol *s, const char *what, location first,
location second)
{
unsigned i = 0;
complain_indent (&second, complaint, &i,
start_complain_indent (&second, complaint, &i,
_("%s redeclaration for %s"), what, s->tag);
i += SUB_INDENT;
complain_indent (&first, complaint, &i,
@@ -222,7 +262,7 @@ semantic_type_redeclaration (semantic_type *s, const char *what, location first,
location second)
{
unsigned i = 0;
complain_indent (&second, complaint, &i,
start_complain_indent (&second, complaint, &i,
_("%s redeclaration for <%s>"), what, s->tag);
i += SUB_INDENT;
complain_indent (&first, complaint, &i,
@@ -241,13 +281,13 @@ symbol_type_set (symbol *sym, uniqstr type_name, location loc)
{
if (type_name)
{
if (sym->type_name)
symbol_redeclaration (sym, "%type", sym->type_location, loc);
if (sym->content->type_name)
symbol_redeclaration (sym, "%type", sym->content->type_location, loc);
else
{
uniqstr_assert (type_name);
sym->type_name = type_name;
sym->type_location = loc;
sym->content->type_name = type_name;
sym->content->type_location = loc;
}
}
}
@@ -260,12 +300,12 @@ void
symbol_code_props_set (symbol *sym, code_props_type kind,
code_props const *code)
{
if (sym->props[kind].code)
if (sym->content->props[kind].code)
symbol_redeclaration (sym, code_props_type_string (kind),
sym->props[kind].location,
sym->content->props[kind].location,
code->location);
else
sym->props[kind] = *code;
sym->content->props[kind] = *code;
}
/*-----------------------------------------------------.
@@ -293,14 +333,14 @@ code_props *
symbol_code_props_get (symbol *sym, code_props_type kind)
{
/* Per-symbol code props. */
if (sym->props[kind].code)
return &sym->props[kind];
if (sym->content->props[kind].code)
return &sym->content->props[kind];
/* Per-type code props. */
if (sym->type_name)
if (sym->content->type_name)
{
code_props *code =
&semantic_type_get (sym->type_name, NULL)->props[kind];
&semantic_type_get (sym->content->type_name, NULL)->props[kind];
if (code->code)
return code;
}
@@ -308,8 +348,8 @@ symbol_code_props_get (symbol *sym, code_props_type kind)
/* Apply default code props's only to user-defined symbols. */
if (sym->tag[0] != '$' && sym != errtoken)
{
code_props *code =
&semantic_type_get (sym->type_name ? "*" : "", NULL)->props[kind];
code_props *code = &semantic_type_get (sym->content->type_name ? "*" : "",
NULL)->props[kind];
if (code->code)
return code;
}
@@ -324,16 +364,17 @@ symbol_code_props_get (symbol *sym, code_props_type kind)
void
symbol_precedence_set (symbol *sym, int prec, assoc a, location loc)
{
sym_content *s = sym->content;
if (a != undef_assoc)
{
if (sym->prec)
symbol_redeclaration (sym, assoc_to_string (a), sym->prec_location,
loc);
if (s->prec)
symbol_redeclaration (sym, assoc_to_string (a),
s->prec_location, loc);
else
{
sym->prec = prec;
sym->assoc = a;
sym->prec_location = loc;
s->prec = prec;
s->assoc = a;
s->prec_location = loc;
}
}
@@ -350,26 +391,26 @@ void
symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring)
{
bool warned = false;
if (sym->class != unknown_sym && sym->class != class)
if (sym->content->class != unknown_sym && sym->content->class != class)
{
complain (&loc, complaint, _("symbol %s redefined"), sym->tag);
/* Don't report both "redefined" and "redeclared". */
warned = true;
}
if (class == nterm_sym && sym->class != nterm_sym)
sym->number = nvars++;
else if (class == token_sym && sym->number == NUMBER_UNDEFINED)
sym->number = ntokens++;
if (class == nterm_sym && sym->content->class != nterm_sym)
sym->content->number = nvars++;
else if (class == token_sym && sym->content->number == NUMBER_UNDEFINED)
sym->content->number = ntokens++;
sym->class = class;
sym->content->class = class;
if (declaring)
{
if (sym->status == declared && !warned)
if (sym->content->status == declared && !warned)
complain (&loc, Wother, _("symbol %s redeclared"), sym->tag);
else
sym->status = declared;
sym->content->status = declared;
}
}
@@ -383,10 +424,7 @@ symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
{
int *user_token_numberp;
if (sym->user_token_number != USER_NUMBER_HAS_STRING_ALIAS)
user_token_numberp = &sym->user_token_number;
else
user_token_numberp = &sym->alias->user_token_number;
user_token_numberp = &sym->content->user_token_number;
if (*user_token_numberp != USER_NUMBER_UNDEFINED
&& *user_token_numberp != user_token_number)
complain (&loc, complaint, _("redefining user token number of %s"),
@@ -396,12 +434,12 @@ symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
/* User defined $end token? */
if (user_token_number == 0)
{
endtoken = sym;
endtoken = sym->content->symbol;
/* It is always mapped to 0, so it was already counted in
NTOKENS. */
if (endtoken->number != NUMBER_UNDEFINED)
if (endtoken->content->number != NUMBER_UNDEFINED)
--ntokens;
endtoken->number = 0;
endtoken->content->number = 0;
}
}
@@ -414,16 +452,17 @@ symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
static inline bool
symbol_check_defined (symbol *sym)
{
if (sym->class == unknown_sym)
sym_content *s = sym->content;
if (s->class == unknown_sym)
{
assert (sym->status != declared);
assert (s->status != declared);
complain (&sym->location,
sym->status == needed ? complaint : Wother,
s->status == needed ? complaint : Wother,
_("symbol %s is used, but is not defined as a token"
" and has no rules"),
sym->tag);
sym->class = nterm_sym;
sym->number = nvars++;
s->class = nterm_sym;
s->number = nvars++;
}
{
@@ -434,9 +473,9 @@ symbol_check_defined (symbol *sym)
/* Set the semantic type status associated to the current symbol to
'declared' so that we could check semantic types unnecessary uses. */
if (sym->type_name)
if (s->type_name)
{
semantic_type *sem_type = semantic_type_get (sym->type_name, NULL);
semantic_type *sem_type = semantic_type_get (s->type_name, NULL);
if (sem_type)
sem_type->status = declared;
}
@@ -493,71 +532,16 @@ symbol_make_alias (symbol *sym, symbol *str, location loc)
_("symbol %s given more than one literal string"), sym->tag);
else
{
str->class = token_sym;
str->user_token_number = sym->user_token_number;
sym->user_token_number = USER_NUMBER_HAS_STRING_ALIAS;
sym_content_free (str->content);
str->content = sym->content;
str->content->symbol = str;
str->is_alias = true;
str->alias = sym;
sym->alias = str;
str->number = sym->number;
symbol_type_set (str, sym->type_name, loc);
}
}
/*---------------------------------------------------------.
| Check that THIS, and its alias, have same precedence and |
| associativity. |
`---------------------------------------------------------*/
static inline void
symbol_check_alias_consistency (symbol *this)
{
symbol *sym = this;
symbol *str = this->alias;
/* Check only the symbol in the symbol-string pair. */
if (!(this->alias
&& this->user_token_number == USER_NUMBER_HAS_STRING_ALIAS))
return;
if (str->type_name != sym->type_name)
{
if (str->type_name)
symbol_type_set (sym, str->type_name, str->type_location);
else
symbol_type_set (str, sym->type_name, sym->type_location);
}
{
int i;
for (i = 0; i < CODE_PROPS_SIZE; ++i)
if (str->props[i].code)
symbol_code_props_set (sym, i, &str->props[i]);
else if (sym->props[i].code)
symbol_code_props_set (str, i, &sym->props[i]);
}
if (sym->prec || str->prec)
{
if (str->prec)
symbol_precedence_set (sym, str->prec, str->assoc,
str->prec_location);
else
symbol_precedence_set (str, sym->prec, sym->assoc,
sym->prec_location);
}
}
static bool
symbol_check_alias_consistency_processor (void *this,
void *null ATTRIBUTE_UNUSED)
{
symbol_check_alias_consistency (this);
return true;
}
/*-------------------------------------------------------------------.
| Assign a symbol number, and write the definition of the token name |
| into FDEFINES. Put in SYMBOLS. |
@@ -566,13 +550,13 @@ symbol_check_alias_consistency_processor (void *this,
static inline bool
symbol_pack (symbol *this)
{
aver (this->number != NUMBER_UNDEFINED);
if (this->class == nterm_sym)
this->number += ntokens;
else if (this->user_token_number == USER_NUMBER_HAS_STRING_ALIAS)
aver (this->content->number != NUMBER_UNDEFINED);
if (this->content->class == nterm_sym)
this->content->number += ntokens;
else if (this->content->user_token_number == USER_NUMBER_HAS_STRING_ALIAS)
return true;
symbols[this->number] = this;
symbols[this->content->number] = this->content->symbol;
return true;
}
@@ -582,7 +566,6 @@ symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED)
return symbol_pack (this);
}
static void
user_token_number_redeclaration (int num, symbol *first, symbol *second)
{
@@ -598,7 +581,7 @@ user_token_number_redeclaration (int num, symbol *first, symbol *second)
first = second;
second = tmp;
}
complain_indent (&second->location, complaint, &i,
start_complain_indent (&second->location, complaint, &i,
_("user token number %d redeclaration for %s"),
num, second->tag);
i += SUB_INDENT;
@@ -615,17 +598,18 @@ static inline bool
symbol_translation (symbol *this)
{
/* Non-terminal? */
if (this->class == token_sym
&& this->user_token_number != USER_NUMBER_HAS_STRING_ALIAS)
if (this->content->class == token_sym
&& !this->is_alias)
{
/* A token which translation has already been set? */
if (token_translations[this->user_token_number] != undeftoken->number)
/* A token which translation has already been set?*/
if (token_translations[this->content->user_token_number]
!= undeftoken->content->number)
user_token_number_redeclaration
(this->user_token_number,
symbols[token_translations[this->user_token_number]],
this);
(this->content->user_token_number,
symbols[token_translations[this->content->user_token_number]], this);
else
token_translations[this->user_token_number] = this->number;
token_translations[this->content->user_token_number]
= this->content->number;
}
return true;
@@ -711,7 +695,7 @@ symbols_new (void)
NULL,
hash_symbol_hasher,
hash_symbol_comparator,
free);
symbol_free);
semantic_type_table = hash_initialize (HT_INITIAL_CAPACITY,
NULL,
hash_semantic_type_hasher,
@@ -811,8 +795,8 @@ dummy_symbol_get (location loc)
sprintf (buf, "$@%d", ++dummy_count);
sym = symbol_get (buf, loc);
sym->class = nterm_sym;
sym->number = nvars++;
sym->content->class = nterm_sym;
sym->content->number = nvars++;
return sym;
}
@@ -902,7 +886,7 @@ symbols_token_translations_init (void)
max_user_token_number = 0;
for (i = 0; i < ntokens; ++i)
{
symbol *this = symbols[i];
sym_content *this = symbols[i]->content;
if (this->user_token_number != USER_NUMBER_UNDEFINED)
{
if (this->user_token_number > max_user_token_number)
@@ -914,8 +898,8 @@ symbols_token_translations_init (void)
/* If 256 is not used, assign it to error, to follow POSIX. */
if (num_256_available_p
&& errtoken->user_token_number == USER_NUMBER_UNDEFINED)
errtoken->user_token_number = 256;
&& errtoken->content->user_token_number == USER_NUMBER_UNDEFINED)
errtoken->content->user_token_number = 256;
/* Set the missing user numbers. */
if (max_user_token_number < 256)
@@ -923,7 +907,7 @@ symbols_token_translations_init (void)
for (i = 0; i < ntokens; ++i)
{
symbol *this = symbols[i];
sym_content *this = symbols[i]->content;
if (this->user_token_number == USER_NUMBER_UNDEFINED)
this->user_token_number = ++max_user_token_number;
if (this->user_token_number > max_user_token_number)
@@ -936,7 +920,7 @@ symbols_token_translations_init (void)
/* Initialize all entries for literal tokens to the internal token
number for $undefined, which represents all invalid inputs. */
for (i = 0; i < max_user_token_number + 1; i++)
token_translations[i] = undeftoken->number;
token_translations[i] = undeftoken->content->number;
symbols_do (symbol_translation_processor, NULL,
symbol_table, &symbols_sorted);
}
@@ -950,9 +934,6 @@ symbols_token_translations_init (void)
void
symbols_pack (void)
{
symbols_do (symbol_check_alias_consistency_processor, NULL,
symbol_table, &symbols_sorted);
symbols = xcalloc (nsyms, sizeof *symbols);
symbols_do (symbol_pack_processor, NULL, symbol_table, &symbols_sorted);
@@ -971,9 +952,7 @@ symbols_pack (void)
else
{
symbols[writei] = symbols[readi];
symbols[writei]->number = writei;
if (symbols[writei]->alias)
symbols[writei]->alias->number = writei;
symbols[writei]->content->number = writei;
writei += 1;
}
}
@@ -982,11 +961,11 @@ symbols_pack (void)
symbols_token_translations_init ();
if (startsymbol->class == unknown_sym)
if (startsymbol->content->class == unknown_sym)
complain (&startsymbol_location, fatal,
_("the start symbol %s is undefined"),
startsymbol->tag);
else if (startsymbol->class == token_sym)
else if (startsymbol->content->class == token_sym)
complain (&startsymbol_location, fatal,
_("the start symbol %s is a token"),
startsymbol->tag);
@@ -1123,9 +1102,9 @@ static inline bool
is_assoc_useless (symbol *s)
{
return s
&& s->assoc != undef_assoc
&& s->assoc != precedence_assoc
&& !used_assoc[s->number];
&& s->content->assoc != undef_assoc
&& s->content->assoc != precedence_assoc
&& !used_assoc[s->content->number];
}
/*-------------------------------.
@@ -1157,19 +1136,19 @@ print_precedence_warnings (void)
{
symbol *s = symbols[i];
if (s
&& s->prec != 0
&& s->content->prec != 0
&& !prec_nodes[i]->pred
&& !prec_nodes[i]->succ)
{
if (is_assoc_useless (s))
complain (&s->prec_location, Wprecedence,
complain (&s->content->prec_location, Wprecedence,
_("useless precedence and associativity for %s"), s->tag);
else if (s->assoc == precedence_assoc)
complain (&s->prec_location, Wprecedence,
else if (s->content->assoc == precedence_assoc)
complain (&s->content->prec_location, Wprecedence,
_("useless precedence for %s"), s->tag);
}
else if (is_assoc_useless (s))
complain (&s->prec_location, Wprecedence,
complain (&s->content->prec_location, Wprecedence,
_("useless associativity for %s, use %%precedence"), s->tag);
}
free (used_assoc);
+15 -6
View File
@@ -50,6 +50,7 @@ typedef int symbol_number;
typedef struct symbol symbol;
typedef struct sym_content sym_content;
/* Declaration status of a symbol.
@@ -82,8 +83,6 @@ enum code_props_type
enum { CODE_PROPS_SIZE = 2 };
/* When extending this structure, be sure to complete
symbol_check_alias_consistency. */
struct symbol
{
/** The key, name of the symbol. */
@@ -91,6 +90,20 @@ struct symbol
/** The location of its first occurrence. */
location location;
/* Points to the other in the symbol-string pair for an alias. */
symbol *alias;
/** Whether this symbol is the alias of another or not. */
bool is_alias;
/** All the info about the pointed symbol is there. */
sym_content *content;
};
struct sym_content
{
symbol *symbol;
/** Its \c \%type.
Beware that this is the type_name as was entered by the user,
@@ -117,10 +130,6 @@ struct symbol
assoc assoc;
int user_token_number;
/* Points to the other in the symbol-string pair for an alias.
Special value USER_NUMBER_HAS_STRING_ALIAS in the symbol half of the
symbol-string pair for an alias. */
symbol *alias;
symbol_class class;
status status;
};
+2 -2
View File
@@ -290,7 +290,7 @@ action_row (state *s)
/* Do not use any default reduction if there is a shift for
error */
if (sym == errtoken->number)
if (sym == errtoken->content->number)
nodefault = true;
}
@@ -300,7 +300,7 @@ action_row (state *s)
for (i = 0; i < errp->num; i++)
{
symbol *sym = errp->symbols[i];
actrow[sym->number] = ACTION_NUMBER_MINIMUM;
actrow[sym->content->number] = ACTION_NUMBER_MINIMUM;
}
/* Turn off default reductions where requested by the user. See
+4 -4
View File
@@ -1385,8 +1385,8 @@ AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([-o input.c input.y], 0,,
[[input.y:24.70-72: warning: useless %destructor for type <*> [-Wother]
input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
input.y:33.3-23: warning: unset value: $$ [-Wother]
input.y:32.3-23: warning: unused value: $3 [-Wother]
input.y:33.3-23: warning: unset value: $$ [-Wother]
]])
AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
@@ -1396,12 +1396,12 @@ AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
%printer { fprintf (yyoutput, "<*> printer should not be called"); } <*>
^^^
input.y:33.3-23: warning: unset value: $$ [-Wother]
{ @$ = 4; } // Only used.
^^^^^^^^^^^^^^^^^^^^^
input.y:32.3-23: warning: unused value: $3 [-Wother]
{ USE ($$); @$ = 3; } // Only set.
^^^^^^^^^^^^^^^^^^^^^
input.y:33.3-23: warning: unset value: $$ [-Wother]
{ @$ = 4; } // Only used.
^^^^^^^^^^^^^^^^^^^^^
]])
AT_COMPILE([input])
+31
View File
@@ -50,6 +50,37 @@ CXXFLAGS="$NO_WERROR_CXXFLAGS @WERROR_CXXFLAGS@"
# If 'exit 77'; skip all C++ tests; otherwise ':'.
BISON_CXX_WORKS='@BISON_CXX_WORKS@'
# Be sure that the C++ compiler is not broken because of gnulib. This
# cannot be checked in configure (gnulib is not parameterized yet),
# and checking this in every C++ test in AC_COMPILE_CXX is too costly.
#
# http://lists.gnu.org/archive/html/bug-bison/2013-06/msg00001.html
#
# FIXME: Check (say 2014) whether this is still needed.
if $BISON_CXX_WORKS; then
# See AT_DATA_SOURCE_PROLOGUE.
cat >conftest.cc <<EOF
#include <config.h>
/* We don't need perfect functions for these tests. */
#undef malloc
#undef memcmp
#undef realloc
#include <iostream>
int main ()
{
std::cout << "Works" << std::endl;
}
EOF
ls
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS -o conftest conftest.cc
case $? in
0);;
*) BISON_CXX_WORKS="as_fn_error 77 cannot-compile-simple-program";;
esac
rm -f conftest*
fi
# Whether the compiler supports POSIXLY_CORRECT defined.
: ${C_COMPILER_POSIXLY_CORRECT='@C_COMPILER_POSIXLY_CORRECT@'}
: ${CXX_COMPILER_POSIXLY_CORRECT='@CXX_COMPILER_POSIXLY_CORRECT@'}
+3 -3
View File
@@ -795,11 +795,11 @@ item:
// Not just 'E', otherwise we reduce when 'E' is the lookahead, and
// then the stack is emptied, defeating the point of the test.
| 'E' 'a' { YYUSE($][1); $][$ = $][2; }
| 'R' { $][$ = YY_NULL; ]AT_VARIANT_IF([], [delete $][1]; )[YYERROR; }
| 'R' { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYERROR; }
| 'p' { $][$ = $][1; }
| 's' { $][$ = $][1; throw std::runtime_error ("reduction"); }
| 'T' { $][$ = YY_NULL; ]AT_VARIANT_IF([], [delete $][1]; )[YYABORT; }
| error { $][$ = YY_NULL; yyerrok; }
| 'T' { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYABORT; }
| error { ]AT_VARIANT_IF([], [$][$ = YY_NULL; ])[yyerrok; }
;
%%
+23 -23
View File
@@ -243,18 +243,18 @@ f: B
]])
AT_BISON_CHECK([-Wprecedence -fcaret -o input.c input.y], 0, [],
[[input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence]
%nonassoc U
^^^^^^^^^
input.y:6.1-6: warning: useless precedence and associativity for V [-Wprecedence]
%right V
^^^^^^
[[input.y:2.1-11: warning: useless precedence for Z [-Wprecedence]
%precedence Z
^^^^^^^^^^^
input.y:5.1-5: warning: useless precedence and associativity for W [-Wprecedence]
%left W
^^^^^
input.y:2.1-11: warning: useless precedence for Z [-Wprecedence]
%precedence Z
^^^^^^^^^^^
input.y:6.1-6: warning: useless precedence and associativity for V [-Wprecedence]
%right V
^^^^^^
input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence]
%nonassoc U
^^^^^^^^^
]])
AT_CLEANUP
@@ -1006,8 +1006,8 @@ cond:
]])
AT_BISON_CHECK([-o input.c input.y], 0, [],
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother]
[[input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother]
input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
]])
AT_CLEANUP
@@ -1050,8 +1050,8 @@ id : '0';
]])
AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
input.y:4.6-8: warning: rule useless in parser due to conflicts [-Wother]
[[input.y:4.6-8: warning: rule useless in parser due to conflicts [-Wother]
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]])
# Check the contents of the report.
@@ -1265,9 +1265,9 @@ e: e '+' e
]])
AT_BISON_CHECK([-Wall -o input.c input.y], 0, [],
[[input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
input.y:1.1-5: warning: useless precedence and associativity for '+' [-Wprecedence]
[[input.y:1.1-5: warning: useless precedence and associativity for '+' [-Wprecedence]
input.y:2.1-5: warning: useless precedence and associativity for '*' [-Wprecedence]
input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
]])
AT_CLEANUP
@@ -1369,15 +1369,15 @@ reported_conflicts:
]])
AT_BISON_CHECK([[--report=all input.y]], 0, [],
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
input.y:12.5-20: warning: rule useless in parser due to conflicts [-Wother]
[[input.y:12.5-20: warning: rule useless in parser due to conflicts [-Wother]
input.y:20.5-20: warning: rule useless in parser due to conflicts [-Wother]
input.y:21.4: warning: rule useless in parser due to conflicts [-Wother]
input.y:25.13: warning: rule useless in parser due to conflicts [-Wother]
input.y:25.16: warning: rule useless in parser due to conflicts [-Wother]
input.y:31.5-7: warning: rule useless in parser due to conflicts [-Wother]
input.y:32.4: warning: rule useless in parser due to conflicts [-Wother]
input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]])
AT_CHECK([[cat input.output]], 0,
@@ -1522,12 +1522,12 @@ AT_DATA([[input-keep.y]],
AT_CHECK([[cat input.y >> input-keep.y]])
AT_BISON_CHECK([[input-keep.y]], 0, [],
[[input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
input-keep.y:22.4: warning: rule useless in parser due to conflicts [-Wother]
[[input-keep.y:22.4: warning: rule useless in parser due to conflicts [-Wother]
input-keep.y:26.16: warning: rule useless in parser due to conflicts [-Wother]
input-keep.y:32.5-7: warning: rule useless in parser due to conflicts [-Wother]
input-keep.y:33.4: warning: rule useless in parser due to conflicts [-Wother]
input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
]])
AT_CLEANUP
@@ -1705,9 +1705,9 @@ exp: 'a' | 'a';
]])
AT_BISON_CHECK([[2.y]], [[0]], [],
[[2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
[[2.y:3.12-14: warning: rule useless in parser due to conflicts [-Wother]
2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
2.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2.y:3.12-14: warning: rule useless in parser due to conflicts [-Wother]
]])
AT_CLEANUP
+84 -84
View File
@@ -426,7 +426,25 @@ dnl don't like even 'print $!4;'.
[[LEX_GETLINE, '$', '!', YNUMBER, '*', YNUMBER, ';']],
dnl BISON-STDERR
[[input.y:66.10: warning: empty rule without %empty [-Wempty-rule]
[[input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence]
input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence]
input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence]
input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence]
input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence]
input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence]
input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence]
input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence]
input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence]
input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence]
input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence]
input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence]
input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence]
input.y:66.10: warning: empty rule without %empty [-Wempty-rule]
input.y:169.8: warning: empty rule without %empty [-Wempty-rule]
input.y:174.12: warning: empty rule without %empty [-Wempty-rule]
input.y:179.13: warning: empty rule without %empty [-Wempty-rule]
@@ -439,24 +457,6 @@ input.y:322.9: warning: empty rule without %empty [-Wempty-rule]
]AT_COND_CASE([[canonical LR]],
[[input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr]]],
[[input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr]]])[
input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence]
input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence]
input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence]
input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence]
input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence]
input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence]
input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence]
input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence]
input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence]
input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence]
input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence]
input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence]
input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence]
]],
dnl LAST-STATE
@@ -1395,7 +1395,13 @@ dnl INPUT
[[]],
dnl BISON-STDERR
[[input.y:128.12: warning: empty rule without %empty [-Wempty-rule]
[[input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]
input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence]
input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence]
input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence]
input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
input.y:128.12: warning: empty rule without %empty [-Wempty-rule]
input.y:137.10: warning: empty rule without %empty [-Wempty-rule]
input.y:142.8: warning: empty rule without %empty [-Wempty-rule]
input.y:161.15: warning: empty rule without %empty [-Wempty-rule]
@@ -1422,12 +1428,6 @@ input.y:591.14: warning: empty rule without %empty [-Wempty-rule]
input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr]]],
[[input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr]]])[
input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]
input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence]
input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence]
input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence]
]],
dnl LAST-STATE
@@ -2009,57 +2009,27 @@ dnl without being followed by "of".)
[[VARIABLE, '=', LABEL, LEFT, DOT_X]],
dnl BISON-STDERR
[[input.y:202.19: warning: empty rule without %empty [-Wempty-rule]
input.y:270.6: warning: empty rule without %empty [-Wempty-rule]
input.y:292.12: warning: empty rule without %empty [-Wempty-rule]
input.y:309.17: warning: empty rule without %empty [-Wempty-rule]
input.y:382.13: warning: empty rule without %empty [-Wempty-rule]
input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother]
input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence]
[[input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence]
input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence]
input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence]
input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence]
input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence]
input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence]
input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence]
input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence]
input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence]
input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence]
input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence]
input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence]
input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence]
input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence]
input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence]
input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence]
input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence]
@@ -2071,12 +2041,43 @@ input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wpr
input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence]
input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence]
input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for '@<:@', use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for TOP, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for NORTH, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for SOUTH, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for EAST, use %precedence [-Wprecedence]
@@ -2084,18 +2085,17 @@ input.y:168.1-5: warning: useless associativity for WEST, use %precedence [-Wpre
input.y:168.1-5: warning: useless associativity for CENTER, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for END, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for START, use %precedence [-Wprecedence]
input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence]
input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence]
input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence]
input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for '@<:@', use %precedence [-Wprecedence]
input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence]
input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence]
input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence]
input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence]
input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
input.y:202.19: warning: empty rule without %empty [-Wempty-rule]
input.y:270.6: warning: empty rule without %empty [-Wempty-rule]
input.y:292.12: warning: empty rule without %empty [-Wempty-rule]
input.y:309.17: warning: empty rule without %empty [-Wempty-rule]
input.y:382.13: warning: empty rule without %empty [-Wempty-rule]
input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother]
]],
dnl LAST-STATE
+62 -62
View File
@@ -142,15 +142,15 @@ exp: foo { $$; } foo { $2; } foo
]])
AT_BISON_CHECK([-fcaret input.y], [1], [],
[[input.y:5.12-13: error: $$ for the midrule at $2 of 'exp' has no declared type
[[input.y:5.6-32: warning: type clash on default action: <bar> != <> [-Wother]
exp: foo { $$; } foo { $2; } foo
^^^^^^^^^^^^^^^^^^^^^^^^^^^
input.y:5.12-13: error: $$ for the midrule at $2 of 'exp' has no declared type
exp: foo { $$; } foo { $2; } foo
^^
input.y:5.24-25: error: $2 of 'exp' has no declared type
exp: foo { $$; } foo { $2; } foo
^^
input.y:5.6-32: warning: type clash on default action: <bar> != <> [-Wother]
exp: foo { $$; } foo { $2; } foo
^^^^^^^^^^^^^^^^^^^^^^^^^^^
input.y:6.6-8: warning: type clash on default action: <bar> != <> [-Wother]
| foo
^^^
@@ -208,12 +208,12 @@ _AT_UNUSED_VALUES_DECLARATIONS])
AT_BISON_CHECK(m4_ifval($2, [--warnings=midrule-values ])[-fcaret input.y],
[0], [],
[[input.y:11.10-32: warning: unset value: $][$ [-Wother]
a: INT | INT { } INT { } INT { };
^^^^^^^^^^^^^^^^^^^^^^^
input.y:11.10-12: warning: unused value: $][1 [-Wother]
[[input.y:11.10-12: warning: unused value: $][1 [-Wother]
a: INT | INT { } INT { } INT { };
^^^
input.y:11.10-32: warning: unset value: $][$ [-Wother]
a: INT | INT { } INT { } INT { };
^^^^^^^^^^^^^^^^^^^^^^^
input.y:11.18-20: warning: unused value: $][3 [-Wother]
a: INT | INT { } INT { } INT { };
^^^
@@ -223,28 +223,28 @@ input.y:11.26-28: warning: unused value: $][5 [-Wother]
input.y:12.10-15: warning: empty rule for typed nonterminal, and no action [-Wother]
b: INT | %empty;
^^^^^^
input.y:13.10-62: warning: unset value: $][$ [-Wother]
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
]]m4_ifval($2, [[[input.y:13.14-20: warning: unset value: $][$ [-Wmidrule-values]
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
^^^^^^^
input.y:13.26-41: warning: unset value: $][$ [-Wmidrule-values]
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
^^^^^^^^^^^^^^^^
]]])[[input.y:13.10-62: warning: unset value: $][$ [-Wother]
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
input.y:13.22-24: warning: unused value: $][3 [-Wother]
]]])[[input.y:13.22-24: warning: unused value: $][3 [-Wother]
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
^^^
input.y:13.43-45: warning: unused value: $][5 [-Wother]
]]m4_ifval($2, [[[input.y:13.26-41: warning: unset value: $][$ [-Wmidrule-values]
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
^^^^^^^^^^^^^^^^
]]])[[input.y:13.43-45: warning: unused value: $][5 [-Wother]
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
^^^
input.y:14.10-49: warning: unset value: $][$ [-Wother]
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
]]m4_ifval($2, [[[input.y:14.14-16: warning: unset value: $][$ [-Wmidrule-values]
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
^^^
]]])[[input.y:14.10-49: warning: unset value: $][$ [-Wother]
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
input.y:14.18-20: warning: unused value: $][3 [-Wother]
]]])[[input.y:14.18-20: warning: unused value: $][3 [-Wother]
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
^^^
input.y:14.30-32: warning: unused value: $][5 [-Wother]
@@ -259,12 +259,12 @@ input.y:15.18-20: warning: unused value: $][3 [-Wother]
input.y:15.27-29: warning: unused value: $][5 [-Wother]
e: INT | INT { } INT { } INT { $][1; };
^^^
input.y:17.10-58: warning: unset value: $][$ [-Wother]
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
input.y:17.10-12: warning: unused value: $][1 [-Wother]
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
^^^
input.y:17.10-58: warning: unset value: $][$ [-Wother]
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
]]m4_ifval($2, [[[input.y:17.14-29: warning: unused value: $][2 [-Wmidrule-values]
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
^^^^^^^^^^^^^^^^
@@ -277,12 +277,12 @@ input.y:17.10-12: warning: unused value: $][1 [-Wother]
]]])[[input.y:17.52-54: warning: unused value: $][5 [-Wother]
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
^^^
input.y:18.10-72: warning: unset value: $][$ [-Wother]
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
input.y:18.10-12: warning: unused value: $][1 [-Wother]
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
^^^
input.y:18.10-72: warning: unset value: $][$ [-Wother]
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
input.y:18.31-33: warning: unused value: $][3 [-Wother]
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
^^^
@@ -295,12 +295,12 @@ input.y:18.31-33: warning: unused value: $][3 [-Wother]
]]m4_ifval($2, [[[input.y:20.18-37: warning: unused value: $][3 [-Wmidrule-values]
j: INT | INT INT { $<integer>$ = 1; } { $][$ = $][1 + $][2; };
^^^^^^^^^^^^^^^^^^^^
]]])[[input.y:21.10-68: warning: unset value: $][$ [-Wother]
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
input.y:21.10-12: warning: unused value: $][1 [-Wother]
]]])[[input.y:21.10-12: warning: unused value: $][1 [-Wother]
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
^^^
input.y:21.10-68: warning: unset value: $][$ [-Wother]
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
input.y:21.14-16: warning: unused value: $][2 [-Wother]
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
^^^
@@ -458,15 +458,15 @@ exp: bar;
]])
AT_BISON_CHECK([-fcaret input.y], [1], [],
[[input.y:2.16-18: error: symbol bar is used, but is not defined as a token and has no rules
%destructor {} bar
^^^
[[input.y:1.13-15: warning: symbol foo is used, but is not defined as a token and has no rules [-Wother]
%printer {} foo baz
^^^
input.y:1.17-19: warning: symbol baz is used, but is not defined as a token and has no rules [-Wother]
%printer {} foo baz
^^^
input.y:1.13-15: warning: symbol foo is used, but is not defined as a token and has no rules [-Wother]
%printer {} foo baz
^^^
input.y:2.16-18: error: symbol bar is used, but is not defined as a token and has no rules
%destructor {} bar
^^^
input.y:3.13-15: warning: symbol qux is used, but is not defined as a token and has no rules [-Wother]
%type <foo> qux
^^^
@@ -672,25 +672,25 @@ exp: foo;
]])
AT_BISON_CHECK([-fcaret input.y], [1], [],
[[input.y:8.7-11: error: %type redeclaration for foo
[[input.y:8.7-11: error: %type redeclaration for "foo"
%type <baz> "foo"
^^^^^
input.y:3.7-11: previous declaration
%type <bar> foo
^^^^^
input.y:10.13-17: error: %destructor redeclaration for foo
%destructor {baz} "foo"
^^^^^
input.y:5.13-17: previous declaration
%destructor {bar} foo
^^^^^
input.y:9.10-14: error: %printer redeclaration for foo
input.y:9.10-14: error: %printer redeclaration for "foo"
%printer {baz} "foo"
^^^^^
input.y:4.10-14: previous declaration
%printer {bar} foo
^^^^^
input.y:11.1-5: error: %left redeclaration for foo
input.y:10.13-17: error: %destructor redeclaration for "foo"
%destructor {baz} "foo"
^^^^^
input.y:5.13-17: previous declaration
%destructor {bar} foo
^^^^^
input.y:11.1-5: error: %left redeclaration for "foo"
%left "foo"
^^^^^
input.y:6.1-5: previous declaration
@@ -1417,9 +1417,9 @@ start: TOK;
AT_BISON_CHECK([[input.yy]], [0], [],
[[input.yy:2.9-25: warning: %define variable 'api.location.type' requires '{...}' values [-Wdeprecated]
input.yy:3.9-21: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated]
input.yy:4.9-18: warning: %define variable 'api.prefix' requires '{...}' values [-Wdeprecated]
input.yy:5.9-24: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated]
input.yy:3.9-21: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated]
]])
])
@@ -1448,11 +1448,11 @@ exp: %empty
]])
AT_BISON_CHECK([[input.y]], [0], [],
[[input.y:5.9-15: warning: %define variable 'lr.type' requires keyword values [-Wdeprecated]
[[input.y:1.9-16: warning: %define variable 'api.pure' requires keyword values [-Wdeprecated]
input.y:2.9-21: warning: %define variable 'api.push-pull' requires keyword values [-Wdeprecated]
input.y:3.9-28: warning: %define variable 'lr.default-reduction' requires keyword values [-Wdeprecated]
input.y:4.9-33: warning: %define variable 'lr.keep-unreachable-state' requires keyword values [-Wdeprecated]
input.y:2.9-21: warning: %define variable 'api.push-pull' requires keyword values [-Wdeprecated]
input.y:1.9-16: warning: %define variable 'api.pure' requires keyword values [-Wdeprecated]
input.y:5.9-15: warning: %define variable 'lr.type' requires keyword values [-Wdeprecated]
]])
])
@@ -1717,26 +1717,26 @@ AT_CHECK([[$PERL -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
|| exit 77]])
AT_BISON_CHECK([input.y], [1], [],
[[input.y:2.9-12: error: invalid number after \-escape: 777
input.y:2.8-13: warning: empty character literal [-Wother]
input.y:2.16-17: error: invalid number after \-escape: 0
[[input.y:2.8-13: warning: empty character literal [-Wother]
input.y:2.9-12: error: invalid number after \-escape: 777
input.y:2.15-18: warning: empty character literal [-Wother]
input.y:2.21-25: error: invalid number after \-escape: xfff
input.y:2.16-17: error: invalid number after \-escape: 0
input.y:2.20-26: warning: empty character literal [-Wother]
input.y:2.29-31: error: invalid number after \-escape: x0
input.y:2.21-25: error: invalid number after \-escape: xfff
input.y:2.28-32: warning: empty character literal [-Wother]
input.y:3.9-14: error: invalid number after \-escape: uffff
input.y:2.29-31: error: invalid number after \-escape: x0
input.y:3.8-15: warning: empty character literal [-Wother]
input.y:3.18-23: error: invalid number after \-escape: u0000
input.y:3.9-14: error: invalid number after \-escape: uffff
input.y:3.17-24: warning: empty character literal [-Wother]
input.y:3.27-36: error: invalid number after \-escape: Uffffffff
input.y:3.18-23: error: invalid number after \-escape: u0000
input.y:3.26-37: warning: empty character literal [-Wother]
input.y:3.40-49: error: invalid number after \-escape: U00000000
input.y:3.27-36: error: invalid number after \-escape: Uffffffff
input.y:3.39-50: warning: empty character literal [-Wother]
input.y:4.9-10: error: invalid character after \-escape: ' '
input.y:3.40-49: error: invalid number after \-escape: U00000000
input.y:4.8-11: warning: empty character literal [-Wother]
input.y:4.14-15: error: invalid character after \-escape: A
input.y:4.9-10: error: invalid character after \-escape: ' '
input.y:4.13-16: warning: empty character literal [-Wother]
input.y:4.14-15: error: invalid character after \-escape: A
input.y:5.9-16: error: invalid character after \-escape: \t
input.y:5.17: error: invalid character after \-escape: \f
input.y:5.18: error: invalid character after \-escape: \0
@@ -2007,12 +2007,12 @@ AT_BISON_CHECK([[input.y]], [[1]], [[]],
input.y:11.15-24: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated]
input.y:12.15-24: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated]
input.y:13.1-14: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
input.y:13.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
input.y:13.11-21: error: %define variable 'parse.error' redefined
input.y:13-6: previous definition
input.y:14.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
input.y:13.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
input.y:14.11-21: error: %define variable 'parse.error' redefined
input.y:13.11-21: previous definition
input.y:14.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
]])
AT_CLEANUP
+4 -3
View File
@@ -339,9 +339,9 @@ m4_define([AT_LANG_DISPATCH],
# AT_DATA_SOURCE_PROLOGUE
# ------------------------
# -----------------------
# The prologue that should be included in any source code that is
# meant to be compiled.
# meant to be compiled. Keep atlocal.in sync (BISON_CXX_WORKS).
m4_define([AT_DATA_SOURCE_PROLOGUE],
[[#include <config.h>
/* We don't need perfect functions for these tests. */
@@ -754,6 +754,7 @@ AT_CHECK(m4_join([ ],
[m4_bmatch([$1], [[.]], [], [$LIBS])]),
0, [ignore], [ignore])])
# AT_COMPILE_CXX(OUTPUT, [SOURCES = OUTPUT.cc])
# ---------------------------------------------
# Compile SOURCES into OUTPUT. If the C++ compiler does not work,
@@ -761,7 +762,7 @@ AT_CHECK(m4_join([ ],
#
# If OUTPUT does not contain '.', assume that we are linking too,
# otherwise pass "-c"; this is a hack. The default SOURCES is OUTPUT
# with trailing .o removed, and ".cc" appended.
# with trailing ".o" removed, and ".cc" appended.
m4_define([AT_COMPILE_CXX],
[AT_KEYWORDS(c++)
AT_CHECK([$BISON_CXX_WORKS], 0, ignore, ignore)
+5 -4
View File
@@ -37,10 +37,11 @@ foo: {};
]AT_BISON_CHECK([$3 $1 $5], 0)[
# Ignore the files non-generated files
]AT_CHECK([find . -type f -and -not -path './$1' -and -not -path './testsuite.log' |
sed 's,\./,,' |
sort |
xargs echo],
]AT_CHECK([[find . -type f |
$PERL -ne '
s,\./,,; chomp;
push @file, $_ unless m{^($1|testsuite.log)$};
END { print join (" ", sort @file), "\n" }']],
[], [$4
])[
]$6[
+41 -41
View File
@@ -88,8 +88,7 @@ exp: useful;
]])
AT_BISON_CHECK([[input.y]], 0, [],
[[input.y: warning: 9 nonterminals useless in grammar [-Wother]
input.y:4.8-15: warning: nonterminal useless in grammar: useless1 [-Wother]
[[input.y:4.8-15: warning: nonterminal useless in grammar: useless1 [-Wother]
input.y:5.8-15: warning: nonterminal useless in grammar: useless2 [-Wother]
input.y:6.8-15: warning: nonterminal useless in grammar: useless3 [-Wother]
input.y:7.8-15: warning: nonterminal useless in grammar: useless4 [-Wother]
@@ -98,6 +97,7 @@ input.y:9.8-15: warning: nonterminal useless in grammar: useless6 [-Wother]
input.y:10.8-15: warning: nonterminal useless in grammar: useless7 [-Wother]
input.y:11.8-15: warning: nonterminal useless in grammar: useless8 [-Wother]
input.y:12.8-15: warning: nonterminal useless in grammar: useless9 [-Wother]
input.y: warning: 9 nonterminals useless in grammar [-Wother]
]])
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
@@ -143,62 +143,62 @@ useless9: '9';
]])
AT_BISON_CHECK([[-fcaret input.y]], 0, [],
[[input.y: warning: 9 nonterminals useless in grammar [-Wother]
input.y: warning: 9 rules useless in grammar [-Wother]
input.y:6.1-8: warning: nonterminal useless in grammar: useless1 [-Wother]
[[input.y:6.1-8: warning: nonterminal useless in grammar: useless1 [-Wother]
useless1: '1';
^^^^^^^^
input.y:7.1-8: warning: nonterminal useless in grammar: useless2 [-Wother]
useless2: '2';
^^^^^^^^
input.y:8.1-8: warning: nonterminal useless in grammar: useless3 [-Wother]
useless3: '3';
^^^^^^^^
input.y:9.1-8: warning: nonterminal useless in grammar: useless4 [-Wother]
useless4: '4';
^^^^^^^^
input.y:10.1-8: warning: nonterminal useless in grammar: useless5 [-Wother]
useless5: '5';
^^^^^^^^
input.y:11.1-8: warning: nonterminal useless in grammar: useless6 [-Wother]
useless6: '6';
^^^^^^^^
input.y:12.1-8: warning: nonterminal useless in grammar: useless7 [-Wother]
useless7: '7';
^^^^^^^^
input.y:13.1-8: warning: nonterminal useless in grammar: useless8 [-Wother]
useless8: '8';
^^^^^^^^
input.y:14.1-8: warning: nonterminal useless in grammar: useless9 [-Wother]
useless9: '9';
^^^^^^^^
input.y:6.11-13: warning: rule useless in grammar [-Wother]
useless1: '1';
^^^
input.y:7.1-8: warning: nonterminal useless in grammar: useless2 [-Wother]
useless2: '2';
^^^^^^^^
input.y:7.11-13: warning: rule useless in grammar [-Wother]
useless2: '2';
^^^
input.y:8.1-8: warning: nonterminal useless in grammar: useless3 [-Wother]
useless3: '3';
^^^^^^^^
input.y:8.11-13: warning: rule useless in grammar [-Wother]
useless3: '3';
^^^
input.y:9.1-8: warning: nonterminal useless in grammar: useless4 [-Wother]
useless4: '4';
^^^^^^^^
input.y:9.11-13: warning: rule useless in grammar [-Wother]
useless4: '4';
^^^
input.y:10.1-8: warning: nonterminal useless in grammar: useless5 [-Wother]
useless5: '5';
^^^^^^^^
input.y:10.11-13: warning: rule useless in grammar [-Wother]
useless5: '5';
^^^
input.y:11.1-8: warning: nonterminal useless in grammar: useless6 [-Wother]
useless6: '6';
^^^^^^^^
input.y:11.11-13: warning: rule useless in grammar [-Wother]
useless6: '6';
^^^
input.y:12.1-8: warning: nonterminal useless in grammar: useless7 [-Wother]
useless7: '7';
^^^^^^^^
input.y:12.11-13: warning: rule useless in grammar [-Wother]
useless7: '7';
^^^
input.y:13.1-8: warning: nonterminal useless in grammar: useless8 [-Wother]
useless8: '8';
^^^^^^^^
input.y:13.11-13: warning: rule useless in grammar [-Wother]
useless8: '8';
^^^
input.y:14.1-8: warning: nonterminal useless in grammar: useless9 [-Wother]
useless9: '9';
^^^^^^^^
input.y:14.11-13: warning: rule useless in grammar [-Wother]
useless9: '9';
^^^
input.y: warning: 9 nonterminals useless in grammar [-Wother]
input.y: warning: 9 rules useless in grammar [-Wother]
]])
@@ -276,23 +276,23 @@ non_productive: non_productive useless_token
]])
AT_BISON_CHECK([[-fcaret not-reduced.y]], 0, [],
[[not-reduced.y: warning: 2 nonterminals useless in grammar [-Wother]
not-reduced.y: warning: 3 rules useless in grammar [-Wother]
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother]
not_reachable: useful { /* A not reachable action. */ }
^^^^^^^^^^^^^
not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive [-Wother]
[[not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive [-Wother]
| non_productive { /* A non productive action. */ }
^^^^^^^^^^^^^^
not-reduced.y:11.6-57: warning: rule useless in grammar [-Wother]
| non_productive { /* A non productive action. */ }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother]
not_reachable: useful { /* A not reachable action. */ }
^^^^^^^^^^^^^
not-reduced.y:14.16-56: warning: rule useless in grammar [-Wother]
not_reachable: useful { /* A not reachable action. */ }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
not-reduced.y:17.17-18.63: warning: rule useless in grammar [-Wother]
non_productive: non_productive useless_token
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
not-reduced.y: warning: 2 nonterminals useless in grammar [-Wother]
not-reduced.y: warning: 3 rules useless in grammar [-Wother]
]])
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' not-reduced.output]], 0,
@@ -361,13 +361,13 @@ indirection: underivable;
]])
AT_BISON_CHECK([[input.y]], 0, [],
[[input.y: warning: 2 nonterminals useless in grammar [-Wother]
input.y: warning: 3 rules useless in grammar [-Wother]
input.y:5.15-25: warning: nonterminal useless in grammar: underivable [-Wother]
input.y:6.14-24: warning: nonterminal useless in grammar: indirection [-Wother]
[[input.y:5.15-25: warning: nonterminal useless in grammar: underivable [-Wother]
input.y:5.15-25: warning: rule useless in grammar [-Wother]
input.y:6.14-24: warning: nonterminal useless in grammar: indirection [-Wother]
input.y:6.14-24: warning: rule useless in grammar [-Wother]
input.y:7.14-24: warning: rule useless in grammar [-Wother]
input.y: warning: 2 nonterminals useless in grammar [-Wother]
input.y: warning: 3 rules useless in grammar [-Wother]
]])
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
@@ -397,9 +397,9 @@ exp: exp;
]])
AT_BISON_CHECK([[input.y]], 1, [],
[[input.y: warning: 2 nonterminals useless in grammar [-Wother]
[[input.y:3.1-3: fatal error: start symbol exp does not derive any sentence
input.y: warning: 2 nonterminals useless in grammar [-Wother]
input.y: warning: 2 rules useless in grammar [-Wother]
input.y:3.1-3: fatal error: start symbol exp does not derive any sentence
]])
AT_CLEANUP
+2 -2
View File
@@ -1147,9 +1147,9 @@ sr_conflict:
]])
AT_BISON_CHECK([[-Wall -o input.c input.y]], [[0]],,
[[input.y:24.5-19: warning: rule useless in parser due to conflicts [-Wother]
[[input.y:18.1-5: warning: useless precedence and associativity for TK1 [-Wprecedence]
input.y:24.5-19: warning: rule useless in parser due to conflicts [-Wother]
input.y:28.5-19: warning: rule useless in parser due to conflicts [-Wother]
input.y:18.1-5: warning: useless precedence and associativity for TK1 [-Wprecedence]
]])
AT_COMPILE([[input]])
AT_PARSER_CHECK([[./input]])
+4 -4
View File
@@ -186,10 +186,10 @@ start: ;
]])
AT_BISON_CHECK([[input1.y]], [[1]], [[]],
[[input1.y: warning: foow fubar [-Wother]
[[fooc.y:1.1-10.5: error: foocat fubar
foow.y:2.3-5.3: warning: foowat fubar [-Wother]
input1.y: warning: foow fubar [-Wother]
input1.y: error: fooc fubar
fooc.y:1.1-10.5: error: foocat fubar
input1.y: fatal error: foof fubar
]])
@@ -276,8 +276,8 @@ start: ;
]])
AT_BISON_CHECK([[input2.y]], [[1]], [[]],
[[input2.y: warning: morning [-Wother]
foo.y:1.5-6: fatal error: M4 should exit immediately here
[[foo.y:1.5-6: fatal error: M4 should exit immediately here
input2.y: warning: morning [-Wother]
]])
AT_CLEANUP