Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
19101826
Commit
19101826
authored
Jan 14, 2017
by
Wouter van Oortmerssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unused field warning in clang.
Change-Id: I71d590a1e5b2709f0e2dcf97faaebda5cb918fc7 Tested: on Linux.
parent
7b94eab2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
idl_gen_cpp.cpp
src/idl_gen_cpp.cpp
+15
-0
monster_test_generated.h
tests/monster_test_generated.h
+2
-0
No files found.
src/idl_gen_cpp.cpp
View file @
19101826
...
...
@@ -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:
...
...
tests/monster_test_generated.h
View file @
19101826
...
...
@@ -154,6 +154,7 @@ MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS {
:
a_
(
flatbuffers
::
EndianScalar
(
_a
)),
b_
(
flatbuffers
::
EndianScalar
(
_b
)),
padding0__
(
0
)
{
(
void
)
padding0__
;
}
int16_t
a
()
const
{
return
flatbuffers
::
EndianScalar
(
a_
);
...
...
@@ -199,6 +200,7 @@ MANUALLY_ALIGNED_STRUCT(16) Vec3 FLATBUFFERS_FINAL_CLASS {
padding1__
(
0
),
test3_
(
_test3
),
padding2__
(
0
)
{
(
void
)
padding0__
;(
void
)
padding1__
;(
void
)
padding2__
;
}
float
x
()
const
{
return
flatbuffers
::
EndianScalar
(
x_
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment