On 23/03/2020 18.16, Philippe REYNES wrote: >>> +#ifdef CONFIG_CMD_UBI_RENAME >> >> Can you use IS_ENABLED(CONFIG_...) and drop the #ifdef way above? > > I've sent a v3 where I use IS_ENABLED instead of #ifdef. > But I've kept a #if IS_ENABLED(...) around the function ubi_rename_vol. > Otherwise if this option is not enabled, there is a warning when building : > > CC cmd/ubi.o > cmd/ubi.c:254:12: warning: 'ubi_rename_vol' defined but not used > [-Wunused-function] > static int ubi_rename_vol(char *oldname, char *newname) > ^~~~~~~~~~~~~~
Use C if (IS_ENABLED(CONFIG_...) && !strcmp(cmd, "rename")) not cpp #if IS_ENABLED(CONFIG_...) if (!strcmp(cmd, "rename")) That way the compiler sees ubi_rename_vol is used, but also knows that it is dead code that can be eliminated. Less ifdeffery (none, actually), and the code in ubi_rename_vol gets compile coverage regardless of configuration. Rasmus