aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2019-02-18 17:44:11 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2019-02-18 10:44:11 -0700
commit7a247605d892747ccc9216ffc047c73bd688ac36 (patch)
tree1e8a721ffec6d54324b24e356164100505e7ce45 /gcc
parente2ebb05cd478db489afa019d4b12e116754a267e (diff)
downloadgcc-7a247605d892747ccc9216ffc047c73bd688ac36.zip
gcc-7a247605d892747ccc9216ffc047c73bd688ac36.tar.gz
gcc-7a247605d892747ccc9216ffc047c73bd688ac36.tar.bz2
invoke.texi (-Wreturn-type): Correct and expand.
gcc/ChangeLog: * doc/invoke.texi (-Wreturn-type): Correct and expand. From-SVN: r268991
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/doc/invoke.texi13
2 files changed, 12 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3caa28a..5a1afdd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2019-02-18 Martin Sebor <msebor@redhat.com>
+ * doc/invoke.texi (-Wreturn-type): Correct and expand.
+
+2019-02-18 Martin Sebor <msebor@redhat.com>
+
PR middle-end/89294
* tree.c (valid_constant_size_p): Avoid assuming size is a constant
expression.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index ab5cb93..a1b7a5f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -5262,13 +5262,16 @@ 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.
+without a warning unless @option{-Wpedantic} is used. Attempting
+to use the return value of a non-@code{void} function other than @code{main}
+that flows off the end by reaching the closing curly brace that terminates
+the function is undefined.
-For C++, a function without return type always produces a diagnostic
-message, even when @option{-Wno-return-type} is specified. The only
-exceptions are @code{main} and functions defined in system headers.
+Unlike in C, in C++, flowing off the end of a non-@code{void} function other
+than @code{main} results in undefined behavior even when the value of
+the function is not used.
-This warning is enabled by default for C++ and is enabled by @option{-Wall}.
+This warning is enabled by default in C++ and by @option{-Wall} otherwise.
@item -Wshift-count-negative
@opindex Wshift-count-negative