This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFH] Uses of output.h in the front ends
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: GCC Mailing List <gcc at gcc dot gnu dot org>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, Ian Lance Taylor <ian at airs dot com>, Jan Hubicha <jh at suse dot cz>, iains at gcc dot gnu dot org, nicola at gcc dot gnu dot org
- Date: Mon, 4 Jun 2012 15:21:28 +0200
- Subject: Re: [RFH] Uses of output.h in the front ends
- References: <CABu31nPyeAW8_5o9+acP4A6_OCKhRJxY-_rLF6CQr5tjeVUcPg@mail.gmail.com>
On Mon, Jun 4, 2012 at 2:40 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> asm_out_file for PCH:
> c-family/c-pch.c:#include "output.h" /* for asm_out_file */
> c-family/c-pch.c: ? ? ?fprintf (asm_out_file, "%s ", ASM_COMMENT_START);
> c-family/c-pch.c: ? ? ?c_common_print_pch_checksum (asm_out_file);
> c-family/c-pch.c: ? ? ?fputc ('\n', asm_out_file);
> c-family/c-pch.c: ?asm_file_startpos = ftell (asm_out_file);
> c-family/c-pch.c: ?asm_file_end = ftell (asm_out_file);
> c-family/c-pch.c: ?if (fseek (asm_out_file, asm_file_startpos, SEEK_SET) != 0)
> c-family/c-pch.c: ? ? ?if (fread (buf, size, 1, asm_out_file) != 1)
> c-family/c-pch.c: ?if (fseek (asm_out_file, 0, SEEK_END) != 0)
> c-family/c-pch.c: ? ? ? ? ? ? || fwrite (buf, size, 1, asm_out_file) != 1)
> c-family/c-pch.c: ? ? ? ?asm_out_file. ?*/
>
> I do not understand this at all. In what way does PCH have anything to
> do with writing out to asm_out_file?!
FWIW, the following patchlet passes bootstrap and testing of pch.exp:
Index: c-pch.c
===================================================================
--- c-pch.c (revision 188177)
+++ c-pch.c (working copy)
@@ -188,6 +188,7 @@ c_common_write_pch (void)
asm_file_end = ftell (asm_out_file);
h.asm_size = asm_file_end - asm_file_startpos;
+ gcc_assert (! h.asm_size);
if (fwrite (&h, sizeof (h), 1, pch_outfile) != 1)
fatal_error ("can%'t write %s: %m", pch_file);
Could it be that this is just a relic of the pre-unit-at-a-time days?
Ciao!
Steven