snapshot of project "byacc", label t20050813

This commit is contained in:
Thomas E. Dickey 2005-08-14 00:21:40 -04:00
parent ae6c951913
commit d68f3f0753
10 changed files with 540 additions and 390 deletions

31
CHANGES
View File

@ -1,3 +1,34 @@
2005-08-13 Thomas E. Dickey <dickey@invisible-island.net>
* main.c: add -V to usage message
* makefile.in: remove -t option from ctags
* VERSION: 2005/8/13
2005-08-13 schmitz
* main.c: Sylvain Schmitz:
modify the '-o' option to work like bison's, which sets the file-prefix.
2005-08-13 Matt.Kraai
* output.c:
Debian #322858 (don't close union_file, which contained data).
This feature is used in groff.
2005-08-13 Thomas E. Dickey <dickey@invisible-island.net>
* configure: regenerated
* aclocal.m4: improve checks for Intel compiler warnings
2005-06-25 Thomas E. Dickey <dickey@invisible-island.net>
* config.sub: update to 2005/6/2
* config.guess: update to 2005/5/27
2005-05-05 Thomas E. Dickey <dickey@invisible-island.net>
* defs.h: add a fallback for GCC_UNUSED

View File

@ -1,4 +1,4 @@
MANIFEST for byacc, version t20050505
MANIFEST for byacc, version t20050813
--------------------------------------------------------------------------------
MANIFEST this file
ACKNOWLEDGEMENTS original version of byacc - 1993

View File

@ -1 +1 @@
20050505
20050813

97
aclocal.m4 vendored
View File

