[C++] Fix -Wnarrowing and -Woverflow due to signed bitfields on G++ ARM (#6163)

Older versions of GCC (at least on ARM) complain about narrowing conversions and
overflows when setting the reference index (defined as an 11-bit signed integer
bitfield) to -1:

```
error: narrowing conversion of '-1' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
error: conversion from 'short unsigned int' to 'short unsigned int:11' changes value from '65535' to '2047'
```

This is due to the signedness of integer bitfields (not explicitly signed or
unsigned) being implementation-defined. This addresses this issue by explicitly
defining the signedness of all the bitfields in `flatbuffers::TypeCode` in C++.
1 file changed
tree: 1f641175d7e10f594d850b4ebaf335ab57456079
  1. .appveyor/
  2. .bazelci/
  3. .github/
  4. .travis/
  5. android/
  6. bazel/
  7. CMake/
  8. conan/
  9. dart/
  10. docs/
  11. go/
  12. grpc/
  13. include/
  14. java/
  15. js/
  16. lobster/
  17. lua/
  18. mjs/
  19. net/
  20. php/
  21. python/
  22. reflection/
  23. rust/
  24. samples/
  25. snap/
  26. src/
  27. swift/
  28. tests/
  29. ts/
  30. .clang-format
  31. .editorconfig
  32. .eslintrc.js
  33. .gitattributes
  34. .gitignore
  35. .travis.yml
  36. appveyor.yml
  37. BUILD
  38. build_defs.bzl
  39. CMakeLists.txt
  40. composer.json
  41. conanfile.py
  42. CONTRIBUTING.md
  43. LICENSE.txt
  44. package.json
  45. pom.xml
  46. readme.md
  47. tsconfig.json
  48. tsconfig.mjs.json
  49. WORKSPACE
  50. yarn.lock
readme.md

logo FlatBuffers

Build Status Build status Join the chat at https://gitter.im/google/flatbuffers Discord Chat Twitter Follow

FlatBuffers is a cross platform serialization library architected for maximum memory efficiency. It allows you to directly access serialized data without parsing/unpacking it first, while still having great forwards/backwards compatibility.

Go to our landing page to browse our documentation.

Supported operating systems

  • Windows
  • MacOS X
  • Linux
  • Android
  • And any others with a recent C++ compiler.

Supported programming languages

  • C++
  • C#
  • C
  • Dart
  • Go
  • Java
  • JavaScript
  • Lobster
  • Lua
  • PHP
  • Python
  • Rust
  • TypeScript

and more in progress...

Contribution

To contribute to this project, see CONTRIBUTING.

Licensing

Flatbuffers is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.