[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

llvm-svn: 302638
This commit is contained in:
Siddharth Bhat 2017-05-10 11:51:44 +00:00
parent a7fcc00d51
commit 8ac5340a4e
1 changed files with 32 additions and 16 deletions

View File

@ -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();