diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2017-02-07 09:57:45 +0100 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2017-02-07 09:57:45 +0100 |
commit | 5a7fc8637ae82d9aaf71c0053078a950ddee3b89 (patch) | |
tree | c68de6d885db1ec3814dc115c427c5960b91783a /cparser/Unblock.mli | |
parent | 6b0dbab6d1315ae3b0df26d034bce771f743af85 (diff) | |
download | compcert-5a7fc8637ae82d9aaf71c0053078a950ddee3b89.tar.gz compcert-5a7fc8637ae82d9aaf71c0053078a950ddee3b89.zip |
More precise warnings about function returns
This commit introduces a control-flow static analysis over C abstract syntax (file cparser/Cflow.ml) and uses it to
- warn for non-void functions that can return by falling through the body
- warn more precisely for _Noreturn functions that can return
- introduce the "return 0" in "main" functions less often (cosmetic).
For the control-flow analysis, the following conservative approximations are made:
- any "goto" label is reachable
- all cases of a "switch" statement are reachable as soon as the "switch" is reachable (i.e. the switch expression takes all values needed to reach every case)
- the boolean expressions in "if", "while", "do"-"while" and "for" can take true and false values, unless they are compile-time constants.
Diffstat (limited to 'cparser/Unblock.mli')
0 files changed, 0 insertions, 0 deletions