* 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:
Akim Demaille
2002-03-04 18:06:42 +00:00
parent 5d08b24fba
commit 4eeb7bc9a2
5 changed files with 43 additions and 4 deletions

View File

@@ -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");