- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We typically compile our codes with -Wall, but we have to selectively disable warnings around the include statements that import headers from third-party libraries which we have no direct control over, so that the warnings from the third-party headers do not pollute our compiler outputs.
In our code, we have used two macros for that task, which looked like this in the case of the "classic" Intel C++ compiler:
#define DISABLE_WARNINGS_MACRO _Pragma("warning(push,0)") \
_Pragma("warning(disable:177)") \
_Pragma("warning(disable:2259)") \
_Pragma("warning(disable:1478)") \
_Pragma("warning(disable:1599)") \
_Pragma("warning(disable:1944)") \
_Pragma("warning(disable:3280)") \
_Pragma("warning(disable:858)")
#define RESTORE_WARNINGS_MACRO _Pragma("warning(pop)")
And the typical use case looked something like this:
#include <iostream>
DISABLE_WARNINGS_MACRO
#include <thirdparty/somelibrary/nastyheader.h>
RESTURE_WARNINGS_MACRO
...
According to the list of pragmas supported by ICPX the warning pragma is still supported. However, according to the Porting Guide for ICC Users to DPCPP or ICX it says that
However, ICX does not have numbered diagnostic message, instead, it prints a hint about which diagnostic option can be used to control the diagnostic.
And that's exactly what happens, I now only get the warning command line options in the output, e.g.:
thirdparty/boost_1_80_0/boost/type_traits/has_nothrow_copy.hpp:36:89: warning: builtin __has_nothrow_copy is deprecated; use __is_nothrow_constructible instead [-Wdeprecated-builtins]
36 | template <class T> struct has_nothrow_copy_constructor : public integral_constant<bool, BOOST_HAS_NOTHROW_COPY(T)>{};
| ^
thirdparty/boost_1_80_0/boost/type_traits/intrinsics.hpp:202:41: note: expanded from macro 'BOOST_HAS_NOTHROW_COPY'
202 | # define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value && is_copy_constructible<T>::value)
| ^
So, my question should be obvious by now: What arguments do I have to pass to the warning pragma to disable a specific warning if the compiler output does not emit the warning numbers anymore?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've escalated your question to our internal team for further investigation. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I have just figured out (by trial-&-error) that apparently the clang-style diagnostics pragmas seem to work with the icpx compiler, which would make sense, since it is based on LLVM. So for example one could use
#define DISABLE_WARNINGS _Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wall\"") \
_Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") \
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
_Pragma("clang diagnostic ignored \"-Wunused-parameter\"") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-builtins\"") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-copy-with-user-provided-dtor\"")
#define RESTORE_WARNINGS _Pragma("clang diagnostic pop")
to turn off individual warnings.
So it seems that this is primarily a documentation issue of the pragmas documentation of the ICPX compiler, which still contains the old numbered warnings pragmas, which were similar to the style used by Microsoft's compilers.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page