Error checking and debugging

The options in this category allow you to detect and correct problems in your source code. In some cases, these options can alter your object code, increase your compile time, or introduce runtime checking that can slow down the execution of your application. The option descriptions indicate how extra checking can impact performance.

To control the amount and type of information you receive regarding the behavior and performance of your application, consult the options in Listings, messages, and compiler information.

For information on debugging optimized code, see the XL C/C++ Optimization and Programming Guide.

Table 1. Error checking and debugging options
Option name Description
-### (-#) (pound sign)

Previews the compilation steps specified on the command line, without actually invoking any compiler components.

-qcheck

Generates code that performs certain types of runtime checking.

-ftrapping-math (-qflttrap)

Determines what types of floating-point exceptions to detect at run time.

-qfullpath

When used with the -g or -qlinedebug option, this option records the full, or absolute, path names of source and include files in object files compiled with debugging information, so that debugging tools can correctly locate the source files.

-g

Generates debugging information for use by a symbolic debugger, and makes the program state available to the debugging session at selected source locations.

-Werror (-qhalt)

Stops compilation before producing any object, executable, or assembler source files if the maximum severity of compile-time messages equals or exceeds the severity you specify.

-qinitauto

Initializes uninitialized automatic variables to a specific value, for debugging purposes.

-qkeepparm

When used with -O2 or higher optimization, specifies whether procedure parameters are stored on the stack.

-qlinedebug

Generates only line number and source file name information for a debugger.

-fsyntax-only (-qsyntaxonly) (C only)

Performs syntax checking without generating an object file.

-Wunsupported-xl-macro

Checks whether any unsupported XL macro is used.

Options to Control Diagnostic Messages Formatting

The following options are supported by XL C/C++ for GCC compatibility. For details about these options, see the GNU Compiler Collection online documentation at http://gcc.gnu.org/onlinedocs/.
  • -fmessage-length
  • -fno-diagnostics-show-option
  • -fno-diagnostics-show-caret
  • -fshow-column
  • -fshow-source-location
  • -fcolor-diagnostics
  • -fansi-escape-codes
  • -fdiagnostics-format=[clang|msvc|vi]
  • -fdiagnostics-show-name
  • -fdiagnostic-show-category=[none|id|name]
  • -fdiagnostics-fixit-info
  • -fdiagnostics-print-source-range-info
  • -fdiagnostic-parsable-fixits
  • -fno-elide-type
  • -fdiagnostic-show-template-tree
  • -pedantic
  • -pedantic-errors
  • -Wextra-tokens
  • -Wambiguous-member-template
  • -Wbind-to-temporary-copy

Options to Request or Suppress Warnings

The following options are supported by XL C/C++ for GCC compatibility. For details about these options, see the GNU Compiler Collection online documentation at http://gcc.gnu.org/onlinedocs/.
  • -w
  • -Wfoo
  • -Weverything
  • -Werror=foo
  • -Wfatal-errors
  • -Wpedantic -pedantic -pedantic-errors
  • -Wall
  • -Wchar-subscripts
  • -Wcomment
  • -Wformat
  • -Wformat=n
  • -Wformat=2
  • -Wno-format
  • -Wno-format-extra-args
  • -Wno-format-zero-length
  • -Wformat-nonliteral
  • -Wformat-security
  • -Wformat-y2k
  • -Wnonnull
  • -Wimplicit-int
  • -Wimplicit-function-declaration
  • -Wimplicit
  • -Wignored-qualifiers
  • -Wmain
  • -Wmissing-braces
  • -Wparantheses
  • -Wsequence-point
  • -Wno-return-local-addr
  • -Wreturn-type
  • -Wswitch
  • -Wtrigraphs
  • -Wunused-label
  • -Wunused-parameter
  • -Wno-unused-result
  • -Wunused-variable
  • -Wunused-value
  • -Wunused
  • -Wuninitialized
  • -Wunknown-pragmas
  • -Wno-division-by-zero
  • -Wsystem-headers
  • -Wfloat-equal
  • -Wundef
  • -Wno-endif-labels
  • -Wshadow
  • -Wpointer-arith
  • -Wtype-limits
  • -Wc++11-compat
  • -Wtautological-compare
  • -Wbad-function-cast
  • -Wcast-align
  • -Wwrite-strings
  • -Wconversion
  • -Wno-int-conversion
  • -Wempty-body
  • -Wenum-compare
  • -Wsign-compare
  • -Wsign-conversion
  • -Wsizeof-pointer-memaccess
  • -Wno-attributes
  • -Wno-builtin-macro-redefined
  • -Wmissing-prototypes
  • -Wmissing-field-initializers
  • -Wno-multichar
  • -Wno-deprecated
  • -Wno-deprecated-declarations
  • -Wno-invalid-offsetof
  • -Wpadded
  • -Wno-int-to-pointer-cast
  • -Wvariadic-macros
  • -Wvarargs
  • -Wvla
  • -Wpointer-sign
  • -Woverlength-strings
  • -Wdelete-non-virtual-dtor
  • -Wnon-virtual-dtor
  • -Wnarrowing
  • -Wreorder
  • -Woverloaded-virtual
  • -Wno-virtual-move-assign
  • -fsyntax-only


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us