← 返回命令列表

Linux command

gnatprep 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Preprocess an Ada source file

gnatprep [input.adb] [output.adb]

Preprocess with symbol definitions file

gnatprep [input.adb] [output.adb] [defs.txt]

Define a symbol on command line

gnatprep -DDEBUG=True [input.adb] [output.adb]

Replace preprocessor lines with blanks

gnatprep -b [input.adb] [output.adb]

Retain preprocessor lines as comments

gnatprep -c [input.adb] [output.adb]

List defined symbols

gnatprep -s [input.adb] [output.adb] [defs.txt]

说明

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.

参数

-b
Replace preprocessor and deleted lines with blank lines.
-c
Retain preprocessor and deleted lines as comments.
-D_symbol_=_value_
Define symbol on command line.
-s
List symbol names and values to stdout.
-T
Use only symbols defined on the command line or in the definitions file (do not use environment variables).
-u
Treat undefined symbols as FALSE.
-r
Generate source reference pragmas.
-v
Verbose mode, display file names as they are processed.

FAQ

What is the gnatprep command used for?

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.

How do I run a basic gnatprep example?

Run `gnatprep [input.adb] [output.adb]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -b do in gnatprep?

Replace preprocessor and deleted lines with blank lines.