Using gcc for Semantic Checking (GNAT User’s Guide for Native Platforms)

#### 4.3.10 Using `gcc` for Semantic Checking ¶

`-gnatc`

  The `c` stands for ‘check’. Causes the compiler to operate in semantic check mode, with full checking for all illegalities specified in the Ada Reference Manual, but without generation of any object code (no object file is generated).

  Because dependent files must be accessed, you must follow the GNAT semantic restrictions on file structuring to operate in this mode:

  - The needed source files must be accessible (see Search Paths and the Run-Time Library (RTL)).
  - Each file must contain only one compilation unit.
  - The file name and unit name must match (File Naming Rules).

  The output consists of error messages as appropriate. No object file is generated. An `ALI` file is generated for use in the context of cross-reference tools, but this file is marked as not being suitable for binding (since no object file is generated). The checking corresponds exactly to the notion of legality in the Ada Reference Manual.

  Any unit can be compiled in semantics-checking-only mode, including units that would not normally be compiled (subunits, and specifications where a separate body is present).