mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-22 23:18:51 +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:
@@ -27,7 +27,9 @@ namespace flatbuffers {
|
||||
|
||||
namespace dart {
|
||||
|
||||
Namer::Config DartDefaultConfig() {
|
||||
namespace {
|
||||
|
||||
static Namer::Config DartDefaultConfig() {
|
||||
return { /*types=*/Case::kUpperCamel,
|
||||
/*constants=*/Case::kScreamingSnake,
|
||||
/*methods=*/Case::kLowerCamel,
|
||||
@@ -50,7 +52,7 @@ Namer::Config DartDefaultConfig() {
|
||||
/*filename_extension=*/".dart" };
|
||||
}
|
||||
|
||||
std::set<std::string> DartKeywords() {
|
||||
static std::set<std::string> DartKeywords() {
|
||||
// see https://www.dartlang.org/guides/language/language-tour#keywords
|
||||
// yield*, async*, and sync* shouldn't be proble
|
||||
return {
|
||||
@@ -67,6 +69,7 @@ std::set<std::string> DartKeywords() {
|
||||
"dynamic", "implements", "set",
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
const std::string _kFb = "fb";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user