]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/ChangeLog:
authormsebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Feb 2019 17:44:11 +0000 (17:44 +0000)
committermsebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Feb 2019 17:44:11 +0000 (17:44 +0000)
* doc/invoke.texi (-Wreturn-type): Correct and expand.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268991 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/doc/invoke.texi

index 3caa28a8cca0b18b7a5881f3a82d319191e1f28e..5a1afdd0d8b0d9531025e4f8f861c03fab22ed67 100644 (file)
@@ -1,3 +1,7 @@
+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
index ab5cb93085576d77d1286a12afcfbcc760b0f253..a1b7a5f4fcd5e9de6c9dff6909a9877e301313e5 100644 (file)
@@ -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