From: Philippe REYNES <philippe.reynes@softathome.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2] cmd: ubi: add a command to rename volume
Date: Mon, 23 Mar 2020 19:24:53 +0100 (CET) [thread overview]
Message-ID: <1390190722.1402355.1584987893066.JavaMail.zimbra@softathome.com> (raw)
In-Reply-To: <748d5984-11bb-df79-0285-57d7b4f9321d@prevas.dk>
Hi Rasmus,
> 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.
Thanks a lot for this explanation.
I have sent a v4. And it works as expected, without the #if ... before
the function ubi_rename_vol, there isn't a warning if ubi rename is not
enabled in the config.
> Rasmus
Regards,
Philippe
prev parent reply other threads:[~2020-03-23 18:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 9:55 [PATCH v2] cmd: ubi: add a command to rename volume Philippe Reynes
2020-03-23 15:37 ` Simon Glass
2020-03-23 17:16 ` Philippe REYNES
2020-03-23 17:47 ` Rasmus Villemoes
2020-03-23 18:24 ` Philippe REYNES [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1390190722.1402355.1584987893066.JavaMail.zimbra@softathome.com \
--to=philippe.reynes@softathome.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox