Message ID | 20110802031540.DB6B81C13F2@gchare.mtv.corp.google.com |
---|---|
State | New |
Headers | show |
>>>>> "Gabriel" == Gabriel Charette <gchare@google.com> writes:
Gabriel> This hack, has described in more details in the email labeled
Gabriel> "Line 0 Hack??", was now causing problem when serializing the
Gabriel> line_table in pph.
I think you do have to handle location 0 somehow.
This is UNKNOWN_LOCATION, referred to widely in the sources.
Gabriel> 2011-08-01 Gabriel Charette <gchare@google.com>
Gabriel> * decl.c (finish_function): Remove unecessary line 0 hack.
Now that -Wunreachable-code is gone, I doubt this code is even
theoretically relevant. So, while I can't approve or reject this patch,
it seems reasonable to me.
Tom
On Fri, Aug 5, 2011 at 13:37, Tom Tromey <tromey@redhat.com> wrote: >>>>>> "Gabriel" == Gabriel Charette <gchare@google.com> writes: > > Gabriel> This hack, has described in more details in the email labeled > Gabriel> "Line 0 Hack??", was now causing problem when serializing the > Gabriel> line_table in pph. > > I think you do have to handle location 0 somehow. > This is UNKNOWN_LOCATION, referred to widely in the sources. > > Gabriel> 2011-08-01 Gabriel Charette <gchare@google.com> > Gabriel> * decl.c (finish_function): Remove unecessary line 0 hack. > > Now that -Wunreachable-code is gone, I doubt this code is even > theoretically relevant. So, while I can't approve or reject this patch, > it seems reasonable to me. In that case, this is OK for trunk. Thanks Tom. Diego.
On Fri, Aug 5, 2011 at 10:37 AM, Tom Tromey <tromey@redhat.com> wrote: >>>>>> "Gabriel" == Gabriel Charette <gchare@google.com> writes: > > Gabriel> This hack, has described in more details in the email labeled > Gabriel> "Line 0 Hack??", was now causing problem when serializing the > Gabriel> line_table in pph. > > I think you do have to handle location 0 somehow. > This is UNKNOWN_LOCATION, referred to widely in the sources. > I do handle location 0, the problem is that this specific call to linemap_line_start was made late, after all linemap entries had exited (LC_LEAVE), and thus this would create a new LC_ENTER in the table and the parsing would finish with line_table->depth == 1 (instead of 0 as expected)... This bug never really showed up because at that point no one is trying to add new entries to the line_table, it only shows up now that we're trying to serialize the line_table. > Gabriel> 2011-08-01 Gabriel Charette <gchare@google.com> > Gabriel> * decl.c (finish_function): Remove unecessary line 0 hack. > > Now that -Wunreachable-code is gone, I doubt this code is even > theoretically relevant. So, while I can't approve or reject this patch, > it seems reasonable to me. > Ok Thanks, Gabriel
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2000bd4..9ee3c6d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13220,22 +13220,13 @@ finish_function (int flags) { if (DECL_MAIN_P (current_function_decl)) { - tree stmt; - /* Make it so that `main' always returns 0 by default (or 1 for VMS). */ #if VMS_TARGET - stmt = finish_return_stmt (integer_one_node); + finish_return_stmt (integer_one_node); #else - stmt = finish_return_stmt (integer_zero_node); + finish_return_stmt (integer_zero_node); #endif - /* Hack. We don't want the middle-end to warn that this - return is unreachable, so put the statement on the - special line 0. */ - { - location_t linezero = linemap_line_start (line_table, 0, 1); - SET_EXPR_LOCATION (stmt, linezero); - } } if (use_eh_spec_block (current_function_decl))