LinuxCommandLibrary

gnatprep

Ada source file preprocessor

TLDR

Preprocess an Ada source file
$ gnatprep [input.adb] [output.adb]
copy
Preprocess with symbol definitions file
$ gnatprep [input.adb] [output.adb] [defs.txt]
copy
Define a symbol on command line
$ gnatprep -DDEBUG=True [input.adb] [output.adb]
copy
Replace preprocessor lines with blanks
$ gnatprep -b [input.adb] [output.adb]
copy
Retain preprocessor lines as comments
$ gnatprep -c [input.adb] [output.adb]
copy
List defined symbols
$ gnatprep -s [input.adb] [output.adb] [defs.txt]
copy

SYNOPSIS

gnatprep inputfile outputfile [definitionsfile] [switches_]

DESCRIPTION

gnatprep is a preprocessor for Ada programs. It processes conditional compilation directives (#if, #elsif, #else, #end if) and symbol substitutions ($symbol) in Ada source files. While designed for GNAT, it is not dependent on GNAT-specific features and can be used independently.

PARAMETERS

-b

Replace preprocessor and deleted lines with blank lines.
-c
Retain preprocessor and deleted lines as comments.
-Dsymbol=value
Define symbol on command line.
-s
List symbol names and values to stdout.
-u
Treat undefined symbols as FALSE.
-r
Generate source reference pragmas.

CAVEATS

Neither -b nor -c preserves original line numbers. If both are absent, preprocessor and deleted lines are removed entirely unless -r is specified.

SEE ALSO

gnatmake(1), gcc(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard