public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: ac131313@redhat.com
To: gcc-gnats@gcc.gnu.org
Subject: c/5678: Returning a void in a void func doesn't get a warning
Date: Tue, 12 Feb 2002 22:26:00 -0000 [thread overview]
Message-ID: <20020213062042.27897.qmail@sources.redhat.com> (raw)
>Number: 5678
>Category: c
>Synopsis: Returning a void in a void func doesn't get a warning
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Feb 12 22:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Andrew Cagney
>Release: unknown-1.0
>Organization:
>Environment:
N/A
>Description:
[added gcc]
Checked in as obvious. Wonder why GCC didn't warn about this. Should
we add some more -Wxxx flags?
I was looking at it and wondering the same thing - I know I've fixed botched return type warnings. Trying:
static int f1 (void) { return 1; }
static void f2 (void) { return 1; }
static void f3 (void) { return; }
static int f4 (void) { return; }
I get:
-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized -Werror
doublest.c: In function `f2':
doublest.c:741: warning: `return' with a value, in function returning void
doublest.c: In function `f4':
doublest.c:743: warning: `return' with no value, in function returning non-void
so ok so far. Hmm, I think this tells the story:
static void f5 (int a) { return f3(); }
Returning the result from a function that returns void (f3()) doesn't attract a warning.
Bug or feature?
Andrew
--
Further discussion concluded it wasn't compliant with ISO C or C99. It might fall into GCC feature category. I struggle to see advantages in this.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
next reply other threads:[~2002-02-13 6:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-12 22:26 ac131313 [this message]
2002-04-23 1:54 rth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020213062042.27897.qmail@sources.redhat.com \
--to=ac131313@redhat.com \
--cc=gcc-gnats@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).