mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 21:33:04 +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:
17
src/files.c
17
src/files.c
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "getargs.h"
|
||||
#include "quote.h"
|
||||
#include "files.h"
|
||||
#include "gram.h"
|
||||
#include "error.h"
|
||||
@@ -419,7 +420,7 @@ compute_base_names (void)
|
||||
|
||||
/* Computes the extensions from the grammar file name. */
|
||||
filename_split (infile, &base, &tab, &ext);
|
||||
|
||||
|
||||
if (ext && !yacc_flag)
|
||||
compute_exts_from_gf (ext);
|
||||
}
|
||||
@@ -445,6 +446,20 @@ compute_output_file_names (void)
|
||||
if (!spec_defines_file)
|
||||
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. */
|
||||
if (!spec_graph_file)
|
||||
spec_graph_file = stringappend (short_base_name, ".vcg");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Output the generated parsing program for bison,
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user