public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11474] -Wreturn-type should default to on when compiling C++
       [not found] <bug-11474-4@http.gcc.gnu.org/bugzilla/>
@ 2020-04-26  9:43 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-26  9:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=55189

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
PR 55189 made it on by default for GCC 8.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/11474] -Wreturn-type should default to on when compiling C++
  2003-07-09 14:24 [Bug c++/11474] New: " lloyd at randombit dot net
                   ` (7 preceding siblings ...)
  2003-07-14 14:54 ` gdr at integrable-solutions dot net
@ 2003-07-14 15:12 ` bangerth at dealii dot org
  8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2003-07-14 15:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474



------- Additional Comments From bangerth at dealii dot org  2003-07-14 15:12 -------
You're certainly right with your argument :-) I guess I should have stated my
underlying assumption: don't have _any_ warnings on by default. I understand
that's not the present state, though.

W.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/11474] -Wreturn-type should default to on when compiling C++
  2003-07-09 14:24 [Bug c++/11474] New: " lloyd at randombit dot net
                   ` (6 preceding siblings ...)
  2003-07-14 14:40 ` bangerth at dealii dot org
@ 2003-07-14 14:54 ` gdr at integrable-solutions dot net
  2003-07-14 15:12 ` bangerth at dealii dot org
  8 siblings, 0 replies; 10+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-07-14 14:54 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474



------- Additional Comments From gdr at integrable-solutions dot net  2003-07-14 14:54 -------
Subject: Re:  -Wreturn-type should default to on when compiling C++

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| What's wrong with asking people to please compile their code with -W -Wall?

In some circumstances, there are not practical.  
I do not have strong feelings about warning by default.  

| There are good reasons for most of the warning flags we have,

there are reasons we have flags.  That they are "good" depends on your
definition of "good", and is certainly a matter of debate.  The issue
is whether the warning should be on by default or not.  
The same arguments you're making can be used for having the warning on
by default and telling people  to use the -Wno- corresponding flags.
As you can see, the line you're reasoning cannot be  determining.

| so people should
| just learn to use warning flags. It's not gcc's task to _think_  for
| programmers unless they specifically ask for it.

But it just does that by deciding which flags to turn off by default! 

-- Gaby


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/11474] -Wreturn-type should default to on when compiling C++
  2003-07-09 14:24 [Bug c++/11474] New: " lloyd at randombit dot net
                   ` (5 preceding siblings ...)
  2003-07-13 16:51 ` jsm at polyomino dot org dot uk
@ 2003-07-14 14:40 ` bangerth at dealii dot org
  2003-07-14 14:54 ` gdr at integrable-solutions dot net
  2003-07-14 15:12 ` bangerth at dealii dot org
  8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2003-07-14 14:40 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474



------- Additional Comments From bangerth at dealii dot org  2003-07-14 14:40 -------
What's wrong with asking people to please compile their code with -W -Wall?
There are good reasons for most of the warning flags we have, so people should
just learn to use warning flags. It's not gcc's task to _think_  for
programmers unless they specifically ask for it.

By the same argument, we also don't switch on optimizations by default, but ask
people to do so explicitly on the command line.

W.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/11474] -Wreturn-type should default to on when compiling C++
  2003-07-09 14:24 [Bug c++/11474] New: " lloyd at randombit dot net
                   ` (4 preceding siblings ...)
  2003-07-13 16:39 ` lloyd at randombit dot net
@ 2003-07-13 16:51 ` jsm at polyomino dot org dot uk
  2003-07-14 14:40 ` bangerth at dealii dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jsm at polyomino dot org dot uk @ 2003-07-13 16:51 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474



------- Additional Comments From jsm at polyomino dot org dot uk  2003-07-13 16:51 -------
Subject: Re:  -Wreturn-type should default to on when compiling
 C++

On Sun, 13 Jul 2003, zack at gcc dot gnu dot org wrote:

> I don't think we can reject the program by default in either C or C++,
> but I would support turning the warning on by default in both languages --
> the condition it warns about is guaranteed to be a bug (unless the code
> predates the existence of the 'void' return type, and even then the fix is
> trivial)

The most obvious problematic cases are where control can't reach the end
of the function because of a call to a nonreturning function, but the
maintainer wants to avoid annotations specific to a particular compiler
(in this case, __attribute__((__noreturn__))) in their source code so the
compiler doesn't know that the function is nonreturning.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/11474] -Wreturn-type should default to on when compiling C++
  2003-07-09 14:24 [Bug c++/11474] New: " lloyd at randombit dot net
                   ` (3 preceding siblings ...)
  2003-07-13  8:22 ` zack at gcc dot gnu dot org
