public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/29521]  New: Confusing warning for return with expression in function returning void
@ 2006-10-20  6:17 muntyan at tamu dot edu
  2006-10-20  9:09 ` [Bug c/29521] " rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: muntyan at tamu dot edu @ 2006-10-20  6:17 UTC (permalink / raw)
  To: gcc-bugs

Consider the following code:

void func () 
{
}

void func2 ()
{
    return func ();
}

gcc -pedantic correctly warns about "return func();", but the warning text is
very confusing:
   'return' with a value, in function returning void
It talks about "value" where there is no value involved.
It took me a while to understand what exactly is wrong. Warning says "value",
so I obviously checked signatures first; then I looked for a problem with
includes; then I asked in comp.lang.c.

It would be better if gcc said something like
   'return' with an expression, in function returning void
or
   ISO C forbids ...

The latter would be the best, I guess.


-- 
           Summary: Confusing warning for return with expression in function
                    returning void
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: muntyan at tamu dot edu


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


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

* [Bug c/29521] Confusing warning for return with expression in function returning void
  2006-10-20  6:17 [Bug c/29521] New: Confusing warning for return with expression in function returning void muntyan at tamu dot edu
@ 2006-10-20  9:09 ` rguenth at gcc dot gnu dot org
  2007-01-18 18:06 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-20  9:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2006-10-20 09:09 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-20 09:09:25
               date|                            |


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


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

* [Bug c/29521] Confusing warning for return with expression in function returning void
  2006-10-20  6:17 [Bug c/29521] New: Confusing warning for return with expression in function returning void muntyan at tamu dot edu
  2006-10-20  9:09 ` [Bug c/29521] " rguenth at gcc dot gnu dot org
@ 2007-01-18 18:06 ` patchapp at dberlin dot org
  2007-02-12 23:15 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: patchapp at dberlin dot org @ 2007-01-18 18:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2007-01-18 18:05 -------
Subject: Bug number PR 29521

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01533.html


-- 


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


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

* [Bug c/29521] Confusing warning for return with expression in function returning void
  2006-10-20  6:17 [Bug c/29521] New: Confusing warning for return with expression in function returning void muntyan at tamu dot edu
  2006-10-20  9:09 ` [Bug c/29521] " rguenth at gcc dot gnu dot org
  2007-01-18 18:06 ` patchapp at dberlin dot org
@ 2007-02-12 23:15 ` patchapp at dberlin dot org
  2007-02-13  0:29 ` manu at gcc dot gnu dot org
  2007-02-13  1:52 ` manu at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: patchapp at dberlin dot org @ 2007-02-12 23:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from patchapp at dberlin dot org  2007-02-12 23:15 -------
Subject: Bug number PR 29521

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-02/msg01110.html


-- 


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


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

* [Bug c/29521] Confusing warning for return with expression in function returning void
  2006-10-20  6:17 [Bug c/29521] New: Confusing warning for return with expression in function returning void muntyan at tamu dot edu
                   ` (2 preceding siblings ...)
  2007-02-12 23:15 ` patchapp at dberlin dot org
@ 2007-02-13  0:29 ` manu at gcc dot gnu dot org
  2007-02-13  1:52 ` manu at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-02-13  0:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2007-02-13 00:29 -------
Subject: Bug 29521

Author: manu
Date: Tue Feb 13 00:29:17 2007
New Revision: 121876

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121876
Log:
2007-02-13  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR c/29521
        * c-typeck.c (c_finish_return): Improve warning message.

testsuite/
        * gcc.dg/c90-return-1.c: Update output.
        * gcc.dg/c99-return-1.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/pr29521-2.c
    trunk/gcc/testsuite/gcc.dg/pr29521.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/29521] Confusing warning for return with expression in function returning void
  2006-10-20  6:17 [Bug c/29521] New: Confusing warning for return with expression in function returning void muntyan at tamu dot edu
                   ` (3 preceding siblings ...)
  2007-02-13  0:29 ` manu at gcc dot gnu dot org
@ 2007-02-13  1:52 ` manu at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-02-13  1:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from manu at gcc dot gnu dot org  2007-02-13 01:52 -------
Fixed in GCC 4.3


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-02-13  1:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-20  6:17 [Bug c/29521] New: Confusing warning for return with expression in function returning void muntyan at tamu dot edu
2006-10-20  9:09 ` [Bug c/29521] " rguenth at gcc dot gnu dot org
2007-01-18 18:06 ` patchapp at dberlin dot org
2007-02-12 23:15 ` patchapp at dberlin dot org
2007-02-13  0:29 ` manu at gcc dot gnu dot org
2007-02-13  1:52 ` manu at gcc dot gnu 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).