mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 09:43:03 +00:00
* tests/output.at (AT_CHECK_OUTPUT): Another test, making sure
bison fails when trying to output a parser and a header under the same name. * src/files.c (compute_output_file_names): Refuse when parser and header have the same name.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2002-03-04 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* tests/output.at (AT_CHECK_OUTPUT): Another test, making sure
|
||||||
|
bison fails when trying to output a parser and a header under the
|
||||||
|
same name.
|
||||||
|
* src/files.c (compute_output_file_names): Refuse when parser and
|
||||||
|
header have the same name.
|
||||||
|
|
||||||
2002-03-04 Akim Demaille <akim@epita.fr>
|
2002-03-04 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/reader.c (readgram): A missing `;' is a warning, not an
|
* src/reader.c (readgram): A missing `;' is a warning, not an
|
||||||
|
|||||||
4
NEWS
4
NEWS
@@ -3,6 +3,10 @@ Bison News
|
|||||||
|
|
||||||
Changes in version 1.33b:
|
Changes in version 1.33b:
|
||||||
|
|
||||||
|
* File name clashes are detected
|
||||||
|
$ bison foo.y -d -o foo.x
|
||||||
|
fatal error: header and parser would be both named `foo.x'
|
||||||
|
|
||||||
* A missing `;' ending a rule triggers a warning
|
* A missing `;' ending a rule triggers a warning
|
||||||
In accordance with POSIX, and in agreement with other
|
In accordance with POSIX, and in agreement with other
|
||||||
Yacc implementations, Bison will mandate this semicolon in a near
|
Yacc implementations, Bison will mandate this semicolon in a near
|
||||||
|
|||||||
15
src/files.c
15
src/files.c
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "getargs.h"
|
#include "getargs.h"
|
||||||
|
#include "quote.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "gram.h"
|
#include "gram.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
@@ -445,6 +446,20 @@ compute_output_file_names (void)
|
|||||||
if (!spec_defines_file)
|
if (!spec_defines_file)
|
||||||
spec_defines_file = stringappend (full_base_name, header_extension);
|
spec_defines_file = stringappend (full_base_name, header_extension);
|
||||||
|
|
||||||
|
if (defines_flag)
|
||||||
|
{
|
||||||
|
/* This is really Q&D, but I don't want to spend time on issues
|
||||||
|
which will be different with 1.50. */
|
||||||
|
const char *parser_filename = NULL;
|
||||||
|
if (spec_outfile)
|
||||||
|
parser_filename = spec_outfile;
|
||||||
|
else
|
||||||
|
parser_filename = stringappend (full_base_name, src_extension);
|
||||||
|
if (!strcmp (spec_defines_file, parser_filename))
|
||||||
|
fatal ("header and parser would be both named %s",
|
||||||
|
quote (parser_filename));
|
||||||
|
}
|
||||||
|
|
||||||
/* It the graph filename if not given, we create it. */
|
/* It the graph filename if not given, we create it. */
|
||||||
if (!spec_graph_file)
|
if (!spec_graph_file)
|
||||||
spec_graph_file = stringappend (short_base_name, ".vcg");
|
spec_graph_file = stringappend (short_base_name, ".vcg");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Output the generated parsing program for bison,
|
/* Output the generated parsing program for bison,
|
||||||
|
|
||||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001 Free Software
|
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
|
||||||
Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ AT_DATA([$1],
|
|||||||
foo: {};
|
foo: {};
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([bison $3 $1], 0)
|
AT_CHECK([bison $3 $1])
|
||||||
AT_CHECK([ls $4], [], [ignore])
|
AT_CHECK([ls $4], [], [ignore])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
])
|
])
|
||||||
@@ -81,3 +81,15 @@ AT_CHECK_OUTPUT([foo.yy], [],
|
|||||||
AT_CHECK_OUTPUT([foo.yy], [],
|
AT_CHECK_OUTPUT([foo.yy], [],
|
||||||
[-o foo.c++ --graph=foo.gph],
|
[-o foo.c++ --graph=foo.gph],
|
||||||
[foo.c++ foo.gph])
|
[foo.c++ foo.gph])
|
||||||
|
|
||||||
|
# Be sure to reject cases where the parser and the header would have
|
||||||
|
# the same name.
|
||||||
|
AT_SETUP([Clashing Output Files.])
|
||||||
|
AT_DATA([foo.y],
|
||||||
|
[[%% foo: {};
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_CHECK([bison -do foo.x foo.y], [1], [],
|
||||||
|
[foo.y:2: fatal error: header and parser would be both named `foo.x'
|
||||||
|
])
|
||||||
|
AT_CLEANUP
|
||||||
|
|||||||
Reference in New Issue
Block a user