Purpose
Warns of possible problems with string input
and output format specifications.
Functions
diagnosed are printf, scanf, strftime, strfmon family
functions and functions marked with format attributes.
Syntax
.-noformat-----------------------.
>>- -q--+-format--+--------------------+-+---------------------><
| .-:-----------. |
| V .-all-----. | |
'-=----+-noall---+-+-'
+-exarg---+
+-noexarg-+
+-nlt-----+
+-nonlt---+
+-sec-----+
+-nosec---+
+-y2k-----+
+-noy2k---+
+-zln-----+
'-nozln---'
Parameters
- all | noall
- Enables or disables all format diagnostic messages.
- exarg | noexarg
- Warns if excess arguments appear in printf and scanf style
function calls.
- nlt | nonlt
- Warns if a format string is not a string literal, unless the format
function takes its format arguments as a va_list.
- sec | nosec
- Warns of possible security problems in use of format functions.
- y2k | noy2k
- Warns of strftime formats that produce a 2-digit
year.
- zln | nozln
- Warns of zero-length formats.
Specifying
-qformat with no suboptions is
equivalent to
-qformat=all.
-qnoformat is equivalent
to -qformat=noall.
Examples
To enable all format string diagnostics,
enter either of the following:
xlc myprogram.c -qformat=all
xlc myprogram.c -qformat
To
enable all format diagnostic checking except that for y2k date diagnostics,
enter:
xlc myprogram.c -qformat=all:noy2k