[PATCH] exception: Add missing string.h

Michal Simek michal.simek at amd.com
Fri Jul 25 15:29:27 CEST 2025



On 7/25/25 14:46, Heinrich Schuchardt wrote:
> On 25.07.25 14:41, Michal Simek wrote:
>> The commit 1e50f7457fca ("include/command.h: Drop <env.h>") removed env.h
>> which also included string.h which generate compilation error.
>> But because none is enabling CMD_EXCEPTION it by default it hasn't been
>> spot.
>>
>> Signed-off-by: Michal Simek <michal.simek at amd.com>
>> ---
>>
>>    CC      drivers/mtd/mtd-uclass.o
>> In file included from cmd/riscv/exception.c:91:
>> include/exception.h: In function 'exception_complete':
>> include/exception.h:41:23: error: implicit declaration of function 'strlen' [- 
>> Wimplicit-function-declaration]
>>     41 |                 len = strlen(argv[1]);
>>        |                       ^~~~~~
>> include/exception.h:1:1: note: 'strlen' is defined in header '<string.h>'; 
>> this is probably fixable by adding '#include <string.h>'
>>    +++ |+#include <string.h>
>>      1 | /* SPDX-License-Identifier: GPL-2.0+ */
>> include/exception.h:49:22: error: implicit declaration of function 
>> 'strncmp' [-Wimplicit-function-declaration]
>>     49 |                 if (!strncmp(argv[1], cmdtp->name, len))
>>        |                      ^~~~~~~
>> include/exception.h:49:22: note: 'strncmp' is defined in header '<string.h>'; 
>> this is probably fixable by adding '#include <string.h>'
>> make[2]: *** [scripts/Makefile.build:297: cmd/riscv/exception.o] Error 1
>> make[2]: *** Waiting for unfinished jobs....
>>    CC      drivers/serial/serial-uclass.o
>>
>> ---
>>   include/exception.h | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/include/exception.h b/include/exception.h
>> index a7f21e73d753..0d4dff49954b 100644
>> --- a/include/exception.h
>> +++ b/include/exception.h
>> @@ -6,6 +6,7 @@
>>    */
>>   #include <command.h>
>> +#include <string.h>
>>   static int do_exception(struct cmd_tbl *cmdtp, int flag, int argc,
>>               char *const argv[])
> 
> This patch just looks like
> https://patchwork.ozlabs.org/project/uboot/patch/20250702205818.44188-1- 
> heinrich.schuchardt at canonical.com/
> and
> https://patchwork.ozlabs.org/project/uboot/patch/20250703051951.43372-2- 
> heinrich.schuchardt at canonical.com/
> which were positively reviewed.
> 
> Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

yes it is the same.

Tom: Please drop this one and take origin one

Thanks,
Michal



More information about the U-Boot mailing list