[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Adopt new naming rules if `--output' is given.
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH] Adopt new naming rules if `--output' is given. |
Date: |
Sun, 02 Nov 2008 15:54:29 +0100 |
User-agent: |
Thunderbird 2.0.0.17 (Macintosh/20080914) |
Just a clarification:
> + warn (_("specifying the output file and the file prefix at the"));
> + warn (_("same time is deprecated; considering output file only"));
This effectively was the case also in the previous versions of Bison;
with Joel's patch, the presence of %language affected which option was
ignored.
Also, with respect to my email from yesterday:
> * Is this true? If not, can we make this true at least for C and C++ by
> changing the new conventions?
I made it true by changing slightly the conventions.
> * Does it make sense to change the new convention so that the "change c
> to h" part holds also in that case?
That was the change in fact.
> * Can we then rewrite the documentation saying that -o, with a filename
> not ending in .tab or _tab, follows the new conventions?
Did so.
> * Maybe can we make this true in the implementation, rather than just
> write the documentation to match? Even if it adds a few lines of code,
> I believe it's worthwhile because it means that 99% of the executions
> would actually follow the new execution path (and the old one would be
> tested by -y and by the testsuite).
Indeed, the new conventions are now triggered exactly by "neither -o nor
-L":
> if (spec_outfile)
> parser_file_name = xstrdup (spec_outfile);
> ...
> if (yacc_flag || language_prio == default_prio)
> {
> char *new_prefix = concat2 (file_prefix, TAB_EXT);
> free (file_prefix);
> file_prefix = new_prefix;
> }
>
> if (!parser_file_name && language_prio == default_prio)
> compute_output_file_names_old ();
and overall the patch ends up deleting more code than it adds.
Also, regarding %skeleton, I think most people were using -o, and those
that weren't are getting more sensible file names now.
Thanks for the thorough tests, they helped a lot validating my
implementation against yours.
Also, here is a typo fix...
diff --git a/src/files.c b/src/files.c
index 27f4b1d..7923747 100644
--- a/src/files.c
+++ b/src/files.c
@@ -257,6 +257,6 @@ compute_output_file_names_old ()
unless in yacc mode (sigh). With `.tab', too (double sigh). */
file_name_split (grammar_file, NULL, &ext);
- if (yacc_flag && 0 == c_strcasecmp (language->language, "c") || !ext)
+ if ((yacc_flag && !c_strcasecmp (language->language, "c")) || !ext)
ext = ".y";
src_extension = xstrdup (ext);
Paolo