Reusing GNU C/C++ compiler options with gxlc and gxlc++

Each of the gxlc and gxlc++ utilities accepts GNU C or C++ compiler options and translates them into comparable XL C/C++ options. Both utilities use the XL C/C++ options to create an xlc or xlC invocation command, which they then use to invoke the compiler. These utilities are provided to facilitate the reuse of make files created for applications previously developed with GNU C/C++. However, to fully exploit the capabilities of XL C/C++, it is recommended that you use the XL C/C++ invocation commands and their associated options.

The actions of gxlc and gxlc++ are controlled by the configuration file gxlc.cfg. The GNU C/C++ options that have an XL C or XL C++ counterpart are shown in this file. Not every GNU option has a corresponding XL C/C++ option. gxlc and gxlc++ return warnings for input options that were not translated.

The gxlc and gxlc++ option mappings are modifiable. For information on adding to or editing the gxlc and gxlc++ configuration file, see Configuring the option mapping.

Example

To use the GCC -ansi option to compile the C version of the Hello World program, you can use:

gxlc -ansi hello.c

which translates into:

xlc -F:c89 hello.c

This command is then used to invoke the XL C compiler.

gxlc and gxlc++ return codes

Like other invocation commands, gxlc and gxlc++ return output, such as listings, diagnostic messages related to the compilation, warnings related to unsuccessful translation of GNU options, and return codes. If gxlc or gxlc++ cannot successfully call the compiler, it sets the return code to one of the following values:

40
A GCC or g++ option error or unrecoverable error has been detected.
255
An error has been detected while the process was running.