This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFH] Uses of output.h in the front ends


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]