@ -1,4 +1,4 @@
dnl $Id: aclocal.m4,v 1.3 2005/05/03 21:29:40 tom Exp $
dnl $Id: aclocal.m4,v 1.4 2005/08/13 23:29:13 tom Exp $
dnl
dnl Macros for cproto configure script (T.Dickey)
dnl ---------------------------------------------------------------------------
@ -256,7 +256,7 @@ AC_SUBST(SHOW_CC)
AC_SUBST(ECHO_CC)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_ATTRIBUTES version: 9 updated: 2002/12/21 19:25:52
dnl CF_GCC_ATTRIBUTES version: 10 updated: 2005/05/28 13:16:28
dnl -----------------
dnl Test for availability of useful gcc __attribute__ directives to quiet
dnl compiler warnings. Though useful, not all are supported -- and contrary
@ -304,18 +304,18 @@ int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
EOF
for cf_attribute in scanf printf unused noreturn
do
CF_UPPER(CF_ATTRIBUTE,$cf_attribute)
CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
cf_directive="__attribute__(($cf_attribute))"
echo "checking for $CC $cf_directive" 1>&AC_FD_CC
case $cf_attribute in
scanf|printf)
cat >conftest.h <<EOF
#define GCC_$CF_ATTRIBUTE 1
#define GCC_$cf_ATTRIBUTE 1
EOF
;;
*)
cat >conftest.h <<EOF
#define GCC_$CF_ATTRIBUTE $cf_directive
#define GCC_$cf_ATTRIBUTE $cf_directive
EOF
;;
esac
@ -345,7 +345,7 @@ if test "$GCC" = yes ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_WARNINGS version: 18 updated: 2004/12/03 20:51:07
dnl CF_GCC_WARNINGS version: 20 updated: 2005/08/06 18:37:29
dnl ---------------
dnl Check if the compiler supports useful warning options. There's a few that
dnl we don't use, simply because they're too noisy:
@ -366,32 +366,53 @@ dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
dnl
AC_DEFUN([CF_GCC_WARNINGS],
[
AC_REQUIRE([CF_INTEL_COMPILER])
AC_REQUIRE([CF_GCC_VERSION])
CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
cat > conftest.$ac_ext <<EOF
#line __oline__ "configure"
int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
EOF
if test "$INTEL_COMPILER" = yes
then
# The "-wdXXX" options suppress warnings:
# remark #1419: external declaration in primary source file
# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
# remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
# remark #193: zero used for undefined preprocessing identifier
# remark #593: variable "curs_sb_left_arrow" was set but never used
# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
# remark #869: parameter "tw" was never referenced
# remark #981: operands are evaluated in unspecified order
# warning #269: invalid format string conversion
EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall \
-wd1419 \
-wd193 \
-wd279 \
-wd593 \
-wd810 \
-wd869 \
-wd981"
AC_CHECKING([for $CC warning options])
cf_save_CFLAGS="$CFLAGS"
EXTRA_CFLAGS="-Wall"
for cf_opt in $1 \
wd1419 \
wd1682 \
wd1683 \
wd1684 \
wd193 \
wd279 \
wd593 \
wd810 \
wd869 \
wd981
do
CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
if AC_TRY_EVAL(ac_compile); then
test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
fi
done
CFLAGS="$cf_save_CFLAGS"
elif test "$GCC" = yes
then
cat > conftest.$ac_ext <<EOF
#line __oline__ "configure"
int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
EOF
AC_CHECKING([for $CC warning options])
cf_save_CFLAGS="$CFLAGS"
EXTRA_CFLAGS="-W -Wall"
@ -428,41 +449,45 @@ EOF
EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
fi
done
rm -f conftest*
CFLAGS="$cf_save_CFLAGS"
fi
rm -f conftest*
AC_SUBST(EXTRA_CFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_INTEL_COMPILER version: 1 updated: 2004/12/03 20:27:48
dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
dnl -----------------
dnl Check if the given compiler is really the Intel compiler for Linux.
dnl It tries to imitate gcc, but does not return an error when it finds a
dnl mismatch between prototypes, e.g., as exercised by CF_MISSING_CHECK.
dnl Check if the given compiler is really the Intel compiler for Linux. It
dnl tries to imitate gcc, but does not return an error when it finds a mismatch
dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
dnl
dnl This macro should be run "soon" after AC_PROG_CC, to ensure that it is
dnl not mistaken for gcc.
dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
dnl the wrappers for gcc and g++ warnings.
dnl
dnl $1 = GCC (default) or GXX
dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
dnl $3 = CFLAGS (default) or CXXFLAGS
AC_DEFUN([CF_INTEL_COMPILER],[
AC_REQUIRE([AC_PROG_CC])
ifelse($2,,INTEL_COMPILER,[$2])=no
INTEL_COMPILER=no
if test "$GCC" = yes ; then
if test "$ifelse($1,,[$1],GCC)" = yes ; then
case $host_os in
linux*|gnu*)
AC_MSG_CHECKING(if this is really Intel compiler)
cf_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -no-gcc"
AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
AC_TRY_COMPILE([],[
#ifdef __INTEL_COMPILER
#else
make an error
#endif
],[INTEL_COMPILER=yes
],[ifelse($2,,INTEL_COMPILER,[$2])=yes
cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
],[])
CFLAGS="$cf_save_CFLAGS"
AC_MSG_RESULT($INTEL_COMPILER)
ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
;;
esac
fi

502
config.guess vendored

File diff suppressed because it is too large Load Diff

37
config.sub vendored
View File

@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
timestamp='2005-02-10'
timestamp='2005-06-02'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -21,14 +21,15 @@ timestamp='2005-02-10'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
@ -83,11 +84,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;;
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit 0 ;;
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@ -99,7 +100,7 @@ while test $# -gt 0 ; do
*local*)
# First pass through any local machine types.
echo $1
exit 0;;
exit ;;
* )
break ;;
@ -231,6 +232,7 @@ case $basic_machine in
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
@ -254,6 +256,7 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| ms1 \
| msp430 \
| ns16k | ns32k \
| openrisc | or32 \
@ -262,7 +265,8 @@ case $basic_machine in
| pyramid \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
@ -271,6 +275,9 @@ case $basic_machine in
| z8k)
basic_machine=$basic_machine-unknown
;;
m32c)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
@ -298,7 +305,7 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
@ -327,6 +334,7 @@ case $basic_machine in
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| ms1-* \
| msp430-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
@ -336,7 +344,8 @@ case $basic_machine in
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
@ -348,6 +357,8 @@ case $basic_machine in
| ymp-* \
| z8k-*)
;;
m32c-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
@ -1178,7 +1189,7 @@ case $os in
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* | -skyos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@ -1556,7 +1567,7 @@ case $basic_machine in
esac
echo $basic_machine$os
exit 0
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)

212
configure vendored
View File

