global: Disable deprecated-non-prototype warning with clang
Subsystems (2)
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.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -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.
Signature · 1 line
2.34.1
PATCH 2/7 dlmalloc: Fix a warning with clang-15
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.
--- common/dlmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
common/dlmalloc.c +4 -4
@@ -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;
Signature · 1 line
2.34.1
Re: [PATCH 2/7] dlmalloc: Fix a warning with clang-15
Hi Tom,
Quoted 6 lines · Tom Rini
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]
Quoted 7 lines
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 <[email protected]>--- common/dlmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
common/dlmalloc.c GmListElement* makeGmListElement (void* bas) · line 83
Quoted 11 lines
common/dlmalloc.c +1
-1@@ -80,7 +80,7 @@ GmListElement* makeGmListElement (void* bas)return this; } -void gcleanup () +void gcleanup (void )
drop space before ( ?
Quoted 31 lines
common/dlmalloc.c +3
-4{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; --
Quoted 2 lines
2.34.1
Regards,
Simon
Re: [PATCH 2/7] dlmalloc: Fix a warning with clang-15
Quoted 28 lines · Simon Glass
Hi Tom,
Quoted 6 lines · Tom Rini
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]
Quoted 7 lines
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 <[email protected]>--- common/dlmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)Reviewed-by Simon Glass <[email protected]>Quoted 9 lines
common/dlmalloc.c +0
-0@@ -80,7 +80,7 @@ GmListElement* makeGmListElement (void* bas)return this; }
Quoted 4 lines
common/dlmalloc.c GmListElement* makeGmListElement (void* bas) · line 83
Quoted 2 lines
common/dlmalloc.c +1
-1-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.
Signature · 1 line
Tom
Re: [PATCH 2/7] dlmalloc: Fix a warning with clang-15
In reply to Tom RiniQuoted 10 lines · Tom Rini
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 <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH 3/7 libavb: Fix a warning with clang-15
In reply to Tom RiniWith 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.
---
Cc: Igor Opaniuk <[email protected]>
--- lib/libavb/avb_cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/libavb/avb_cmdline.c +1 -1
@@ -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)); }
Signature · 1 line
2.34.1
Re: [PATCH 3/7] libavb: Fix a warning with clang-15
Quoted 9 lines · Tom Rini
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.
Quoted 6 lines
Signed-off-by Tom Rini <[email protected]>---
Cc: Igor Opaniuk <[email protected]>--- lib/libavb/avb_cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH 3/7] libavb: Fix a warning with clang-15
In reply to Tom RiniQuoted 10 lines · Tom Rini
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 <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH 4/7 zlib: trees.c: Fix a warning with clang-15
In reply to Tom RiniWith 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.
--- lib/zlib/trees.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/zlib/trees.c +1 -1
@@ -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 ;
Signature · 1 line
2.34.1
Re: [PATCH 4/7] zlib: trees.c: Fix a warning with clang-15
Quoted 6 lines · Tom Rini
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]
Quoted 7 lines
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 <[email protected]>--- lib/zlib/trees.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH 4/7] zlib: trees.c: Fix a warning with clang-15
In reply to Tom RiniQuoted 10 lines · Tom Rini
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 <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH 5/7 imx8image: Remove unused cont_img_count variable
In reply to Tom RiniWith 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.
---
Cc: Peng Fan <[email protected]>
Cc: Mikhail Ilin <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
--- tools/imx8image.c | 5 ----- 1 file changed, 5 deletions(-)
tools/imx8image.c +0 -5
@@ -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 ;
Signature · 1 line
2.34.1
Re: [PATCH 5/7] imx8image: Remove unused cont_img_count variable
Quoted 12 lines · Tom Rini
With clang-15, it is now reported that
cont_img_countis unused. This is true as the code will increment / reset this counter, but never functionally use it. Remove it.Signed-off-by Tom Rini <[email protected]>---
Cc: Peng Fan <[email protected]>
Cc: Mikhail Ilin <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Quoted 4 lines
--- tools/imx8image.c | 5 ----- 1 file changed, 5 deletions(-)
Re: [PATCH 5/7] imx8image: Remove unused cont_img_count variable
In reply to Tom RiniQuoted 6 lines · Tom Rini
With clang-15, it is now reported that
cont_img_countis unused. This is true as the code will increment / reset this counter, but never functionally use it. Remove it.Signed-off-by Tom Rini <[email protected]>
Re: [PATCH 5/7] imx8image: Remove unused cont_img_count variable
In reply to Tom RiniQuoted 5 lines · Tom Rini
With clang-15, it is now reported that
cont_img_countis unused. This is true as the code will increment / reset this counter, but never functionally use it. Remove it.Signed-off-by Tom Rini <[email protected]>
Quoted 47 lines
---
Cc: Peng Fan <[email protected]>
Cc: Mikhail Ilin <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>--- tools/imx8image.c | 5 ----- 1 file changed, 5 deletions(-)tools/imx8image.c +0
-5@@ -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 ;
Re: [PATCH 5/7] imx8image: Remove unused cont_img_count variable
In reply to Tom RiniQuoted 8 lines · Tom Rini
With clang-15, it is now reported that
cont_img_countis unused. This is true as the code will increment / reset this counter, but never functionally use it. Remove it.Signed-off-by Tom Rini <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Fabio Estevam <[email protected]>Reviewed-by Peng Fan <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH 6/7 proftool: Remove unused variables in make_flame_tree
In reply to Tom RiniWith 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.
---
Cc: Simon Glass <[email protected]>
--- tools/proftool.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
tools/proftool.c +1 -14
@@ -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 ; }
Signature · 1 line
2.34.1
Re: [PATCH 6/7] proftool: Remove unused variables in make_flame_tree
Quoted 11 lines · Tom Rini
With clang-15 we now get reported that in the
make_flame_treefunction, neither themissing_countnor depth variables are used, only incremenete/decremented. Remove these.Signed-off-by Tom Rini <[email protected]>---
Cc: Simon Glass <[email protected]>--- tools/proftool.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
Yes I removed the debugging but wasn't 100% sure it wasn't needed, then forgot about it :-)
Re: [PATCH 6/7] proftool: Remove unused variables in make_flame_tree
In reply to Tom RiniQuoted 6 lines · Tom Rini
With clang-15 we now get reported that in the
make_flame_treefunction, neither themissing_countnor depth variables are used, only incremenete/decremented. Remove these.Signed-off-by Tom Rini <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH 7/7 CI: Move to clang-15
In reply to Tom RiniAs this is now the stable release, move to using that now for our tests.
--- .azure-pipelines.yml | 6 +++--- .gitlab-ci.yml | 4 ++-- tools/docker/Dockerfile | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
.azure-pipelines.yml +3 -3
@@ -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:
.gitlab-ci.yml +2 -2
@@ -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:
tools/docker/Dockerfile +2 -2
@@ -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/x86_64-gcc-12.2.0-nolibc-aarch64-linux.tar.xz | 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 \
Signature · 1 line
2.34.1
Re: [PATCH 7/7] CI: Move to clang-15
Quoted 10 lines · Tom Rini
As this is now the stable release, move to using that now for our tests.
Signed-off-by Tom Rini <[email protected]>--- .azure-pipelines.yml | 6 +++--- .gitlab-ci.yml | 4 ++-- tools/docker/Dockerfile | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
Quoted 16 lines · Tom Rini
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.
Quoted 4 lines
Signed-off-by Tom Rini <[email protected]>--- Makefile | 1 + 1 file changed, 1 insertion(+)
Quoted 10 lines · Tom Rini
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 */{
...
}
Quoted 7 lines
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 <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom