All files / transpiler/types IToolchainRequirement.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73                                                                                                                                                 
import type ICompilerFloor from "./ICompilerFloor";
import type TCompilerExtension from "./TCompilerExtension";
import type TLanguageStandard from "./TLanguageStandard";
import type TOutputMode from "./TOutputMode";
import type TRequirementKey from "./TRequirementKey";
 
/**
 * Issue #1143: One conditional toolchain requirement carried by generated
 * output.
 *
 * The three axes are independent, and that independence is the point. A
 * construct may cost a newer language standard while needing no particular
 * compiler (`_Static_assert`), or cost a platform library while being plain
 * C99 (`cli()`), or cost a compiler extension at any standard (inline asm).
 * "Standard C99" is not an answer to any of those questions on its own.
 */
interface IToolchainRequirement {
  /** Stable key. Must equal the key this record is filed under. */
  readonly key: TRequirementKey;
 
  /**
   * Human grouping shared by sibling arms, e.g. "critical section". Rows with
   * the same feature and a non-null condition are reported as alternatives.
   */
  readonly feature: string;
 
  /**
   * Output modes this requirement can appear in. A probe is only meaningful
   * within these modes -- see TOutputMode for why text alone is not enough.
   */
  readonly modes: readonly TOutputMode[];
 
  /** Axis 1: minimum language standard the emitted text conforms to. */
  readonly standard: TLanguageStandard;
 
  /** Axis 2: minimum compiler versions, or null when any conforming one works. */
  readonly compiler: ICompilerFloor | null;
 
  /** Axis 2: non-standard compiler features used. Empty when strictly conforming. */
  readonly extensions: readonly TCompilerExtension[];
 
  /** Axis 3: platform library that must supply the symbols, or null when none. */
  readonly platformLib: string | null;
 
  /** Preprocessor condition selecting this arm, or null when unconditional. */
  readonly condition: string | null;
 
  /** The exact emitted token this requirement is about. Shown verbatim to users. */
  readonly reason: string;
 
  /** What the user wrote in .cnx to incur it. One clause, no trailing period. */
  readonly incurredBy: string;
 
  /**
   * Regex that must match generated output whenever this key is recorded, and
   * whose match implies the key is recorded. This is the #1143 invariant in
   * machine-checkable form: it is what makes it impossible to ship a guard,
   * banner line or documentation row for a construct the file does not contain.
   *
   * null only where no reliable token exists (the baselines, which have no
   * single distinguishing construct).
   */
  readonly probe: RegExp | null;
 
  /** ADR this requirement originates from, or null. */
  readonly adr: string | null;
 
  /** MISRA C:2012 guideline ids this bears on, e.g. ["1.2", "Dir 4.3"]. */
  readonly misra: readonly string[];
}
 
export default IToolchainRequirement;