aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2016-06-04 20:50:50 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2016-06-04 14:50:50 -0600
commit58bfcc6615d1d472bfde8acb229a95a1803bb9f1 (patch)
treec14483c2db68aed0895bd3c950849111d39ad9fe
parent174d7275dbcd1a3c00030f948fca4b83a5893cdf (diff)
downloadgcc-58bfcc6615d1d472bfde8acb229a95a1803bb9f1.zip
gcc-58bfcc6615d1d472bfde8acb229a95a1803bb9f1.tar.gz
gcc-58bfcc6615d1d472bfde8acb229a95a1803bb9f1.tar.bz2
PR c/48116 - -Wreturn-type does not work as advertised
gcc/ChangeLog: 2016-06-04 Martin Sebor <msebor@redhat.com> Marcin Baczyński <marbacz@gmail.com> PR c/48116 * doc/invoke.texi (-Wreturn-type): Mention not warning on return with a void expression in a void function. Co-Authored-By: Marcin Baczyński <marbacz@gmail.com> From-SVN: r237093
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/doc/invoke.texi8
2 files changed, 13 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7df6c67..3e3a255 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2016-06-04 Martin Sebor <msebor@redhat.com>
+ Marcin Baczyński <marbacz@gmail.com>
+
+ PR c/48116
+ * doc/invoke.texi (-Wreturn-type): Mention not warning on return with
+ a void expression in a void function.
+
2016-06-03 Jan Hubicka <hubicka@ucw.cz>
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Do not check
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 89bd983..e3a2399 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -4055,8 +4055,12 @@ Warn whenever a function is defined with a return type that defaults
to @code{int}. Also warn about any @code{return} statement with no
return value in a function whose return type is not @code{void}
(falling off the end of the function body is considered returning
-without a value), and about a @code{return} statement with an
-expression in a function whose return type is @code{void}.
+without a value).
+
+For C only, warn about a @code{return} statement with an expression in a
+function whose return type is @code{void}, unless the expression type is
+also @code{void}. As a GNU extension, the latter case is accepted
+without a warning unless @option{-Wpedantic} is used.
For C++, a function without return type always produces a diagnostic
message, even when @option{-Wno-return-type} is specified. The only