This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa] diagnosing switch errors

So I'm looking at where I should move the bits from stmt.c that
are intended to handle -Wswitch-default, -Wswitch-enum and the
like.  It'd be nice to do this somewhere that could be reused by
all front ends.

One possibility is to do this just after gimplification.  At
that point we're guaranteed to have the program in a canonical
form.  I am hesitant, however, to add yet another scan of the
entire function.  From past experience with rtl, we can expect
this to be worth 1-2% compile-time performance.

Looking at the C/C++ front ends, it would be nicest to do this
check at the same time the switch statement is built.  Since we're
already building data structures to check and error for duplicate
case labels, we have everything available to make this easy.

So I went looking to see what Java and Fortran do.  And I can't
see that we check for duplicate case labels at all.  Am I correct
in this, or have I missed something?

I mean, I suppose we could move this check to the gimplifier, but
we should decide what we really want to do.  Personally I don't
think the gimplifier is the appropriate place to be generating
diagnostics; perhaps others disagree.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]