[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bison-1.30 build failure with K&R C compiler
From: |
Nelson H. F. Beebe |
Subject: |
bison-1.30 build failure with K&R C compiler |
Date: |
Mon, 17 Dec 2001 15:52:47 -0700 (MST) |
An attempt to build bison-1.30 on an HP-UX 10.01 system that only
has an old K&R-style C compiler failed.
bison goes to special trouble to support such old systems, automatically
detecting the need for ansi2knr, and running it to produce a temporary
modified source file for compilation.
However, the file ./src/vcg.c has statements like these:
$ grep 'assert' ./src/vcg.c
assert (!"Not a default color.");
assert (!"Not a text mode.");
assert (!"Not a shape.");
assert (!"Not a layout algorithm.");
assert (!"Either yes nor no.");
assert (!"Not an orientation.");
assert (!"Not an alignement.");
assert (!"Not an arrow mode.");
assert (!"Not a crossing type.");
assert (!"Not a view.");
assert (!"Not a line style.");
assert (!"Not an arrow style.");
These produce compilation failures, because the definition of
the assert() macro from /usr/include/assert.h looks like this:
# define assert(_EX) \
((_EX) ? (void)0 : __assert("_EX", __FILE__, __LINE__))
The expansion then looks like this:
((!"Not a shape.") ? (void)0 : __assert("!"Not a shape."", __FILE__,
__LINE__))
and that is syntactically wrong, since the quotes are handled incorrectly.
Also, there are three statements in src/reader.c that do not compile
in a K&R environment: here is a patch:
diff -c src/reader.c.org src/reader.c
*** src/reader.c.org Tue Sep 25 12:30:44 2001
--- src/reader.c Mon Dec 17 11:17:45 2001
***************
*** 320,326 ****
}
else
{
! char buf[] = "@c";
buf[1] = c;
complain (_("%s is invalid"), quote (buf));
}
--- 320,326 ----
}
else
{
! static char buf[] = "@c";
buf[1] = c;
complain (_("%s is invalid"), quote (buf));
}
***************
*** 384,390 ****
}
else
{
! char buf[] = "$c";
buf[1] = c;
complain (_("%s is invalid"), quote (buf));
}
--- 384,390 ----
}
else
{
! static char buf[] = "$c";
buf[1] = c;
complain (_("%s is invalid"), quote (buf));
}
***************
*** 1010,1016 ****
fatal (_("no input grammar"));
else
{
! char buf[] = "c";
buf[0] = c;
complain (_("unknown character: %s"), quote (buf));
skip_to_char ('%');
--- 1010,1016 ----
fatal (_("no input grammar"));
else
{
! static char buf[] = "c";
buf[0] = c;
complain (_("unknown character: %s"), quote (buf));
skip_to_char ('%');
The fix in each statement is to add the static attribute.
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- Center for Scientific Computing FAX: +1 801 585 1640, +1 801 581 4148 -
- University of Utah Internet e-mail: address@hidden -
- Department of Mathematics, 322 INSCC address@hidden address@hidden -
- 155 S 1400 E RM 233 address@hidden -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe -
-------------------------------------------------------------------------------
- bison-1.30 build failure with K&R C compiler,
Nelson H. F. Beebe <=