mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-01 17:57:25 +00:00
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.
This commit is contained in:
parent
a66de58af9
commit
f7c511957f
25 changed files with 327 additions and 140 deletions
|
|
@ -47,6 +47,7 @@ using ::cpp17::MyGame::Example::Vec3;
|
|||
/*******************************************************************************
|
||||
** Build some FB objects.
|
||||
*******************************************************************************/
|
||||
namespace {
|
||||
const Monster *BuildMonster(flatbuffers::FlatBufferBuilder &fbb) {
|
||||
using ::cpp17::MyGame::Example::Color;
|
||||
using ::cpp17::MyGame::Example::MonsterBuilder;
|
||||
|
|
@ -250,6 +251,7 @@ int FlatBufferCpp17Tests() {
|
|||
StringifyAnyFlatbuffersTypeTest();
|
||||
return 0;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main(int /*argc*/, const char * /*argv*/[]) {
|
||||
InitTestEngine();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue