diff options
author | Steven Bosscher <stevenb@suse.de> | 2005-01-01 16:15:23 +0000 |
---|---|---|
committer | Steven Bosscher <stevenb@suse.de> | 2005-01-01 16:15:23 +0000 |
commit | 7f3b04618386e70457f607696ad3baea64f87516 (patch) | |
tree | c6d40e9cbaa9fa337df7a271539a709395f1c913 /gcc/cp/decl.c | |
parent | dd9c22cd5a151a11d2cca0c6599f6417c6ae3061 (diff) |
* 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.
(remove_bb): Likewise.
cp/
PR middle-end/17544
* decl.c (finish_function): Fix comment. Annotate the compiler
generated return with the current file name and line 0.
testsuite/
* gcc.dg/20041231-1.C: New test.
* g++.dg/warn/Wunreachable-code-1.C: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@92784 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 61f2d648679..d0d1ff354b3 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1,6 +1,6 @@ /* Process declarations and variables for C++ compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004,2005 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GCC. @@ -10635,12 +10635,19 @@ finish_function (int flags) { if (DECL_MAIN_P (current_function_decl)) { - /* Make it so that `main' always returns 0 by default. */ + tree stmt; + + /* Make it so that `main' always returns 0 by default (or + 1 for VMS). */ #if VMS_TARGET - finish_return_stmt (integer_one_node); + stmt = finish_return_stmt (integer_one_node); #else - finish_return_stmt (integer_zero_node); + stmt = 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. */ + annotate_with_file_line (stmt, input_filename, 0); } /* Finish dealing with exception specifiers. */ |