From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: Linus Torvalds <torvalds@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 4/4] bug: mark disabled BUG() as unreachable() code
Date: Sat, 28 Apr 2012 09:10:18 +0400 [thread overview]
Message-ID: <4F9B7BBA.7030504@openvz.org> (raw)
In-Reply-To: <20120425112636.26927.27124.stgit@zurg>
Konstantin Khlebnikov wrote:
> This patch suppress some compiler warnings (if CONFIG_BUG=n)
> "warning: control reaches end of non-void function"
With this patch gcc throw out loop at the end of do_exit():
schedule();
BUG();
/* Avoid "noreturn function does return". */
for (;;)
cpu_relax(); /* For when BUG is null */
Is this ok? Probably not, and we need here some BUG_NORETURN() which
really never returns even if CONFIG_BUG=n.
>
> Plus now gcc can throw out some dead code.
> bloat-o-meter: add/remove: 1/1 grow/shrink: 68/173 up/down: 1569/-5607 (-4038)
>
> Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>
> ---
> include/asm-generic/bug.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
> index aadb6fc..0b08199 100644
> --- a/include/asm-generic/bug.h
> +++ b/include/asm-generic/bug.h
> @@ -108,7 +108,7 @@ extern void warn_slowpath_null(const char *file, const int line);
>
> #else /* !CONFIG_BUG */
> #ifndef HAVE_ARCH_BUG
> -#define BUG() do {} while(0)
> +#define BUG() unreachable()
> #endif
>
> #ifndef HAVE_ARCH_BUG_ON
>
next prev parent reply other threads:[~2012-04-28 5:10 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-25 11:26 [PATCH 1/4] compiler.h: introduce unused_expression() macro Konstantin Khlebnikov
2012-04-25 11:26 ` [PATCH 2/4] bug: completely remove code of disabled VM_BUG_ON() Konstantin Khlebnikov
2012-04-25 14:40 ` Geert Uytterhoeven
2012-04-26 22:32 ` Andrew Morton
2012-04-27 5:17 ` Geert Uytterhoeven
2012-04-27 7:07 ` Andrew Morton
2012-04-25 11:26 ` [PATCH 3/4] bug: completely remove code of disabled BUG_ON() Konstantin Khlebnikov
2012-04-25 11:26 ` Konstantin Khlebnikov
2012-04-25 11:26 ` [PATCH 4/4] bug: mark disabled BUG() as unreachable() code Konstantin Khlebnikov
2012-04-25 11:26 ` Konstantin Khlebnikov
2012-04-28 5:10 ` Konstantin Khlebnikov [this message]
2012-04-28 5:21 ` Linus Torvalds
2012-04-28 5:21 ` Linus Torvalds
2012-04-28 6:14 ` Andrew Morton
2012-04-25 11:51 ` [PATCH 1/4] compiler.h: introduce unused_expression() macro Cong Wang
2012-04-25 11:54 ` Konstantin Khlebnikov
2012-04-25 11:54 ` Konstantin Khlebnikov
2012-04-26 22:29 ` Andrew Morton
2012-04-27 9:55 ` Konstantin Khlebnikov
2012-04-27 21:53 ` Andrew Morton
2012-04-26 22:34 ` Andrew Morton
2012-04-26 22:34 ` Andrew Morton
2012-04-27 7:54 ` Konstantin Khlebnikov
2012-04-27 8:16 ` H. Peter Anvin
2012-04-28 3:50 ` Konstantin Khlebnikov
2012-04-28 3:50 ` Konstantin Khlebnikov
2012-04-28 7:06 ` [PATCH v2 1/2] bug: introduce BUILD_BUG_ON_INVALID() macro Konstantin Khlebnikov
2012-04-28 7:06 ` Konstantin Khlebnikov
2012-04-28 7:06 ` [PATCH v2 2/2] bug: completely remove code of disabled VM_BUG_ON() Konstantin Khlebnikov
2012-04-28 7:06 ` Konstantin Khlebnikov
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=4F9B7BBA.7030504@openvz.org \
--to=khlebnikov@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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 NNTP newsgroup(s).