-w

Pragma equivalent

None.

Purpose

Suppresses warning messages.

This option is equivalent to specifying -qflag=e : e.

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -w---------------------------------------------------------><

Defaults

All informational and warning messages are reported.

Usage

Informational and warning messages that supply additional information to a severe error are not disabled by this option.

Predefined macros

None.

Examples

Consider the file myprogram.c.

#include <stdio.h>
int main()
 { char* greeting = "hello world";
   printf("%d \n", greeting);
   return 0;
}
  • If you compile myprogram.c without the -w option, the compiler issues a warning message.
    xlC myprogram.c
    Output:
    "5:18: warning: format specifies type 'int' but the argument has type 'char *' [-Wformat]
    printf("%d \n", greeting);
    ~~ ^~~~~
    %s
    1 warning generated."
  • If you compile myprogram.c with the -w option, the warning message is suppressed.
    xlC myprogram.c -w

Related information



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