[PATCH 1/7] global: Disable deprecated-non-prototype warning with clang

We have a number of places in the code which use the following syntax:
void func(a, b, c) int a; /* Does a */ something_t *b; /* Pointer to b */ int c; /* Does c */ { ... }
Which while not what we document as our coding style, this is also code which we have imported from other projects, and would like to re-sync with in the future. While the biggest example of this is the zlib code, there are other places as well. For now, we will silence this warning.
Signed-off-by: Tom Rini trini@konsulko.com --- Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile index 54f894dab841..d2c132be6e09 100644 --- a/Makefile +++ b/Makefile @@ -790,6 +790,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) +KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) endif
# These warnings generated too much noise in a regular build.

With clang-15 we now will get warnings such as:
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
And it is easy enough to address this warning here, as we aren't concerned with re-syncing with an upstream.
Signed-off-by: Tom Rini trini@konsulko.com --- common/dlmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 41c7230424cc..0f9b7262d512 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -80,7 +80,7 @@ GmListElement* makeGmListElement (void* bas) return this; }
-void gcleanup () +void gcleanup (void) { BOOL rval; assert ( (head == NULL) || (head->base == (void*)gAddressBase)); @@ -2340,7 +2340,7 @@ size_t malloc_usable_size(mem) Void_t* mem; /* Utility to update current_mallinfo for malloc_stats and mallinfo() */
#ifdef DEBUG -static void malloc_update_mallinfo() +static void malloc_update_mallinfo(void) { int i; mbinptr b; @@ -2397,7 +2397,7 @@ static void malloc_update_mallinfo() */
#ifdef DEBUG -void malloc_stats() +void malloc_stats(void) { malloc_update_mallinfo(); printf("max system bytes = %10u\n", @@ -2418,7 +2418,7 @@ void malloc_stats() */
#ifdef DEBUG -struct mallinfo mALLINFo() +struct mallinfo mALLINFo(void) { malloc_update_mallinfo(); return current_mallinfo;

Hi Tom,
On Mon, 27 Feb 2023 at 15:08, Tom Rini trini@konsulko.com wrote:
With clang-15 we now will get warnings such as:
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
And it is easy enough to address this warning here, as we aren't concerned with re-syncing with an upstream.
Signed-off-by: Tom Rini trini@konsulko.com
common/dlmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 41c7230424cc..0f9b7262d512 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -80,7 +80,7 @@ GmListElement* makeGmListElement (void* bas) return this; }
-void gcleanup () +void gcleanup (void)
drop space before ( ?
{ BOOL rval; assert ( (head == NULL) || (head->base == (void*)gAddressBase)); @@ -2340,7 +2340,7 @@ size_t malloc_usable_size(mem) Void_t* mem; /* Utility to update current_mallinfo for malloc_stats and mallinfo() */
#ifdef DEBUG -static void malloc_update_mallinfo() +static void malloc_update_mallinfo(void) { int i; mbinptr b; @@ -2397,7 +2397,7 @@ static void malloc_update_mallinfo() */
#ifdef DEBUG -void malloc_stats() +void malloc_stats(void) { malloc_update_mallinfo(); printf("max system bytes = %10u\n", @@ -2418,7 +2418,7 @@ void malloc_stats() */
#ifdef DEBUG -struct mallinfo mALLINFo() +struct mallinfo mALLINFo(void) { malloc_update_mallinfo(); return current_mallinfo; -- 2.34.1
Regards, Simon

On Mon, Feb 27, 2023 at 05:35:30PM -0700, Simon Glass wrote:
Hi Tom,
On Mon, 27 Feb 2023 at 15:08, Tom Rini trini@konsulko.com wrote:
With clang-15 we now will get warnings such as:
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
And it is easy enough to address this warning here, as we aren't concerned with re-syncing with an upstream.
Signed-off-by: Tom Rini trini@konsulko.com
common/dlmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 41c7230424cc..0f9b7262d512 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -80,7 +80,7 @@ GmListElement* makeGmListElement (void* bas) return this; }
-void gcleanup () +void gcleanup (void)
drop space before ( ?
The file is so badly out of sync with our coding style I literally just went and did %s/()$/(void)/ to move on to the next sets of problems. So I'd rather not fix one more style issue here when I suspect there's a barely exaggerated thousand more.

On Mon, Feb 27, 2023 at 05:08:34PM -0500, Tom Rini wrote:
With clang-15 we now will get warnings such as:
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
And it is easy enough to address this warning here, as we aren't concerned with re-syncing with an upstream.
Signed-off-by: Tom Rini trini@konsulko.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

With clang-15 we now will get warnings such as:
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
And it is easy enough to address this warning here, as we aren't concerned with re-syncing with an upstream.
Signed-off-by: Tom Rini trini@konsulko.com --- Cc: Igor Opaniuk igor.opaniuk@gmail.com --- lib/libavb/avb_cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/libavb/avb_cmdline.c b/lib/libavb/avb_cmdline.c index cb54e658c487..a58ce6c48c01 100644 --- a/lib/libavb/avb_cmdline.c +++ b/lib/libavb/avb_cmdline.c @@ -394,7 +394,7 @@ out: return ret; }
-AvbCmdlineSubstList* avb_new_cmdline_subst_list() { +AvbCmdlineSubstList* avb_new_cmdline_subst_list(void) { return (AvbCmdlineSubstList*)avb_calloc(sizeof(AvbCmdlineSubstList)); }

On Mon, 27 Feb 2023 at 15:09, Tom Rini trini@konsulko.com wrote:
With clang-15 we now will get warnings such as:
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
And it is easy enough to address this warning here, as we aren't concerned with re-syncing with an upstream.
Signed-off-by: Tom Rini trini@konsulko.com
Cc: Igor Opaniuk igor.opaniuk@gmail.com
lib/libavb/avb_cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Feb 27, 2023 at 05:08:35PM -0500, Tom Rini wrote:
With clang-15 we now will get warnings such as:
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
And it is easy enough to address this warning here, as we aren't concerned with re-syncing with an upstream.
Signed-off-by: Tom Rini trini@konsulko.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

With clang-15 we now will get warnings such as:
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
And it is easy enough to address this warning here, even if we would like to stay in sync more with upstream as it's a single location.
Signed-off-by: Tom Rini trini@konsulko.com --- lib/zlib/trees.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/zlib/trees.c b/lib/zlib/trees.c index 970bc5dbc64e..e040617686a1 100644 --- a/lib/zlib/trees.c +++ b/lib/zlib/trees.c @@ -237,7 +237,7 @@ local void send_bits(s, value, length) /* =========================================================================== * Initialize the various 'constant' tables. */ -local void tr_static_init() +local void tr_static_init(void) { #if defined(GEN_TREES_H) || !defined(STDC) static int static_init_done = 0;

On Mon, 27 Feb 2023 at 15:09, Tom Rini trini@konsulko.com wrote:
With clang-15 we now will get warnings such as:
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
And it is easy enough to address this warning here, even if we would like to stay in sync more with upstream as it's a single location.
Signed-off-by: Tom Rini trini@konsulko.com
lib/zlib/trees.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Feb 27, 2023 at 05:08:36PM -0500, Tom Rini wrote:
With clang-15 we now will get warnings such as:
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
And it is easy enough to address this warning here, even if we would like to stay in sync more with upstream as it's a single location.
Signed-off-by: Tom Rini trini@konsulko.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

With clang-15, it is now reported that cont_img_count is unused. This is true as the code will increment / reset this counter, but never functionally use it. Remove it.
Signed-off-by: Tom Rini trini@konsulko.com --- Cc: Peng Fan peng.fan@nxp.com Cc: Mikhail Ilin ilin.mikhail.ol@gmail.com Cc: Stefano Babic sbabic@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: "NXP i.MX U-Boot Team" uboot-imx@nxp.com --- tools/imx8image.c | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/tools/imx8image.c b/tools/imx8image.c index 395d5c64bdf0..c25ea84e25c5 100644 --- a/tools/imx8image.c +++ b/tools/imx8image.c @@ -829,7 +829,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, int ret;
int container = -1; - int cont_img_count = 0; /* indexes to arrange the container */
memset((char *)&imx_header, 0, sizeof(imx_header_v3_t));
@@ -879,7 +878,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, img_sp->src = file_off;
file_off += ALIGN(sbuf.st_size, sector_size); - cont_img_count++; break;
case SECO: @@ -899,7 +897,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, img_sp->src = file_off;
file_off += sbuf.st_size; - cont_img_count++; break;
case NEW_CONTAINER: @@ -908,8 +905,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, CONTAINER_ALIGNMENT, CONTAINER_FLAGS_DEFAULT, fuse_version); - /* reset img count when moving to new container */ - cont_img_count = 0; scfw_flags = 0; break;

On Mon, 27 Feb 2023 at 15:09, Tom Rini trini@konsulko.com wrote:
With clang-15, it is now reported that cont_img_count is unused. This is true as the code will increment / reset this counter, but never functionally use it. Remove it.
Signed-off-by: Tom Rini trini@konsulko.com
Cc: Peng Fan peng.fan@nxp.com Cc: Mikhail Ilin ilin.mikhail.ol@gmail.com Cc: Stefano Babic sbabic@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: "NXP i.MX U-Boot Team" uboot-imx@nxp.com
tools/imx8image.c | 5 ----- 1 file changed, 5 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Feb 27, 2023 at 7:08 PM Tom Rini trini@konsulko.com wrote:
With clang-15, it is now reported that cont_img_count is unused. This is true as the code will increment / reset this counter, but never functionally use it. Remove it.
Signed-off-by: Tom Rini trini@konsulko.com
Reviewed-by: Fabio Estevam festevam@denx.de

On 2/28/2023 6:08 AM, Tom Rini wrote:
With clang-15, it is now reported that cont_img_count is unused. This is true as the code will increment / reset this counter, but never functionally use it. Remove it.
Signed-off-by: Tom Rini trini@konsulko.com
Reviewed-by: Peng Fan peng.fan@nxp.com
Cc: Peng Fan peng.fan@nxp.com Cc: Mikhail Ilin ilin.mikhail.ol@gmail.com Cc: Stefano Babic sbabic@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: "NXP i.MX U-Boot Team" uboot-imx@nxp.com
tools/imx8image.c | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/tools/imx8image.c b/tools/imx8image.c index 395d5c64bdf0..c25ea84e25c5 100644 --- a/tools/imx8image.c +++ b/tools/imx8image.c @@ -829,7 +829,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, int ret;
int container = -1;
int cont_img_count = 0; /* indexes to arrange the container */
memset((char *)&imx_header, 0, sizeof(imx_header_v3_t));
@@ -879,7 +878,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, img_sp->src = file_off;
file_off += ALIGN(sbuf.st_size, sector_size);
cont_img_count++; break;
case SECO:
@@ -899,7 +897,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, img_sp->src = file_off;
file_off += sbuf.st_size;
cont_img_count++; break;
case NEW_CONTAINER:
@@ -908,8 +905,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, CONTAINER_ALIGNMENT, CONTAINER_FLAGS_DEFAULT, fuse_version);
/* reset img count when moving to new container */
cont_img_count = 0; scfw_flags = 0; break;

On Mon, Feb 27, 2023 at 05:08:37PM -0500, Tom Rini wrote:
With clang-15, it is now reported that cont_img_count is unused. This is true as the code will increment / reset this counter, but never functionally use it. Remove it.
Signed-off-by: Tom Rini trini@konsulko.com Reviewed-by: Simon Glass sjg@chromium.org Reviewed-by: Fabio Estevam festevam@denx.de Reviewed-by: Peng Fan peng.fan@nxp.com
Applied to u-boot/next, thanks!

With clang-15 we now get reported that in the make_flame_tree function, neither the missing_count nor depth variables are used, only incremenete/decremented. Remove these.
Signed-off-by: Tom Rini trini@konsulko.com --- Cc: Simon Glass sjg@chromium.org --- tools/proftool.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/tools/proftool.c b/tools/proftool.c index 089360428c2c..101bcb63334e 100644 --- a/tools/proftool.c +++ b/tools/proftool.c @@ -1713,18 +1713,11 @@ static int make_flame_tree(enum out_format_t out_format, struct flame_state state; struct flame_node *tree; struct trace_call *call; - int missing_count = 0; - int i, depth; + int i;
/* maintain a stack of start times, etc. for 'calling' functions */ state.stack_ptr = 0;
- /* - * The first thing in the trace may not be the top-level function, so - * set the initial depth so that no function goes below depth 0 - */ - depth = -calc_min_depth(); - tree = create_node("tree"); if (!tree) return -1; @@ -1736,16 +1729,10 @@ static int make_flame_tree(enum out_format_t out_format, ulong timestamp = call->flags & FUNCF_TIMESTAMP_MASK; struct func_info *func;
- if (entry) - depth++; - else - depth--; - func = find_func_by_offset(call->func); if (!func) { warn("Cannot find function at %lx\n", text_offset + call->func); - missing_count++; continue; }

On Mon, 27 Feb 2023 at 15:08, Tom Rini trini@konsulko.com wrote:
With clang-15 we now get reported that in the make_flame_tree function, neither the missing_count nor depth variables are used, only incremenete/decremented. Remove these.
Signed-off-by: Tom Rini trini@konsulko.com
Cc: Simon Glass sjg@chromium.org
tools/proftool.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Yes I removed the debugging but wasn't 100% sure it wasn't needed, then forgot about it :-)

On Mon, Feb 27, 2023 at 05:08:38PM -0500, Tom Rini wrote:
With clang-15 we now get reported that in the make_flame_tree function, neither the missing_count nor depth variables are used, only incremenete/decremented. Remove these.
Signed-off-by: Tom Rini trini@konsulko.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

As this is now the stable release, move to using that now for our tests.
Signed-off-by: Tom Rini trini@konsulko.com --- .azure-pipelines.yml | 6 +++--- .gitlab-ci.yml | 4 ++-- tools/docker/Dockerfile | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 30025ff7517e..59629b39265c 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -2,7 +2,7 @@ variables: windows_vm: windows-2019 ubuntu_vm: ubuntu-22.04 macos_vm: macOS-12 - ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20230126-17Feb2023 + ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20230126-27Feb2023 # Add '-u 0' options for Azure pipelines, otherwise we get "permission # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer", # since our $(ci_runner_image) user is not root. @@ -244,7 +244,7 @@ stages: TEST_PY_BD: "sandbox" sandbox_clang: TEST_PY_BD: "sandbox" - OVERRIDE: "-O clang-14" + OVERRIDE: "-O clang-15" sandbox_nolto: TEST_PY_BD: "sandbox" BUILD_ENV: "NO_LTO=1" @@ -498,7 +498,7 @@ stages: OVERRIDE: "-a ASAN" sandbox_clang_asan: BUILDMAN: "sandbox" - OVERRIDE: "-O clang-14 -a ASAN" + OVERRIDE: "-O clang-15 -a ASAN" samsung_socfpga: BUILDMAN: "samsung socfpga" sun4i: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e320a24ef31e..068f39eb1114 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@
# Grab our configured image. The source for this is found # in the u-boot tree at tools/docker/Dockerfile -image: trini/u-boot-gitlab-ci-runner:jammy-20230126-17Feb2023 +image: trini/u-boot-gitlab-ci-runner:jammy-20230126-27Feb2023
# We run some tests in different order, to catch some failures quicker. stages: @@ -260,7 +260,7 @@ sandbox test.py: sandbox with clang test.py: variables: TEST_PY_BD: "sandbox" - OVERRIDE: "-O clang-14" + OVERRIDE: "-O clang-15" <<: *buildman_and_testpy_dfn
sandbox without LTO test.py: diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index c367bb482b4d..99da8cd38cae 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -12,7 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive # Add LLVM repository RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/* RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main | tee /etc/apt/sources.list.d/llvm.list +RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main | tee /etc/apt/sources.list.d/llvm.list
# Manually install the kernel.org "Crosstool" based toolchains for gcc-12.2.0 RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/... | tar -C /opt -xJ @@ -39,7 +39,7 @@ RUN apt-get update && apt-get install -y \ binutils-dev \ bison \ build-essential \ - clang-14 \ + clang-15 \ coreutils \ cpio \ cppcheck \

On Mon, 27 Feb 2023 at 15:10, Tom Rini trini@konsulko.com wrote:
As this is now the stable release, move to using that now for our tests.
Signed-off-by: Tom Rini trini@konsulko.com
.azure-pipelines.yml | 6 +++--- .gitlab-ci.yml | 4 ++-- tools/docker/Dockerfile | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, 27 Feb 2023 at 15:09, Tom Rini trini@konsulko.com wrote:
We have a number of places in the code which use the following syntax:
void func(a, b, c) int a; /* Does a */ something_t *b; /* Pointer to b */ int c; /* Does c */ { ... }
Which while not what we document as our coding style, this is also code which we have imported from other projects, and would like to re-sync with in the future. While the biggest example of this is the zlib code, there are other places as well. For now, we will silence this warning.
Signed-off-by: Tom Rini trini@konsulko.com
Makefile | 1 + 1 file changed, 1 insertion(+)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Feb 27, 2023 at 05:08:33PM -0500, Tom Rini wrote:
We have a number of places in the code which use the following syntax:
void func(a, b, c) int a; /* Does a */ something_t *b; /* Pointer to b */ int c; /* Does c */ { ... }
Which while not what we document as our coding style, this is also code which we have imported from other projects, and would like to re-sync with in the future. While the biggest example of this is the zlib code, there are other places as well. For now, we will silence this warning.
Signed-off-by: Tom Rini trini@konsulko.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!
participants (4)
-
Fabio Estevam
-
Peng Fan
-
Simon Glass
-
Tom Rini