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/Cutil.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/Cutil.mli')
-rw-r--r-- | cparser/Cutil.mli | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/cparser/Cutil.mli b/cparser/Cutil.mli index 4eaa9e4a..bd5a2c3e 100644 --- a/cparser/Cutil.mli +++ b/cparser/Cutil.mli @@ -285,8 +285,3 @@ val subst_expr: exp IdentMap.t -> exp -> exp val subst_init: exp IdentMap.t -> init -> init val subst_decl: exp IdentMap.t -> decl -> decl val subst_stmt: exp IdentMap.t -> stmt -> stmt - -(* Statement properties *) - -val contains_return: stmt -> bool - (* Does the stmt contain a return. *) |