Diagnostic message control

In IBM® XL C/C++ for AIX® 16.1.0 invoked by xlC or earlier releases, when the compiler encounters a programming error while you compile a C or C++ source program, it issues a diagnostic message to the standard error device or to a listing file. Diagnostic messages contain message numbers, message severity, message describing texts, and so on.

IBM Open XL C/C++ for AIX 17.1.2 adopts the Clang infrastructure. The diagnostic implementation in Clang is entirely different from that of the classic XL compilers. Clang provides an expressive set of diagnostic messages that do not have individual message numbers. In IBM Open XL C/C++ for AIX 17.1.2, use either of the following Clang option or pragma to suppress or control the generation of diagnostic messages:
  • Clang options in the form of -W[no-]
  • #pragma clang diagnostic ignored
Example
//t.c
#include <stdio.h>

void f(int x) { 
   printf("%f", x); 
}
Compile t.c with the following command:
ibm-clang t.c -c
The compiler issues the following warning message:
t.c:3:30: warning: format specifies type 'double' but the argument has type 'int' [-Wformat]
You can specify the -Wno-format option to suppress the warning message:
ibm-clang t.c -c -Wno-format
Then the compiler compiles the program with no warning messages issued.

Related information