[Openmp-commits] [PATCH] D57848: [OPENMP] fix build failure with GCC4.8

Kelvin Li via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Feb 6 14:31:42 PST 2019


kkwli0 created this revision.
kkwli0 added reviewers: protze.joachim, AndreyChurbanov, Hahnfeld, jlpeyton.
Herald added a subscriber: guansong.

The change in kmp-os.h in https://reviews.llvm.org/D56397 causes build failure with GCC4.8 as the build compiler.  This patch is to introduce a guard to get it compiled.

  /gsa/tlbgsa/home/k/l/kli/llvm-project/openmp/runtime/src/kmp_os.h:303:49: error: missing binary operator before token "("
   #if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
                                                   ^
  /gsa/tlbgsa/home/k/l/kli/llvm-project/openmp/runtime/src/kmp_os.h:305:26: error: missing binary operator before token "("
   #elif __has_cpp_attribute(clang::fallthrough)
                            ^
  /gsa/tlbgsa/home/k/l/kli/llvm-project/openmp/runtime/src/kmp_os.h:307:22: error: missing binary operator before token "("
   #elif __has_attribute(fallthough) || _GNUC_VER >= 700
                        ^


https://reviews.llvm.org/D57848

Files:
  openmp/runtime/src/kmp_os.h


Index: openmp/runtime/src/kmp_os.h
===================================================================
--- openmp/runtime/src/kmp_os.h
+++ openmp/runtime/src/kmp_os.h
@@ -300,12 +300,16 @@
 // case label is intentional and should not be diagnosed by a compiler
 //   Code from libcxx/include/__config
 // 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]]
-#elif __has_cpp_attribute(clang::fallthrough)
-#  define KMP_FALLTHROUGH() [[clang::fallthrough]]
-#elif __has_attribute(fallthough) || _GNUC_VER >= 700
-#  define KMP_FALLTHROUGH() __attribute__((__fallthrough__))
+#if __GNUC__ >= 5
+#  if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
+#    define KMP_FALLTHROUGH() [[fallthrough]]
+#  elif __has_cpp_attribute(clang::fallthrough)
+#    define KMP_FALLTHROUGH() [[clang::fallthrough]]
+#  elif __has_attribute(fallthough) || __GNUC__ >= 7
+#    define KMP_FALLTHROUGH() __attribute__((__fallthrough__))
+#  else
+#    define KMP_FALLTHROUGH() ((void)0)
+#  endif
 #else
 #  define KMP_FALLTHROUGH() ((void)0)
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57848.185640.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190206/91fae14d/attachment.bin>


More information about the Openmp-commits mailing list