[PATCH master 1/3] envfs: fix defaultenv_append_directory macro definition

Sascha Hauer sha at pengutronix.de
Thu Aug 17 23:00:58 PDT 2023


On Thu, Aug 17, 2023 at 09:39:39AM +0200, Ahmad Fatoum wrote:
> defaultenv_append_directory is called as if it were a function and the
> trailing semicolon can break parse of if-else statements. Wrap in do { }
> while (0) to avoid this.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  include/envfs.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/include/envfs.h b/include/envfs.h
> index d4e2c6110e65..abe0ffb96397 100644
> --- a/include/envfs.h
> +++ b/include/envfs.h
> @@ -139,13 +139,13 @@ static inline int defaultenv_load(const char *dir, unsigned flags)
>   * from the filename.
>   */
>  #define defaultenv_append_directory(name)			\
> -	{							\
> +	do {							\
>  		extern char __bbenv_##name##_start[];		\
>  		extern char __bbenv_##name##_end[];		\
>  		defaultenv_append(__bbenv_##name##_start,	\
>  				__bbenv_##name##_end -		\
>  				__bbenv_##name##_start,		\
>  				__stringify(name));		\
> -	}
> +	} while (0)
>  
>  #endif /* _ENVFS_H */
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list