[polly] r302638 - [GPUJIT] Disabled gcc's -Wpedantic for use of dlsym

Siddharth Bhat via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 04:51:45 PDT 2017


Author: bollu
Date: Wed May 10 06:51:44 2017
New Revision: 302638

URL: http://llvm.org/viewvc/llvm-project?rev=302638&view=rev
Log:
[GPUJIT] Disabled gcc's -Wpedantic for use of dlsym

GCC's ISO C standard does not strictly define the bahavior of converting
a `void*` pointer to a function pointer, but dlsym's POSIX standard
does.

The retrieval of function pointers through dlsym in this case
generates an unnecessary amount of warnings for every API function
assignment, bloating the output.

This patch removes GCC's `-Wpedantic` flag for retrieval and assignment
of these functions. This simplifies debugging the output of GPUJIT.

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

Modified:
    polly/trunk/tools/GPURuntime/GPUJIT.c

Modified: polly/trunk/tools/GPURuntime/GPUJIT.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/tools/GPURuntime/GPUJIT.c?rev=302638&r1=302637&r2=302638&view=diff
==============================================================================
--- polly/trunk/tools/GPURuntime/GPUJIT.c (original)
+++ polly/trunk/tools/GPURuntime/GPUJIT.c Wed May 10 06:51:44 2017
@@ -218,18 +218,25 @@ static int initialDeviceAPILibrariesCL()
   return 1;
 }
 
+/* Get function pointer to OpenCL Runtime API.
+ *
+ * Note that compilers conforming to the ISO C standard are required to
+ * generate a warning if a conversion from a void * pointer to a function
+ * pointer is attempted as in the following statements. The warning
+ * of this kind of cast may not be emitted by clang and new versions of gcc
+ * as it is valid on POSIX 2008. For compilers required to generate a warning,
+ * we temporarily disable -Wpedantic, to avoid bloating the output with
+ * unnecessary warnings.
+ *
+ * Reference:
+ * http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
 static int initialDeviceAPIsCL() {
   if (initialDeviceAPILibrariesCL() == 0)
     return 0;
 
-  /* Get function pointer to OpenCL Runtime API.
-   *
-   * Note that compilers conforming to the ISO C standard are required to
-   * generate a warning if a conversion from a void * pointer to a function
-   * pointer is attempted as in the following statements. The warning
-   * of this kind of cast may not be emitted by clang and new versions of gcc
-   * as it is valid on POSIX 2008.
-   */
   clGetPlatformIDsFcnPtr =
       (clGetPlatformIDsFcnTy *)getAPIHandleCL(HandleOpenCL, "clGetPlatformIDs");
 
@@ -294,6 +301,7 @@ static int initialDeviceAPIsCL() {
 
   return 1;
 }
+#pragma GCC diagnostic pop
 
 /* Context and Device. */
 static PollyGPUContext *GlobalContext = NULL;
@@ -999,18 +1007,25 @@ static int initialDeviceAPILibrariesCUDA
   return 1;
 }
 
+/* Get function pointer to CUDA Driver APIs.
+ *
+ * Note that compilers conforming to the ISO C standard are required to
+ * generate a warning if a conversion from a void * pointer to a function
+ * pointer is attempted as in the following statements. The warning
+ * of this kind of cast may not be emitted by clang and new versions of gcc
+ * as it is valid on POSIX 2008. For compilers required to generate a warning,
+ * we temporarily disable -Wpedantic, to avoid bloating the output with
+ * unnecessary warnings.
+ *
+ * Reference:
+ * http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
 static int initialDeviceAPIsCUDA() {
   if (initialDeviceAPILibrariesCUDA() == 0)
     return 0;
 
-  /* Get function pointer to CUDA Driver APIs.
-   *
-   * Note that compilers conforming to the ISO C standard are required to
-   * generate a warning if a conversion from a void * pointer to a function
-   * pointer is attempted as in the following statements. The warning
-   * of this kind of cast may not be emitted by clang and new versions of gcc
-   * as it is valid on POSIX 2008.
-   */
   CuLaunchKernelFcnPtr =
       (CuLaunchKernelFcnTy *)getAPIHandleCUDA(HandleCuda, "cuLaunchKernel");
 
@@ -1080,6 +1095,7 @@ static int initialDeviceAPIsCUDA() {
 
   return 1;
 }
+#pragma GCC diagnostic pop
 
 static PollyGPUContext *initContextCUDA() {
   dump_function();




More information about the llvm-commits mailing list