* src/files.c (strsuffix): New.

(stringappend): Be just like strcat but allocate.
(base_names): Eve out from open_files.
Try to simplify the rather hairy computation of base_name and
short_base_name.
(open_files): Use it.
* tests/suite.at (Checking output file names): New test.
This commit is contained in:
Akim Demaille
2000-12-19 18:14:35 +00:00
parent 573c1d9ff8
commit 19c50364f3
11 changed files with 339 additions and 272 deletions

View File

@@ -87,7 +87,7 @@ FILE *yyin;
static void
yyerror (const char *s)
{
#ifdef YYLSP_NEEDED
#if YYLSP_NEEDED
fprintf (stderr, "%d.%d:%d.%d: ",
yylloc.first_line, yylloc.first_column,
yylloc.last_line, yylloc.last_column);
@@ -99,7 +99,7 @@ static int
yygetc ()
{
int res = getc (yyin);
#ifdef YYLSP_NEEDED
#if YYLSP_NEEDED
if (res == '\n')
{
yylloc.last_line++;
@@ -115,7 +115,7 @@ yygetc ()
static void
yyungetc (int c)
{
#ifdef YYLSP_NEEDED
#if YYLSP_NEEDED
/* Wrong when C == `\n'. */
yylloc.last_column--;
#endif
@@ -159,7 +159,7 @@ yylex (void)
{
int c;
#ifdef YYLSP_NEEDED
#if YYLSP_NEEDED
yylloc.first_column = yylloc.last_column;
yylloc.first_line = yylloc.last_line;
#endif
@@ -167,7 +167,7 @@ yylex (void)
/* Skip white space. */
while ((c = yygetc ()) == ' ' || c == '\t')
{
#ifdef YYLSP_NEEDED
#if YYLSP_NEEDED
yylloc.first_column = yylloc.last_column;
yylloc.first_line = yylloc.last_line;
#endif
@@ -217,7 +217,7 @@ main (int argn, const char **argv)
#if YYDEBUG
yydebug = 1;
#endif
#ifdef YYLSP_NEEDED
#if YYLSP_NEEDED
yylloc.last_column = 0;
yylloc.last_line = 1;
#endif

View File

@@ -1,4 +1,5 @@
#! /bin/sh
# -*- Autoconf -*-
# Validation suite for Bison.
# Copyright 2000 Free Software Foundation, Inc.
@@ -6,3 +7,31 @@ AT_INIT([bison])
AT_INCLUDE([calc.at])
AT_INCLUDE([regression.at])
## ---------------------------- ##
## Checking output file names. ##
## ---------------------------- ##
AT_SETUP([Checking output file names.])
AT_DATA([foo.y],
[[%%
foo: {}
]])
# AT_CHECK_BISON_OUTPUT(FLAGS, EXPECTED-FILES-SORTED)
# ---------------------------------------------------
AT_DEFINE([AT_CHECK_BISON_OUTPUT],
[rm -rf $2
AT_CHECK([bison -dv foo.y $1], 0, ignore, ignore)
AT_CHECK([ls $2 | sort | tr '\n' ' ' | sed 's/.$//g'], 0, [$2])
rm -f $2])
AT_CHECK_BISON_OUTPUT([], [foo.tab.c foo.tab.h foo.tab.output])
AT_CHECK_BISON_OUTPUT([-o foo.c], [foo.c foo.h foo.output])
AT_CHECK_BISON_OUTPUT([-o foo.tab.c], [foo.tab.c foo.tab.h foo.tab.output])
AT_CHECK_BISON_OUTPUT([-y], [y.tab.c y.tab.h y.tab.output])
AT_CHECK_BISON_OUTPUT([-b bar], [bar.tab.c bar.tab.h bar.tab.output])
AT_CLEANUP