Audspace PySound.cpp fails with clang11

Testing build with the upcoming clang v11 and I find that audspace fails. The fail comes from a numpy include so the fix could be in numpy’s court.

error: cannot initialize return object of type 'bool' with an rvalue of type 'nullptr_t'

Applies to 2.83.5 and master

Tried with numpy v1.16.5 and v1.19.1

I am on freebsd 12.1. using clang v11.0 rc1 - previous clang versions work.
Config build with clang11 by passing cmake options -DCMAKE_C_COMPILER=/usr/local/bin/clang11 -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++11

[ 77%] Building CXX object extern/audaspace/CMakeFiles/audaspace-py.dir/bindings/python/PySound.cpp.o
[ 78%] Built target cycles_render
[ 78%] Building CXX object source/blender/freestyle/CMakeFiles/bf_freestyle.dir/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp.o
[ 78%] Building CXX object source/blender/freestyle/CMakeFiles/bf_freestyle.dir/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp.o
/home/shane/Projects/blender-bits/blender-trunk-clang11/blender/extern/audaspace/bindings/python/PySound.cpp:2019:2: error: cannot initialize return object of type 'bool' with an rvalue of type 'nullptr_t'
/usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1531:151: note: expanded from macro 'import_array'
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NULL; } }
/usr/include/sys/_null.h:37:14: note: expanded from macro 'NULL'
#define NULL    nullptr
1 error generated.
--- extern/audaspace/CMakeFiles/audaspace-py.dir/bindings/python/PySound.cpp.o ---
*** [extern/audaspace/CMakeFiles/audaspace-py.dir/bindings/python/PySound.cpp.o] Error code 1

@neXyon, this seems like something to be fixed Audaspace.

The Macro that is causing the error is in numpy, so it needs to be fixed there …

My understanding is that the macro is expected to be used inside a function returning a pointer rather than a boolean. And that this was silently ignored by clang before, but now throws an error.

I don’t think that is something to be fixed in numpy? It’s not necessarily great API design, but that’s another matter.

Oh, you’re right! I fixed it.


Works for me.