Next: Using gcc for Semantic Checking, Previous: Style Checking, Up: Switches for gcc
gcc
for Syntax Checking-gnats
s
stands for syntax.
Run GNAT in syntax checking only mode. For example, the command
$ gcc -c -gnats x.adb
compiles file x.adb in syntax-check-only mode. You can check a
series of files in a single command
, and can use wild cards to specify such a group of files.
Note that you must specify the -c
(compile
only) flag in addition to the -gnats flag.
.
You may use other switches in conjunction with -gnats. In particular, -gnatl and -gnatv are useful to control the format of any generated error messages.
The output is simply the error messages, if any. No object file or ALI
file is generated by a syntax-only compilation. Also, no units other
than the one specified are accessed. For example, if a unit X
with
's a unit Y
, compiling unit X
in syntax
check only mode does not access the source file containing unit
Y
.
Normally, GNAT allows only a single unit in a source file. However, this
restriction does not apply in syntax-check-only mode, and it is possible
to check a file containing multiple compilation units concatenated
together. This is primarily used by the gnatchop
utility
(see Renaming Files Using gnatchop).