From 1b94864a87f0017d0c709225e556efec161bd1e8 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 28 Dec 2023 11:45:30 +0100 Subject: [PATCH] drivers epprom_simulator: Set standard source macro appropriately This file uses several functions which are extensions to the the std C library. Let's explicity select one of the extensions which includes it instead of relaying on somebody having set it for this file somewhere else. Signed-off-by: Alberto Escolar Piedras --- drivers/eeprom/eeprom_simulator.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/eeprom/eeprom_simulator.c b/drivers/eeprom/eeprom_simulator.c index 2e8d0ca665..19efa5b3d9 100644 --- a/drivers/eeprom/eeprom_simulator.c +++ b/drivers/eeprom/eeprom_simulator.c @@ -7,6 +7,20 @@ #define DT_DRV_COMPAT zephyr_sim_eeprom +#ifdef CONFIG_ARCH_POSIX +#undef _POSIX_C_SOURCE +/* Note: This is used only for interaction with the host C library, and is therefore exempt of + * coding guidelines rule A.4&5 which applies to the embedded code using embedded libraries + */ +#define _POSIX_C_SOURCE 200809L +#include +#include +#include +#include +#include "cmdline.h" +#include "soc.h" +#endif + #include #include @@ -17,15 +31,6 @@ #include #include -#ifdef CONFIG_ARCH_POSIX -#include -#include -#include -#include -#include "cmdline.h" -#include "soc.h" -#endif - #define LOG_LEVEL CONFIG_EEPROM_LOG_LEVEL #include LOG_MODULE_REGISTER(eeprom_simulator);