@ -1297,51 +1297,10 @@ fi
INTEL_COMPILER=no
if test "$GCC" = yes ; then
case $host_os in
linux*|gnu*)
echo $ac_n "checking if this is really Intel compiler""... $ac_c" 1>&6
echo "configure:1308: checking if this is really Intel compiler" >&5
cf_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -no-gcc"
cat > conftest.$ac_ext <<EOF
#line 1312 "configure"
#include "confdefs.h"
int main() {
#ifdef __INTEL_COMPILER
#else
make an error
#endif
; return 0; }
EOF
if { (eval echo configure:1324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
INTEL_COMPILER=yes
cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
CFLAGS="$cf_save_CFLAGS"
echo "$ac_t""$INTEL_COMPILER" 1>&6
;;
esac
fi
GCC_VERSION=none
if test "$GCC" = yes ; then
echo $ac_n "checking version of $CC""... $ac_c" 1>&6
echo "configure:1345: checking version of $CC" >&5
echo "configure:1304: checking version of $CC" >&5
GCC_VERSION="`${CC} --version|sed -e '2,$d' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`"
test -z "$GCC_VERSION" && GCC_VERSION=unknown
echo "$ac_t""$GCC_VERSION" 1>&6
@ -1351,7 +1310,7 @@ fi
if ( test "$GCC" = yes || test "$GXX" = yes )
then
echo $ac_n "checking if you want to check for gcc warnings""... $ac_c" 1>&6
echo "configure:1355: checking if you want to check for gcc warnings" >&5
echo "configure:1314: checking if you want to check for gcc warnings" >&5
# Check whether --with-warnings or --without-warnings was given.
if test "${with_warnings+set}" = set; then
@ -1383,9 +1342,9 @@ EOF
if test "$GCC" = yes
then
echo "checking for $CC __attribute__ directives" 1>&6
echo "configure:1387: checking for $CC __attribute__ directives" >&5
echo "configure:1346: checking for $CC __attribute__ directives" >&5
cat > conftest.$ac_ext <<EOF
#line 1389 "configure"
#line 1348 "configure"
#include "confdefs.h"
#include "conftest.h"
#include "conftest.i"
@ -1407,23 +1366,23 @@ EOF
for cf_attribute in scanf printf unused noreturn
do
CF_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
cf_directive="__attribute__(($cf_attribute))"
echo "checking for $CC $cf_directive" 1>&5
case $cf_attribute in
scanf|printf)
cat >conftest.h <<EOF
#define GCC_$CF_ATTRIBUTE 1
#define GCC_$cf_ATTRIBUTE 1
EOF
;;
*)
cat >conftest.h <<EOF
#define GCC_$CF_ATTRIBUTE $cf_directive
#define GCC_$cf_ATTRIBUTE $cf_directive
EOF
;;
esac
if { (eval echo configure:1427: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
test -n "$verbose" && echo "$ac_t""... $cf_attribute" 1>&6
cat conftest.h >>confdefs.h
fi
@ -1437,32 +1396,92 @@ fi
INTEL_COMPILER=no
if test "$GCC" = yes ; then
case $host_os in
linux*|gnu*)
echo $ac_n "checking if this is really Intel C compiler""... $ac_c" 1>&6
echo "configure:1406: checking if this is really Intel C compiler" >&5
cf_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -no-gcc"
cat > conftest.$ac_ext <<EOF
#line 1410 "configure"
#include "confdefs.h"
int main() {
#ifdef __INTEL_COMPILER
#else
make an error
#endif
; return 0; }
EOF
if { (eval echo configure:1422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
INTEL_COMPILER=yes
cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
CFLAGS="$cf_save_CFLAGS"
echo "$ac_t""$INTEL_COMPILER" 1>&6
;;
esac
fi
cat > conftest.$ac_ext <<EOF
#line 1440 "configure"
int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
EOF
if test "$INTEL_COMPILER" = yes
then
# The "-wdXXX" options suppress warnings:
# remark #1419: external declaration in primary source file
# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
# remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
# remark #193: zero used for undefined preprocessing identifier
# remark #593: variable "curs_sb_left_arrow" was set but never used
# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
# remark #869: parameter "tw" was never referenced
# remark #981: operands are evaluated in unspecified order
# warning #269: invalid format string conversion
EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall \
-wd1419 \
-wd193 \
-wd279 \
-wd593 \
-wd810 \
-wd869 \
-wd981"
echo "checking for $CC warning options" 1>&6
echo "configure:1459: checking for $CC warning options" >&5
cf_save_CFLAGS="$CFLAGS"
EXTRA_CFLAGS="-Wall"
for cf_opt in \
wd1419 \
wd1682 \
wd1683 \
wd1684 \
wd193 \
wd279 \
wd593 \
wd810 \
wd869 \
wd981
do
CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
if { (eval echo configure:1475: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6
EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
fi
done
CFLAGS="$cf_save_CFLAGS"
elif test "$GCC" = yes
then
cat > conftest.$ac_ext <<EOF
#line 1462 "configure"
int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
EOF
echo "checking for $CC warning options" 1>&6
echo "configure:1466: checking for $CC warning options" >&5
echo "configure:1485: checking for $CC warning options" >&5
cf_save_CFLAGS="$CFLAGS"
EXTRA_CFLAGS="-W -Wall"
cf_warn_CONST=""
@ -1481,7 +1500,7 @@ echo "configure:1466: checking for $CC warning options" >&5
Wundef $cf_warn_CONST
do
CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
if { (eval echo configure:1485: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1504: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6
case $cf_opt in #(vi
Wcast-qual) #(vi
@ -1499,9 +1518,10 @@ echo "configure:1466: checking for $CC warning options" >&5
EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
fi
done
rm -f conftest*
CFLAGS="$cf_save_CFLAGS"
fi
rm -f conftest*
fi
@ -1509,7 +1529,7 @@ fi
echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6
echo "configure:1513: checking if you want to see long compiling messages" >&5
echo "configure:1533: checking if you want to see long compiling messages" >&5
# Check whether --enable-echo or --disable-echo was given.
if test "${enable_echo+set}" = set; then
@ -1552,12 +1572,12 @@ echo "$ac_t""$enableval" 1>&6
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
echo "configure:1556: checking for Cygwin environment" >&5
echo "configure:1576: checking for Cygwin environment" >&5
if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1561 "configure"
#line 1581 "configure"
#include "confdefs.h"
int main() {
@ -1568,7 +1588,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
if { (eval echo configure:1572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1592: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@ -1585,19 +1605,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
echo "configure:1589: checking for mingw32 environment" >&5
echo "configure:1609: checking for mingw32 environment" >&5
if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1594 "configure"
#line 1614 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
if { (eval echo configure:1601: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1621: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@ -1629,7 +1649,7 @@ esac
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
echo "configure:1633: checking for executable suffix" >&5
echo "configure:1653: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1639,7 +1659,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
if { (eval echo configure:1643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@ -1660,13 +1680,13 @@ echo "$ac_t""${ac_cv_exeext}" 1>&6
ac_exeext=$EXEEXT
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
echo "configure:1664: checking for object suffix" >&5
echo "configure:1684: checking for object suffix" >&5
if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
if { (eval echo configure:1670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1690: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@ -1692,7 +1712,7 @@ EOF
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1696: checking how to run the C preprocessor" >&5
echo "configure:1716: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -1707,13 +1727,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1711 "configure"
#line 1731 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1717: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1737: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1724,13 +1744,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1728 "configure"
#line 1748 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1741,13 +1761,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1745 "configure"
#line 1765 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1773,7 +1793,7 @@ echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking if you want to link with dbmalloc for testing""... $ac_c" 1>&6
echo "configure:1777: checking if you want to link with dbmalloc for testing" >&5
echo "configure:1797: checking if you want to link with dbmalloc for testing" >&5
# Check whether --with-dbmalloc or --without-dbmalloc was given.
if test "${with_dbmalloc+set}" = set; then
@ -1787,17 +1807,17 @@ echo "$ac_t""$with_dbmalloc" 1>&6
if test "$with_dbmalloc" = yes ; then
ac_safe=`echo "dbmalloc.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dbmalloc.h""... $ac_c" 1>&6
echo "configure:1791: checking for dbmalloc.h" >&5
echo "configure:1811: checking for dbmalloc.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1796 "configure"
#line 1816 "configure"
#include "confdefs.h"
#include <dbmalloc.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1821: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1814,7 +1834,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for debug_malloc in -ldbmalloc""... $ac_c" 1>&6
echo "configure:1818: checking for debug_malloc in -ldbmalloc" >&5
echo "configure:1838: checking for debug_malloc in -ldbmalloc" >&5
ac_lib_var=`echo dbmalloc'_'debug_malloc | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1822,7 +1842,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldbmalloc $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1826 "configure"
#line 1846 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1833,7 +1853,7 @@ int main() {
debug_malloc()
; return 0; }
EOF
if { (eval echo configure:1837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1868,7 +1888,7 @@ fi
echo $ac_n "checking if you want to link with dmalloc for testing""... $ac_c" 1>&6
echo "configure:1872: checking if you want to link with dmalloc for testing" >&5
echo "configure:1892: checking if you want to link with dmalloc for testing" >&5
# Check whether --with-dmalloc or --without-dmalloc was given.
if test "${with_dmalloc+set}" = set; then
@ -1882,17 +1902,17 @@ echo "$ac_t""$with_dmalloc" 1>&6
if test "$with_dmalloc" = yes ; then
ac_safe=`echo "dmalloc.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dmalloc.h""... $ac_c" 1>&6
echo "configure:1886: checking for dmalloc.h" >&5
echo "configure:1906: checking for dmalloc.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1891 "configure"
#line 1911 "configure"
#include "confdefs.h"
#include <dmalloc.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1909,7 +1929,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for dmalloc_debug in -ldmalloc""... $ac_c" 1>&6
echo "configure:1913: checking for dmalloc_debug in -ldmalloc" >&5
echo "configure:1933: checking for dmalloc_debug in -ldmalloc" >&5
ac_lib_var=`echo dmalloc'_'dmalloc_debug | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1917,7 +1937,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldmalloc $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1921 "configure"
#line 1941 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1928,7 +1948,7 @@ int main() {
dmalloc_debug()
; return 0; }
EOF
if { (eval echo configure:1932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else

38
main.c
View File

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.12 2005/05/05 00:09:54 tom Exp $ */
/* $Id: main.c,v 1.14 2005/08/14 00:21:40 tom Exp $ */
#include <signal.h>
#include <unistd.h> /* for _exit() */
@ -121,6 +121,7 @@ static void usage(void)
," -r produce separate code and table files (y.code.c)"
," -t add debugging support"
," -v write description (y.output)"
," -V show version information and exit"
};
unsigned n;
@ -263,7 +264,7 @@ char *allocate(unsigned n)
}
#define CREATE_FILE_NAME(dest, suffix) \
dest = MALLOC(len + sizeof(suffix)); \
dest = MALLOC(len + strlen(suffix) + 1); \
if (dest == 0) \
no_space(); \
strcpy(dest, file_prefix); \
@ -271,9 +272,31 @@ char *allocate(unsigned n)
static void create_file_names(void)
{
int len;
register int len;
register char *defines_suffix;
register char *prefix;
len = strlen(file_prefix);
prefix = NULL;
defines_suffix = DEFINES_SUFFIX;
/* compute the file_prefix from the user provided output_file_name */
if (output_file_name != 0)
{
if (!(prefix = strstr(output_file_name, ".tab.c"))
&& (prefix = strstr(output_file_name, ".c")))
defines_suffix = ".h";
}
if (prefix != NULL)
{
len = prefix - output_file_name;
file_prefix = (char *)MALLOC(len);
if (file_prefix == 0)
no_space();
strncpy(file_prefix, output_file_name, len);
}
else
len = strlen(file_prefix);
/* if "-o filename" was not given */
if (output_file_name == 0)
@ -290,7 +313,7 @@ static void create_file_names(void)
if (dflag)
{
CREATE_FILE_NAME(defines_file_name, DEFINES_SUFFIX);
CREATE_FILE_NAME(defines_file_name, defines_suffix);
}
if (vflag)
@ -302,6 +325,11 @@ static void create_file_names(void)
{
CREATE_FILE_NAME(graph_file_name, GRAPH_SUFFIX);
}
if (prefix != NULL)
{
FREE(file_prefix);
}
}
static void open_files(void)

View File

@ -1,4 +1,4 @@
# $Id: makefile.in,v 1.8 2005/05/05 00:37:59 tom Exp $
# $Id: makefile.in,v 1.9 2005/08/14 00:02:20 tom Exp $
#
# UNIX template-makefile for Berkeley Yacc
@ -119,7 +119,7 @@ check: $(THIS)$x
cd test && $(SHELL) ./run_test.sh
tags: $(H_FILES) $(C_FILES)
ctags -t $(C_FILES) $(H_FILES)
ctags $(C_FILES) $(H_FILES)
depend:
makedepend -- $(CPPFLAGS) -- $(C_FILES)

View File

@ -1,4 +1,4 @@
/* $Id: output.c,v 1.6 2005/05/05 00:12:02 tom Exp $ */
/* $Id: output.c,v 1.7 2005/08/13 23:30:42 Matt.Kraai Exp $ */
#include "defs.h"
@ -844,9 +844,6 @@ static void output_defines(void)
if (dflag && unionized)
{
rewind(union_file);
union_file = tmpfile();
if (union_file == NULL)
open_error("union_file");
while ((c = getc(union_file)) != EOF)
putc(c, defines_file);
fprintf(defines_file, " YYSTYPE;\nextern YYSTYPE %slval;\n",