-w

Pragma equivalent

None.

Purpose

Suppresses warning messages.

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.

//The content of file myprogram.C
#include <stdio.h>
int main()
 { char* greet = "hello world";
   printf("%d \n", greet);
   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", greet);
    ~~ ^~~~~
    %s
    1 warning generated."
  • If you compile myprogram.C with the -w option, the warning message is suppressed.
    xlC myprogram.C -w


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