[Toybox] Commit 897: size reduction, and new warning

Rob Landley rob at landley.net
Mon May 13 21:15:48 PDT 2013


On 05/12/2013 01:58:12 AM, idunham at lavabit.com wrote:
> I'm impressed:
> -rwxr-xr-x 1 143640 May 11 23:16 toybox
> -rwxr-xr-x 1 252748 May 10 21:32 toybox-895
> -rwxr-xr-x 1 166499 May 11 23:16 toybox_unstripped
> (Coincidentally, this is the output of ls -lgo with coreutils;
> toybox appears to have no way to do a full ls with neither group nor
> owner...but I'd expect that one could deal with that via pipes.)
> 
> No config changes, and the list of applets is constant:
> for i in ./toybox*; do $i |md5sum ; done
> 58671088549e63bde77622705dc677af  -
> 58671088549e63bde77622705dc677af  -
> 58671088549e63bde77622705dc677af  -
> 
> So a change of less than 30 lines nearly halved size.

Odd. I'm not seeing that here. Have you tried Have you tried  
scripts/bloat-o-meter?

hg checkout -r 896
make allyesconfig
make baseline
hg checkout -r 897
make bloatcheck

name                                           old       new      delta
-----------------------------------------------------------------------
  xgetmountlist                                   0       243        243
  df_main                                       299       294         -5
  getmountlist                                  343         0       -343
-----------------------------------------------------------------------
                                                                     
-105 total

> But gcc is warning about line 21 of lib/getmountlist.c:
>   for (mtlist = 0; me = getmntent(fp); mtlist = mt) {

Yeah it wants an extra parentheses to confirm I really MEAN an  
assignment in the middle there. On the todo list...

> Output of make:
> scripts/make.sh
> Make generated/config.h from .config.
> Extract configuration information from toys/*.c files...
> Generate headers from toys/*/*.c...
> generated/newtoys.h
> generated/globals.h
> generated/help.h
> Extract help text from Config.in.
> Library probe...
> Compile toybox...
> lib/getmountlist.c: In function 'xgetmountlist':
> lib/getmountlist.c:21: warning: suggest parentheses around assignment  
> used as truth value
> toys/pending/stat.c: In function 'check_type_file':
> toys/pending/stat.c:84: warning: control reaches end of non-void  
> function
> 
> The latter warning is GCC nonsense, I know.

My allyesconfig is also giving warnings from mke2fs and toysh, but both  
of those need to essentially be restarted...

> So gcc seems to be assuming that the condition is
> "While assigning the result of getmntent(fp) to me succeeds."
> Am I missing something here, or should that have been "=="?

No, it's actually an assignment. It reads in the next entry, saving it  
to the variable, and stops if the entry was null. The test condition is  
run the first time through the loop and after every increment, so  
putting it there avoids duplicating it.

I should probably have a comment about that...

Rob
 1368504948.0


More information about the Toybox mailing list