Previous: Object, Up: Overview [Contents][Index]

### 1.7 Error and Warning Messages

`as` may write warnings and error messages to the standard error file (usually your terminal). This should not happen when a compiler runs `as` automatically. Warnings report an assumption made so that `as` could keep assembling a flawed program; errors report a grave problem that stops the assembly.

Warning messages have the format

    file_name:NNN:Warning Message Text

(where NNN is a line number). If both a logical file name (see `.file`) and a logical line number (see `.line`) have been given then they will be used, otherwise the file name and line number in the current assembler source file will be used. The message text is intended to be self explanatory (in the grand Unix tradition).

Note the file name must be set via the logical version of the `.file` directive, not the DWARF2 version of the `.file` directive. For example:

      .file 2 "bar.c"
         error_assembler_source
      .file "foo.c"
      .line 30
          error_c_source

produces this output:

      Assembler messages:
      asm.s:2: Error: no such instruction: `error_assembler_source'
      foo.c:31: Error: no such instruction: `error_c_source'

Error messages have the format

    file_name:NNN:FATAL:Error Message Text

The file name and line number are derived as for warning messages. The actual message text may be rather less explanatory because many of them aren’t supposed to happen.