[PATCH v2 00/10] tools/nolibc: enable compiler warnings

Thomas Weißschuh posted 10 patches 2 years, 6 months ago
There is a newer version of this series
tools/include/nolibc/stdint.h                |   4 +
tools/include/nolibc/sys.h                   |   3 +-
tools/testing/selftests/nolibc/Makefile      |   2 +-
tools/testing/selftests/nolibc/nolibc-test.c | 108 +++++++++++++++++----------
4 files changed, 74 insertions(+), 43 deletions(-)
[PATCH v2 00/10] tools/nolibc: enable compiler warnings
Posted by Thomas Weißschuh 2 years, 6 months ago
To help the developers to avoid mistakes and keep the code smaller let's
enable compiler warnings.

I stuck with __attribute__((unused)) over __maybe_unused in
nolibc-test.c for consistency with nolibc proper.
If we want to add a define it needs to be added twice once for nolibc
proper and once for nolibc-test otherwise libc-test wouldn't build
anymore.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Changes in v2:
- Don't drop unused test helpers, mark them as __attribute__((unused))
- Make some function in nolibc-test static
- Also handle -W and -Wextra
- Link to v1: https://lore.kernel.org/r/20230731-nolibc-warnings-v1-0-74973d2a52d7@weissschuh.net

---
Thomas Weißschuh (10):
      tools/nolibc: drop unused variables
      tools/nolibc: sys: avoid implicit sign cast
      tools/nolibc: stdint: use int for size_t on 32bit
      selftests/nolibc: drop unused variables
      selftests/nolibc: mark test helpers as potentially unused
      selftests/nolibc: make functions static if possible
      selftests/nolibc: avoid unused arguments warnings
      selftests/nolibc: avoid sign-compare warnings
      selftests/nolibc: test return value of read() in test_vfprintf
      selftests/nolibc: enable compiler warnings

 tools/include/nolibc/stdint.h                |   4 +
 tools/include/nolibc/sys.h                   |   3 +-
 tools/testing/selftests/nolibc/Makefile      |   2 +-
 tools/testing/selftests/nolibc/nolibc-test.c | 108 +++++++++++++++++----------
 4 files changed, 74 insertions(+), 43 deletions(-)
---
base-commit: dfef4fc45d5713eb23d87f0863aff9c33bd4bfaf
change-id: 20230731-nolibc-warnings-c6e47284ac03

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH v2 00/10] tools/nolibc: enable compiler warnings
Posted by Willy Tarreau 2 years, 6 months ago
Hi Thomas,

On Tue, Aug 01, 2023 at 07:30:07AM +0200, Thomas Weißschuh wrote:
> To help the developers to avoid mistakes and keep the code smaller let's
> enable compiler warnings.
(...)

OK, that's overall OK to me, and I noted thta you'll likely update
6 and 9. Just let me know how you prefer to proceed, I hope to send
the PR to Shuah this week-end so I want to be sure we avoid a last
minute rush and the risks of breakage that comes with it.

Thanks!
Willy
Re: [PATCH v2 00/10] tools/nolibc: enable compiler warnings
Posted by Thomas Weißschuh 2 years, 6 months ago
On 2023-08-02 22:22:43+0200, Willy Tarreau wrote:
> Hi Thomas,
> 
> On Tue, Aug 01, 2023 at 07:30:07AM +0200, Thomas Weißschuh wrote:
> > To help the developers to avoid mistakes and keep the code smaller let's
> > enable compiler warnings.
> (...)
> 
> OK, that's overall OK to me, and I noted thta you'll likely update
> 6 and 9. Just let me know how you prefer to proceed, I hope to send
> the PR to Shuah this week-end so I want to be sure we avoid a last
> minute rush and the risks of breakage that comes with it.

I'm not yet sure when I can rework those patches.
Could you already pick up those you are fine with?
(And also leave out the final one to not have spurious warnings)

Thomas
Re: [PATCH v2 00/10] tools/nolibc: enable compiler warnings
Posted by Willy Tarreau 2 years, 6 months ago
On Wed, Aug 02, 2023 at 11:10:17PM +0200, Thomas Weißschuh wrote:
> On 2023-08-02 22:22:43+0200, Willy Tarreau wrote:
> > Hi Thomas,
> > 
> > On Tue, Aug 01, 2023 at 07:30:07AM +0200, Thomas Weißschuh wrote:
> > > To help the developers to avoid mistakes and keep the code smaller let's
> > > enable compiler warnings.
> > (...)
> > 
> > OK, that's overall OK to me, and I noted thta you'll likely update
> > 6 and 9. Just let me know how you prefer to proceed, I hope to send
> > the PR to Shuah this week-end so I want to be sure we avoid a last
> > minute rush and the risks of breakage that comes with it.
> 
> I'm not yet sure when I can rework those patches.

No problem.

> Could you already pick up those you are fine with?
> (And also leave out the final one to not have spurious warnings)

OK, I'll stick to this for now, thank you!
Willy