Re: warnings in 2.1.90 using pgcs

Michael L. Galbraith (mikeg@weiden.de)
Fri, 20 Mar 1998 16:53:03 +0100 (MET)


On Fri, 20 Mar 1998, David Burrows wrote:

> On Fri, 20 Mar 1998, Michael L. Galbraith wrote:
>
> > Hello Christopher,
> >
> > I'm using this to get it to shut up.. OOGLY, but silently produces
> > assembler identical to the original. The problem is that gcc doesn't
> > know that all cases are covered, so it warns about a possibly undesired
> > fall-through.. goodthing(tm) but darned annoying.
> >
> > -Mike
> >
> > extern inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
> > {
> > switch (count) {
> > case 0:
> > goto return_s;
> > case 1:
> > *(unsigned char *)s = pattern;
> > goto return_s;
> >
> > ...
>
> This looks rather silly to me.. My solution was to replace "case 3:" with
> "default:".. If you think about it, it makes sense.. If its not 0, or 1,
> or 2 then it HAS to be 3, so making it the default case will satisfy egcs
> that something is ALWAYS returned regardless..
>

Yes it is silly looking :). I was tinkering with the compiler.. not
the warning.

I took its choices away intentionally to see what it would produce.
When it produced identical assembler to original, I just left it.

-Mike

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu