Skip to contentSkip to conversation

kbuild: add -Werror=implicit-function-declaration

PATCH New Masahiro Yamada 5 participants 12 messages May 7, 2020 – May 11, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index cc99873062..f8b136a07f 100644
@@ -419,7 +419,7 @@ CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
 KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
 
 KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
-		   -Wno-format-security \
+		   -Werror=implicit-function-declaration -Wno-format-security \
 		   -fno-builtin -ffreestanding $(CSTD_FLAG)
 KBUILD_CFLAGS	+= -fshort-wchar -fno-strict-aliasing
 KBUILD_AFLAGS   := -D__ASSEMBLY__
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

#2 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Quoted 26 lines · Simon Glass

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

Quoted 5 lines

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux. What does it make different for U-Boot ?

commit 94bed2a9c4ae980838003f5d32681eef794ecc28

Author: Dave Jones <[email protected]>
Date:   Sun Jul 15 23:41:38 2007 -0700

Add -Werror-implicit-function-declaration

Add -Werror-implicit-function-declaration
This makes builds fail sooner if something is implicitly defined instead of having to wait half an hour for it to fail at the linking stage.

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Hi Masahiro,

Quoted 36 lines · Masahiro Yamada
Quoted 26 lines · Simon Glass

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

Quoted 5 lines

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

Quoted 7 lines

Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux. What does it make different for U-Boot ?

Well that commit message is quite misleading. The author is presumably ignoring the warnings that come out in the compile phase. For me they come up loud and clear. I don't know why it takes half an hour to get to the link stage. My average incremental build time is under 4 seconds including the link.

Finally, the warning does not tell you anything about whether the function doesn't exist. It just tells you you have left out a header file.

I know how much of a pain this is, because coreboot does this. It does it partly because there is so much build output that the warnings are invisible unless they actually halt the build. Even then you have to search for what went wrong.

Regards,
SImon

Quoted 24 lines

commit 94bed2a9c4ae980838003f5d32681eef794ecc28

Author: Dave Jones <[email protected]>
Date:   Sun Jul 15 23:41:38 2007 -0700

Add -Werror-implicit-function-declaration

Add -Werror-implicit-function-declaration
This makes builds fail sooner if something is implicitly defined instead of having to wait half an hour for it to fail at the linking stage.

--
Best Regards
Masahiro Yamada

#4 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Quoted 53 lines · Simon Glass

Hi Masahiro,

Quoted 36 lines · Masahiro Yamada
Quoted 26 lines · Simon Glass

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

Quoted 5 lines

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

Quoted 7 lines

Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux. What does it make different for U-Boot ?

Well that commit message is quite misleading. The author is presumably ignoring the warnings that come out in the compile phase. For me they come up loud and clear. I don't know why it takes half an hour to get to the link stage. My average incremental build time is under 4 seconds including the link.

Quoted 8 lines

Finally, the warning does not tell you anything about whether the function doesn't exist. It just tells you you have left out a header file.

I know how much of a pain this is, because coreboot does this. It does it partly because there is so much build output that the warnings are invisible unless they actually halt the build. Even then you have to search for what went wrong.

I'm not immediately sure of the right answer here. Part of the problem is that even with 'make -s' U-Boot can be horribly noisy due to device tree warnings. I assume Yamada-san ran in to a problem and was expecting the build to have failed but instead was chasing down a run-time debug until finding this. It's really easy to build with -Werror set via buildman, but a lot of people don't expect to have to use buildman (as it's not required, just a good idea), see for example the thread about building non-functional sunxi binaries. If they used buildman the non-zero exit code would have saved them the debug time.

All that said, I can imagine that doing something like the include cleanup series that you do would be even harder with this on. But on the 3rd or 4th hand, adding -k to make gets those builds going along anyhow.

Personally, when I see those warnings I fix them up before tossing at the hardware, but I know that's not everyones workflow.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200508/69d73c42/attachment.sig>
#5 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Hi Tom,

Quoted 59 lines · Tom Rini
Quoted 57 lines · Simon Glass

Hi Masahiro,

Quoted 36 lines · Masahiro Yamada
Quoted 26 lines · Simon Glass

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

Quoted 5 lines

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

Quoted 7 lines

Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux. What does it make different for U-Boot ?

Well that commit message is quite misleading. The author is presumably ignoring the warnings that come out in the compile phase. For me they come up loud and clear. I don't know why it takes half an hour to get to the link stage. My average incremental build time is under 4 seconds including the link.

Finally, the warning does not tell you anything about whether the function doesn't exist. It just tells you you have left out a header file.

Quoted 8 lines
Quoted 4 lines

I know how much of a pain this is, because coreboot does this. It does it partly because there is so much build output that the warnings are invisible unless they actually halt the build. Even then you have to search for what went wrong.

I'm not immediately sure of the right answer here. Part of the problem is that even with 'make -s' U-Boot can be horribly noisy due to device tree warnings. I assume Yamada-san ran in to a problem and was

Yes, I even added -y to buildman as I was so sick of that.

Quoted 9 lines

expecting the build to have failed but instead was chasing down a run-time debug until finding this. It's really easy to build with -Werror set via buildman, but a lot of people don't expect to have to use buildman (as it's not required, just a good idea), see for example the thread about building non-functional sunxi binaries. If they used buildman the non-zero exit code would have saved them the debug time.

All that said, I can imagine that doing something like the include cleanup series that you do would be even harder with this on. But on

Yes, in general. Errors make the pace of progress really slow. Warnings are not as bad. You know you need to get them them but at least you can see the whole picture of what you are doing.

Quoted 2 lines

the 3rd or 4th hand, adding -k to make gets those builds going along anyhow.

Yes there are lots of workarounds, but warnings are warnings for a reason. The code can still work, and you need to fix it sometime.

Quoted 3 lines

Personally, when I see those warnings I fix them up before tossing at the hardware, but I know that's not everyones workflow.

Generally for me, building = writing to the hardware, so long as the build doesn't fail. Normally my build step is 'make' && 'write to board' so I just need to press reset if that is not in the script.

Regards,
Simon

#6 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

In reply to Tom Rini
Quoted 64 lines · Tom Rini
Quoted 53 lines · Simon Glass

Hi Masahiro,

Quoted 36 lines · Masahiro Yamada
Quoted 26 lines · Simon Glass

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

Quoted 5 lines

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

Quoted 7 lines

Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux. What does it make different for U-Boot ?

Well that commit message is quite misleading. The author is presumably ignoring the warnings that come out in the compile phase. For me they come up loud and clear. I don't know why it takes half an hour to get to the link stage. My average incremental build time is under 4 seconds including the link.

Quoted 8 lines

Finally, the warning does not tell you anything about whether the function doesn't exist. It just tells you you have left out a header file.

I know how much of a pain this is, because coreboot does this. It does it partly because there is so much build output that the warnings are invisible unless they actually halt the build. Even then you have to search for what went wrong.

Quoted 5 lines

I'm not immediately sure of the right answer here. Part of the problem is that even with 'make -s' U-Boot can be horribly noisy due to device tree warnings. I assume Yamada-san ran in to a problem and was expecting the build to have failed but instead was chasing down a run-time debug until finding this.

I did not run into a problem.

When I was replacing <common.h> with some lighter headers, I missed some warnings ( but I noticed them after all).

In Linux, if I miss to include a header, it fails to build. In U-Boot, it does not.

Personally, I like to align with Linux policy,
but if you are not comfortable with this patch, please feel free to ignore it.

Quoted 16 lines

It's really easy to build with
-Werror set via buildman, but a lot of people don't expect to have to use buildman (as it's not required, just a good idea), see for example the thread about building non-functional sunxi binaries. If they used buildman the non-zero exit code would have saved them the debug time.

All that said, I can imagine that doing something like the include cleanup series that you do would be even harder with this on. But on the 3rd or 4th hand, adding -k to make gets those builds going along anyhow.

Personally, when I see those warnings I fix them up before tossing at the hardware, but I know that's not everyones workflow.

--
Tom

Signature · 2 lines
Best Regards
Masahiro Yamada
#7 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Hi Masahiro,

Quoted 78 lines · Masahiro Yamada
Quoted 64 lines · Tom Rini
Quoted 53 lines · Simon Glass

Hi Masahiro,

Quoted 36 lines · Masahiro Yamada
Quoted 26 lines · Simon Glass

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

Quoted 5 lines

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

Quoted 7 lines

Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux. What does it make different for U-Boot ?

Well that commit message is quite misleading. The author is presumably ignoring the warnings that come out in the compile phase. For me they come up loud and clear. I don't know why it takes half an hour to get to the link stage. My average incremental build time is under 4 seconds including the link.

Quoted 8 lines

Finally, the warning does not tell you anything about whether the function doesn't exist. It just tells you you have left out a header file.

I know how much of a pain this is, because coreboot does this. It does it partly because there is so much build output that the warnings are invisible unless they actually halt the build. Even then you have to search for what went wrong.

Quoted 5 lines

I'm not immediately sure of the right answer here. Part of the problem is that even with 'make -s' U-Boot can be horribly noisy due to device tree warnings. I assume Yamada-san ran in to a problem and was expecting the build to have failed but instead was chasing down a run-time debug until finding this.

I did not run into a problem.

When I was replacing <common.h> with some lighter headers, I missed some warnings ( but I noticed them after all).

Quoted 6 lines

In Linux, if I miss to include a header, it fails to build. In U-Boot, it does not.

Personally, I like to align with Linux policy,
but if you are not comfortable with this patch, please feel free to ignore it.

I really don't understand the point of warnings if we are just going to turn them into errors.

How about adding an option to tell U-Boot to use -Werror, etc.? Then those that what it can enable it.

Regards,
Simon

#8 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Hi Simon,

Quoted 89 lines · Simon Glass

Hi Masahiro,

Quoted 78 lines · Masahiro Yamada
Quoted 64 lines · Tom Rini
Quoted 53 lines · Simon Glass

Hi Masahiro,

Quoted 36 lines · Masahiro Yamada
Quoted 26 lines · Simon Glass

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

Quoted 5 lines

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

Quoted 7 lines

Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux. What does it make different for U-Boot ?

Well that commit message is quite misleading. The author is presumably ignoring the warnings that come out in the compile phase. For me they come up loud and clear. I don't know why it takes half an hour to get to the link stage. My average incremental build time is under 4 seconds including the link.

Quoted 8 lines

Finally, the warning does not tell you anything about whether the function doesn't exist. It just tells you you have left out a header file.

I know how much of a pain this is, because coreboot does this. It does it partly because there is so much build output that the warnings are invisible unless they actually halt the build. Even then you have to search for what went wrong.

Quoted 5 lines

I'm not immediately sure of the right answer here. Part of the problem is that even with 'make -s' U-Boot can be horribly noisy due to device tree warnings. I assume Yamada-san ran in to a problem and was expecting the build to have failed but instead was chasing down a run-time debug until finding this.

I did not run into a problem.

When I was replacing <common.h> with some lighter headers, I missed some warnings ( but I noticed them after all).

Quoted 6 lines

In Linux, if I miss to include a header, it fails to build. In U-Boot, it does not.

Personally, I like to align with Linux policy,
but if you are not comfortable with this patch, please feel free to ignore it.

Quoted 5 lines

I really don't understand the point of warnings if we are just going to turn them into errors.

How about adding an option to tell U-Boot to use -Werror, etc.? Then those that what it can enable it.

OK. We can do it with

make KCFLAGS=-Werror

Signature · 2 lines
Best Regards
Masahiro Yamada
#9 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Quoted 95 lines · Masahiro Yamada

Hi Simon,

Quoted 92 lines · Simon Glass

Hi Masahiro,

Quoted 78 lines · Masahiro Yamada
Quoted 64 lines · Tom Rini
Quoted 53 lines · Simon Glass

Hi Masahiro,

Quoted 36 lines · Masahiro Yamada
Quoted 26 lines · Simon Glass

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

Quoted 5 lines

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

Quoted 7 lines

Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux. What does it make different for U-Boot ?

Well that commit message is quite misleading. The author is presumably ignoring the warnings that come out in the compile phase. For me they come up loud and clear. I don't know why it takes half an hour to get to the link stage. My average incremental build time is under 4 seconds including the link.

Quoted 8 lines

Finally, the warning does not tell you anything about whether the function doesn't exist. It just tells you you have left out a header file.

I know how much of a pain this is, because coreboot does this. It does it partly because there is so much build output that the warnings are invisible unless they actually halt the build. Even then you have to search for what went wrong.

Quoted 5 lines

I'm not immediately sure of the right answer here. Part of the problem is that even with 'make -s' U-Boot can be horribly noisy due to device tree warnings. I assume Yamada-san ran in to a problem and was expecting the build to have failed but instead was chasing down a run-time debug until finding this.

I did not run into a problem.

When I was replacing <common.h> with some lighter headers, I missed some warnings ( but I noticed them after all).

Quoted 6 lines

In Linux, if I miss to include a header, it fails to build. In U-Boot, it does not.

Personally, I like to align with Linux policy,
but if you are not comfortable with this patch, please feel free to ignore it.

I really don't understand the point of warnings if we are just going to turn them into errors.

Quoted 8 lines
Quoted 2 lines

How about adding an option to tell U-Boot to use -Werror, etc.? Then those that what it can enable it.

OK. We can do it with

make KCFLAGS=-Werror

I've had a few of these failures due to implicit fn declaration, so I'd be all for adding the error by default. And if things error out and you are too lazy to spot the error, use make -k ; make -k and the error will be right there at the end.

So I'm fine with this patch as-is.

Signature · 2 lines
Best regards,
Marek Vasut
#10 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Hi,

Quoted 104 lines · Marek Vasut
Quoted 102 lines · Masahiro Yamada

Hi Simon,

Quoted 89 lines · Simon Glass

Hi Masahiro,

Quoted 78 lines · Masahiro Yamada
Quoted 64 lines · Tom Rini
Quoted 53 lines · Simon Glass

Hi Masahiro,

Quoted 36 lines · Masahiro Yamada
Quoted 26 lines · Simon Glass

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

Quoted 5 lines

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

Quoted 7 lines

Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux. What does it make different for U-Boot ?

Well that commit message is quite misleading. The author is presumably ignoring the warnings that come out in the compile phase. For me they come up loud and clear. I don't know why it takes half an hour to get to the link stage. My average incremental build time is under 4 seconds including the link.

Quoted 8 lines

Finally, the warning does not tell you anything about whether the function doesn't exist. It just tells you you have left out a header file.

I know how much of a pain this is, because coreboot does this. It does it partly because there is so much build output that the warnings are invisible unless they actually halt the build. Even then you have to search for what went wrong.

Quoted 5 lines

I'm not immediately sure of the right answer here. Part of the problem is that even with 'make -s' U-Boot can be horribly noisy due to device tree warnings. I assume Yamada-san ran in to a problem and was expecting the build to have failed but instead was chasing down a run-time debug until finding this.

I did not run into a problem.

When I was replacing <common.h> with some lighter headers, I missed some warnings ( but I noticed them after all).

Quoted 6 lines

In Linux, if I miss to include a header, it fails to build. In U-Boot, it does not.

