On Mon, Jun 4, 2012 at 4:52 PM, Richard Guenther
<[email protected]> wrote:
>>> I suppose make ASM_OUTPUT_IDENT a target hook instead.
>>
>> This doesn't really help: You'd now have a target hook called from the
>> front end that writes to asm_out_file. I want front ends to stop
>> writing to asm_out_file at all.
>
> I mean make the whole "write #ident" a target hook.
>
> Richard.
I think I understand what you mean. But consider the following two:
static void
cb_ident (cpp_reader * ARG_UNUSED (pfile),
unsigned int ARG_UNUSED (line),
const cpp_string * ARG_UNUSED (str))
{
#ifdef ASM_OUTPUT_IDENT
if (!flag_no_ident)
{
/* Convert escapes in the string. */
cpp_string cstr = { 0, 0 };
if (cpp_interpret_string (pfile, str, 1, &cstr, CPP_STRING))
{
ASM_OUTPUT_IDENT (asm_out_file, (const char *) cstr.text);
free (CONST_CAST (unsigned char *, cstr.text));
}
}
#endif
}
vs.
static void
cb_ident (cpp_reader * ARG_UNUSED (pfile),
unsigned int ARG_UNUSED (line),
const cpp_string * ARG_UNUSED (str))
{
if (targetm.asm_out.ident)
{
/* Convert escapes in the string. */
cpp_string cstr = { 0, 0 };
if (cpp_interpret_string (pfile, str, 1, &cstr, CPP_STRING))
{
targetm.asm_out.ident ((const char *) cstr.text);
free (CONST_CAST (unsigned char *, cstr.text));
}
}
}
where targetm.asm_out.ident writes to asm_out_file.
This change would allow one to remove #include output.h from
c-family/c-lex.c, but the front end will still be writing to
asm_out_file, indirectly through the target hook. So making
ASM_OUTPUT_IDENT a target hook solves part of the problem (remove
#include output.h) but doesn't solve the bigger problem (try to avoid
writing to asm_out_file from front ends).
Ciao!
Steven