Skip to contentSkip to conversation

sandbox: fix compiler warning

PATCH Superseded Allen Martin 3 participants 5 messages Jan 22, 2013 – Feb 16, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 sandbox: fix compiler warning

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

---
 arch/sandbox/cpu/start.c |    3 +++
 1 file changed, 3 insertions(+)
arch/sandbox/cpu/start.c +3 -0
index 7603bf9..5287fd5 100644
@@ -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;
 }
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v3 1/1 sandbox: fix compiler warning

Hi Allen,

Quoted 16 lines · Allen Martin

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

---
 arch/sandbox/cpu/start.c |    3 +++
 1 file changed, 3 insertions(+)
arch/sandbox/cpu/start.c +0 -0
index 7603bf9..5287fd5 100644

arch/sandbox/cpu/start.c int main(int argc, char *argv[]) · line 128

Quoted 7 lines
arch/sandbox/cpu/start.c +3 -0
@@ -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,

Signature · 1 line
Albert.
#2 lore raw

PATCH v3 1/1 sandbox: fix compiler warning

Quoted 16 lines · Albert ARIBAUD

Hi Allen,

Quoted 11 lines · Allen Martin

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

---
 arch/sandbox/cpu/start.c |    3 +++
 1 file changed, 3 insertions(+)
Quoted 16 lines

arch/sandbox/cpu/start.c int main(int argc, char *argv[]) · line 128

Quoted 12 lines
arch/sandbox/cpu/start.c +3 -0
index 7603bf9..5287fd5 100644
@@ -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

Signature · 1 line
nvpublic
#3 lore raw

PATCH v3 1/1 sandbox: fix compiler warning

Hi Allen,

Quoted 9 lines · Allen Martin
Quoted 3 lines

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.

Quoted 1 line

-Allen

Amicalement,

Signature · 1 line
Albert.
Applied
#4 lore raw

PATCH v3 1/1 sandbox: fix compiler warning

Quoted 15 lines · Albert ARIBAUD

Hi Allen,

Quoted 9 lines · Allen Martin
Quoted 3 lines

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[]) [...]

Quoted 7 lines

Makes sense, thanks.

Quoted 1 line

-Allen

Amicalement,
--
Albert.

Applied to x86/master.