wrong warning w/ non-void functions

Ingolf Koch ingolf@minet.uni-jena.de
Wed Mar 18 04:16:00 GMT 1998


Hi,

IMHO, gcc/g++ should be able to find out by flow analysis
that a warning is not necessary in the following case:

enum ab {A, B};
int f(ab argument);

int
f(ab argument) {
    switch (argument) {
        case A:
            return 1;
        case B:
            return 2;
    }
}

Current versions of the compiler warn about
"control reaches end of non-void function `f(ab)'"
when compiling with -Wall.

If a warning is indeed desired in this case, it would be
nice to have an option to suppress it (if -Wall is specified).

Regards
-- 

Ingolf Koch         http://www.minet.uni-jena.de/~ingolf/ 
FSU Jena, Institut fuer Angewandte Mathematik, 07740 Jena



More information about the Gcc-bugs mailing list