All files / utils/constants STRUCT_POINTER_C_FUNCTIONS.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                              96x              
/**
 * Nullable C standard-library functions that return a STRUCT pointer (`FILE*`),
 * as opposed to the `char*`-returning ones (`fgets`, `strstr`) which map to
 * C-Next's `cstring`. Codegen adds an asterisk to the generated type for these.
 *
 * #1322: this was a static method on `NullCheckAnalyzer`, which put a constant
 * lookup inside pass 2.1 and gave `output/` a reason to import an analyzer.
 * That edge is what `render-cannot-import-analyzers` forbids -- a later pass
 * reaching into an earlier one's modules rather than reading its artifact.
 *
 * It is a constant, not a decision: it answers "which C functions are these?",
 * which is neither "is this program legal?" (2.1) nor "what C should exist?"
 * (2.2). It sits in `src/utils/constants/` because its one reader is
 * `utils/DeclaredPointer`, which both passes reach (#1853).
 */
const STRUCT_POINTER_C_FUNCTIONS: ReadonlySet<string> = new Set([
  "fopen",
  "freopen",
  "tmpfile",
]);
 
export default STRUCT_POINTER_C_FUNCTIONS;