Fix strange %define locations for default values.

Reported by Akim Demaille at
<http://lists.gnu.org/archive/html/bug-bison/2007-12/msg00001.html>
and discussed again starting at
<http://lists.gnu.org/archive/html/bison-patches/2008-11/msg00102.html>.
* data/bison.m4 (b4_percent_define_default): Leave syncline blank
because location information is bogus.
Use angle brackets to delimit fake file name because square brackets
look like over-quoted m4.  Choose a better fake file name.
Use negative line numbers.
* src/muscle_tab.c (muscle_percent_define_default): Likewise.
* src/location.c (location_print): If line for a boundary is negative,
only print that boundary's file name.
* src/location.h: Document that.
* tests/skeletons.at (%define Boolean variables: invalid skeleton
defaults): Update output.
This commit is contained in:
Joel E. Denny
2009-04-03 03:13:36 -04:00
parent 5d3a1ecbbe
commit 580c075d7f
6 changed files with 69 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
/* Muscle table manager for Bison.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -540,13 +540,12 @@ muscle_percent_define_default (char const *variable, char const *value)
{
location loc;
MUSCLE_INSERT_STRING (name, value);
loc.start.file = loc.end.file = "[Bison:muscle_percent_define_default]";
loc.start.line = loc.end.line = 1;
loc.start.column = loc.end.column = 0;
loc.start.file = loc.end.file = "<default value>";
loc.start.line = loc.end.line = -1;
loc.start.column = loc.end.column = -1;
muscle_insert (loc_name, "");
muscle_location_grow (loc_name, loc);
muscle_insert (syncline_name, "");
muscle_syncline_grow (syncline_name, loc);
}
}