* [U-Boot] [PATCH v3] sandbox: fix compiler warning
@ 2013-01-22 23:11 Allen Martin
2013-01-23 6:46 ` Albert ARIBAUD
0 siblings, 1 reply; 5+ messages in thread
From: Allen Martin @ 2013-01-22 23:11 UTC (permalink / raw)
To: u-boot
Add back return statement to fix compiler warning about control flow
reaching end of non void function that was introduced with:
e05e5de arm: move C runtime setup code in crt0.S
Signed-off-by: Allen Martin <amartin@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
arch/sandbox/cpu/start.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 7603bf9..5287fd5 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -122,4 +122,7 @@ int main(int argc, char *argv[])
* never return.
*/
board_init_f(0);
+
+ /* NOTREACHED - board_init_f() does not return */
+ return 0;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v3] sandbox: fix compiler warning
2013-01-22 23:11 [U-Boot] [PATCH v3] sandbox: fix compiler warning Allen Martin
@ 2013-01-23 6:46 ` Albert ARIBAUD
2013-01-23 21:05 ` Allen Martin
0 siblings, 1 reply; 5+ messages in thread
From: Albert ARIBAUD @ 2013-01-23 6:46 UTC (permalink / raw)
To: u-boot
Hi Allen,
On Tue, 22 Jan 2013 15:11:21 -0800, Allen Martin <amartin@nvidia.com>
wrote:
> Add back return statement to fix compiler warning about control flow
> reaching end of non void function that was introduced with:
>
> e05e5de arm: move C runtime setup code in crt0.S
>
> Signed-off-by: Allen Martin <amartin@nvidia.com>
> Acked-by: Simon Glass <sjg@chromium.org>
> ---
> arch/sandbox/cpu/start.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
> index 7603bf9..5287fd5 100644
> --- a/arch/sandbox/cpu/start.c
> +++ b/arch/sandbox/cpu/start.c
> @@ -122,4 +122,7 @@ int main(int argc, char *argv[])
> * never return.
> */
> board_init_f(0);
> +
> + /* NOTREACHED - board_init_f() does not return */
> + return 0;
> }
Shouldn't the function be given '__attribute__((noreturn))' rather than
adding a non-executed 'return 0' to it?
Amicalement,
--
Albert.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v3] sandbox: fix compiler warning
2013-01-23 6:46 ` Albert ARIBAUD
@ 2013-01-23 21:05 ` Allen Martin
2013-01-24 12:45 ` Albert ARIBAUD
0 siblings, 1 reply; 5+ messages in thread
From: Allen Martin @ 2013-01-23 21:05 UTC (permalink / raw)
To: u-boot
On Tue, Jan 22, 2013 at 10:46:03PM -0800, Albert ARIBAUD wrote:
> Hi Allen,
>
> On Tue, 22 Jan 2013 15:11:21 -0800, Allen Martin <amartin@nvidia.com>
> wrote:
>
> > Add back return statement to fix compiler warning about control flow
> > reaching end of non void function that was introduced with:
> >
> > e05e5de arm: move C runtime setup code in crt0.S
> >
> > Signed-off-by: Allen Martin <amartin@nvidia.com>
> > Acked-by: Simon Glass <sjg@chromium.org>
> > ---
> > arch/sandbox/cpu/start.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
> > index 7603bf9..5287fd5 100644
> > --- a/arch/sandbox/cpu/start.c
> > +++ b/arch/sandbox/cpu/start.c
> > @@ -122,4 +122,7 @@ int main(int argc, char *argv[])
> > * never return.
> > */
> > board_init_f(0);
> > +
> > + /* NOTREACHED - board_init_f() does not return */
> > + return 0;
> > }
>
> Shouldn't the function be given '__attribute__((noreturn))' rather than
> adding a non-executed 'return 0' to it?
>
The function in question is sandbox main(), and it can return if there
was an error prior to calling board_init_f(). Here's the whole
function for context:
int main(int argc, char *argv[])
{
struct sandbox_state *state;
int err;
err = state_init();
if (err)
return err;
state = state_get_current();
if (os_parse_args(state, argc, argv))
return 1;
/*
* Do pre- and post-relocation init, then start up
U-Boot. This will
* never return.
*/
board_init_f(0);
/* NOTREACHED - board_init_f() does not return */
return 0;
}
-Allen
--
nvpublic
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot] [PATCH v3] sandbox: fix compiler warning
2013-01-23 21:05 ` Allen Martin
@ 2013-01-24 12:45 ` Albert ARIBAUD
2013-02-16 0:06 ` Simon Glass
0 siblings, 1 reply; 5+ messages in thread
From: Albert ARIBAUD @ 2013-01-24 12:45 UTC (permalink / raw)
To: u-boot
Hi Allen,
On Wed, 23 Jan 2013 13:05:27 -0800, Allen Martin <amartin@nvidia.com>
wrote:
> > Shouldn't the function be given '__attribute__((noreturn))' rather than
> > adding a non-executed 'return 0' to it?
> >
>
> The function in question is sandbox main(), and it can return if there
> was an error prior to calling board_init_f(). Here's the whole
> function for context:
>
> int main(int argc, char *argv[]) [...]
Makes sense, thanks.
> -Allen
Amicalement,
--
Albert.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v3] sandbox: fix compiler warning
2013-01-24 12:45 ` Albert ARIBAUD
@ 2013-02-16 0:06 ` Simon Glass
0 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2013-02-16 0:06 UTC (permalink / raw)
To: u-boot
On Thu, Jan 24, 2013 at 4:45 AM, Albert ARIBAUD
<albert.u.boot@aribaud.net> wrote:
> Hi Allen,
>
> On Wed, 23 Jan 2013 13:05:27 -0800, Allen Martin <amartin@nvidia.com>
> wrote:
>
>> > Shouldn't the function be given '__attribute__((noreturn))' rather than
>> > adding a non-executed 'return 0' to it?
>> >
>>
>> The function in question is sandbox main(), and it can return if there
>> was an error prior to calling board_init_f(). Here's the whole
>> function for context:
>>
>> int main(int argc, char *argv[]) [...]
>
> Makes sense, thanks.
>
>> -Allen
>
> Amicalement,
> --
> Albert.
Applied to x86/master.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-02-16 0:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-22 23:11 [U-Boot] [PATCH v3] sandbox: fix compiler warning Allen Martin
2013-01-23 6:46 ` Albert ARIBAUD
2013-01-23 21:05 ` Allen Martin
2013-01-24 12:45 ` Albert ARIBAUD
2013-02-16 0:06 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox