Re: kernel and egcs

Richard B. Johnson (root@chaos.analogic.com)
Sun, 25 Jan 1998 22:03:53 -0500 (EST)


On Mon, 26 Jan 1998, Regis Duchesne wrote:

> > 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;
> It is slower : it adds one unuseful jump compared to the original code
> That's why the best solution is to keep all returns were they are, to add
> one return at the end, and to comment it with something like :
>
> /* Never reached. Needed to avoid a stupid gcc warning */
>
> Regards,
>
> Regis "HPReg" Duchesne - Engineering Student at ***** ******** *****
> www http://www.via.ecp.fr/~regis/
> (O o) I use Linux & 3Com (1135 KB/s over 10Mb/s ethernet)
> --.oOO--(_)--OOo.-----------------------------------------------------------
>
I think it's just crying for a `default: ; break;`, which will do nothing,
and add a few bytes of code that are never executed. The `returns` are the
way-to-go on the original code. Just add a `default` to make the compiler
happy.

Cheers,
Dick Johnson
***** FILE SYSTEM MODIFIED *****
Penguin : Linux version 2.1.80 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.