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


Thanks,

- Kever

On 2024/9/18 21:01, Lukasz Czechowski wrote:
In case DEBUG UART is not used, define dummy macros replacing
the actual function implementations that will not be available.
This allows to compile code and avoid linker errors.
Because the DEBUG_UART_FUNCS macro should not be used if
DEBUG UART is not available, redefine it to generate compilation
warning.

Signed-off-by: Lukasz Czechowski <[email protected]>

Reviewed-by: Simon Glass <[email protected]>
Reviewed-by: Kever Yang <[email protected]>
---
  include/debug_uart.h | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)

diff --git a/include/debug_uart.h b/include/debug_uart.h
index 714b369e6fe..dc0f1aa4c98 100644
--- a/include/debug_uart.h
+++ b/include/debug_uart.h
@@ -128,6 +128,8 @@ void printdec(unsigned int value);
                        (1 << CONFIG_DEBUG_UART_SHIFT), \
                CONFIG_DEBUG_UART_SHIFT)
+#ifdef CONFIG_DEBUG_UART
+
  /*
   * Now define some functions - this should be inserted into the serial driver
   */
@@ -197,4 +199,18 @@ void printdec(unsigned int value);
                _DEBUG_UART_ANNOUNCE \
        } \
+#else
+
+#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);
+
+#endif
+
  #endif

Reply via email to