You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the differences between using -I vs -isystem is that headers found through -isystem will not emit warnings in user code. This is convenient when user code compiles with stricter warnings that might trigger a warning in nvtx header code, but it requires users to know to use -isystem (or a cmake SYSTEM include).
A more robust option that doesn't require people to know the difference between -I and -isystem is to use #pragma system_header on the top of every NVTX header to automatically make it as if the header were found via -isystem and silence any warnings.
For context, we did the same thing with CCCL headers here: NVIDIA/cccl#527
This would look something like:
// Check for GCC (probably needs version checks)
#if defined(__GNUC__) && !defined(__clang__)
#define NVTX3_IMPLICIT_SYSTEM_HEADER _Pragma("GCC system_header")
// Check for Clang (probably needs version checks)
#elif defined(__clang__)
#define NVTX3_IMPLICIT_SYSTEM_HEADER _Pragma("clang system_header")
// Check for MSVC (probably needs version checks)
#elif defined(_MSC_VER)
#define NVTX3_IMPLICIT_SYSTEM_HEADER __pragma(system_header)
// If none of the known compilers are detected, define it as an empty statement
#else
#define NVTX3_IMPLICIT_SYSTEM_HEADER
#endif
// If the disable flag is set, define it as an empty statement
#else
#define NVTX3_IMPLICIT_SYSTEM_HEADER
#endif
The text was updated successfully, but these errors were encountered:
One of the differences between using
-I
vs-isystem
is that headers found through-isystem
will not emit warnings in user code. This is convenient when user code compiles with stricter warnings that might trigger a warning in nvtx header code, but it requires users to know to use-isystem
(or a cmakeSYSTEM
include).A more robust option that doesn't require people to know the difference between
-I
and-isystem
is to use#pragma system_header
on the top of every NVTX header to automatically make it as if the header were found via-isystem
and silence any warnings.For context, we did the same thing with CCCL headers here: NVIDIA/cccl#527
This would look something like:
The text was updated successfully, but these errors were encountered: