www.delorie.com/gnu/docs/gcc/gnat_ug_48.html   search  
Buy the book!

Untitled Document

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2.8 Using gcc for Syntax Checking


The 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 section 7. Renaming Files Using gnatchop).

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003