Personally, I like to align with Linux policy,
but if you are not comfortable with this patch, please feel free to ignore it.

Quoted 5 lines

I really don't understand the point of warnings if we are just going to turn them into errors.

How about adding an option to tell U-Boot to use -Werror, etc.? Then those that what it can enable it.

OK. We can do it with

Quoted 6 lines
Quoted 1 line

make KCFLAGS=-Werror

I've had a few of these failures due to implicit fn declaration, so I'd be all for adding the error by default. And if things error out and you are too lazy to spot the error, use make -k ; make -k and the error will be right there at the end.

So are you ignoring the warning? Is it because there are so many device-tree warnings? Should we figure out how to silence those things?

Quoted 2 lines

So I'm fine with this patch as-is.

Perhaps you can use Masahiro's option above?

Regards,
Simon

#11 lore raw

PATCH 1/1 kbuild: add -Werror=implicit-function-declaration

Quoted 109 lines · Simon Glass

Hi,

Quoted 106 lines · Marek Vasut
Quoted 103 lines · Masahiro Yamada

Hi Simon,

Quoted 89 lines · Simon Glass

Hi Masahiro,

Quoted 78 lines · Masahiro Yamada
Quoted 64 lines · Tom Rini
Quoted 53 lines · Simon Glass

Hi Masahiro,

Quoted 36 lines · Masahiro Yamada
Quoted 26 lines · Simon Glass

Hi Masahiro,

Quoted 7 lines · Masahiro Yamada

Add -Werror=implicit-function-declaration as Linux does.

If you do not check the prototype, it may go wrong run-time. It is better to break the build, and require to include correct headers.

Quoted 5 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NAK

We already get a warning in this situation. This makes it painful for development since things that should be warnings end up being errors. So your build fails when really it should work well enough to do a test run with your new code. I don't think it has any benefit on code quality since we already detect warnings in gitlab, etc.

Quoted 5 lines

U-Boot is set up so that warnings are reported and are easy to spot if you use 'make -s' (i.e. not buried in the output).

Regards,
Simon

Quoted 7 lines

Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux. What does it make different for U-Boot ?

Well that commit message is quite misleading. The author is presumably ignoring the warnings that come out in the compile phase. For me they come up loud and clear. I don't know why it takes half an hour to get to the link stage. My average incremental build time is under 4 seconds including the link.

Quoted 8 lines

Finally, the warning does not tell you anything about whether the function doesn't exist. It just tells you you have left out a header file.

I know how much of a pain this is, because coreboot does this. It does it partly because there is so much build output that the warnings are invisible unless they actually halt the build. Even then you have to search for what went wrong.

Quoted 5 lines

I'm not immediately sure of the right answer here. Part of the problem is that even with 'make -s' U-Boot can be horribly noisy due to device tree warnings. I assume Yamada-san ran in to a problem and was expecting the build to have failed but instead was chasing down a run-time debug until finding this.

I did not run into a problem.

When I was replacing <common.h> with some lighter headers, I missed some warnings ( but I noticed them after all).

Quoted 6 lines

In Linux, if I miss to include a header, it fails to build. In U-Boot, it does not.

Personally, I like to align with Linux policy,
but if you are not comfortable with this patch, please feel free to ignore it.

Quoted 5 lines

I really don't understand the point of warnings if we are just going to turn them into errors.

How about adding an option to tell U-Boot to use -Werror, etc.? Then those that what it can enable it.

OK. We can do it with

make KCFLAGS=-Werror

Quoted 8 lines
Quoted 4 lines

I've had a few of these failures due to implicit fn declaration, so I'd be all for adding the error by default. And if things error out and you are too lazy to spot the error, use make -k ; make -k and the error will be right there at the end.

So are you ignoring the warning? Is it because there are so many device-tree warnings? Should we figure out how to silence those things?

I keep wondering how many device tree warnings would get fixed with a re-sync of Linux.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200511/606b49f2/attachment.sig>