init fails to compile for !CONFIG_FEATURE_KILL_REMOVED

Rob Landley rob at landley.net
Sun Feb 15 01:07:40 UTC 2009


On Saturday 14 February 2009 14:58:20 Denys Vlasenko wrote:
> On Saturday 14 February 2009 14:02, Bernhard Reutner-Fischer wrote:
> > Hi,
> >
> > When CONFIG_FEATURE_KILL_REMOVED is off then we end up with
> >
> > $ egrep "(INIT|KILL)" .config
> > CONFIG_INIT=y
> > CONFIG_FEATURE_USE_INITTAB=y
> > # CONFIG_FEATURE_KILL_REMOVED is not set
> > CONFIG_FEATURE_KILL_DELAY=

For type "int" the not set value should probably be "0".  (This is not a 
string.)

> > This should work but doesn't sound too clean. Suggestions?
>
> Hmm, there goes my attempt to make Rob happier :)
> (he wanted less #if's in init.c).

Actually I try to avoid preprocessor macros in the middle of C code in 
general, and I usually don't have trouble writing code that doesn't have them.  
Very few can't either be eliminated or moved to a header file...

> This is the case when #if is better than if
> (because #if would work, and if won't):

Or, alternately, this is a case where the kconfig logic isn't doing what we 
want, and fixing it is one line:

Index: scripts/kconfig/confdata.c
===================================================================
--- scripts/kconfig/confdata.c	(revision 25316)
+++ scripts/kconfig/confdata.c	(working copy)
@@ -524,6 +524,7 @@
 				}
 			case S_INT:
 				str = sym_get_string_value(sym);
+				if (!*str) str="0";
 				fprintf(out, "CONFIG_%s=%s\n", sym->name, str);
 				if (out_h) {
 					fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str);
 
It's a point of view thing, really.

Rob

P.S. Don't mind me, I found out I'm allergic to cedar pollen.  How did I find 
out?  The Great Cedar Pollen Apocalypse of 2009, of course:
http://www.kxan.com/dpp/weather/Cedar_pollen_counts_explode

If you're wondering why I've been irritable all month, let's just say that 
this past week I've lost my sense of smell and the ability to taste food, but 
it's still a big step up from the previous week.  I'm heading up to 
Pennsylvania on Tuesday, and staying there until March 4, so I should feel 
better soonish...


More information about the busybox mailing list