Module Name: src Committed By: rillig Date: Sun Mar 21 18:58:34 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: func.c tree.c Log Message: lint: reduce number of places where 'reached' is set When determining the reachability of a statement, the idea was that whenever 'reached' was set to false, 'rchflg' (the abbreviation for "do not warn about unreachable statements") would be reset as well. In some (trivial) cases, this was done, but many more interesting cases simply forgot to set this second variable. To prevent this in the future, encapsulate this in a simple helper function. Now even if a statement is reachable, 'rchflg' gets reset. This does not hurt since as long as the current statement is reachable, the value of 'rchflg' does not matter. No functional change. There would be quite a big functional change though if check_statement_reachable were to reset 'rchflg' instead of 'reached', as the comment already suggests. In that case, with the current code, many legitimate warnings about unreachable statements would be skipped, especially those involving 'if' statements, since these didn't reset 'rchflg' properly before. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.243 -r1.244 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.