[PATCH 1/5] commands: nv: fail with verbose message if invoked without args
Stefan Lengfeld
contact at stefanchrist.eu
Wed Nov 1 12:43:51 PDT 2017
Hi Enrico,
On Tue, Oct 31, 2017 at 10:47:43PM +0100, Enrico Jörns wrote:
> Hi Lengfeld,
>
> Am 31.10.2017 um 18:51 schrieb Stefan Lengfeld:
> > Hi Jorns,
> >
> > On Mon, Oct 30, 2017 at 11:34:17AM +0100, Enrico Jorns wrote:
> >> Signed-off-by: Enrico Jorns <ejo at pengutronix.de>
> >> ---
> >> commands/nv.c | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >> diff --git a/commands/nv.c b/commands/nv.c
> >> index 37cdb96647..1c5514dd32 100644
> >> --- a/commands/nv.c
> >> +++ b/commands/nv.c
> >> @@ -56,6 +56,7 @@ static int do_nv(int argc, char *argv[])
> >> argv += optind;
> >>
> >> if (argc < 1)
> >> + printf("Invalid usage: Missing argument");
> >> return COMMAND_ERROR_USAGE;
> >
> > Missing curly brackets for if clause. Indentation does not matter in C
> > as it does in for example python. Now the function returns always
> > 'COMMAND_ERROR_USAGE'.
>
> ouh, you are right, must have lost them while merging the patches too
> quickly.
> But I tried my best to hide it, didn't I?
<joke>
Yeah. Maybe we should start a working group: How to hide non-obvious
functionality in obvious looking patches and invite the 'goto fail;'
guys from apple.
</joke>
Recents version of gcc (>=6) have a compiler warning
'-Wmisleading-indentation' to catch theses errors. [1]
Kind regards
Stefan
[1] https://www.phoronix.com/scan.php?page=news_item&px=GCC6-Misleading-Indentation
More information about the barebox
mailing list