[PATCH v3 1/4] debug_uart: Replace debug functions with dummies if CONFIG_DEBUG_UART is not set

Quentin Schulz quentin.schulz at cherry.de
Mon Sep 30 10:55:17 CEST 2024


Hi Kever,

On 9/29/24 3:53 AM, Kever Yang wrote:
> Hi Lukasz,
> 
>      I think this will make the error happen like this:
> 
> +common/console.c: In function 'puts':
> +common/console.c:746:29: error: unused variable 'ch' [-Werror=unused- 
> variable]
> +  746 |                         int ch = *s++;
> +      |                             ^~
> +cc1: all warnings being treated as errors
> +make[2]: *** [scripts/Makefile.build:257: common/console.o] Error 1
> 
> 
> The main reason is that below patch removes "#ifdef":
> 
> c04f856822a console: remove #ifdef CONFIG when it is possible
> 

Can you please always share the link to the pipelines that fail so 
people have an idea on how to reproduce it locally?

Here I assume it is: 
https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/pipelines/22455

A simple way is to apply the patches, build the pine64-lts for example 
and then you'll see warnings (which aren't failing builds locally I 
believe but in CI, yes).

I think we can fool the compiler with the following:

diff --git a/include/debug_uart.h b/include/debug_uart.h
index dc0f1aa4c98..b19e44d6d0f 100644
--- a/include/debug_uart.h
+++ b/include/debug_uart.h
@@ -204,12 +204,12 @@ void printdec(unsigned int value);
  #define DEBUG_UART_FUNCS \
  	#warning "DEBUG_UART not defined!"

-#define printch(ch) do{}while(0);
-#define printascii(str) do{}while(0);
-#define printhex2(value) do{}while(0);
-#define printhex4(value) do{}while(0);
-#define printhex8(value) do{}while(0);
-#define printdec(value) do{}while(0);
+#define printch(ch) do{ (void)(ch); }while(0);
+#define printascii(str) do{ (void)(str); }while(0);
+#define printhex2(value) do{ (void)(value); }while(0);
+#define printhex4(value) do{ (void)(value); }while(0);
+#define printhex8(value) do{ (void)(value); }while(0);
+#define printdec(value) do{ (void)(value); }while(0);

  #endif

Does this make sense?

Cheers,
Quentin


More information about the U-Boot mailing list