public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Gabriel Charette <gchare@google.com>
To: steven@gcc.gnu.org, Tom Tromey <tromey@redhat.com>
Cc: Diego Novillo <dnovillo@google.com>,
	Lawrence Crowl <crowl@google.com>,
	       Collin Winter <collinwinter@google.com>,
	gcc@gcc.gnu.org
Subject: Re: Line 0 Hack??
Date: Tue, 02 Aug 2011 03:17:00 -0000	[thread overview]
Message-ID: <CAJTZ7LL=wQN+f9xboSug8Vv5OSFepjiZkKtdxuzTYsNj=m39BQ@mail.gmail.com> (raw)
In-Reply-To: <CAJTZ7LJ1Ad0h-kquEv09HNKVmaOB4JL9+BMRJbr7J=GuyLFo5Q@mail.gmail.com>

I have removed the hack and the test output is identical to the clean
build test output.

See issue4835047 for the patch.

Gabriel

On Mon, Aug 1, 2011 at 2:56 PM, Gabriel Charette <gchare@google.com> wrote:
> Re-sending as plain text for gcc@gcc.gnu.org ...
>
> ----------------------------
>
> Hi,
>
> I have a question about the line 0 hack on line 13232 of gcc/cp/decl.c
> (or just text search for "Hack", it's the only place it's found in
> that file...).
>
> From my revision history, Steven introduced this in 2005, and Tom
> modified it in 2007 (probably when modifying the linemap).
>
> The problem is that this very call to get the source_location of line
> 0 creates a NEW linemap entry in the line table, AFTER all of the
> LC_LEAVE have taken place (i.e. we were done parsing and now add a new
> linemap to the line_table)...
>
> And hence, we finish the parsing with line_table->depth == 1.
>
> In particular, I am building linemap serialization for pre-parsed
> headers, and added what I think to be a fair gcc_assert that when we
> serialize the line_table, it's depth should be 0. However, if we
> happen to have "main" in the header (this is when we get in this block
> in decl.c from my understanding as DECL_MAIN_P is then true), a new
> linemap is added at the end of the line table in the header after the
> LC_LEAVE... when merging this in the middle of a C file upon
> deserializing, this entry makes no sense, but I can't just ignore it
> either as a source_location has been handed off for it...
>
> My question is, what is this "special line 0" is this just a hack for
> this particular situation or is "line 0" a much more important concept
> I can't mess around with?
>
> I could potentially hack around it, but hacking around a hack can only
> make things worst in the long run..
>
> I'm not familiar with the "middle end warning" referred to in the
> comment in decl.c, could we potentially once and for all get rid of
> this hack?
>
> Best,
> Gabriel
>

      reply	other threads:[~2011-08-02  3:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJTZ7LL9JW0S_tDxZ80DvNcPQSD_+PRD4yQ4HkykLqjJOLbY7g@mail.gmail.com>
2011-08-01 21:56 ` Gabriel Charette
2011-08-02  3:17   ` Gabriel Charette [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJTZ7LL=wQN+f9xboSug8Vv5OSFepjiZkKtdxuzTYsNj=m39BQ@mail.gmail.com' \
    --to=gchare@google.com \
    --cc=collinwinter@google.com \
    --cc=crowl@google.com \
    --cc=dnovillo@google.com \
    --cc=gcc@gcc.gnu.org \
    --cc=steven@gcc.gnu.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).