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
42a265b4
Commit
42a265b4
authored
Jan 19, 2017
by
Wouter van Oortmerssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add no-op for padding variables to prevent clang compiler warning.
Change-Id: I119ee7109bfa2b0be0f468d2b2be459f45d1bb11
parent
4bc4979a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
idl_gen_cpp.cpp
src/idl_gen_cpp.cpp
+14
-14
monster_test_generated.h
tests/monster_test_generated.h
+3
-1
No files found.
src/idl_gen_cpp.cpp
View file @
42a265b4
...
...
@@ -1618,14 +1618,14 @@ class CppGenerator : public BaseGenerator {
NumToString
((
*
id
)
++
)
+
"__;"
;
}
static
void
Padding
Declaration
(
int
bits
,
std
::
string
*
code_ptr
,
int
*
id
)
{
static
void
Padding
Initializer
(
int
bits
,
std
::
string
*
code_ptr
,
int
*
id
)
{
(
void
)
bits
;
*
code_ptr
+=
"
(void)padding"
+
NumToString
((
*
id
)
++
)
+
"__;
"
;
*
code_ptr
+=
"
,
\n
padding"
+
NumToString
((
*
id
)
++
)
+
"__(0)
"
;
}
static
void
Padding
Initializer
(
int
bits
,
std
::
string
*
code_ptr
,
int
*
id
)
{
static
void
Padding
Noop
(
int
bits
,
std
::
string
*
code_ptr
,
int
*
id
)
{
(
void
)
bits
;
*
code_ptr
+=
"
,
\n
padding"
+
NumToString
((
*
id
)
++
)
+
"__(0)
"
;
*
code_ptr
+=
"
(void)padding"
+
NumToString
((
*
id
)
++
)
+
"__;
"
;
}
// Generate an accessor struct with constructor for a flatbuffers struct.
...
...
@@ -1704,20 +1704,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}}"
;
padding_id
=
0
;
for
(
auto
it
=
struct_def
.
fields
.
vec
.
begin
();
it
!=
struct_def
.
fields
.
vec
.
end
();
++
it
)
{
const
auto
&
field
=
**
it
;
if
(
field
.
padding
)
{
std
::
string
padding
;
GenPadding
(
field
,
&
padding
,
&
padding_id
,
PaddingNoop
);
code_
+=
padding
;
}
}
code_
+=
" }"
;
// Generate accessor methods of the form:
...
...
tests/monster_test_generated.h
View file @
42a265b4
...
...
@@ -200,7 +200,9 @@ MANUALLY_ALIGNED_STRUCT(16) Vec3 FLATBUFFERS_FINAL_CLASS {
padding1__
(
0
),
test3_
(
_test3
),
padding2__
(
0
)
{
(
void
)
padding0__
;(
void
)
padding1__
;(
void
)
padding2__
;
(
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