This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c-dump.c problems
- From: Cedric Roux <Cedric dot Roux at lip6 dot fr>
- To: <bug-gcc at gnu dot org>
- Date: Mon, 25 Feb 2002 18:34:54 +0100 (CET)
- Subject: c-dump.c problems
- Reply-to: <Cedric dot Roux at lip6 dot fr>
Hi gcc coders,
the -fdump-ast-xx -fdump-translation-unit and the like
don't work (gcc 3.0.4, the latest, present in 3.0.3 too and
maybe earlier, I don't know).
We have in c-dump.c :
static struct dump_file_info dump_files[TDI_end] =
{
{".tu", "dump-translation-unit", 0, 0},
{".original", "dump-ast-original", 0, 0},
{".optimized", "dump-ast-optimized", 0, 0},
{".class", "dump-class-hierarchy", 0, 0},
};
and later (in dump_switch_p), we do :
if ((option_value = skip_leading_substring (arg, dump_files[ix].swtch)))
but the function dump_switch_p is called from
c_decode_option in c-decl.c
and the "-f" is not removed, so the comparaison doesn't work, so we can't
dump (I want to dump !! :-))
So you have to fix it one way or the other.
The simpler is to add "-f" to you dump_files tab, thus leading to :
static struct dump_file_info dump_files[TDI_end] =
{
{".tu", "-fdump-translation-unit", 0, 0},
{".original", "-fdump-ast-original", 0, 0},
{".optimized", "-fdump-ast-optimized", 0, 0},
{".class", "-fdump-class-hierarchy", 0, 0},
};
Next, I want to dump. So I give -fdump-translation-unit to gcc and
I get the .tu file. Ok, all is fine (well, I hope so, maybe the generated
file is wrong, I am new with this :)).
Then I try a -fdump-ast-original to see what it gives.
And there, no .original file generated. Well, what's going on ?
disk quota overflow ? I check it... no, quota ok. So what ?
I go back to the source, and I see this :
In c-lang.c :
FILE *stream = dump_begin (TDI_all, &flags);
TDI_all, ok.
Let's look at the enum :
in c-common.h :
enum tree_dump_index
{
TDI_all, /* dump the whole translation unit */
TDI_original, /* dump each function before optimizing it
*/
TDI_optimized, /* dump each function after
optimizing i
t */
TDI_class, /* dump class heirarchy */
TDI_end
};
Ok, we check if -fdump-translation-unit is wanted.
But a grep TDI_original gives nothing. So, this dump is never
done if the user asks for it.
2 solutions :
1 - modify the documentation so that the user don't think it is
legal to use -fdump-ast* or -fdump-class*
2 - add some code to handle this.
The 2 is better I think :)
Et voila,
Best regards,
Cedric.