[Openmp-commits] [PATCH] D25823: [OpenMP] Fix issue with directives used in a macro.

Samuel Antao via Openmp-commits openmp-commits at lists.llvm.org
Thu Oct 20 05:29:45 PDT 2016


sfantao created this revision.
sfantao added reviewers: tlwilmar, jlpeyton, AndreyChurbanov.
sfantao added a subscriber: openmp-commits.

If directives are used in a macro, clang complains with:

  src/projects/openmp/runtime/src/kmp_runtime.c:7486:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
  #if KMP_USE_MONITOR

This patch fixes two occurrences of the issue in `kmp_runtime.cpp`.


https://reviews.llvm.org/D25823

Files:
  runtime/src/kmp_runtime.c


Index: runtime/src/kmp_runtime.c
===================================================================
--- runtime/src/kmp_runtime.c
+++ runtime/src/kmp_runtime.c
@@ -7482,16 +7482,19 @@
 
     set__bt_set_team( thread->th.th_team, tid, bt_set );
     set__bt_set_team( thread->th.th_serial_team, 0, bt_set );
-    KF_TRACE(10, ( "kmp_set_blocktime: T#%d(%d:%d), blocktime=%d"
 #if KMP_USE_MONITOR
+    KF_TRACE(10, ( "kmp_set_blocktime: T#%d(%d:%d), blocktime=%d"
                    ", bt_intervals=%d, monitor_updates=%d"
-#endif
                    "\n",
                    __kmp_gtid_from_tid(tid, thread->th.th_team), thread->th.th_team->t.t_id, tid, blocktime
-#if KMP_USE_MONITOR
                    , bt_intervals, __kmp_monitor_wakeups
-#endif
                  ) );
+#else
+    KF_TRACE(10, ( "kmp_set_blocktime: T#%d(%d:%d), blocktime=%d"
+                   "\n",
+                   __kmp_gtid_from_tid(tid, thread->th.th_team), thread->th.th_team->t.t_id, tid, blocktime
+                 ) );
+#endif
 }
 
 void


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25823.75288.patch
Type: text/x-patch
Size: 1027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20161020/6b570b50/attachment.bin>


More information about the Openmp-commits mailing list