@ 2003-07-13 16:39 ` lloyd at randombit dot net
  2003-07-13 16:51 ` jsm at polyomino dot org dot uk
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: lloyd at randombit dot net @ 2003-07-13 16:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474



------- Additional Comments From lloyd at randombit dot net  2003-07-13 16:39 -------
Obviously I was wrong about it being an standard-mandated diagnostic (I suppose
I should have checked the standard first, I just assumed). However, if the
behavior when encoutering this is undefined, then a warning is fine as far as
the standard is concerned, correct?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/11474] -Wreturn-type should default to on when compiling C++
  2003-07-09 14:24 [Bug c++/11474] New: " lloyd at randombit dot net
                   ` (2 preceding siblings ...)
  2003-07-13  7:41 ` gdr at integrable-solutions dot net
@ 2003-07-13  8:22 ` zack at gcc dot gnu dot org
  2003-07-13 16:39 ` lloyd at randombit dot net
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: zack at gcc dot gnu dot org @ 2003-07-13  8:22 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474



------- Additional Comments From zack at gcc dot gnu dot org  2003-07-13 08:22 -------
I don't think we can reject the program by default in either C or C++,
but I would support turning the warning on by default in both languages --
the condition it warns about is guaranteed to be a bug (unless the code
predates the existence of the 'void' return type, and even then the fix is
trivial)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/11474] -Wreturn-type should default to on when compiling C++
  2003-07-09 14:24 [Bug c++/11474] New: " lloyd at randombit dot net
  2003-07-09 14:39 ` [Bug c++/11474] " bangerth at dealii dot org
  2003-07-13  7:40 ` gdr at integrable-solutions dot net
@ 2003-07-13  7:41 ` gdr at integrable-solutions dot net
  2003-07-13  8:22 ` zack at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-07-13  7:41 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474



------- Additional Comments From gdr at integrable-solutions dot net  2003-07-13 07:41 -------
Subject: Re:  -Wreturn-type should default to on when compiling C++

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| No. 6.6.3/2 says
|   [...] Flowing off the end of a function is equivalent to a return with
|   no value; this results in undefined behavior in a value-returning
|   function.
| 
| It specifically does not say that a diagnostic is required.

a diagnostic is required only  for diagnosable rules, and
"undefined behaviour" is not one.

-- Gaby


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/11474] -Wreturn-type should default to on when compiling C++
  2003-07-09 14:24 [Bug c++/11474] New: " lloyd at randombit dot net
  2003-07-09 14:39 ` [Bug c++/11474] " bangerth at dealii dot org
@ 2003-07-13  7:40 ` gdr at integrable-solutions dot net
  2003-07-13  7:41 ` gdr at integrable-solutions dot net
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-07-13  7:40 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474



------- Additional Comments From gdr at integrable-solutions dot net  2003-07-13 07:40 -------
Subject: Re:  New: -Wreturn-type should default to on when compiling C++

"lloyd at randombit dot net" <gcc-bugzilla@gcc.gnu.org> writes:

| This is pretty simple - when using C++, -Wreturn-type should a) always be on,
| and b) always cause an error, since not returning correctly from the function
| is ALWAYS an error in C++

The last statement is untrue.  

-- Gaby


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/11474] -Wreturn-type should default to on when compiling C++
  2003-07-09 14:24 [Bug c++/11474] New: " lloyd at randombit dot net
@ 2003-07-09 14:39 ` bangerth at dealii dot org
  2003-07-13  7:40 ` gdr at integrable-solutions dot net
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2003-07-09 14:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From bangerth at dealii dot org  2003-07-09 14:39 -------
No. 6.6.3/2 says
  [...] Flowing off the end of a function is equivalent to a return with
  no value; this results in undefined behavior in a value-returning
  function.

It specifically does not say that a diagnostic is required.

W.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-04-26  9:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-11474-4@http.gcc.gnu.org/bugzilla/>
2020-04-26  9:43 ` [Bug c++/11474] -Wreturn-type should default to on when compiling C++ redi at gcc dot gnu.org
2003-07-09 14:24 [Bug c++/11474] New: " lloyd at randombit dot net
2003-07-09 14:39 ` [Bug c++/11474] " bangerth at dealii dot org
2003-07-13  7:40 ` gdr at integrable-solutions dot net
2003-07-13  7:41 ` gdr at integrable-solutions dot net
2003-07-13  8:22 ` zack at gcc dot gnu dot org
2003-07-13 16:39 ` lloyd at randombit dot net
2003-07-13 16:51 ` jsm at polyomino dot org dot uk
2003-07-14 14:40 ` bangerth at dealii dot org
2003-07-14 14:54 ` gdr at integrable-solutions dot net
2003-07-14 15:12 ` bangerth at dealii dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).