New CONFIG_ guard: IF_FEATURE_BLAH(stuff)

Rob Landley rob at landley.net
Thu Feb 9 01:50:06 UTC 2006


Suggestion:

As long as we're generating the ENABLE_BLAH from the CONFIG_BLAH, we might as 
well generate IF_BLAH(x) that looks about like:

#ifdef CONFIG_BLAH
#define IF_BLAH(x) x
#else
#define IF_BLAH(x)
#endif

(I'm not tied to the name, feel free to come up with a better prefix.)

I'm currently looking at the date.c code (adding the new hint option in a 
different way), and as usual encountering stuff like:

#ifdef CONFIG_FEATURE_DATE_ISOFMT
# define GETOPT_ISOFMT  "I::"
#else
# define GETOPT_ISOFMT
#endif
    bb_opt_complementally = "?:d--s:s--d";
    opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:" GETOPT_ISOFMT,
                    &date_str, &date_str, &filename
#ifdef CONFIG_FEATURE_DATE_ISOFMT
                    , &isofmt_arg
#endif
                    );

And it seems to me that what that really wants to be something like:

  opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:"
 IF_FEATURE_DATE_ISOFMT("I::"),
 &date_str, &date_str, &filename
 IF_FEATURE_DATE_ISOFMT(,&isofmt_arg) );

Opinions?

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