Community
cancel
Showing results for 
Search instead for 
Did you mean: 
meldaproduction
Beginner
136 Views

Intel C++ Compiler warnings on Windows with MSVC

Hi,

I'm trying the intel compiler (normally use MSVC 2013), and I get lots of warnings, pretty always. I added "/Qvc12", but that doesn't seem to make difference (/Qvc10 made the compiler dysfunctional). Any ideas? Here are the warnings I always get:

 

  C:/Program Files (x86)/Microsoft Visual Studio 12.0/Vc/include/stddef.h(29): war
ning #2157: NULL defined to 0 (type is integer not pointer)
  #define NULL    0
                   ^

C:/Program Files (x86)/Windows Kits/8.1/Include/um/winnt.h(5756): warning #161:
unrecognized #pragma
  #pragma prefast(push)
          ^

C:/Program Files (x86)/Windows Kits/8.1/Include/um/winnt.h(5758): warning #161:
unrecognized #pragma
  #pragma prefast(disable: 6001 28113, "The barrier variable is accessed only to
 create a side effect.")
          ^

C:/Program Files (x86)/Windows Kits/8.1/Include/um/winnt.h(5773): warning #161:
unrecognized #pragma
  #pragma prefast(pop)
          ^

C:/Program Files (x86)/Windows Kits/8.1/Include/um/winbase.h(8816): warning #319
9: "defined" is always false in a macro expansion in Microsoft mode
  #if MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS  /* { *
/
      ^

C:/Program Files (x86)/Windows Kits/8.1/Include/um/shlobj.h(972): warning #2650:
 attributes ignored here
  DECLSPEC_DEPRECATED SHSTDAPI    ILLoadFromStream(_In_ IStream *pstm, _Inout_ P
IDLIST_RELATIVE *pidl);
  ^

C:/Program Files (x86)/Microsoft Visual Studio 12.0/Vc/include/xatomic0.h(78): w
arning #864: extern inline function "std::_Atomic_compare_exchange_weak_4" was r
eferenced but not defined
  inline int _Atomic_compare_exchange_weak_4(
             ^

C:/Program Files (x86)/Microsoft Visual Studio 12.0/Vc/include/xatomic0.h(80): w
arning #864: extern inline function "std::_Atomic_fetch_add_4" was referenced bu
t not defined
  inline _Uint4_t _Atomic_fetch_add_4(
                  ^

C:/Program Files (x86)/Microsoft Visual Studio 12.0/Vc/include/xatomic0.h(82): w
arning #864: extern inline function "std::_Atomic_fetch_sub_4" was referenced bu
t not defined
  inline _Uint4_t _Atomic_fetch_sub_4(
                  ^

I could five with it, but it honestly sucks, no way to find some real stuff in that mess.

Thanks in advance.

0 Kudos
4 Replies
TimP
Black Belt
136 Views

Are you trying to use VS2012 headers but link against VS2010, which hadn't yet implemented any Atomic_fetch ?  ICL doesn't have its own implementation of C++11 std library; it relies on consistent use of a Visual Studio.

I don't think it makes sense to set a Qvc option which conflicts with the ICL setup you use, which will default to one of the VS versions you integrated with ICL at installation.

If your source code has specific requirements for VS2013, you will need an ICL version recent enough to integrate with it.  I still wouldn't expect pragma prefast to work, not only because ICL has different warning message numbers.

meldaproduction
Beginner
136 Views

Tim Prince wrote:

Are you trying to use VS2012 headers but link against VS2010, which hadn't yet implemented any Atomic_fetch ?  ICL doesn't have its own implementation of C++11 std library; it relies on consistent use of a Visual Studio.

I don't think it makes sense to set a Qvc option which conflicts with the ICL setup you use, which will default to one of the VS versions you integrated with ICL at installation.

If your source code has specific requirements for VS2013, you will need an ICL version recent enough to integrate with it.  I still wouldn't expect pragma prefast to work, not only because ICL has different warning message numbers.

Well, I'm using the newest IC, newest VC2013. I'm invoking the compiler manually (same with MSVC), but with no specific "additional" features or anything, basically plain old C++ (not even C++11), no advanced system settings, nothing...

 

Judith_W_Intel
Employee
136 Views

 

Warnings should be disabled if the compiling is processing system headers. Did you include the headers explicitly as non-system headers with the /I option yourself? What does your command line look like?

As Tim points out the /Qvc12 should not unnecessary since the icl driver will figure out which version of cl.exe you have on your system and set this automagically.

Judy

Brower__David
Beginner
136 Views

Hi, we use ICL as our production C compiler on windows

A third party header we include everywhere produces the warning

.../cictype.h(167): warning #2157: NULL defined to 0 (type is integer not pointer)
  #define NULL 0
                ^

I don't understand why this produces a warning at all -- I have long understood the literal '0' to be a completely legal definition for NULL.   This corresponds to the discussion at http://stackoverflow.com/questions/9894013/is-null-always-zero-in-c, where we see:

 6.3.2.3 of the C99 standard says

An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant) If a null pointer constant is converted to a pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal to a pointer to any object or function.

§ 7.17 also says

[...] NULL which expands to an implementation-defined null pointer constant [...]

The address of the NULL pointer might be different from 0, while it will behave like it was in most cases.

(This should be the same as in older C standards, which I don't have at hand right now

 

I suspect the warning is C++ thinking that isn't correct for C compilation.

Is the warning specific to NULL, so that suppressing it is safe, or is it a general warning about integers in contexts that suggest pointers should be used?

thx,

-dB