Skip to content

Commit

Permalink
[OpenMP][libomp] Fix fallthrough attribute detection for Intel compilers
Browse files Browse the repository at this point in the history
icc does not properly detect lack of fallthrough attribute since it
defines __GNU__ > 7 and also icc's __has_cpp_attribute/__has_attribute
feature detectors do not properly detect the lack of fallthrough attribute.

Differential Revision: https://reviews.llvm.org/D126001
  • Loading branch information
jpeyton52 committed Jul 19, 2022
1 parent b7d3ba4 commit 28c8da2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openmp/runtime/src/kmp_os.h
Expand Up @@ -345,6 +345,9 @@ extern "C" {
// Use a function like macro to imply that it must be followed by a semicolon
#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
#define KMP_FALLTHROUGH() [[fallthrough]]
// icc cannot properly tell this attribute is absent so force off
#elif KMP_COMPILER_ICC
#define KMP_FALLTHROUGH() ((void)0)
#elif __has_cpp_attribute(clang::fallthrough)
#define KMP_FALLTHROUGH() [[clang::fallthrough]]
#elif __has_attribute(fallthrough) || __GNUC__ >= 7
Expand Down
3 changes: 3 additions & 0 deletions openmp/tools/archer/ompt-tsan.cpp
Expand Up @@ -42,6 +42,9 @@
// Use a function like macro to imply that it must be followed by a semicolon
#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
#define KMP_FALLTHROUGH() [[fallthrough]]
// icc cannot properly tell this attribute is absent so force off
#elif defined(__INTEL_COMPILER)
#define KMP_FALLTHROUGH() ((void)0)
#elif __has_cpp_attribute(clang::fallthrough)
#define KMP_FALLTHROUGH() [[clang::fallthrough]]
#elif __has_attribute(fallthrough) || __GNUC__ >= 7
Expand Down

0 comments on commit 28c8da2

Please sign in to comment.