mach-k3: common_fdt: Fix Label Issue
Subsystems (2)
PATCH 1/1 mach-k3: common_fdt: Fix Label Issue
Labels are not allowed before declarations. Add a semicolon after the label to introduce an empty statement. This will fix following error:
arch/arm/mach-k3/common_fdt.c: In function 'fdt_fixup_reserved':arch/arm/mach-k3/common_fdt.c:156:2: error: a label can only be part of a statement and a declaration is not a statement
156 | struct fdt_memory carveout = {
| ^~~~~~make[1]: *** [scripts/Makefile.build:256: arch/arm/mach-k3/common_fdt.o] Error 1
make: *** [Makefile:1919: arch/arm/mach-k3] Error 2
---
I'm open to other suggestions! This is just the easiest way to fix this compile error. BTW, master is fine since 096aa229a9e is only on next.
arch/arm/mach-k3/common_fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-k3/common_fdt.c +1 -1
@@ -152,7 +152,7 @@ int fdt_fixup_reserved(void *blob, const char *name, } } -add_carveout: +add_carveout: ;struct fdt_memory carveout = { .start = new_address, .end = new_address + new_size -1 ,
Signature · 1 line
2.25.1
Hi Daniel.
Thanks for patch
Quoted 9 lines · Daniel Schultz
Labels are not allowed before declarations. Add a semicolon after the label to introduce an empty statement. This will fix following error:
arch/arm/mach-k3/common_fdt.c: In function 'fdt_fixup_reserved':arch/arm/mach-k3/common_fdt.c:156:2: error: a label can only be part of a statement and a declaration is not a statement156 | struct fdt_memory carveout = { | ^~~~~~make[1]: *** [
scripts/Makefile.build:256:arch/arm/mach-k3/common_fdt.o] Error 1
make: *** [Makefile:1919:arch/arm/mach-k3] Error 2
Is there some specific compiler option you are using, Sorry but I don't see this error .
i just build sha id e458e103d4f5fb7aaf13e744c65916ab3ba4a18d of next
Quoted 17 lines
Fixes 096aa229a9e ("mach-k3: common_fdt: create a reserved memory node")Signed-off-by Daniel Schultz <[email protected]>---
I'm open to other suggestions! This is just the easiest way to fix this compile error. BTW, master is fine since
096aa229a9eis only on next.arch/arm/mach-k3/common_fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-k3/common_fdt.c +0
-0
arch/arm/mach-k3/common_fdt.c int fdt_fixup_reserved(void *blob, const char *name, · line 158
Quoted 8 lines
arch/arm/mach-k3/common_fdt.c +1
-1@@ -152,7 +152,7 @@ int fdt_fixup_reserved(void *blob, const char *name, } } -add_carveout: +add_carveout: ;struct fdt_memory carveout = { .start = new_address, .end = new_address + new_size -1 ,
My suggestion will be to move this struct at start of function.
and change only size here
carveout.end = new_address + new_size - 1;
Hi Udit
Quoted 17 lines · Udit
Hi Daniel.
Thanks for patch
Quoted 11 lines · Daniel Schultz
Labels are not allowed before declarations. Add a semicolon after the label to introduce an empty statement. This will fix following error:
arch/arm/mach-k3/common_fdt.c: In function 'fdt_fixup_reserved':arch/arm/mach-k3/common_fdt.c:156:2: error: a label can only be part of a statement and a declaration is not a statement
156 | structfdt_memorycarveout = {
| ^~~~~~
make[1]: *** [scripts/Makefile.build:256:arch/arm/mach-k3/common_fdt.o] Error 1
make: *** [Makefile:1919:arch/arm/mach-k3] Error 2
Quoted 5 lines
Is there some specific compiler option you are using, Sorry but I don't see this error .
i just build sha id
e458e103d4f5fb7aaf13e744c65916ab3ba4a18dof next
I had run into the same issue when I was using v10.1 of the Arm GNU toolchain, moving to v14.2, I no longer see it.
Quoted 34 lines
Quoted 21 lines
Fixes 096aa229a9e ("mach-k3: common_fdt: create a reserved memory node")Signed-off-by Daniel Schultz <[email protected]>---
I'm open to other suggestions! This is just the easiest way to fix this compile error. BTW, master is fine since
096aa229a9eis only on next.
arch/arm/mach-k3/common_fdt.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-k3/common_fdt.c +0
-0@@ -152,7 +152,7 @@ int fdt_fixup_reserved(void *blob, const char *name, } }Quoted 5 lines
-add_carveout:
+add_carveout: ;
structfdt_memorycarveout = {
.start =new_address,
.end =new_address+new_size- 1,My suggestion will be to move this struct at start of function.
and change only size here
carveout.end =
new_address+new_size- 1;
Signature · 2 lines
Thanking You Neha Malcom Francis
On April 6, 2025 thus sayeth Daniel Schultz:
Quoted 10 lines
Labels are not allowed before declarations. Add a semicolon after the label to introduce an empty statement. This will fix following error:
arch/arm/mach-k3/common_fdt.c: In function 'fdt_fixup_reserved':arch/arm/mach-k3/common_fdt.c:156:2: error: a label can only be part of a statement and a declaration is not a statement156 | struct fdt_memory carveout = { | ^~~~~~make[1]: *** [
scripts/Makefile.build:256:arch/arm/mach-k3/common_fdt.o] Error 1
make: *** [Makefile:1919:arch/arm/mach-k3] Error 2
Quoted 8 lines
Fixes 096aa229a9e ("mach-k3: common_fdt: create a reserved memory node")Signed-off-by Daniel Schultz <[email protected]>---
I'm open to other suggestions! This is just the easiest way to fix this compile error. BTW, master is fine since
096aa229a9eis only on next.
Ha I learn something new every day. It makes sense as we can't declare variables inside switch statements so the same rules should apply when adding jump labels at the function scope.
I was never really in love with the layout of this function, my thought was to move that carveout structure to the top with all the other declarations but I'm not apposed to the null statement here either.
Thanks for fixing this
~Bryan
Quoted 19 lines · Neha Malcom Francis
Hi Udit
Quoted 16 lines · Udit
Hi Daniel.
Thanks for patch
Quoted 11 lines · Daniel Schultz
Labels are not allowed before declarations. Add a semicolon after the label to introduce an empty statement. This will fix following error:
arch/arm/mach-k3/common_fdt.c: In function 'fdt_fixup_reserved':arch/arm/mach-k3/common_fdt.c:156:2: error: a label can only be part of a statement and a declaration is not a statement
156 | structfdt_memorycarveout = {
| ^~~~~~
make[1]: *** [scripts/Makefile.build:256:arch/arm/mach-k3/common_fdt.o] Error 1
make: *** [Makefile:1919:arch/arm/mach-k3] Error 2
Quoted 7 lines
Quoted 5 lines
Is there some specific compiler option you are using, Sorry but I don't see this error .
i just build sha id
e458e103d4f5fb7aaf13e744c65916ab3ba4a18dof nextI had run into the same issue when I was using v10.1 of the Arm GNU toolchain, moving to v14.2, I no longer see it.
I'm currently using "aarch64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0" with just make.
Quoted 27 lines
Quoted 27 lines
Quoted 18 lines
Fixes 096aa229a9e ("mach-k3: common_fdt: create a reserved memory node")Signed-off-by Daniel Schultz <[email protected]>---
I'm open to other suggestions! This is just the easiest way to fix this compile error. BTW, master is fine since
096aa229a9eis only on next.arch/arm/mach-k3/common_fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-k3/common_fdt.c +0
-0arch/arm/mach-k3/common_fdt.c int fdt_fixup_reserved(void *blob, const char *name, · line 158
Quoted 7 lines
arch/arm/mach-k3/common_fdt.c +1
-0@@ -152,7 +152,7 @@ int fdt_fixup_reserved(void *blob, const char *name, } } -add_carveout: +add_carveout: ; struct fdt_memory carveout = { .start = new_address, .end = new_address + new_size - 1,My suggestion will be to move this struct at start of function.
Quoted 3 lines
Quoted 3 lines
and change only size here
carveout.end =
new_address+new_size- 1;
sounds good.
- Daniel
Quoted 2 lines
Quoted 2 lines
Quoted 10 lines · Daniel Schultz
Labels are not allowed before declarations. Add a semicolon after the label to introduce an empty statement. This will fix following error:
arch/arm/mach-k3/common_fdt.c: In function 'fdt_fixup_reserved':arch/arm/mach-k3/common_fdt.c:156:2: error: a label can only be part of a statement and a declaration is not a statement156 | struct fdt_memory carveout = { | ^~~~~~make[1]: *** [
scripts/Makefile.build:256:arch/arm/mach-k3/common_fdt.o] Error 1
make: *** [Makefile:1919:arch/arm/mach-k3] Error 2
Quoted 7 lines
Fixes 096aa229a9e ("mach-k3: common_fdt: create a reserved memory node")Signed-off-by Daniel Schultz <[email protected]>---
I'm open to other suggestions! This is just the easiest way to fix this compile error. BTW, master is fine since
096aa229a9eis only on next.
Is this the only warning you get with Ubuntu 20.04's gcc? But I would also rather see Udit's suggestion on how to fix it rather than adding a ';' here as that looks like a stray character rather than an intentional but not always obvious fix. Thanks.
Signature · 1 line
Tom
Quoted 16 lines · Tom Rini
Quoted 15 lines · Daniel Schultz
Labels are not allowed before declarations. Add a semicolon after the label to introduce an empty statement. This will fix following error:
arch/arm/mach-k3/common_fdt.c: In function 'fdt_fixup_reserved':arch/arm/mach-k3/common_fdt.c:156:2: error: a label can only be part of a statement and a declaration is not a statement156 | struct fdt_memory carveout = { | ^~~~~~make[1]: *** [
scripts/Makefile.build:256:arch/arm/mach-k3/common_fdt.o] Error 1
make: *** [Makefile:1919:arch/arm/mach-k3] Error 2Fixes 096aa229a9e ("mach-k3: common_fdt: create a reserved memory node")Signed-off-by Daniel Schultz <[email protected]>---
Quoted 6 lines
Quoted 2 lines
I'm open to other suggestions! This is just the easiest way to fix this compile error. BTW, master is fine since
096aa229a9eis only on next.Is this the only warning you get with Ubuntu 20.04's gcc? But I would also rather see Udit's suggestion on how to fix it rather than adding a ';' here as that looks like a stray character rather than an intentional but not always obvious fix. Thanks.
I agree. See patch [1] from yesterday which should be good to go.
- Daniel
1: https://lists.denx.de/pipermail/u-boot/2025-April/586915.html