Audit and fixups for GCC and Clang (#7212)

Added (for compiler versions that support it):
-Wmissing-declarations
-Wzero-as-null-pointer-constant

Then, fixes to problems identified by the extra warnings
Tested only on GCC 9.4.0

Adjusted the CPP code generator to output nullptr where appropriate,
to satisfy -Wzero-as-null-pointer-constant

Added a lot of 'static' declarations in front of functions,
to satisfy -Wmissing-declarations,
and wrap static function defs in anonymous namespaces.

There are advantages to both anonymous namespaces and static,
it seems that marking a function as static will not publish the name in
the symbol table at all, thus giving the linker less work to do.
25 files changed
tree: fddb969b5e3ce04e85cdb50454d513f4ba357bc6
  1. .bazelci/
  2. .github/
  3. android/
  4. bazel/
  5. benchmarks/
  6. CMake/
  7. conan/
  8. dart/
  9. docs/
  10. go/
  11. grpc/
  12. include/
  13. java/
  14. js/
  15. kotlin/
  16. lobster/
  17. lua/
  18. mjs/
  19. net/
  20. php/
  21. python/
  22. reflection/
  23. rust/
  24. samples/
  25. scripts/
  26. snap/
  27. src/
  28. swift/
  29. tests/
  30. ts/
  31. .clang-format
  32. .editorconfig
  33. .eslintrc.js
  34. .gitattributes
  35. .gitignore
  36. .travis.yml
  37. BUILD.bazel
  38. build_defs.bzl
  39. CMakeLists.txt
  40. composer.json
  41. conanfile.py
  42. CONTRIBUTING.md
  43. Formatters.md
  44. LICENSE.txt
  45. package.json
  46. pom.xml
  47. readme.md
  48. SECURITY.md
  49. swift.swiftformat
  50. tsconfig.json
  51. tsconfig.mjs.json
  52. typescript.bzl
  53. WORKSPACE
  54. yarn.lock
readme.md

logo FlatBuffers

Build status Fuzzing Status OpenSSF Scorecard Join the chat at https://gitter.im/google/flatbuffers Discord Chat Twitter Follow 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
  • Swift
  • TypeScript

and more in progress...

Contribution

To contribute to this project, see CONTRIBUTING.

Security

Please see our Security Policy for reporting vulnerabilities.

Licensing

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