Repository navigation
Releases
0.8.0
cchecker 0.8.0 moves to Agentica 0.31.0 and adds lock helpers that depend on a flag.
- Breaking: needs Agentica 0.31.0 and the packages
prop-0.3.0andnative-gen-0.4.0. The findings, the codes and the options are the same. CC_ACQUIRES_IF(lock, *flag),CC_RELEASES_IF(lock, flag),CC_TRIES(lock)and[assume] tries: helpers that take or release a lock only on the side of a flag or a result.
Install and run (needs Agentica 0.31.0 or later, gcc 10+, clang and clang-tidy):
git clone --branch 0.8.0 https://github.com/agentica-lang/cchecker ~/cchecker
agentica ~/cchecker/cchecker.agc -p build # in your project, with build/compile_commands.jsonSee the CHANGELOG.
0.6.2
0.7.0
cchecker 0.7.0 follows a trylock result kept in a local variable.
- Breaking:
r = pthread_mutex_trylock(&mu); if (r == 0)(andbool ok = ... == 0,if ((r = ...) != 0)) now takes the lock on the path where the call gave 0, and later tests ofrfollow it. A release on the path where the call failed shows where it came from (6:11 fails). A trylock spin with a blocking fallback passes. Run--update-baselineonce after upgrading. - A function too large to walk with its conditions (over 200 000 states) is listed in
incomplete_functions.
Install and run (needs Agentica 0.29.0 or later, gcc 10+, clang and clang-tidy):
git clone --branch 0.7.0 https://github.com/agentica-lang/cchecker ~/cchecker
agentica ~/cchecker/cchecker.agc -p build # in your project, with build/compile_commands.jsonSee the CHANGELOG.
0.6.1
cchecker 0.6.1 is a hotfix: it keeps cchecker building with the next Agentica, and fixes two ownership false results.
- The sources compile with the next Agentica, which refuses a method call right after the
endof adoblock (CHECK-CHAIN-AFTER-END); they still need Agentica 0.29.0 or later. c = b; zap(&b);no longer clearsctoo:free(c)orwork(c)after it is a CC-OWN-DOUBLE-FREE or a CC-OWN-USE-AFTER-FREE.- A self-assignment of an owning pointer or field (
p.right = p.right) is no longer a false CC-OWN-LEAK.
Install and run (needs Agentica 0.29.0 or later, gcc 10+, clang and clang-tidy):
git clone --branch 0.6.1 https://github.com/agentica-lang/cchecker ~/cchecker
agentica ~/cchecker/cchecker.agc -p build # in your project, with build/compile_commands.jsonSee the CHANGELOG.
0.6.0
cchecker 0.6.0 moves to Agentica 0.29.0. The checks are the same as in 0.5.0.
Breaking:
- Needs Agentica 0.29.0 or later: the sources use
Process.Optionsand the syntax of 0.29.0 (implicit returns, guards, one-line defs).
Install and run (needs Agentica 0.29.0 or later, gcc 10+, clang and clang-tidy):
git clone --branch 0.6.0 https://github.com/agentica-lang/cchecker ~/cchecker
agentica ~/cchecker/cchecker.agc -p build # in your project, with build/compile_commands.jsonSee the CHANGELOG.
0.5.0
cchecker 0.5.0 follows ownership through structs much further: nested structs, arrays of structs and struct parameters passed by value.
- Struct fields up to the escape: the
CC_OWNSfields of a local struct are followed until the struct escapes (its address passed, a copy, a return), and handed on there. A leak before the escape is found. - Cleanup and clears: a struct with a
cleanupfunction is followed;pair_free(&p)at aCC_FREESparameter,memset(&p, 0, sizeof p)andp = (struct pair){...}free or clear its fields. - Structs by declaration: a struct declared in a function body, an unnamed one, and one that shadows another of the same name are followed.
- Fields set from a local: after
p.left = b, the field stands forb: freeing both is a double free, andfind(&key); free(name);is clean. - Nested structs: a struct in a struct by value (
p.inner.left), up to 8 levels and 16CC_OWNSfields. - Arrays of structs: a local array of a constant size (
struct pair a[2]) is followed item by item when the function names its items by constant indexes. - Struct parameters by value:
CC_OWNSon a struct parameter makes itsCC_OWNSfields own from the entry of the function, and the caller hands them on.
Breaking:
- These rules give new
CC-OWN-LEAK,CC-OWN-DOUBLE-FREEandCC-OWN-USE-AFTER-FREEfindings on code that was clean before. - Run
--update-baselineonce after upgrading.
Install and run (needs Agentica 0.27.0 or 0.28.0, gcc 10+, clang and clang-tidy):
git clone --branch 0.5.0 https://github.com/agentica-lang/cchecker ~/cchecker
agentica ~/cchecker/cchecker.agc -p build # in your project, with build/compile_commands.jsonChangelog
Changed
- Breaking: the ownership rules follow the
CC_OWNSfields of a local struct up to where the struct escapes (its
address passed, a copy, a by-value argument, a return,p = q), and hand them on there: a leak before the escape,
or a field that still owns when the whole struct gets a new value, is a CC-OWN-LEAK. Run--update-baselineonce
after upgrading. - Breaking: a local struct with a
cleanupfunction, or whoseCC_OWNSfield has its address taken
(free_and_null(&p.left),take(&p.left)), is followed too; the cleanup function,pair_free(&p)at aCC_FREES
parameter,memset(&p, 0, sizeof p)andp = (struct pair){...}free or clear its fields. A field freed twice, or
one that still owns at a clear, is a finding. Run--update-baselineonce after upgrading. - Breaking: the ownership rules find the struct of a local variable, an initializer and a compound literal by its
declaration, as C finds a tag or a typedef, not by its name: a struct declared in a function body, an unnamed one and
one that shadows another of the same name are followed, and an initializer of a union or of an unnamed member hands
its pointer on. Run--update-baselineonce after upgrading. - Breaking: a
CC_OWNSfield of a local struct set from a local (p.left = b,{ .left = b }) stands for the
local: freeing both is a CC-OWN-DOUBLE-FREE, and when the struct escapes the local is lent with it
(find(&key); free(name);is clean). A field or a local that gets a pointer already freed or handed on
(free(b); char *c = b;) is a CC-OWN-USE-AFTER-FREE, and a call that clears only an alias (zap(&c),
zap(&p.left)) frees the pointer it stands for. Run--update-baselineonce after upgrading. - Breaking: a struct in a local struct by value (
p.inner.left, up to 8 levels and 16CC_OWNSfields in all;
over that only its own fields) and a field of an unnamed struct member (c.buf) are followed as the fields of the
struct are:keep(&p.inner),p.inner = q,memset(&p.inner, 0, sizeof p.inner)andpair_free(&p.inner)work on
the fields of that member, and a nested initializer ({ .inner = { .left = b } }) gives each its item. Run
--update-baselineonce after upgrading. - Breaking: a local array of structs of a constant size (
struct pair a[2], up to 16CC_OWNSfields in all) is
followed item by item when a function names its items by constant indexes only (a[0].left); an index that is
not a constant, the array read whole (keep(a),a + 1) or&a[0]anywhere in the function leaves it not
followed there, andmemset(a, 0, sizeof a)clears it. Run--update-baselineonce after upgrading. - Breaking:
CC_OWNSon a struct parameter passed by value (void f(CC_OWNS struct pair p)) says that the
function owns itsCC_OWNSfields from the entry (p.left), not the struct as one pointer; a caller that passes a
struct there hands its fields on. Run--update-baselineonce after upgrading. - The items of
p = (struct pair){...}that read a field ofp(p.left ? p.left : make(n)) are read before the
store, and acaseordefaultlabel inside a block of aswitchkeeps the pointers of that block, as agoto
into it does.
0.4.0
cchecker 0.4.0 follows ownership more closely (struct fields, a pointer saved before it is replaced, inner blocks) and gives fewer false findings on common C idioms.
- Owned fields: the ownership rules follow the
CC_OWNSfields of a local struct used field by field (p.left, also from an initializer or a compound literal). - Saved pointers: after
old = p;, a new value ofpleaves the old pointer toold, so the TAKE_PTR idiom (old = p; p = NULL;) is no longer a false leak or double free. - Blocks and shadowing: a leak of a pointer declared in an inner block is reported where the path leaves the block. A local that shadows another has its own state.
- Statement expressions:
return ({ ...; p; })andfree(({ ...; p; }))hand on or freep, and a statement-expression macro used many times no longer leaves the function incomplete. - Path rules: a condition is forgotten after its last test, so many independent flags no longer multiply the states or give false findings.
- Short locks:
[assume] owned_locksnames the pointer fields and globals that point to a mutex of their own. - Docs: the docs are now a site, https://agentica-lang.github.io/cchecker/, with search and a Markdown copy of each page.
Breaking:
- cchecker needs Agentica 0.27.0 or later.
- A
CC_OWNSfield of a local struct that is not freed or handed on is now aCC-OWN-LEAK. - After
old = p;, the leak of the old pointer is reported onold, no longer as an overwrite ofp. - Run
--update-baselineonce after upgrading.
Install and run (needs Agentica 0.27.0+, gcc 10+, clang and clang-tidy):
git clone --branch 0.4.0 https://github.com/agentica-lang/cchecker ~/cchecker
agentica ~/cchecker/cchecker.agc -p build # in your project, with build/compile_commands.jsonChangelog
Added
- The docs as a site, https://agentica-lang.github.io/cchecker/, with search and a Markdown copy of each page.
[assume] owned_locksnames the pointer fields and globals that point to a mutex of their own
(lock.mutex): the inference of short locks gives such a lock the class of the pointer instead of stopping.
Changed
- Breaking: cchecker needs Agentica 0.27.0 or later (native-gen makes the C side of its scan module).
- Breaking: the ownership rules follow the
CC_OWNSfields of a local struct that the function uses only field by
field (p.left, also from an initializer): a field that is not freed or handed on is a CC-OWN-LEAK, where a store
into it used to hand the pointer on. Run--update-baselineonce after upgrading. - Breaking: after
old = p;, a new value ofp(p = make(),p = NULL,take(&p)) leaves the old pointer to
old: its leak is reported onold, no longer as an overwrite ofp. Run--update-baselineonce after upgrading. - A leak of a pointer declared in an inner block is reported where the path leaves the block (its end, a
break,
continue,gotoorreturn), not at the end of the function. - The path rules forget a condition after its last test: many independent flags (
if (a) lock(); if (a) unlock();)
no longer multiply the states, nor fall back to the walk without conditions, which gave false findings.
Fixed
- The TAKE_PTR idiom (
old = p; p = NULL;), and a pointer that an initializer or a compound literal puts in a
CC_OWNSfield, are no longer a false CC-OWN-LEAK or CC-OWN-DOUBLE-FREE. - A local that shadows another (a parameter, a global, a local of an outer block) has its own state, so it no longer
gives false CC-OWN or lock findings or hides real ones. - A statement expression returned, passed to a call or in a
?:(return ({ ...; p; }),free(({ ...; p; }))) hands
on or freesp: no longer a false CC-OWN-LEAK. - A statement-expression macro used many times into one variable (
s = TAKE(); if (s) free(s);) no longer leaves the
function inincomplete_functions.
0.3.0
cchecker 0.3.0 has fewer false positives on code that cannot be marked (vendored libraries, interpreters that longjmp), and it no longer loses findings without a word.
- Jumps:
CC_JUMPSand[assume] jumpsmark a raiser that never returns: its call is a way out where a pointer that still owns isCC-OWN-LEAKand a held lock isCC-PATH-LOCK-NOT-RELEASED.may_jumpnow spreads through the call graph unless a function catches (setjmp,CC_CATCHES).CC_JUMP_RELEASES/[assume] jump_releasescover a lock that the catcher gives back. - Settings for code you cannot edit:
[assume] acquiresandreleasesmark lock wrappers.[assume] stop_callscuts one call edge.[assume] nonblockingnames the functions whose descriptors are non-blocking.[roots]and[assume]takename@pathfor static functions.
- Calls that do not block:
uv_runwithUV_RUN_NOWAIT,waitpid/wait3/wait4/waitidwithWNOHANG, and a flag held in a local variable set before the call. - The compile database: a file listed twice is checked once.
[database] fold_ignoringfolds entries that differ only in named defines. - Fixed:
- clang-tidy findings are no longer dropped without a word under
UseColor: true. --checks '-*,...'now works: an option value may start with-.
- clang-tidy findings are no longer dropped without a word under
- Experimental, off by default:
[library] short_lock_sections = trueinfers short locks from their critical sections.
Breaking:
CC_MAY_JUMPon a function that never returns now meansCC_JUMPS.- The inference of
may_jump([library] may_jump_callers) may add findings that your baseline does not hold. Run--update-baselineonce after upgrading.
Install and run (needs Agentica 0.26.1+, gcc 10+, clang and clang-tidy):
git clone --branch 0.3.0 https://github.com/agentica-lang/cchecker ~/cchecker
agentica ~/cchecker/cchecker.agc -p build # in your project, with build/compile_commands.jsonChangelog
Added
waitpid,wait3,wait4andwaitidwithWNOHANGare not blocking calls forCC_SHORT
(libc_nonblocking_flags).- The flag of
libc_nonblocking_flagsmay be in a local variable that gets only constants and gets one before the
call on every path (options = WNOHANG; waitpid(pid, &status, options)). [assume] nonblocking = ["uv__read"]: the calls on a descriptor (read,write,recv,send,accept, ...)
that these functions make are not blocking forCC_SHORT, for code whose descriptors are all non-blocking.[assume] acquiresandreleases("my_lock(0)","name@path(N)") mark a lock wrapper of code that cannot be
edited asCC_ACQUIRESandCC_RELEASESdo, with the parameter that holds the lock.short_lockstakes the same
name(N)for a wrapper whose lock cannot be named: every lock taken through it is short.[database] fold_ignoring = ["NAME"]: two entries of one file that differ only in those defines (any value) are
checked once, the first of the database, like the-D<target>_EXPORTSof a shared library (libuv's
BUILDING_UV_SHARED). A define that changes the C the rules read hides it from the entries left out.[assume] stop_calls = ["caller>callee"]cuts the calls ofcalleeincallerout of the call graph, for every rule
that walks it (effects, the lock rules' system path, the inference ofmay_jump_callers); the callee stays reachable
from its other callers, wherestopremoves it for all. Each side takesname@path, and a pair that matches no
call is exit 2.uv_walk: its callback, and a function stored in theexit_cbofuv_process_options_t, areCC_SHORTroots like the
other callbacks of libuv that run on the loop (libuv_callbacks_short).[roots]and[assume](short,stop,may_jump,jumps,catches,jump_releases) takename@path, the
function of that name whose file ends withpath, so a name shared by static functions of several files no longer
marks all of them.CC_JUMPSand[assume] jumps: a call of a function that always jumps out and never returns (an interpreter's raise
withlongjmp) is a way out of its caller, where a pointer that still owns isCC-OWN-LEAKand a lock held is
CC-PATH-LOCK-NOT-RELEASED, and the path ends there.- A function that calls a function that may jump out or jumps may jump out too, unless it calls
setjmpor
sigsetjmpor is markedCC_CATCHES(or[assume] catches): only the raisers need a mark. The last step ofpath
names the chain of calls (may jump in path_of (as_string, wrong_tag)), and such a finding has
"source":"may_jump_callers";[library] may_jump_callers = falseturns the inference off. Breaking: a project
withCC_MAY_JUMPmarks may get new findings that its baseline does not hold. CC_JUMP_RELEASESand[assume] jump_releaseson aCC_ACQUIRESorCC_RELEASEShelper whose lock the catcher
of a jump gives back: a jump with that lock held or released is no lock finding when the function takes and
releases it only through such helpers; a return still is.- Experimental, off by default: with
[library] short_lock_sections = true, a lock whose critical sections reach no
blocking call, in a full run of a compile database, is short forCC_SHORT, as with[assume] short_locks;
inferred_short_locksof--jsonlists them and the text report counts them. It may call a lock short wrongly in
cases it does not handle yet; turn it on only to try it.
Changed
uv_runwith a constantUV_RUN_NOWAITis no longer a blocking call forCC_SHORT(libc_nonblocking_flags);
UV_RUN_ONCE,UV_RUN_DEFAULTand a mode in a variable still are.- Breaking:
CC_MAY_JUMPor[assume] may_jumpon a function that never returns (_Noreturn,CC_NORETURN) now
meansCC_JUMPS: its calls are checked as a way out, where before they only ended the path and found nothing. A
project with that combination may get new findings that its baseline does not hold. - A file listed more than once with the same flags is checked once; flags that differ only by
-fPIC,-fPIEand
CMake's-D<target>_EXPORTScount as the same (a static and a shared library of CMake), any other define does not
(libuv'sBUILDING_UV_SHAREDkeeps both entries).foldedof--jsoncounts the repeated entries left out.
Fixed
- A
.clang-tidywithUseColor: true, or a-fdiagnostics-color=alwaysor-fdiagnostics-urls=alwaysin the
flags, no longer drops or renames the findings of that tool without a word: cchecker turns colours and links off
after the project's settings, and a diagnostic line that it cannot read is a tool error (exit 2). - A value that starts with
-is taken from the next word, as getopt does:--checks '-*,bugprone-*'works like
--checks='-*,bugprone-*'instead of saying that--checksneeds a value (and-j -1now says that-1is too
small).
0.2.0
cchecker 0.2.0 comes from running 0.1.0 over the Agentica VM in CI: it covers shapes that needed a cchecker: ignore there, and it makes the baseline safer to keep in CI.
CC_MAY_JUMPand[assume] may_jump: a call of a function that may jump out (longjmpon an error) is also a way out of its caller. A pointer that still owns there isCC-OWN-LEAK, and a lock still held isCC-PATH-LOCK-NOT-RELEASED.CC_OWNS_OUT: an out-parameter (int take(CC_OWNS_OUT char **out)) hands an owned pointer to the caller, andtake(&p)makespown it. A store into an array that owns (argv[i] = p) handspon to the array.--strict-baseline: a baseline entry whose finding is gone, in the tools and files the run covered, fails the run. Every run now names its stale entries.- Tool versions in the baseline: an update of every file records the versions of gcc, clang and clang-tidy. A run with another version number warns and lists the change in
version_changesof--json. A 0.1.0 baseline still reads.
Breaking: the macros of include/cchecker.h are now empty unless cchecker dumps the AST (CCHECKER_AST). A normal clang build no longer carries an annotate attribute on every mark. A project that read that attribute must define the macros itself. Copy the new header into your project.
Install and run (needs Agentica 0.26.1+, gcc 10+, clang and clang-tidy):
git clone --branch 0.2.0 https://github.com/agentica-lang/cchecker ~/cchecker
agentica ~/cchecker/cchecker.agc -p build # in your project, with build/compile_commands.jsonChangelog
Added
--strict-baseline: a stale baseline entry (its finding is gone) of the tools and files that the run covered exits- Every run now names its stale entries after the summary and in
staleof--json.
- Every run now names its stale entries after the summary and in
CC_MAY_JUMPand[assume] may_jump: a call of a function that may jump out (longjmpon an error) is also a way
out of its caller, where a pointer that still owns isCC-OWN-LEAKand a lock held isCC-PATH-LOCK-NOT-RELEASED.CC_OWNS_OUTon a parameter (char **out):*out = phandspout to the caller, andtake(&p)makespown
what the call left.argv[i] = pin an array that owns handspon to the array.- A baseline records the versions of the tools. An
--update-baselineof every file (no FILE, no--exclude) writes
those of the tools it ran (gcc,clang,clang-tidy) intotools, and a run with another version number warns on
standard error and lists the change inversion_changesof--json. The exit code does not change; a baseline of
0.1.0 still reads.
Changed
include/cchecker.h: the macros are empty unless cchecker dumps the AST (CCHECKER_AST), so a normal clang build no
longer carries anannotateattribute on every marked field and local. Breaking: a project that read the
annotateattribute defines the macros itself.
0.1.0
The first release of cchecker: it checks C code for the rules of a project and runs the usual analyzers in one command. It runs gcc -fanalyzer, clang-tidy and its own rules on the files of a compile database in parallel, and prints their findings in one format with stable codes, as lines or --json. A baseline file accepts today's findings, so CI fails only on new ones; suppressions with a reason go next to the code.
The rules read clang's JSON AST and the annotations of include/cchecker.h:
- Effects on the call graph: a
CC_SHORTfunction never reaches a blocking call; aCC_HOTfunction never allocates or makes a system call. Roots can also come from settings or from libuv loop callbacks. - Locks on every path: locks released and held as they should be, no system call under a
CC_NO_SYSCALL_UNDERlock,CC_LOCK_LEVELorder, andCC_PAIRset/restore pairs. - Ownership on every path:
CC_OWNSpointers freed or handed on, never freed twice or used after free; collector values (CC_GC) never stored inmallocmemory or statics.
Install and run (needs Agentica 0.26.1+, gcc 10+, clang and clang-tidy):
git clone --branch 0.1.0 https://github.com/agentica-lang/cchecker ~/cchecker
agentica ~/cchecker/cchecker.agc -p build # in your project, with build/compile_commands.jsonSee the README.
Changelog
The first release.
Added
cchecker: runsgcc -fanalyzer,clang-tidyand its ownruleson the C files of a compile database (or of the
command line) in parallel, and prints their findings in one format with stable codes (CC-GCC-,CC-TIDY-,
CC-EFFECT-,CC-PATH-,CC-OWN-), as lines or--json. The default tools aregcc,clang-tidy,rules, so
clangis needed too;--tools gcc,clang-tidyruns without it, and--clang PROGRAMnames the clang that dumps
the AST.- Exit codes: 0 no new findings, 1 new findings, 2 usage or tool error. A non-zero exit of a tool is a tool error, a
file that does not compile is never a finding, only the analyzer warnings of gcc are findings (a gcc killed after
analyzer errors or halfway is a tool error, with itsfatal errorline), and a timeout stops the tool's children
too (withtimeoutinstalled). - A file whose
#includeis not found is not checked, withcchecker: warning: FILE not checked: HEADER not found
and an entry inunchecked_filesof--json; the other files are checked and the exit code does not change. - A baseline file (
--baseline,--update-baseline) that accepts findings by code, file and message, not by line.
An update keeps the entries of the tools and files the run did not cover, and a header that a partial run did not
name keeps the larger count of its entry. It is refused when a file of the database was skipped, while--checks,
--no-inferor a[library]flag set to false turns a check off, and with a-c FILEthat leaves out ashortor
hotname of[roots]of the project settings. include/cchecker.h: the annotation macros (CC_SHORT,CC_BLOCKING,CC_HOT,CC_OWNS,CC_PAIR,
CC_NO_SYSCALL_UNDER, ...), anannotateattribute for clang and empty for other compilers. UnderCCHECKER_AST
they aredeprecatedattributes, whose text clang 19 keeps in its JSON AST.- The
rulestool: one call graph of the project from clang's JSON AST, function pointers included where the project
stores a function in a field, a variable or a parameter.CC-EFFECT-SHORT-BLOCKS: aCC_SHORTfunction reaches a
blocking call (aCC_BLOCKINGfunction, or a known blocking call of libc, pthread or libuv; auv_fs_*call with
no callback blocks only when its libc call does, else it is a system call).CC-EFFECT-HOT-ALLOCATESand
CC-EFFECT-HOT-SYSCALL: aCC_HOTfunction allocates or makes a system call. The printed line and thepathfield
of--jsongive the call path; the baseline matches the message without it.--all-pathsgives a finding for each
distinct bad call, each with its shortest path. - The effect walk does not go into an error exit: a function that is
_Noreturn,[[noreturn]],CC_NORETURN,
__attribute__((noreturn))(also through a typedef, or with a calling convention after it) or
__attribute__((cold)), or a library call that never returns (_exit,abort, ...).[effects] follow_cold = truefollows it; aCC_BLOCKINGmark on such a function still counts. openandopenatwithO_NONBLOCK, andrecv,send,recvfromandsendtowithMSG_DONTWAIT, are not
blocking forCC_SHORTwhen the flag is a constant, with the values of the target (Linux and macOS);
[library] libc_nonblocking_flagsturns it off.- Settings, read from the first of
-c FILE(its[tool.cchecker]table when it has one),cchecker.toml, the
[tool.cchecker]table ofagentica.toml, and the defaults;configin--jsonsays which.[library]turns the
families of library knowledge off one by one, andsourcein--jsonnames the one of a finding.[roots]names
CC_SHORTandCC_HOTroots without a mark. - Inferred roots: a function passed as a callback to a libuv call that runs it on the loop thread (timers, handles,
streams, UDP, DNS,uv_fs_*requests and more; the lists match libuv 1.50) is aCC_SHORTroot
(libuv_callbacks_short,--no-infer). Its finding gives the call inroot; a callback that leads to no function
is listed inunresolved_callbacksof--json. - Assumptions of a project:
CC_ASSUME_SHORTand[assume] shortname a function that counts as fine for
CC_SHORT;CC_STOPand[assume] stopone that no rule walks into;[assume] stop_fieldsthe function-pointer
fields whose calls no rule follows; short locks (CC_NO_SYSCALL_UNDER()or[assume] short_locks) are not
blocking forCC_SHORT. A name that no function of the compile database declares is an error. - Locks on every path: a control flow graph of each function that takes or releases a lock.
CC-PATH-LOCK-NOT-RELEASED: a path returns with a lock the function took;CC-PATH-LOCK-NOT-HELD: a path releases
a lock it did not take.CC_ACQUIRES(lock)andCC_RELEASES(lock)mark the helpers that take or drop a lock for
their caller. A function with more paths than the rules follow is listed inincomplete_functionsof--json
(file,line,function) and on standard error; one too large for a graph is an error of therulestool. - What runs under a lock:
CC_NO_SYSCALL_UNDER()on the field of a lock (orCC_NO_SYSCALL_UNDER(lock)on a
function) andCC-PATH-SYSCALL-UNDER-LOCKfor a system or blocking call made or reached under it, aCC_RELEASES
helper included;CC_LOCK_LEVEL(n)andCC-PATH-LOCK-ORDERfor a lock taken while one of the same or a higher
level is held. A lock mark that cannot be read is one error of therulestool, on the file of the mark. - Pairs of calls:
CC_PAIR(set, restore)on a function (or onsetitself, for all its callers).
CC-PATH-PAIR-NOT-RESTORED: a path returns aftersetwithoutrestore;CC-PATH-PAIR-NOT-SET: arestorewith
nosetbefore it. - Ownership on every path:
CC_OWNSon a local, a parameter, a function (it returns an owned pointer) or a field,
andCC_FREESon a parameter.CC-OWN-LEAK,CC-OWN-DOUBLE-FREEandCC-OWN-USE-AFTER-FREE. - Values of the collector:
CC_GCon a type andCC_GC_ALLOCon an allocator (the Boehm allocators are known,
[library] libgc_alloc).CC-OWN-GC-IN-MALLOCandCC-OWN-GC-IN-STATIC: such a value stored in memory from
mallocor in a static. - Suppressions with a reason: a comment
cchecker: ignore CODE: reasonafter the code of a finding's line or alone on
the line above (//,///,//!,/* */), andCC_IGNORE("CODE", "reason")on a function for the codes of the
rules.--jsonlists them undersuppressed; a code that matches no finding isCC-UNUSED-IGNORE; neither goes
into the baseline. - Speed: a native module in C scans clang's AST, which clang writes into a FIFO. The 84 files of the VM of Agentica
take 17.9 s and 411 MB at-j 2, and a chain of 3000 else-if 4 s and 170 MB.-jdefaults to the number of cores,
and the jobs of the largest files start first.