flatbuffers
flatbuffers copied to clipboard
[c++ 23.5.26] Compiling with clang -Wshorten-64-to-32 produces a mountain of warnings
We have -Wshorten-64-to-32 enabled to detect portability problems. After adding flatbuffers to our project, we now see a bunch of new warnings in the flatbuffers header files. Flatbuffers should compile cleanly with this warning enabled.
C/C++: flatbuffers/include/flatbuffers/verifier.h:265:23: warning: implicit conversion loses integer precision: 'unsigned long long' to 'size_t' (aka 'unsigned int') [-Wshorten-64-to-32]
C/C++: flatbuffers/include/flatbuffers/verifier.h:327:10: note: in instantiation of function template specialization 'flatbuffers::Verifier::VerifyOffset<unsigned long long, long long>' requested here
C/C++: flatbuffers/include/flatbuffers/verifier.h:266:12: warning: implicit conversion loses integer precision: 'const unsigned long long' to 'size_t' (aka 'unsigned int') [-Wshorten-64-to-32]
...
C/C++: In file included from flatbuffers/include/flatbuffers/flatbuffers.h:29:
C/C++: flatbuffers/include/flatbuffers/flatbuffer_builder.h:523:38: warning: implicit conversion loses integer precision: 'unsigned long long' to 'size_t' (aka 'unsigned int') [-Wshorten-64-to-32]
C/C++: flatbuffers/include/flatbuffers/flatbuffer_builder.h:530:5: note: in instantiation of member function 'flatbuffers::FlatBufferBuilderImpl<true>::PreAlign' requested here
C/C++: flatbuffers/include/flatbuffers/flatbuffer_builder.h:1377:5: note: in instantiation of function template specialization 'flatbuffers::FlatBufferBuilderImpl<true>::PreAlign<unsigned int>' requested here
C/C++: flatbuffers/include/flatbuffers/flatbuffer_builder.h:1439:3: note: in instantiation of member function 'flatbuffers::FlatBufferBuilderImpl<true>::CreateStringImpl' requested here
...
C/C++: In file included from flatbuffers/include/flatbuffers/flatbuffers.h:29:
C/C++: flatbuffers/include/flatbuffers/vector_downward.h:278:43: warning: implicit conversion loses integer precision: 'unsigned long long' to 'size_t' (aka 'unsigned int') [-Wshorten-64-to-32]
C/C++: flatbuffers/include/flatbuffers/vector_downward.h:145:39: note: in instantiation of member function 'flatbuffers::vector_downward<unsigned long long>::reallocate' requested here
C/C++: flatbuffers/include/flatbuffers/vector_downward.h:152:7: note: in instantiation of member function 'flatbuffers::vector_downward<unsigned long long>::ensure_space' requested here
C/C++: flatbuffers/include/flatbuffers/vector_downward.h:214:5: note: in instantiation of member function 'flatbuffers::vector_downward<unsigned long long>::make_space' requested here
C/C++: flatbuffers/include/flatbuffers/flatbuffer_builder.h:1378:10: note: in instantiation of member function 'flatbuffers::vector_downward<unsigned long long>::fill' requested here
C/C++: flatbuffers/include/flatbuffers/flatbuffer_builder.h:1439:3: note: in instantiation of member function 'flatbuffers::FlatBufferBuilderImpl<true>::CreateStringImpl' requested here
...
C/C++: In file included from flatbuffers/include/flatbuffers/flatbuffers.h:29: