]> granicus.if.org Git - graphviz/commit
smyrna Init: squash -Wincompatible-pointer-types
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 21 Mar 2022 15:09:55 +0000 (08:09 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 26 Mar 2022 05:31:13 +0000 (22:31 -0700)
commit87cc54644e40fccc0651b7fedc137b3dd02b4514
tree3b7ee78133484b49f4c6959c5b4303029f8ecc47
parent43c2d8da5dad0bccb53e52fef9804d77813a15c3
smyrna Init: squash -Wincompatible-pointer-types

OpenGL has an unorthodox API wherein the `gluTessCallback` function’s prototype
indicates it takes a `void(*)(void)`, but its docs¹ explain that the type
actually varies depending on the second argument. As a result, the compiler
(correctly) warns that some of these `gluTessCallback` calls are passing
function pointers that do not have the same ABI. Presumably this works out
because at the end of the day a function pointer is just some bits in C and the
OpenGL implementation branches on the `which` argument and invokes the pointer
correctly. But if OpenGL really wanted to discard type safety this way, it is
not clear to me why they did not make the function pointer argument a `void*`.
Anyway, this commit squashes the compiler warnings which emerge when enabling
this in the CMake build system, failing the build.

Gitlab: related to #1836

¹ This is not the authoritative source, but Microsoft’s docs for their
  implementation provide a good explanation.
  https://docs.microsoft.com/en-us/windows/win32/opengl/glutess
cmd/smyrna/polytess.c