cpp11
cpp11 copied to clipboard
Use Intel specific pragma to disable unknown attribute warning
See https://github.com/r-lib/systemfonts/issues/98 for the original issue. That issue turned out to be a different error, but this PR still silences the warning that appeared there. The original issue poster confirmed that this PR fixed the warning.
On the Intel compiler (icpc), it looks like our pragmas to disable unknown attribute warnings are not working, i.e. in the original issue the user saw:
In file included from caches.cpp(1):
caches.h(22): warning #3924: attribute namespace "cpp11" is unrecognized
[[cpp11::init]]
On the Intel compiler, it looks like you disable warnings using the diagnostic number instead, in this case that is the #3924 you see in the warning output above. The following two resources support this. In particular, the second resource disables the exact warning that we are also trying to disable, so it serves as a good reference:
- https://community.intel.com/t5/Intel-C-Compiler/how-to-ignore-deprecated-warning/td-p/1072843
- https://github.com/softwareQinc/qpp/blob/55b8184b98559233d9fb439ba78a517893380f89/include/qpp.h#L42-L62
To detect the Intel compiler, we need to look for __INTEL_COMPILER. But it seems like the Intel compiler also defines __GNUC__, so I've tweaked the defines a little to reflect that. See the GCC C/C++ and Intel C/C++ sections of the following resource:
- https://sourceforge.net/p/predef/wiki/Compilers/