Skip to content

Commit

Permalink
libutils, zlib: fix Clang warnings
Browse files Browse the repository at this point in the history
Clang 18.1.6 reports the following warnings:

   CC      out/arm/ldelf-lib/libutils/isoc/bget_malloc.o
 In file included from lib/libutils/isoc/bget_malloc.c:127:
 lib/libutils/isoc/bget.c:607:7: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]
   607 | void *bget(requested_align, hdr_size, requested_size, poolset)
       |       ^

And same with lib/zlib/{adler32.c,inffast.c,inflate.c,zutil.c}.

In addition, zutil.c causes:

  CC      out/arm/core/lib/zlib/zutil.o
core/lib/zlib/zutil.c:28:33: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
   28 | const char * ZEXPORT zlibVersion()
      |                                 ^
      |                                  void

Add -Wno-deprecated-non-prototype to libutils' bget_malloc.c to silence
the first series, and simply remove -Wstrict-prototypes (added by
default by mk/compile.mk) when building zlib.

Signed-off-by: Jerome Forissier <[email protected]>
Acked-by: Joakim Bech <[email protected]>
Acked-by: Jens Wiklander <[email protected]>
  • Loading branch information
jforissier committed Jun 18, 2024
1 parent dc9fd53 commit 47d5e6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/lib/zlib/sub.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ srcs-y += inftrees.c
srcs-y += zutil.c
cflags-remove-y += -Wold-style-definition
cflags-remove-y += -Wswitch-default
cflags-remove-y += -Wstrict-prototypes
cflags-y += $(call cc-option,-Wno-deprecated-non-prototype)
1 change: 1 addition & 0 deletions lib/libutils/isoc/sub.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ global-incdirs-y += include
srcs-y += bget_malloc.c
cflags-remove-bget_malloc.c-y += -Wold-style-definition -Wredundant-decls
cflags-bget_malloc.c-y += -Wno-sign-compare -Wno-cast-align
cflags-bget_malloc.c-y += $(call cc-option,-Wno-deprecated-non-prototype)
ifeq ($(sm),core)
cflags-remove-bget_malloc.c-y += $(cflags_kasan)
endif
Expand Down

0 comments on commit 47d5e6c

Please sign in to comment.