The Embarcadero “Classic” compiler method of disabling warnings was to use a pragma statement of the form:
#pragma warn -1234
This does NOT work with clang compiler.
In order to disable specific warnings you have to proceed as follows.
1) Remove the orginal #pragma warn line that was used for the classic compiler
2) Configure project|options|C++compiler|Advanced|Other options to include passing the value
-fdiagnostics-show-option
3) Compile the file which generates the unwanted warning
4) Make a note of the warning text that appears in the compiler “output” tab (eg [-Wdeprecated-declarations]
5) Add the following two lines prior to the code that generates the warning
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored “-Wdeprecated-declarations”
6) add the following line after the code generating the warning
#pragma GCC diagnostic pop // restore standard warnings
here’s an example from a code snippet I have used.
// #pragma -w6898 - GetVersionEx() is deprecated - hide warning (the original “Classic” compiler line)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
unsigned int GetProcessorType()
{
unsigned int Result;
bool IsWin95;
OSVERSIONINFO info;
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (GetVersionEx(&info)) {
if ((info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) &&
(info.dwMinorVersion == 0))
IsWin95 = true;
else
IsWin95 = false;
}
else {
IsWin95 = true; // default to safe (but uninformative) option
}
SYSTEM_INFO sys_info;
GetSystemInfo(&sys_info);
if (IsWin95)
Result = sys_info.dwProcessorType;
else
Result = sys_info.wProcessorLevel; // this is a simplification ! see help
// on SYSTEM_INFO for more information
return Result;
}
#pragma GCC diagnostic pop // restore warnings