spnda / fastgltf

A modern C++17 glTF 2.0 library focused on speed, correctness, and usability
https://fastgltf.readthedocs.io/v0.8.x/
MIT License
315 stars 48 forks source link

clang + Apple M1 compiler warnings #43

Closed t0rakka closed 10 months ago

t0rakka commented 10 months ago

[353/354] Compiling C++ object libmango-import3d.0.1.2.dylib.p/.._source_external_fastgltf_src_fastgltf.cpp.o ../../source/external/fastgltf/src/fastgltf.cpp:2709:41: warning: lambda capture 'this' is not used [-Wunused-lambda-capture] auto parseAttributes = [this](dom::object& object, decltype(primitive.attributes)& attributes) -> auto { ^~~~ ../../source/external/fastgltf/src/fastgltf.cpp:2928:45: warning: lambda capture 'this' is not used [-Wunused-lambda-capture] auto parseAttributes = [this](dom::object& object, decltype(node.instancingAttributes)& attributes) -> auto { ^~~~ ../../source/external/fastgltf/src/fastgltf.cpp:130:24: warning: unused variable 'crcFunction' [-Wunused-variable] static CRCFunction crcFunction = crc32c;

The lambda capture warnings only appear on Apple M1 + clang, compiles clean on Intel clang on macOS, GCC + Linux, MSVC and so on.

Compiler version information:

Apple clang version 12.0.5 (clang-1205.0.22.11) Target: arm64-apple-darwin23.2.0 Thread model: posix

spnda commented 10 months ago

Ah, this issue comes from having FASTGLTF_DISABLE_CUSTOM_MEMORY_POOL = 1, which gets automatically set on older compilers which don't support it. In that case nothing from this is used in the lambda. crcFunction seems to just not be used anymore and I forgot to remove it.