Skip to content

Fix for warnings from Intel compiler on macOS.#48

Open
jeremygibbs wants to merge 1 commit intonemequ:masterfrom
jeremygibbs:warning_fix
Open

Fix for warnings from Intel compiler on macOS.#48
jeremygibbs wants to merge 1 commit intonemequ:masterfrom
jeremygibbs:warning_fix

Conversation

@jeremygibbs
Copy link

@jeremygibbs jeremygibbs commented Mar 4, 2021

On macOS using the latest Intel compilers, the code emits these warnings:

hedley.h(1261): warning #161: unrecognized #pragma
  HEDLEY_DIAGNOSTIC_PUSH
  ^

hedley.h(1287): warning #161: unrecognized #pragma
  HEDLEY_DIAGNOSTIC_POP

This seems to be because the Intel cxx compiler, icpc, defines the clang macro. I added an additional check on the relevant part of the code to make sure an Intel compiler is not being used. I wasn't sure if there was a better way you prefer, but the warnings go away with this small change and did not seem to affect compilation with a clang compiler.

@nemequ
Copy link
Owner

nemequ commented Sep 25, 2024

Do you still have access to icpc on macOS? I've added several icpc on Linux jobs to CI (in the dev branch), which work well, but I don't see a way to install icc/icpc classic on macOS during CI. Honestly, I don't even see a way to do it if I had a macOS machine (which I don't) without spending a ton of money.

I suspect that they've fixed this issue, though I've only been able to test back to version 2021.1.1, which I believe is the first version that was part of oneAPI (much easier to install in CI than the non-oneAPI verison, which I don't think is available for download anymore). If you can still reproduce this I'd love to fix it… instead of adding an exception for Intel, though, a better solution might be to reorder the Intel check to before the clang one:

diff --git a/hedley.h b/hedley.h
index ffb55f5..f92fd0e 100644
--- a/hedley.h
+++ b/hedley.h
@@ -753,12 +753,12 @@
 #if defined(HEDLEY_DIAGNOSTIC_POP)
 #  undef HEDLEY_DIAGNOSTIC_POP
 #endif
-#if defined(__clang__)
-#  define HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
-#  define HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
-#elif HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+#if HEDLEY_INTEL_VERSION_CHECK(13,0,0)
 #  define HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
 #  define HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
+#elif defined(__clang__)
+#  define HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
+#  define HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
 #elif HEDLEY_GCC_VERSION_CHECK(4,6,0)
 #  define HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
 #  define HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")

But I'd really like to be able to do a more complete test to make sure there are no similar issues for other macros.

FWIW, I've also added icx/icpx jobs (the new versions of icc/icpc which are based on clang), and they work well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants