4.5.2 Message Format

By default, messages are printed in a human-readable format. This format can vary from one internal application to another, since each application reports information about different file formats.

Some applications (for example, the parser) are typically able to pinpoint the area of interest down to a position on a particular line of C source code. Other applications (for example, the linker) can at best only indicate a module name and record number, which is less directly associated with any particular line of code. Some messages relate to issues in driver options that are in no way associated with the source code.

The format of messages produced by the Clang front end cannot be changed, but the following information is still relevant for the other compiler applications.

The compiler will use environment variables, if set, whose values are used as a template for all messages produced by all compiler applications. The names and effects of these environment variables are given in the table below.

Table 4-4. Messaging Environment Variables
Variable Effect
HTC_MSG_FORMAT All advisory messages
HTC_WARN_FORMAT All warning messages
HTC_ERR_FORMAT All error and fatal error messages

The value of these environment variables are strings that are used as templates for the message format. Printf-like placeholders can be placed within the string to allow the message format to be customized. The placeholders and what they represent are presented in the table below.

Table 4-5. Messaging Placeholders
Placeholder Replacement
%a Application name
%c Column number
%f Filename
%l Line number
%n Message number
%s Message string (from MDF)

If these options are used in a DOS batch file, two percent characters will need to be used to specify the placeholders, as DOS interprets a single percent character as an argument and will not pass this on to the compiler. For example:

SET HTC_ERR_FORMAT="file %%f: line %%l"