On Thu, 24 Sep 2009, Richard Guenther wrote: > The regular problem of emitting warnings for unreachable code may > be addressed by using a new variant of debug statements. Those > would queue up warnings and if still around emit them during > expansion. Currently queueing a warning can be done with inserting > a __builtin_warning function call.
If queueing a warning you need to be careful about i18n - probably queue the exact text that would be emitted (as affected by options such as -fdiagnostics-show-*) and then make sure it does not get passed through translation again. Other cases for queueing warnings are where the issue is not unreachable code but some other property that may be proved during optimization, such as whether an expression implicitly converted from signed to unsigned can ever actually be negative. There are several places where the C front end lowers expressions (calls c_fully_fold) prematurely to avoid bogus warnings in such cases, and if all folding (and probably then the other lowering c_fully_fold does) is to be moved to gimplification time or later then a solution to these warnings is needed. -- Joseph S. Myers jos...@codesourcery.com