- spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT);
- name[names++] = spec_verbose_file;
+ if (!spec_verbose_file)
+ spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT);
+ output_file_name_check (&spec_verbose_file);
+ }
+
+ free (all_but_tab_ext);
+ free (src_extension);
+ free (header_extension);
+}
+
+void
+output_file_name_check (char **file_name)
+{
+ bool conflict = false;
+ if (0 == strcmp (*file_name, grammar_file))
+ {
+ complain (_("refusing to overwrite the input file %s"),
+ quote (*file_name));
+ conflict = true;
+ }
+ else
+ {
+ int i;
+ for (i = 0; i < file_names_count; i++)
+ if (0 == strcmp (file_names[i], *file_name))
+ {
+ warn (_("conflicting outputs to file %s"),
+ quote (*file_name));
+ conflict = true;
+ }