From 2ebdd72487a96879b3f8689e0b35ae5f7a49973a Mon Sep 17 00:00:00 2001 From: Tiago Medicci Serrano Date: Wed, 29 Jan 2025 18:13:02 -0300 Subject: [PATCH] include/stdlib.h: define system()'s prototype for the flat build The `$(APPDIR)` folder is added to the `$(KERNDEPDIRS)` when `CONFIG_BUILD_KERNEL=y`. The `depend` phase iterates over the `$(KERNDEPDIRS)` folders and executes the `depend` recipe of these folders (including the apps' recipes) with the `__KERNEL__` macro defined, which prevents `system()`'s prototype from being declared. --- include/stdlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/stdlib.h b/include/stdlib.h index b5a5b30285..f3ede5d9c6 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -183,7 +183,7 @@ void _Exit(int status) noreturn_function; * standards compatibility. */ -#ifndef __KERNEL__ +#if !defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT) int system(FAR const char *cmd); #endif