List of condition variables without a surrounding loop
As per @slomo request, I'm opening an independent issue to track the condition variables used without a loop. You may find the original discussion in !4086 (merged) .
Here's a clang-query
script that finds g_cond_wait
ran without a loop:
matcher.txt:
# while loop with his body
let m1 compoundStmt(hasDescendant(whileStmt()))
# call to g_cond_wait that is not in a while body
let m2 callExpr(callee(functionDecl(hasName("g_cond_wait"))),unless(hasParent(m1))).bind("cond_wait_without_loop")
m m2
Call in the GStreamer root (requires parallel, clang-query and jq):
parallel clang-query -f ../matcher.txt -- `jq -r '.[].file' compile_commands.json`
This throws 300+ instances, not counting g_cond_wait_until
. Many of them are false positives as noted by @slomo and @ndufresne
Here's the list that the script above generates. g_cond_wait_without_loop.txt