Commit Graph

39 Commits

Author SHA1 Message Date
Xin LI
c1613cd50a Indent the else path, reduce diff against OpenBSD. 2008-07-18 23:35:31 +00:00
Kevin Lo
068d36032a Fix a longstanding bug, from Otto Moerbeck:
if we're reducing a rule that has an empty
right hand side and the yacc stackpointer is pointing at the very
end of the allocated stack, we end up accessing the stack out of
bounds by the implicit $$ = $1 action

Obtained from:	OpenBSD
2008-07-18 15:05:14 +00:00
Chad David
c979c169a7 Add __unused to the declaration of yyrcsid in a more portable way.
Discussed with: alfred, bde, jmallett, obrien
2003-02-12 18:03:55 +00:00
Chad David
0b40ce9875 Backout my previous commit as requested. This solution generates
parsers that are non-portable.
2003-02-08 17:23:22 +00:00
Chad David
143c9ae267 Add __unused to the declaration of yyrcsid. 2003-02-07 03:39:27 +00:00
Ruslan Ermilov
c3e3cbe16e No longer needed to #ifdef __FBSDID, this is now handled by Makefile.inc1. 2002-04-09 11:39:05 +00:00
David Malone
9f5b04e925 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
Warner Losh
bc505f7742 Only use __FBSDID if it is defined. This fixes the 4.4-release (but
not stable) -> current upgrade path.

Reviewed by: markm
2001-12-08 02:28:16 +00:00
Mark Murray
f1b6a5418e Use __FBSDID(). 2001-12-02 21:24:03 +00:00
Mark Murray
f906e265a6 WARNS=2 and s/register//.
Set NO_WERROR=true because there are some flex(1) issues that need
to be dealt with.
2001-12-01 17:34:42 +00:00
Peter Wemm
8d03543c79 Have yacc use a prototype for yygrowstack(void) on ANSI compilers.
This fixes a gcc warning with -Wmissing-prototypes.
2001-02-19 01:10:01 +00:00
Bruce Evans
87be6e697a Fixed breakage of K&R support in rev.1.26. yyparse() was defined as
`int yyparse(;) ; { ... }' in K&R mode.  Getting rid of the second
unwanted semicolon in this made the ifdef tangle more tangled than
before.  Fixed a backwards comment in the tangle.
2000-01-17 02:04:06 +00:00
Bruce Evans
dd079f6ca5 Fixed breakage of K&R support in rev.1.8 of output.c: don't generate
#elif.  Cleaned up rev.1.8 a bit more: generate the #include of
<stdio.h> closer to the code that needs it.
2000-01-17 01:51:29 +00:00
David E. O'Brien
484620e2e4 Make "YYPARSE_PARAM" and "YYPARSE_PARAM_TYPE" C++/ANSI-C clean. 1999-10-28 15:18:05 +00:00
David E. O'Brien
c3584b3b4e Allow a user specified parameter to 'yyparse()', in a manner similar to
that used by bison.  The names are consistent with the bison implementation
but this one also allows the type of the parameter to be specified.

For a desired prototype of:

	int yyparse __P((struct yyresult *));

and compile like this:

	yacc -dv grammar.y
	cc -c -DYYPARSE_PARAM_TYPE="struct yyresult *" \
	      -DYYPARSE_PARAM="parm" y.tab.c

and use like this:

	${
	#include "usrtypes.h"
	#include "usrproto.h"
	}$

	%token NUMBER

	%%

	goal : NUMBER
		{
		parm->value = yylval;
		} ;

If YYPARSE_PARAM_TYPE isn't specified then "void *" is the default type.
If YYPARSE_PARAM is not specified then the generated code behaves exactly
as traditional byacc.

PR:		13562
Submitted by:	W Gerald Hicks <wghicks@bellsouth.net>
1999-10-27 17:51:37 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
David E. O'Brien
17e6630760 Revert the past 3 commits to what should have been the rev 1.18 -> rev 1.19
change.  (doesn't anybody read commit logs and look at the diffs?)
1999-07-30 15:05:32 +00:00
Dag-Erling Smørgrav
aed4de8a07 Hyphens are not legal characters in a C identifier.
Broken by:	hoek
1999-07-30 14:52:23 +00:00
Tim Vanderhoek
593bbda376 Even better fix for last commit: rename rcsid[] to _yacc-parser_rcsid[]
(one always gets these ideas just after the commit).
1999-07-30 13:04:19 +00:00
Tim Vanderhoek
892d5804bb Don't output rcsid into the output parser. It may have already been
defined in an input file such as src/bin/sh/arith.y.  #if 0 it out.  I did
not add $Id$ back into the comment header (as removed from last commit).
1999-07-30 12:53:21 +00:00
David E. O'Brien
55293461db Only output `rcsid' (set to our Id string) into the resulting parser file.
Don't output `sccsid' (set to an anchient UCB Id string) into the parser file.

Submitted by:	bde
1999-07-30 06:40:00 +00:00
David E. O'Brien
5da860fa05 Follow the directions in the comments and add our Id string to the output
file.
1999-07-29 09:59:06 +00:00
David E. O'Brien
e7bd01e5df * Don't assume realloc() can take NULL as first arg. Yacc needs to
generate portable code...
* Correctly define yyparse() (ie, K&R vs. C++/ANSI-C)

Obtained from:	OpenBSD revs 1.5 & 1.10
1999-07-29 09:42:14 +00:00
David E. O'Brien
de18e37eba YYRECOVERING(), not YYRECOVERING.
Obtained from:	OpenBSD rev 1.8 (approved by Robert Corbett)
1999-07-29 08:47:30 +00:00
Peter Wemm
7c71e88713 Clean up the skeleton code a little. There was a #ifdef to avoid
stdlib.h unless on C++.  However, we already included it above, so there
was no point using the redundant declarations instead.
1999-04-18 13:37:49 +00:00
Steve Price
86bdf9bc0b #include <stdlib.h> in the C++ case and declare getenv and realloc
in the C case so that we don't have to depend on stdlib.h being
present.

Submitted by:	Bruce Evans <bde@freefall.freebsd.org>
1997-04-29 03:07:45 +00:00
Steve Price
7dce0a1e9f Fix problems using -Wwrite-strings and -Wcast-qual with yacc generated
parsers.  Closes PR #2792.

Submitted by:	Tim Vanderhoek
1997-04-28 03:36:13 +00:00
Bruce Evans
7677efc6a4 Don't generate invalid C++ code (for implicit conversion from `void *' in
assignment).
1997-03-22 01:48:17 +00:00
Peter Wemm
c115df18cd Revert $FreeBSD$ to $Id$ 1997-02-22 19:58:13 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Steve Price
2b5f199de6 Add RCS id's since these files have left the default branch. 1997-01-12 21:29:55 +00:00
Steve Price
2726ae5b7c This doesn't change any functionality, it simple makes yacc(1)
compile -Wall clean.
1997-01-12 21:16:25 +00:00
Steve Price
610a365e2d Merge Lite2 mods. 1997-01-06 03:07:20 +00:00
Jeffrey Hsu
b20d9ed2e7 Add YYLEX and YYEMPTY macros to make byacc look more like bison.
Obtained from:  Cygnus source tree, with permission.
		Original commit by Jim Wilson, wilson@cygnus.com.
1996-11-04 21:54:52 +00:00
Steve Price
2e66d503c6 Fix for PR# 1427, yacc-generated parser generates warnings
with -Wall.  Tim's work with some minor additions by me.

Submitted by:	Tim Vanderhoek <hoek@freenet.hamilton.on.ca>
1996-09-22 02:05:53 +00:00
Peter Wemm
80396a110a Fix -Wall warning in skeleton parser 1996-09-03 10:56:32 +00:00
Joerg Wunsch
ec9b6b00a2 Make the yacc skeleton aware of C++. It was previously broken in the
YYDEBUG case (getenv() declared wrong).
1996-09-03 08:00:26 +00:00
Poul-Henning Kamp
08f9c42211 Make all the tables "const" so that they don't clutter our data-segment. 1996-01-07 22:30:13 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00