mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 20:31:23 +00:00
Fix unused field warning in clang.
Change-Id: I71d590a1e5b2709f0e2dcf97faaebda5cb918fc7 Tested: on Linux.
This commit is contained in:
@@ -1621,6 +1621,11 @@ class CppGenerator : public BaseGenerator {
|
||||
NumToString((*id)++) + "__;";
|
||||
}
|
||||
|
||||
static void PaddingDeclaration(int bits, std::string *code_ptr, int *id) {
|
||||
(void)bits;
|
||||
*code_ptr += "(void)padding" + NumToString((*id)++) + "__;";
|
||||
}
|
||||
|
||||
static void PaddingInitializer(int bits, std::string *code_ptr, int *id) {
|
||||
(void)bits;
|
||||
*code_ptr += ",\n padding" + NumToString((*id)++) + "__(0)";
|
||||
@@ -1702,10 +1707,20 @@ class CppGenerator : public BaseGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
padding_id = 0;
|
||||
std::string padding_list;
|
||||
for (auto it = struct_def.fields.vec.begin();
|
||||
it != struct_def.fields.vec.end(); ++it) {
|
||||
auto field = *it;
|
||||
GenPadding(*field, &padding_list, &padding_id, PaddingDeclaration);
|
||||
}
|
||||
|
||||
code_.SetValue("ARG_LIST", arg_list);
|
||||
code_.SetValue("INIT_LIST", init_list);
|
||||
code_.SetValue("PADDING_LIST", padding_list);
|
||||
code_ += " {{STRUCT_NAME}}({{ARG_LIST}})";
|
||||
code_ += " : {{INIT_LIST}} {";
|
||||
if (padding_list.length()) code_ += " {{PADDING_LIST}}";
|
||||
code_ += " }";
|
||||
|
||||
// Generate accessor methods of the form:
|
||||
|
||||
Reference in New Issue
Block a user