pyopengl icon indicating copy to clipboard operation
pyopengl copied to clipboard

accelerate: Fix C type errors for GCC 14/Clang compatibility

Open fweimer-rh opened this issue 1 year ago • 2 comments

This fixes type errors that cause build failures with current compilers:

src/numpy_formathandler.c: In function ‘__pyx_f_17OpenGL_accelerate_19numpy_form
athandler_12NumpyHandler_c_asArray’:
src/numpy_formathandler.c:6412:43: error: passing argument 1 of ‘(int (*)(PyArrayObject *, PyObject *))*(PyArray_API + 832)’ from incompatible pointer type
 6412 |     __pyx_v_res = PyArray_FillWithScalar(((PyObject *)__pyx_v_working), __pyx_v_instance);
      |                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                           |
      |                                           PyObject * {aka struct _object *}
src/numpy_formathandler.c:6412:43: note: expected ‘PyArrayObject *’ {aka ‘struct tagPyArrayObject_fields *’} but argument is of type ‘PyObject *’ {aka ‘struct _object *’}
src/numpy_formathandler.c: In function ‘__pyx_pymod_exec_numpy_formathandler’:
src/numpy_formathandler.c:9799:3: error: returning ‘void *’ from a function with return type ‘int’ makes integer from pointer without a cast
 9799 |   import_array();
      |   ^~~~~~~~~~~~

Related to:

  • https://fedoraproject.org/wiki/Changes/PortingToModernC
  • https://fedoraproject.org/wiki/Toolchain/PortingToModernC

fweimer-rh avatar Jan 05 '24 07:01 fweimer-rh

Using this PR, I was able to get https://github.com/p5py/p5 installed from head on an M1 Mac.

% sw_vers
ProductName:		macOS
ProductVersion:		14.4
BuildVersion:		23E214
% clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

seanjensengrey avatar Jul 08 '24 07:07 seanjensengrey

@mcfletch the failures are in py27 on windows/vc++. Do you have an env to debug or can we turn those builds off?

seanjensengrey avatar Jul 10 '24 18:07 seanjensengrey