aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cflow.ml
Commit message (Collapse)AuthorAgeFilesLines
* [BROKEN] Merge with v3.9 : something broken for __builtin_expect in ↵Cyril SIX2021-06-011-5/+10
| | | | cfrontend/C2C.ml
* Typo in commentXavier Leroy2018-09-031-1/+1
|
* Control-flow analysis: bug in switch without defaultXavier Leroy2017-02-171-1/+30
| | | | If no 'default' case appears in a 'switch', one is implicit at the end of the switch body, making possible to have a fall-through behavior.
* Added _exit.Bernhard Schommer2017-02-171-1/+1
|
* Add longjmp. Bug 21009Bernhard Schommer2017-02-171-1/+1
|
* Added handling for noreturn std functions.Bernhard Schommer2017-02-161-3/+8
| | | | | | | | | | The C11 standard declares exit,abort,_Exit,quick_exit and thrd_exit as _Noreturn however this is not included in older C libs and leads to false negatives in reporting _Noreturn and return type warnings. This can be avoided by enhancing the noreturn check of the Cflow analysis to also test if one of the above functions is called. Bug 21009
* Reverted changes in Cutil and catch in Cflow.Bernhard Schommer2017-02-161-0/+1
| | | | | | Instead of changing the definition of sizeof we now ignore errors raise in the Cflow module. Bug 21005
* Cflow: analysis of "switch" was too impreciseXavier Leroy2017-02-071-2/+3
| | | | Plus: updated comments.
* Revised, more precise implementation of control-flow analysisXavier Leroy2017-02-071-48/+98
| | | | The new implementation keeps track of goto labels that are actually branched to. It is less optimized than the previous implementation (no bit vectors) but perhaps easier to read.
* Control-flow analysis: wrong flow for "case"/"default" statementsXavier Leroy2017-02-071-4/+6
| | | | Those labeled statements can be entered either by fall-through or by the enclosing switch.
* More precise warnings about function returnsXavier Leroy2017-02-071-0/+195
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.