diff mbox

[U-Boot] panic: add noreturn attribute

Message ID 1309384684-26415-1-git-send-email-vapier@gentoo.org
State Accepted
Commit d2e8b911c0a0661d395ccac72156040702ac842d
Delegated to: Wolfgang Denk
Headers show

Commit Message

Mike Frysinger June 29, 2011, 9:58 p.m. UTC
Since panic() never returns, we should add an appropriate attribute to
let gcc improve optimization around it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/common.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Wolfgang Denk July 26, 2011, 2:54 p.m. UTC | #1
Dear Mike Frysinger,

In message <1309384684-26415-1-git-send-email-vapier@gentoo.org> you wrote:
> Since panic() never returns, we should add an appropriate attribute to
> let gcc improve optimization around it.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  include/common.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
Wolfgang Denk July 27, 2011, 12:24 p.m. UTC | #2
Dear Mike Frysinger,

In message <20110726145430.3E637138EED4@gemini.denx.de> I wrote:
> 
> In message <1309384684-26415-1-git-send-email-vapier@gentoo.org> you wrote:
> > Since panic() never returns, we should add an appropriate attribute to
> > let gcc improve optimization around it.
> > 
> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> > ---
> >  include/common.h |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> Applied, thanks.

Arghh... this is causing build warnings for ALL boards:

vsprintf.c: In function 'panic':
vsprintf.c:730: warning: 'noreturn' function does return


Please fix!


[Did you not test this??]

Best regards,

Wolfgang Denk
Kumar Gala July 27, 2011, 1:10 p.m. UTC | #3
On Jul 27, 2011, at 7:24 AM, Wolfgang Denk wrote:

> Dear Mike Frysinger,
> 
> In message <20110726145430.3E637138EED4@gemini.denx.de> I wrote:
>> 
>> In message <1309384684-26415-1-git-send-email-vapier@gentoo.org> you wrote:
>>> Since panic() never returns, we should add an appropriate attribute to
>>> let gcc improve optimization around it.
>>> 
>>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>>> ---
>>> include/common.h |    2 +-
>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> Applied, thanks.
> 
> Arghh... this is causing build warnings for ALL boards:
> 
> vsprintf.c: In function 'panic':
> vsprintf.c:730: warning: 'noreturn' function does return
> 
> 
> Please fix!

http://patchwork.ozlabs.org/patch/106987/

- k
Mike Frysinger July 28, 2011, 12:50 a.m. UTC | #4
On Wed, Jul 27, 2011 at 05:24, Wolfgang Denk wrote:
> Mike Frysinger wrote:
>> Mike Frysinger wrote:
>> > Since panic() never returns, we should add an appropriate attribute to
>> > let gcc improve optimization around it.
>> >
>> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> > ---
>> >  include/common.h |    2 +-
>> >  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> Applied, thanks.
>
> Arghh... this is causing build warnings for ALL boards:

no, it isnt all boards.  if you look at the code, you see it's based
on the CONFIG_PANIC_HANG define.  and all my boards enable that, so i
didnt see any warnings.
-mike
Wolfgang Denk July 28, 2011, 7:45 a.m. UTC | #5
Dear Mike Frysinger,

In message <CAJaTeTqTEC2XHdbSeZHLWYhhSkdBXqDx1mFSBzuUaeWEyru=Zg@mail.gmail.com> you wrote:
>
> > Arghh... this is causing build warnings for ALL boards:
> 
> no, it isnt all boards.  if you look at the code, you see it's based
> on the CONFIG_PANIC_HANG define.  and all my boards enable that, so i
> didnt see any warnings.

That's why the documentation says: "Before sending the patch, you must
run the MAKEALL script on your patched source tree and make sure that
no errors or warnings are reported for any of the boards. ... Please
also run MAKEALL for at least one other architecture than the one you
made your modifications in."

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/include/common.h b/include/common.h
index 1e21b7a..b59079b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -651,7 +651,7 @@  int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
 unsigned long long	simple_strtoull(const char *cp,char **endp,unsigned int base);
 long	simple_strtol(const char *cp,char **endp,unsigned int base);
 void	panic(const char *fmt, ...)
-		__attribute__ ((format (__printf__, 1, 2)));
+		__attribute__ ((format (__printf__, 1, 2), noreturn));
 int	sprintf(char * buf, const char *fmt, ...)
 		__attribute__ ((format (__printf__, 2, 3)));
 int	vsprintf(char *buf, const char *fmt, va_list args);