mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-09 14:46:26 +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:
@@ -117,6 +117,9 @@ bool release_n_verify(flatbuffers::FlatBufferBuilder &fbb,
|
||||
return verify(buf, expected_name, color);
|
||||
}
|
||||
|
||||
// forward-declared in test.cpp
|
||||
void FlatBufferBuilderTest();
|
||||
|
||||
void FlatBufferBuilderTest() {
|
||||
using flatbuffers::FlatBufferBuilder;
|
||||
|
||||
@@ -138,5 +141,8 @@ void FlatBufferBuilderTest() {
|
||||
TestSelector(tests, tests + 4));
|
||||
}
|
||||
|
||||
// forward-declared in test_builder.h
|
||||
void CheckTestGeneratedIsValid(const MyGame::Example::Color&);
|
||||
|
||||
// Link-time check using pointer type.
|
||||
void CheckTestGeneratedIsValid(const MyGame::Example::Color &) {}
|
||||
|
||||
Reference in New Issue
Block a user