All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: How to fix warning 'control reaches end of non-void function'
Date: Tue, 29 Jul 2008 21:02:57 +0000	[thread overview]
Message-ID: <20080729210236.GB30067@joi> (raw)
In-Reply-To: <20080729191738.GA32506@orion>

On Tue, Jul 29, 2008 at 11:17:38PM +0400, Alexander Beregalov wrote:
> Hi
> 
> What is it a right way to fix these warnings?
> 
> smth function()
> {
> 	switch (var) {
> 	case one:
> 		return 1;
> 	default:
> 		BUG();
> 	}
> }
> 
> warning: control reaches end of non-void function

If BUG() would be normal function it could be marked as __attribute__((noreturn)).
But it's a macro defined differently depending on architecture and CONFIG_*.
Sometimes it calls panic() which is annotated properly and sometimes it calls
other code....

If you are brave, you could fix all implementations.

Marcin

  parent reply	other threads:[~2008-07-29 21:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-29 19:17 How to fix warning 'control reaches end of non-void function' Alexander Beregalov
2008-07-29 20:48 ` Daniel Baluta
2008-07-29 20:51 ` Johannes Weiner
2008-07-29 21:02 ` Marcin Slusarz [this message]
2008-07-29 21:20 ` Johannes Weiner
2008-07-29 22:38 ` Rene Herman
2008-07-29 23:15 ` Jacob
2008-07-29 23:27 ` Alexander Beregalov
2008-07-30  8:34 ` Sandeep K Sinha
2008-07-30 12:40 ` Hugo Vasconcelos Saldanha
2008-07-30 15:57 ` walter harms

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=20080729210236.GB30067@joi \
    --to=marcin.slusarz@gmail.com \
    --cc=kernel-janitors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.