flatc should output a warning, when an attribute is attached more than once (#6146)
* Added missing EndTable() call to VerifyObject() VerifyObject called VerifyTableStart() but not EndTable(). This made Verifier::VerifyComplexity() increase depth_ with each table, not with the depth of tables. https://groups.google.com/forum/#!topic/flatbuffers/OpxtW5UFAdg * Added Check to VerifyAlignment https://stackoverflow.com/questions/59376308/flatbuffers-verifier-returns-false-without-any-assertion-flatbuffers-debug-veri * Add GetStringView (Convenience function to get string_view from a String returning an empty string_view on null pointer) like GetString, GetCstring * flatc should warn, when an attribute is attached more than once. flatc.exe -b duplicate.fbs warning: duplicate.fbs(5, 36): warning: attribute already found: priority duplicate.fbs: namespace MyGame; attribute "priority"; table Monster (priority:1, priority:2) { } root_type Monster;
This commit is contained in:
parent
689bfafa7e
commit
ab01ae1620
|
@ -592,7 +592,7 @@ static inline const char *GetCstring(const String *str) {
|
||||||
static inline flatbuffers::string_view GetStringView(const String *str) {
|
static inline flatbuffers::string_view GetStringView(const String *str) {
|
||||||
return str ? str->string_view() : flatbuffers::string_view();
|
return str ? str->string_view() : flatbuffers::string_view();
|
||||||
}
|
}
|
||||||
#endif // FLATBUFFERS_HAS_STRING_VIEW
|
#endif // FLATBUFFERS_HAS_STRING_VIEW
|
||||||
|
|
||||||
// Allocator interface. This is flatbuffers-specific and meant only for
|
// Allocator interface. This is flatbuffers-specific and meant only for
|
||||||
// `vector_downward` usage.
|
// `vector_downward` usage.
|
||||||
|
|
|
@ -1559,7 +1559,7 @@ CheckedError Parser::ParseMetaData(SymbolTable<Value> *attributes) {
|
||||||
name);
|
name);
|
||||||
NEXT();
|
NEXT();
|
||||||
auto e = new Value();
|
auto e = new Value();
|
||||||
attributes->Add(name, e);
|
if (attributes->Add(name, e)) Warning("attribute already found: " + name);
|
||||||
if (Is(':')) {
|
if (Is(':')) {
|
||||||
NEXT();
|
NEXT();
|
||||||
ECHECK(ParseSingleValue(&name, *e, true));
|
ECHECK(ParseSingleValue(&name, *e, true));
|
||||||
|
|
Loading…
Reference in New Issue