Skip to content

Commit 91c32fd

Browse files
committed
Guard a feature that unsupported by old GCC
Summary: As @David2050 commented, changes introduced by https://reviews.llvm.org/D56397 break builds for older compilers which don't support `__has(_cpp)_attribute`. This is a fix for the break. Reviewers: protze.joachim, jlpeyton, AndreyChurbanov, Hahnfeld, david2050 Subscribers: openmp-commits, david2050 Tags: #openmp Differential Revision: https://reviews.llvm.org/D57851 llvm-svn: 353538
1 parent 3ce8112 commit 91c32fd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

openmp/runtime/src/kmp_os.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@
3939
#define KMP_MEM_CONS_MODEL KMP_MEM_CONS_VOLATILE
4040
#endif
4141

42+
#ifndef __has_cpp_attribute
43+
#define __has_cpp_attribute(x) 0
44+
#endif
45+
46+
#ifndef __has_attribute
47+
#define __has_attribute(x) 0
48+
#endif
49+
4250
/* ------------------------- Compiler recognition ---------------------- */
4351
#define KMP_COMPILER_ICC 0
4452
#define KMP_COMPILER_GCC 0
@@ -304,7 +312,7 @@ extern "C" {
304312
# define KMP_FALLTHROUGH() [[fallthrough]]
305313
#elif __has_cpp_attribute(clang::fallthrough)
306314
# define KMP_FALLTHROUGH() [[clang::fallthrough]]
307-
#elif __has_attribute(fallthough) || _GNUC_VER >= 700
315+
#elif __has_attribute(fallthough) || __GNUC__ >= 7
308316
# define KMP_FALLTHROUGH() __attribute__((__fallthrough__))
309317
#else
310318
# define KMP_FALLTHROUGH() ((void)0)

0 commit comments

Comments
 (0)