[Openmp-commits] [PATCH] D45528: [OpenMP] Remove compilation warning when using clang to compile bc files.

George Rokos via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Apr 12 13:33:50 PDT 2018


grokos added inline comments.


================
Comment at: libomptarget/deviceRTLs/nvptx/src/counter_groupi.h:48
 INLINE void omptarget_nvptx_CounterGroup::Complete(Counter &priv, Counter n) {
-  PRINT(LD_SYNCD, "complete priv counter 0x%llx with val %lld->%lld (+%d)\n",
+  PRINT(LD_SYNCD, "complete priv counter 0x%llx with val %lld->%lld (+%lld)\n",
         P64(&priv), P64(priv), P64(priv + n), n);
----------------
The `P64` macro casts its argument to an `unsigned long long`. Use `%llu` instead of `%lld`.


================
Comment at: libomptarget/deviceRTLs/nvptx/src/libcall.cu:195
                 "task descr %s %d: %s, in par %d, dyn %d, rt sched %d,"
-                " chunk %lld; tid %d, tnum %d, nthreads %d\n",
+                " chunk %lu; tid %d, tnum %d, nthreads %d\n",
                 "ancestor", steps,
----------------
Chunk is defined as `unsigned long long`, shouldn't the modifier be `%llu`?


================
Comment at: libomptarget/deviceRTLs/nvptx/src/libcall.cu:264
     currTaskDescr->RuntimeChunkSize() = modifier;
-    PRINT(LD_IOD, "omp_set_schedule did set sched %d & modif %d\n",
+    PRINT(LD_IOD, "omp_set_schedule did set sched %d & modif %lu\n",
           (int)currTaskDescr->GetRuntimeSched(),
----------------
Same here, `%llu`?


================
Comment at: libomptarget/deviceRTLs/nvptx/src/loop.cu:304
       PRINT(LD_LOOP,
-            "dispatch init (static chunk) : num threads = %d, ub = %lld,"
+            "dispatch init (static chunk) : num threads = %d, ub = %ld,"
             "next lower bound = %lld, stride = %lld\n",
----------------
For consistency with the rest of libomptarget, use the `PRId64` macro to print an `int64_t`:
```
"dispatch init (static chunk) : num threads = %d, ub = %" PRId64 ","
```


================
Comment at: libomptarget/deviceRTLs/nvptx/src/loop.cu:325
       PRINT(LD_LOOP,
-            "dispatch init (static nochunk) : num threads = %d, ub = %lld,"
+            "dispatch init (static nochunk) : num threads = %d, ub = %ld,"
             "next lower bound = %lld, stride = %lld\n",
----------------
`PRId64`


================
Comment at: libomptarget/deviceRTLs/nvptx/src/loop.cu:341
       PRINT(LD_LOOP,
-            "dispatch init (dyn) : num threads = %d, ub = %lld, chunk %lld, "
+            "dispatch init (dyn) : num threads = %d, ub = %ld, chunk %ld, "
             "events number = %lld\n",
----------------
Same here, `PRId64` for ub, `%llu` for chunk.


================
Comment at: libomptarget/deviceRTLs/nvptx/src/supporti.h:180-181
   void *ptr = malloc(size);
-  PRINT(LD_MEM, "malloc data of size %d for %s: 0x%llx\n", size, msg, P64(ptr));
-  ASSERT(LT_SAFETY, ptr, "failed to allocate %d bytes for %s\n", size, msg);
+  PRINT(LD_MEM, "malloc data of size %ld for %s: 0x%llx\n", size, msg, P64(ptr));
+  ASSERT(LT_SAFETY, ptr, "failed to allocate %ld bytes for %s\n", size, msg);
   return ptr;
----------------
`size_t` can be printed in a portable way with the `%zu` modifier. For the nvptx RTL this is not a problem, but in general `size_t` is not guaranteed to be a long int, so usage of `%zu` is preferred. This is what we use in the rest of libomptarget. Can you use `%zu` here as well for consistency?


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D45528





More information about the Openmp-commits mailing list