Skip to content

Releases

0.8.0

Choose a tag to compare

@sonic182 sonic182 released this 13 Nov 17:33
6f94efd

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.0 and native-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.json

See the CHANGELOG.

0.6.2

Choose a tag to compare

@sonic182 sonic182 released this 13 Nov 00:00
9ef291f

0.7.0

Choose a tag to compare

@sonic182 sonic182 released this 12 Nov 14:03
6766717

cchecker 0.7.0 follows a trylock result kept in a local variable.

  • Breaking: r = pthread_mutex_trylock(&mu); if (r == 0) (and bool ok = ... == 0, if ((r = ...) != 0)) now takes the lock on the path where the call gave 0, and later tests of r follow 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-baseline once 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.json

See the CHANGELOG.

0.6.1

Choose a tag to compare

@sonic182 sonic182 released this 12 Nov 11:11
9dbf8ed

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 end of a do block (CHECK-CHAIN-AFTER-END); they still need Agentica 0.29.0 or later.
  • c = b; zap(&b); no longer clears c too: free(c) or work(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.json

See the CHANGELOG.

0.6.0

Choose a tag to compare

@sonic182 sonic182 released this 10 Nov 19:44
f7ec380

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.Options and 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.json

See the CHANGELOG.

0.5.0

Choose a tag to compare

@sonic182 sonic182 released this 10 Nov 17:33
6848a76

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_OWNS fields 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 cleanup function is followed; pair_free(&p) at a CC_FREES parameter, memset(&p, 0, sizeof p) and p = (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 for b: freeing both is a double free, and find(&key); free(name); is clean.
  • Nested structs: a struct in a struct by value (p.inner.left), up to 8 levels and 16 CC_OWNS fields.
  • 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_OWNS on a struct parameter makes its CC_OWNS fields own from the entry of the function, and the caller hands them on.

Breaking:

  • These rules give new CC-OWN-LEAK, CC-OWN-DOUBLE-FREE and CC-OWN-USE-AFTER-FREE findings on code that was clean before.
  • Run --update-baseline once 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.json

Changelog

Changed

  • Breaking: the ownership rules follow the CC_OWNS fields 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-baseline once
    after upgrading.
  • Breaking: a local struct with a cleanup function, or whose CC_OWNS field has its address taken
    (free_and_null(&p.left), take(&p.left)), is followed too; the cleanup function, pair_free(&p) at a CC_FREES
    parameter, memset(&p, 0, sizeof p) and p = (struct pair){...} free or clear its fields. A field freed twice, or
    one that still owns at a clear, is a finding. Run --update-baseline once 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-baseline once after upgrading.
  • Breaking: a CC_OWNS field 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-baseline once after upgrading.
  • Breaking: a struct in a local struct by value (p.inner.left, up to 8 levels and 16 CC_OWNS fields 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) and pair_free(&p.inner) work on
    the fields of that member, and a nested initializer ({ .inner = { .left = b } }) gives each its item. Run
    --update-baseline once after upgrading.
  • Breaking: a local array of structs of a constant size (struct pair a[2], up to 16 CC_OWNS fields 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, and memset(a, 0, sizeof a) clears it. Run --update-baseline once after upgrading.
  • Breaking: CC_OWNS on a struct parameter passed by value (void f(CC_OWNS struct pair p)) says that the
    function owns its CC_OWNS fields from the entry (p.left), not the struct as one pointer; a caller that passes a
    struct there hands its fields on. Run --update-baseline once after upgrading.
  • The items of p = (struct pair){...} that read a field of p (p.left ? p.left : make(n)) are read before the
    store, and a case or default label inside a block of a switch keeps the pointers of that block, as a goto
    into it does.

0.4.0

Choose a tag to compare

@sonic182 sonic182 released this 09 Nov 22:31
4b17d20

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_OWNS fields 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 of p leaves the old pointer to old, 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; }) and free(({ ...; p; })) hand on or free p, 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_locks names 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_OWNS field of a local struct that is not freed or handed on is now a CC-OWN-LEAK.
  • After old = p;, the leak of the old pointer is reported on old, no longer as an overwrite of p.
  • Run --update-baseline once 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.json

Changelog

Added

  • The docs as a site, https://agentica-lang.github.io/cchecker/, with search and a Markdown copy of each page.
  • [assume] owned_locks names 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_OWNS fields 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-baseline once after upgrading.
  • Breaking: after old = p;, a new value of p (p = make(), p = NULL, take(&p)) leaves the old pointer to
    old: its leak is reported on old, no longer as an overwrite of p. Run --update-baseline once 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, goto or return), 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_OWNS field, 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 frees p: 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 in incomplete_functions.

0.3.0

Choose a tag to compare

@sonic182 sonic182 released this 09 Nov 16:34
8ded9b8

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_JUMPS and [assume] jumps mark a raiser that never returns: its call is a way out where a pointer that still owns is CC-OWN-LEAK and a held lock is CC-PATH-LOCK-NOT-RELEASED. may_jump now spreads through the call graph unless a function catches (setjmp, CC_CATCHES). CC_JUMP_RELEASES / [assume] jump_releases cover a lock that the catcher gives back.
  • Settings for code you cannot edit:
    • [assume] acquires and releases mark lock wrappers.
    • [assume] stop_calls cuts one call edge.
    • [assume] nonblocking names the functions whose descriptors are non-blocking.
    • [roots] and [assume] take name@path for static functions.
  • Calls that do not block: uv_run with UV_RUN_NOWAIT, waitpid/wait3/wait4/waitid with WNOHANG, and a flag held in a local variable set before the call.
  • The compile database: a file listed twice is checked once. [database] fold_ignoring folds 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 -.
  • Experimental, off by default: [library] short_lock_sections = true infers short locks from their critical sections.

Breaking:

  • CC_MAY_JUMP on a function that never returns now means CC_JUMPS.
  • The inference of may_jump ([library] may_jump_callers) may add findings that your baseline does not hold. Run --update-baseline once 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.json

Changelog

Added

  • waitpid, wait3, wait4 and waitid with WNOHANG are not blocking calls for CC_SHORT
    (libc_nonblocking_flags).
  • The flag of libc_nonblocking_flags may 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 for CC_SHORT, for code whose descriptors are all non-blocking.
  • [assume] acquires and releases ("my_lock(0)", "name@path(N)") mark a lock wrapper of code that cannot be
    edited as CC_ACQUIRES and CC_RELEASES do, with the parameter that holds the lock. short_locks takes 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>_EXPORTS of 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 of callee in caller out of the call graph, for every rule
    that walks it (effects, the lock rules' system path, the inference of may_jump_callers); the callee stays reachable
    from its other callers, where stop removes it for all. Each side takes name@path, and a pair that matches no
    call is exit 2.
  • uv_walk: its callback, and a function stored in the exit_cb of uv_process_options_t, are CC_SHORT roots 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) take name@path, the
    function of that name whose file ends with path, so a name shared by static functions of several files no longer
    marks all of them.
  • CC_JUMPS and [assume] jumps: a call of a function that always jumps out and never returns (an interpreter's raise
    with longjmp) is a way out of its caller, where a pointer that still owns is CC-OWN-LEAK and 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 setjmp or
    sigsetjmp or is marked CC_CATCHES (or [assume] catches): only the raisers need a mark. The last step of path
    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 = false turns the inference off. Breaking: a project
    with CC_MAY_JUMP marks may get new findings that its baseline does not hold.
  • CC_JUMP_RELEASES and [assume] jump_releases on a CC_ACQUIRES or CC_RELEASES helper 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 for CC_SHORT, as with [assume] short_locks;
    inferred_short_locks of --json lists 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_run with a constant UV_RUN_NOWAIT is no longer a blocking call for CC_SHORT (libc_nonblocking_flags);
    UV_RUN_ONCE, UV_RUN_DEFAULT and a mode in a variable still are.
  • Breaking: CC_MAY_JUMP or [assume] may_jump on a function that never returns (_Noreturn, CC_NORETURN) now
    means CC_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, -fPIE and
    CMake's -D<target>_EXPORTS count as the same (a static and a shared library of CMake), any other define does not
    (libuv's BUILDING_UV_SHARED keeps both entries). folded of --json counts the repeated entries left out.

Fixed

  • A .clang-tidy with UseColor: true, or a -fdiagnostics-color=always or -fdiagnostics-urls=always in 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 --checks needs a value (and -j -1 now says that -1 is too
    small).

0.2.0

Choose a tag to compare

@sonic182 sonic182 released this 09 Nov 09:16
e866af2

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_JUMP and [assume] may_jump: a call of a function that may jump out (longjmp on an error) is also a way out of its caller. A pointer that still owns there is CC-OWN-LEAK, and a lock still held is CC-PATH-LOCK-NOT-RELEASED.
  • CC_OWNS_OUT: an out-parameter (int take(CC_OWNS_OUT char **out)) hands an owned pointer to the caller, and take(&p) makes p own it. A store into an array that owns (argv[i] = p) hands p on 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_changes of --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.json

Changelog

Added

  • --strict-baseline: a stale baseline entry (its finding is gone) of the tools and files that the run covered exits
    1. Every run now names its stale entries after the summary and in stale of --json.
  • CC_MAY_JUMP and [assume] may_jump: a call of a function that may jump out (longjmp on an error) is also a way
    out of its caller, where a pointer that still owns is CC-OWN-LEAK and a lock held is CC-PATH-LOCK-NOT-RELEASED.
  • CC_OWNS_OUT on a parameter (char **out): *out = p hands p out to the caller, and take(&p) makes p own
    what the call left. argv[i] = p in an array that owns hands p on to the array.
  • A baseline records the versions of the tools. An --update-baseline of every file (no FILE, no --exclude) writes
    those of the tools it ran (gcc, clang, clang-tidy) into tools, and a run with another version number warns on
    standard error and lists the change in version_changes of --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 an annotate attribute on every marked field and local. Breaking: a project that read the
    annotate attribute defines the macros itself.

0.1.0

Choose a tag to compare

@sonic182 sonic182 released this 08 Nov 19:33
bffe57d

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_SHORT function never reaches a blocking call; a CC_HOT function 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_UNDER lock, CC_LOCK_LEVEL order, and CC_PAIR set/restore pairs.
  • Ownership on every path: CC_OWNS pointers freed or handed on, never freed twice or used after free; collector values (CC_GC) never stored in malloc memory 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.json

See the README.

Changelog

The first release.

Added

  • cchecker: runs gcc -fanalyzer, clang-tidy and its own rules on 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 are gcc,clang-tidy,rules, so
    clang is needed too; --tools gcc,clang-tidy runs without it, and --clang PROGRAM names 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 its fatal error line), and a timeout stops the tool's children
    too (with timeout installed).
  • A file whose #include is not found is not checked, with cchecker: warning: FILE not checked: HEADER not found
    and an entry in unchecked_files of --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-infer or a [library] flag set to false turns a check off, and with a -c FILE that leaves out a short or
    hot name 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, ...), an annotate attribute for clang and empty for other compilers. Under CCHECKER_AST
    they are deprecated attributes, whose text clang 19 keeps in its JSON AST.
  • The rules tool: 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: a CC_SHORT function reaches a
    blocking call (a CC_BLOCKING function, or a known blocking call of libc, pthread or libuv; a uv_fs_* call with
    no callback blocks only when its libc call does, else it is a system call). CC-EFFECT-HOT-ALLOCATES and
    CC-EFFECT-HOT-SYSCALL: a CC_HOT function allocates or makes a system call. The printed line and the path field
    of --json give the call path; the baseline matches the message without it. --all-paths gives 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 = true follows it; a CC_BLOCKING mark on such a function still counts.
  • open and openat with O_NONBLOCK, and recv, send, recvfrom and sendto with MSG_DONTWAIT, are not
    blocking for CC_SHORT when the flag is a constant, with the values of the target (Linux and macOS);
    [library] libc_nonblocking_flags turns it off.
  • Settings, read from the first of -c FILE (its [tool.cchecker] table when it has one), cchecker.toml, the
    [tool.cchecker] table of agentica.toml, and the defaults; config in --json says which. [library] turns the
    families of library knowledge off one by one, and source in --json names the one of a finding. [roots] names
    CC_SHORT and CC_HOT roots 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 a CC_SHORT root
    (libuv_callbacks_short, --no-infer). Its finding gives the call in root; a callback that leads to no function
    is listed in unresolved_callbacks of --json.
  • Assumptions of a project: CC_ASSUME_SHORT and [assume] short name a function that counts as fine for
    CC_SHORT; CC_STOP and [assume] stop one that no rule walks into; [assume] stop_fields the function-pointer
    fields whose calls no rule follows; short locks (CC_NO_SYSCALL_UNDER() or [assume] short_locks) are not
    blocking for CC_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) and CC_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 in incomplete_functions of --json
    (file, line, function) and on standard error; one too large for a graph is an error of the rules tool.
  • What runs under a lock: CC_NO_SYSCALL_UNDER() on the field of a lock (or CC_NO_SYSCALL_UNDER(lock) on a
    function) and CC-PATH-SYSCALL-UNDER-LOCK for a system or blocking call made or reached under it, a CC_RELEASES
    helper included; CC_LOCK_LEVEL(n) and CC-PATH-LOCK-ORDER for 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 the rules tool, on the file of the mark.
  • Pairs of calls: CC_PAIR(set, restore) on a function (or on set itself, for all its callers).
    CC-PATH-PAIR-NOT-RESTORED: a path returns after set without restore; CC-PATH-PAIR-NOT-SET: a restore with
    no set before it.
  • Ownership on every path: CC_OWNS on a local, a parameter, a function (it returns an owned pointer) or a field,
    and CC_FREES on a parameter. CC-OWN-LEAK, CC-OWN-DOUBLE-FREE and CC-OWN-USE-AFTER-FREE.
  • Values of the collector: CC_GC on a type and CC_GC_ALLOC on an allocator (the Boehm allocators are known,
    [library] libgc_alloc). CC-OWN-GC-IN-MALLOC and CC-OWN-GC-IN-STATIC: such a value stored in memory from
    malloc or in a static.
  • Suppressions with a reason: a comment cchecker: ignore CODE: reason after the code of a finding's line or alone on
    the line above (//, ///, //!, /* */), and CC_IGNORE("CODE", "reason") on a function for the codes of the
    rules. --json lists them under suppressed; a code that matches no finding is CC-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. -j defaults to the number of cores,
    and the jobs of the largest files start first.