mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 10:13:03 +00:00
output: do not generate source files when late errors are caught
Reported by Alexandre Duret-Lutz as "second problem" in: http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html * bootstrap.conf: We need the "unlink" module. * src/files.h, src/files.c (unlink_generated_sources): New. * src/output.c: Use it. * tests/output.at: Check the case of late errors.
This commit is contained in:
@@ -34,7 +34,8 @@ gnulib_modules='
|
|||||||
readme-release
|
readme-release
|
||||||
realloc-posix
|
realloc-posix
|
||||||
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
||||||
unistd unistd-safer unlocked-io update-copyright unsetenv verify
|
unistd unistd-safer unlink unlocked-io
|
||||||
|
update-copyright unsetenv verify
|
||||||
warnings
|
warnings
|
||||||
xalloc
|
xalloc
|
||||||
xalloc-die
|
xalloc-die
|
||||||
|
|||||||
10
src/files.c
10
src/files.c
@@ -398,6 +398,16 @@ output_file_name_check (char **file_name, bool source)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
unlink_generated_sources (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < generated_files_size; i++)
|
||||||
|
if (generated_files[i].is_source)
|
||||||
|
/* Ignore errors. The file might not even exist. */
|
||||||
|
unlink (generated_files[i].name);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
output_file_names_free (void)
|
output_file_names_free (void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,6 +70,9 @@ void output_file_names_free (void);
|
|||||||
*/
|
*/
|
||||||
void output_file_name_check (char **file_name, bool source);
|
void output_file_name_check (char **file_name, bool source);
|
||||||
|
|
||||||
|
/** Remove all the generated source files. */
|
||||||
|
void unlink_generated_sources (void);
|
||||||
|
|
||||||
FILE *xfopen (const char *name, char const *mode);
|
FILE *xfopen (const char *name, char const *mode);
|
||||||
void xfclose (FILE *ptr);
|
void xfclose (FILE *ptr);
|
||||||
FILE *xfdopen (int fd, char const *mode);
|
FILE *xfdopen (int fd, char const *mode);
|
||||||
|
|||||||
@@ -704,6 +704,11 @@ output (void)
|
|||||||
/* Process the selected skeleton file. */
|
/* Process the selected skeleton file. */
|
||||||
output_skeleton ();
|
output_skeleton ();
|
||||||
|
|
||||||
|
/* If late errors were generated, destroy the generated source
|
||||||
|
files. */
|
||||||
|
if (complaint_status)
|
||||||
|
unlink_generated_sources ();
|
||||||
|
|
||||||
obstack_free (&format_obstack, NULL);
|
obstack_free (&format_obstack, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ done
|
|||||||
]AT_DATA([$1],
|
]AT_DATA([$1],
|
||||||
[$2[
|
[$2[
|
||||||
%%
|
%%
|
||||||
foo: {};
|
foo: %empty {};
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
]AT_BISON_CHECK([$3 $1], [$5], [], [ignore])[
|
]AT_BISON_CHECK([$3 $1], [$5], [], [ignore])[
|
||||||
@@ -126,6 +126,14 @@ AT_CHECK_OUTPUT([foo.y], [%type <foo> useless],
|
|||||||
[foo.dot foo.output foo.xml],
|
[foo.dot foo.output foo.xml],
|
||||||
[1])
|
[1])
|
||||||
|
|
||||||
|
# Do not generate code when there are late errors (even warnings as
|
||||||
|
# errors).
|
||||||
|
AT_CHECK_OUTPUT([foo.y], [%define useless],
|
||||||
|
[--defines --graph --xml --report=all -Wall -Werror],
|
||||||
|
[foo.dot foo.output foo.xml],
|
||||||
|
[1])
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## C++ output. ##
|
## C++ output. ##
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
|
|||||||
Reference in New Issue
Block a user