Warnings in the C++ Front-End and GCC in General

Frederick W. Wheeler wheeler@ipl.rpi.edu
Fri Sep 11 06:45:00 GMT 1998

Perhaps egcs could provide the ability to control warnings in certain
regions of source code with a language extension instead of command
line arguments or pragmas.  I put a simple example below that
emphasises my desire to simply turn off all warnings until the
compiler is through with the system headers.

It is easier to use macros to manipulate a language extension to
control warnings than it is to manipulate pragmas.

Fred Wheeler

#if defined(__GNUC__) && ! defined(__STDC__)
#define WARNCTL(str) _gcc_warning_control(str)
#define WARNCTL(str)

WARNCTL("push")              // save current warning on/off status
WARNCTL("off all")           // turn off all warnings
#include <system_headers>
WARNCTL("pop")               // revert to original warning on/off status

int main()
  // ...

More information about the Gcc mailing list