Re: [KBUILD] 2.x.x mkdep incorrectly handles serial.c, etc...

Riley Williams (rhw@MemAlpha.CX)
Wed, 16 Jun 1999 17:17:47 +0100 (GMT)


Hi Michael.

>>> Changing CONFIG_SERIAL_SHARE_IRQ with no other changes does
>>> *not* recompile serial.c but it should.

>> Good bug report. Ok, I believe I see the problem. Here is the
>> structure of drivers/char/serial.c:

>> #if 0
>> #define CONFIG_SERIAL_MANY_PORTS
>> ...
>> #endif

>> ... uses of CONFIG_SERIAL_MANY_PORTS ...

>> mkdep.c sees the definition of CONFIG_SERIAL_MANY_PORTS and says
>> "oh this is not an autoconfig variable; serial.c explicitly
>> defines it". This is why your patch to serial.c avoids the
>> problem. It's really a bug in mkdep.c: it doesn't understand
>> the effects of #if lines.

> Can I offer the enclosed patch to deal with this problem?

===8<=== CUT ===>8===

On further thought, that patch only addresses part of the problem.
Please apply the modified version thereof that I've put online at
http://www.MemAlpha.CX/Linux/Patches/ and which also handles a second
case that needs attention, but be aware that there's a third case that
needs dealing with, which neither of those patches touch.

The full set of relevant scenarios are as follows:

Q> #if 0
Q> :
Q> #endif

This is the scenario that is dealt with by my original patch, and the
one that was originally under discussion.

Q> #if 0
Q> :
Q> #else
Q> :
Q> #endif

This is a variant on the first, where #else indicates the point where
mkdep should start processing data again. This case is correctly dealt
with after making only minor modifications to my original patch, and
these modifications are included in the patch referenced above.

Q> #if 1
Q> :
Q> #endif

This case is correctly dealt with already, and needs no further
consideration.

Q> #if 1
Q> :
Q> #else
Q> :
Q> #endif

THIS is the problem case since, in this case, mkdep should ignore the
text in the #else branch, and the algorithm used in my patch can't
handle this case. I'm therefore going to investigate further and see
if I can develop one that can.

The simplest way to handle this case would be to convert all 125 files
containing this construct into the equivalent "#if 0"-#else-#endif
construct, and insist that this construct isn't used, but that isn't a
realistic solution to the problem.

For reference, there are 512 files with the '#if 0' construct in them,
including 83 which also have the '#if 1' construct therein.

If you'd like to look at them, all the major patches I've developed
for the Linux Kernel, including this one, are available from the
following URL:

http://www.MemAlpha.CX/Linux/Patches/

Best wishes from Riley.

+----------------------------------------------------------------------+
| There is something frustrating about the quality and speed of Linux |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch. |
+----------------------------------------------------------------------+
* ftp://ftp.MemAlpha.cx/pub/rhw/Linux
* http://www.MemAlpha.cx/kernel.versions.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/