Skip to content

yugr/FlakyIterators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License Build Status codecov Total alerts Coverity Scan

A fast and dirty checker which detects non-deterministic iteration e.g.

std::unordered_map<...> map; for (auto [k, v] : map) { ... } std::map<Something *, ...> map; for (auto [k, v] : map) { ... } 

Warnings are reported only if functions with predefined names (e.g. printf) are encountered in a loop.

Comparison with Clang Static Analyzer

CSA's PointerIteration does not report nondeterministic iteration neither over ordered containers of pointers, nor over unordered containers of non-pointers.

How to build

To build, install (on Debian/Ubuntu) llvm, libclang-dev and libpcre3-dev:

$ sudo apt-get install llvm libclang-dev libpcre3-dev 

and run

$ make clean all 

To build debug or sanitized versions run make with DEBUG=1, ASAN=1 or UBSAN=1.

How to use

Run bin/find-flaky on files you are interested in:

$ bin/find-flaky tests/3-unordered-map-notok.cc find-flaky: warning: calling IO function 'printf' inside flaky loop 

By default tool looks for most common IO functions (like printf) but you provide your own patterns:

$ cat patterns.txt # A useful comment my_debug_fun # Another one other_fun $ bin/find-flaky --patterns patterns.txt ... 

Custom compile flags (usually -D and -I) can be supplied with --cflags parameter and verbosity can be set with -v flag. For additional options run bin/find-flaky -h.

How to test

Build and then run

$ make test Found no errors 

TODO

  • support other loop types

About

A fast and dirty checker based on libclang which detects non-deterministic iteration

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published