Next: , Previous: Using gcc for Semantic Checking, Up: Switches for gcc


3.2.10 Compiling Ada 83 Programs

-gnat83
Although GNAT is primarily an Ada 95 compiler, it accepts this switch to specify that an Ada 83 program is to be compiled in Ada83 mode. If you specify this switch, GNAT rejects most Ada 95 extensions and applies Ada 83 semantics where this can be done easily. It is not possible to guarantee this switch does a perfect job; for example, some subtle tests, such as are found in earlier ACVC tests (that have been removed from the ACVC suite for Ada 95), may not compile correctly. However, for most purposes, using this switch should help to ensure that programs that compile correctly under the -gnat83 switch can be ported easily to an Ada 83 compiler. This is the main use of the switch.

With few exceptions (most notably the need to use <> on unconstrained generic formal parameters, the use of the new Ada 95 keywords, and the use of packages with optional bodies), it is not necessary to use the -gnat83 switch when compiling Ada 83 programs, because, with rare exceptions, Ada 95 is upwardly compatible with Ada 83. This means that a correct Ada 83 program is usually also a correct Ada 95 program.