Please fix a bug in bb_mkdep.c.

Rob Landley rob at landley.net
Thu Feb 9 22:24:08 UTC 2006


On Thursday 09 February 2006 04:21, Vladimir N. Oleynik wrote:
> Rob,
>
> > I want to move the USAGE_BLAH(x) macros from _usage.h to bb_config.h.
>
> mkdep do not parse _usage.h. Only config.h and bb_config.h.
> depend line from Makefile with _usage.h is hack for regenerate
> _usage.h after change config.


Maybe that's why it's having trouble when I move the USAGE(x) macros from 
_usage.h to bb_config.h.

> > I have two reasons:
> >
> > 1) So you can #include just one file and get all the configuration
> > macros.
>
> Its not problem.

It's a goal.

> > 2) It's easy for the sed call that generates the ENABLE_ macros to also
> > generate the USAGE_ macros at the same time.
>
> mkdep unsupport
> #if expr
> syntax

I'm not using #ifdef, I am generating the correct macro directly, using sed.

#define CONFIG_FEATURE_BUFFERS_USE_MALLOC 1
#define ENABLE_FEATURE_BUFFERS_USE_MALLOC 1
#define USAGE_FEATURE_BUFFERS_USE_MALLOC(...) __VA_ARGS__
#define ENABLE_FEATURE_BUFFERS_GO_ON_STACK 0
#define USAGE_FEATURE_BUFFERS_GO_ON_STACK(...)

And so on.

> The result
>
> #if FEATURE_BLAH
> #define IF_BLAH(x) x
> #else
> #define IF_BLAH(x)
> #endif
>
>   - first line skiped
>   - second line can`t understand: its depend or not of IF_BLAH?
>         What save line to include/config/IF_BLAH?
>         (x) x? But it do not detect if FEATURE_BLAH=0

I'm not asking for bb_mkdep to learn to parse #ifdefs, I'm asking that it 
learn two things:

1) "USAGE_XXX(...) __VA_ARGS__" works like "ENABLE_XXX 1"
2) "USAGE_XXX(...)" works like "ENABLE_XXX 0"

>   - fourth line redeclare IF_BLAH

It's not doing that.

> Why not save secondary`s depend macros to bb_config_macros.h?

Because if we start actually using these macros then they will generate 
dependencies.  If bb_mkdep doesn't understand them, it won't rebuild 
properly.

Right now we're not using the USAGE() macros from _usage.h outside of 
include/usage.h, but I'd like to change that.

> > I traced this to line 376 of bb_mkdep.c, but that's yacc output
>
> yacc-like.
>
> > and I don't have the yacc source.
>
> yacc source have first (demo) variant of my bb_mkdep.
> Current variant is my and only my fast and stupid (but more clever
> vs Linus kernel "mkdep") C parser.

Ok.

Rob
-- 
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.



More information about the busybox mailing list