Re: kernel and egcs

Michael Elizabeth Chastain (mec@shout.net)
Sun, 25 Jan 1998 17:52:07 -0600


Hi Matthias,

> That's not a stupid warning. memcpy is _defined_ to return its destination
> address.

The code in question looks like this:

/* include/asm-i386/string.h */
switch (n % 4) {
case 0: COMMON(""); return to;
case 1: COMMON("\n\tmovsb"); return to;
case 2: COMMON("\n\tmovsw"); return to;
case 3: COMMON("\n\tmovsw\n\tmovsb"); return to;
}

The compiler isn't smart enough to figure out that one of the cases
is always taken.

In this case I would just accommodate the compiler:

/* include/asm-i386/string.h */
switch (n % 4) {
case 0: COMMON(""); break;
case 1: COMMON("\n\tmovsb"); break;
case 2: COMMON("\n\tmovsw"); break;
case 3: COMMON("\n\tmovsw\n\tmovsb"); break;
}
return to;

Regards,

Michael Chastain
<mailto:mec@shout.net>
"love without fear"