mirror of
https://github.com/Z3Prover/z3
synced 2025-08-14 14:55:25 +00:00
add python file
Signed-off-by: Lev Nachmanson <levnach@Levs-MacBook-Pro.local>
This commit is contained in:
parent
31a30370ac
commit
d218e87f76
2 changed files with 37 additions and 0 deletions
|
@ -1017,6 +1017,7 @@ public:
|
|||
|
||||
void apply_sort_cnstr(enode* n, sort*) {
|
||||
TRACE(arith, tout << "sort constraint: " << pp(n) << "\n";);
|
||||
std::cout << "sort constraint: " << pp(n) << " " << __FILE__ << ":" << __LINE__ << "\n";
|
||||
#if 0
|
||||
if (!th.is_attached_to_var(n))
|
||||
mk_var(n->get_owner());
|
||||
|
|
36
sus.py
Normal file
36
sus.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
sus.py: Search for function calls with three function-call arguments (ambiguous parameter evaluation order)
|
||||
and print matches in grep-like format: file:line:match
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
|
||||
# pattern: identifier(... foo(...), ... bar(...)) with two function-call args
|
||||
pattern = re.compile(
|
||||
r"\b[A-Za-z_]\w*" # function name
|
||||
r"\s*\(\s*" # '('
|
||||
r"[^)]*?[A-Za-z_]\w*\([^)]*\)" # first func-call arg anywhere
|
||||
r"[^)]*?,[^)]*?[A-Za-z_]\w*\([^)]*\)" # second func-call arg
|
||||
r"[^)]*?\)" # up to closing ')'
|
||||
)
|
||||
|
||||
# file extensions to include
|
||||
excl = ('TRACE', 'ASSERT', 'VERIFY', )
|
||||
|
||||
for root, dirs, files in os.walk('src/smt'):
|
||||
# skip hidden dirs
|
||||
dirs[:] = [d for d in dirs if not d.startswith('.')]
|
||||
for file in files:
|
||||
path = os.path.join(root, file)
|
||||
try:
|
||||
with open(path, 'r', encoding='utf-8', errors='ignore') as f:
|
||||
for i, line in enumerate(f, 1):
|
||||
if pattern.search(line):
|
||||
# skip lines with TRACE or ASSERT in all caps
|
||||
if any(word in line for word in excl):
|
||||
continue
|
||||
full_path = os.path.abspath(path)
|
||||
print(f"{full_path}:{i}:{line.rstrip()}")
|
||||
except OSError:
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue