-qsource

Category

Listings, messages, and compiler information

Pragma equivalent

#pragma options [no]source

Purpose

Produces a compiler listing file that includes the source section of the listing and provides additional source information when printing error messages.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-nosource-.   
>>- -q--+-source---+-------------------------------------------><

Defaults

-qnosource

Usage

When -qsource or #pragma options source is in effect, a listing file with the .lst suffix is generated for each source file specified on the command line. For details about the contents of the listing file, see Compiler listings.

You can selectively print parts of the source by using pairs of #pragma options source and #pragma options nosource preprocessor directives throughout your source program. The source following #pragma options source and preceding #pragma options nosource is printed.

The -qnoprint option overrides this option.

Predefined macros

None.

Examples

The myprogram.c file contains the following code:

#include <stdio.h> 
int main()
{ 
  printf("Hello World");  
}

To compile the myprogram.c file to produce a compiler listing that includes the source code, enter:

xlc myprogram.c -qsource
The myprogram.lst file contains a source section with the code in the myprogram.c file:
>>>>> SOURCE SECTION <<<<<

1 | # include <stdio.h>
2 |
3 | int main ()
4 | {
5 |   printf("Hello World");
6 | }

Related information