Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

how to ignore deprecated warning

applemax82
Beginner
2,083 Views

hi,

The icc version that I use is 'icc (ICC) 14.0.2 20140120' in linux.

Some elements in some structs are declared as deprecated. Some functions will use those deprecated elements.

For example, __attribute__((deprecated)) int *val;

 

If gcc is used, the following preprocessor lines can turn off and on 'deprecated warning'

#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

#pragma GCC diagnostic warning "-Wdeprecated-declarations"

 

If icc is used. how to turn off and on 'deprecated warning' in source code, but not in compiling flags.

 

Thanks!

Regards

 

Andrew

 

 

0 Kudos
4 Replies
Judith_W_Intel
Employee
2,083 Views

 

You could use pragma warning with the diagnostic number instead, i.e.:

#pragma warning (disable:1478)

void foo() {
  val = 0; // uses deprecated varable
}

#pragma warning (enable:1478)
 

Judy

0 Kudos
applemax82
Beginner
2,083 Views

Thanks for your help.

I have another question. Is there some micro definition with which to differentiate between GCC and ICC compiler?

Thanks

Andrew

0 Kudos
Judith_W_Intel
Employee
2,083 Views

 

Yes.

__INTEL_COMPILER

Judy

0 Kudos
nemequ
New Contributor I
2,083 Views

You may want to bookmark https://sourceforge.net/p/predef/wiki/Home/.  It's a great resource for answering that type of question (the second one, not the first).  Second only to https://graphics.stanford.edu/~seander/bithacks.html on my list of favorite C/C++ resources (though the former is generally slightly more useful).

0 Kudos
Reply