From patchwork Tue Aug 2 03:15:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gab Charette X-Patchwork-Id: 107836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 5E524B712A for ; Tue, 2 Aug 2011 13:16:07 +1000 (EST) Received: (qmail 1889 invoked by alias); 2 Aug 2011 03:16:02 -0000 Received: (qmail 1864 invoked by uid 22791); 2 Aug 2011 03:15:58 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_SV, TW_TM X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Aug 2011 03:15:44 +0000 Received: from kpbe12.cbf.corp.google.com (kpbe12.cbf.corp.google.com [172.25.105.76]) by smtp-out.google.com with ESMTP id p723FgD4023993; Mon, 1 Aug 2011 20:15:43 -0700 Received: from gchare.mtv.corp.google.com (gchare.mtv.corp.google.com [172.18.111.122]) by kpbe12.cbf.corp.google.com with ESMTP id p723FfQe007254; Mon, 1 Aug 2011 20:15:41 -0700 Received: by gchare.mtv.corp.google.com (Postfix, from userid 138564) id DB6B81C13F2; Mon, 1 Aug 2011 20:15:40 -0700 (PDT) To: reply@codereview.appspotmail.com, crowl@google.com, dnovillo@google.com, steven@gcc.gnu.org, tromey@redhat.com, gcc-patches@gcc.gnu.org Subject: Remove line 0 hack in cp/decl.c (issue4835047) Message-Id: <20110802031540.DB6B81C13F2@gchare.mtv.corp.google.com> Date: Mon, 1 Aug 2011 20:15:40 -0700 (PDT) From: gchare@google.com (Gabriel Charette) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This hack, has described in more details in the email labeled "Line 0 Hack??", was now causing problem when serializing the line_table in pph. According to the revision history: this was introduced by steven in 2005: commit ba821eb102fc1a654c0542fcba73898340a9a02d Author: steven Date: Sat Jan 1 16:15:23 2005 +0000 * emit-rtl.c (add_insn_before): Fix comment typo. PR middle-end/17544 * c-decl.c (finish_function): If compiling C99, annotate the compiler generated return with the current file name and line 0. * tree-cfg.c (remove_useless_stmts_warn_notreached): Only warn if the source line is greater than 0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92784 138bc75d-0d04-0410-961f-82ee72b054a4 The function remove_useless_stmts_warn_notreached refered to by steven in his 2005 commit has been removed on 2009-10-08 by matz@suse.de according to ChangeLog-2009. This patch removes this hack which appears to be no longer necessary. Tested with a full bootstrap build and regression testing on x64. Gabriel 2011-08-01 Gabriel Charette * decl.c (finish_function): Remove unecessary line 0 hack. --- This patch is available for review at http://codereview.appspot.com/4835047 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))