[OpenMP] Fix issue with directives used in a macro.
authorSamuel Antao <sfantao@us.ibm.com>
Thu, 20 Oct 2016 13:20:17 +0000 (13:20 +0000)
committerSamuel Antao <sfantao@us.ibm.com>
Thu, 20 Oct 2016 13:20:17 +0000 (13:20 +0000)
Summary:
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`.

Reviewers: tlwilmar, jlpeyton, AndreyChurbanov, Hahnfeld

Subscribers: Hahnfeld, openmp-commits

Differential Revision: https://reviews.llvm.org/D25823

llvm-svn: 284728

openmp/runtime/src/kmp_runtime.c

index 478ac61..240d1f3 100644 (file)
@@ -7482,16 +7482,17 @@ __kmp_aux_set_blocktime (int arg, kmp_info_t *thread, int tid)
 
     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
-                   ", 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
+    KF_TRACE(10, ("kmp_set_blocktime: T#%d(%d:%d), blocktime=%d, "
+                  "bt_intervals=%d, monitor_updates=%d\n",
+                  __kmp_gtid_from_tid(tid, thread->th.th_team),
+                  thread->th.th_team->t.t_id, tid, blocktime, bt_intervals,
+                  __kmp_monitor_wakeups));
+#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