[U-Boot] [RFC 0/2 v2] Remove CONFIG_SYS_MAXARGS
Wolfgang Denk
wd at denx.de
Fri Apr 9 23:04:07 CEST 2010
Dear John Schmoller,
In message <cover.1268416692.git.jschmoller at xes-inc.com> you wrote:
> The first patch removes CONFIG_SYS_MAXARGS, replacing the staticly defined
> array with a malloc'd array of the appropriate size. When a function has no
> upper argument limit (ie, was set to CONFIG_SYS_MAXARGS), it is now set to 0
> to indicate this fact. Argument count is now unlimited, within reason and
> malloc buffer size.
>
> The second patch removes cmdtp->maxargs and moves the checks to the individual
> command functions. Since most functions do bounds checking anyway, it's a
> a fairly cheap task (sometimes free) to remove this bounds check in
> common/main.c. In addition, it's more intuitive (in my opinion) if all bounds
> checking is done in only one place for each function. The second patch also
> creates a CMD_ERR_USAGE return value, which prints usage when returned. The
> overall effect of this patch is to reduce code size by an average of 200-250
> bytes and, I feel, make things a bit cleaner.
>
> I'm looking for comments on these two patches as they are quite invasive, and
> will definitly cause problems for those people who maintain their own code
> out-of-tree. They may also require an additional amount of testing.
Did you actually run MAKEALL after applying the patches?
I tried to get a feeling for the impact on the memory footprint, but
it doesn't work for me. I get tons of error messages like these:
...
cmd_bdinfo.c:389:1: error: macro "U_BOOT_CMD" passed 6 arguments, but takes just 5
cmd_bdinfo.c:385: warning: data definition has no type or storage class
cmd_bdinfo.c:385: warning: type defaults to 'int' in declaration of 'U_BOOT_CMD'
...
cmd_bootm.c:466:65: error: macro "U_BOOT_CMD_MKENT" passed 6 arguments, but takes just 5
cmd_bootm.c:466: error: 'U_BOOT_CMD_MKENT' undeclared here (not in a function)
cmd_bootm.c:467:67: error: macro "U_BOOT_CMD_MKENT" passed 6 arguments, but takes just 5
cmd_bootm.c:469:69: error: macro "U_BOOT_CMD_MKENT" passed 6 arguments, but takes just 5
cmd_bootm.c:474:72: error: macro "U_BOOT_CMD_MKENT" passed 6 arguments, but takes just 5
cmd_bootm.c:475:65: error: macro "U_BOOT_CMD_MKENT" passed 6 arguments, but takes just 5
cmd_bootm.c:476:66: error: macro "U_BOOT_CMD_MKENT" passed 6 arguments, but takes just 5
cmd_bootm.c:477:62: error: macro "U_BOOT_CMD_MKENT" passed 6 arguments, but takes just 5
cmd_bootm.c:1022:1: error: macro "U_BOOT_CMD" passed 6 arguments, but takes just 5
cmd_bootm.c:986: warning: data definition has no type or storage class
cmd_bootm.c:986: warning: type defaults to 'int' in declaration of 'U_BOOT_CMD'
cmd_bootm.c:1047:1: error: macro "U_BOOT_CMD" passed 6 arguments, but takes just 5
cmd_bootm.c:1043: warning: data definition has no type or storage class
cmd_bootm.c:1043: warning: type defaults to 'int' in declaration of 'U_BOOT_CMD'
cmd_bootm.c:1054:1: error: macro "U_BOOT_CMD" passed 6 arguments, but takes just 5
cmd_bootm.c:1050: warning: data definition has no type or storage class
cmd_bootm.c:1050: warning: type defaults to 'int' in declaration of 'U_BOOT_CMD'
cmd_bootm.c:1142:1: error: macro "U_BOOT_CMD" passed 6 arguments, but takes just 5
cmd_bootm.c:1135: warning: data definition has no type or storage class
cmd_bootm.c:1135: warning: type defaults to 'int' in declaration of 'U_BOOT_CMD'
cmd_bootm.c:1209:1: error: macro "U_BOOT_CMD" passed 6 arguments, but takes just 5
cmd_bootm.c:1203: warning: data definition has no type or storage class
cmd_bootm.c:1203: warning: type defaults to 'int' in declaration of 'U_BOOT_CMD'
cmd_boot.c:70:1: error: macro "U_BOOT_CMD" passed 6 arguments, but takes just 5
cmd_boot.c:65: warning: data definition has no type or storage class
cmd_boot.c:65: warning: type defaults to 'int' in declaration of 'U_BOOT_CMD'
cmd_boot.c:78:1: error: macro "U_BOOT_CMD" passed 6 arguments, but takes just 5
cmd_boot.c:74: warning: data definition has no type or storage class
cmd_boot.c:74: warning: type defaults to 'int' in declaration of 'U_BOOT_CMD'
...
I suggest you rebase your patches against current code, test that
they actually compile, and repost.
Thanks in advance.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You can't have everything... where would you put it? - Steven Wright
More information about the U-Boot
mailing list