Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Open Source Software
Zipr Backend
Commits
d800f095
Commit
d800f095
authored
9 years ago
by
whh8b
Browse files
Options
Downloads
Patches
Plain Diff
Fix warnings (-Wreorder and useless statement)
parent
911bd130
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/zipr_impl.h
+5
-4
5 additions, 4 deletions
include/zipr_impl.h
src/zipr_options.cpp
+20
-30
20 additions, 30 deletions
src/zipr_options.cpp
with
25 additions
and
34 deletions
include/zipr_impl.h
+
5
−
4
View file @
d800f095
...
...
@@ -44,6 +44,7 @@ class ZiprImpl_t : public Zipr_t
elfiop
(
new
ELFIO
::
elfio
),
start_of_new_space
(
0
),
memory_space
(),
random_int_distribution
(
1
,
INT_MAX
),
m_output_filename
(
"output"
,
"b.out"
),
m_callbacks
(
"callbacks"
),
m_objcopy
(
"objcopy"
,
"/usr/bin/objcopy"
),
...
...
@@ -51,7 +52,6 @@ class ZiprImpl_t : public Zipr_t
m_verbose
(
"verbose"
,
true
),
m_variant
(
"variant"
),
m_architecture
(
"architecture"
),
random_int_distribution
(
1
,
INT_MAX
),
m_seed
(
"seed"
,
random_int_distribution
(
random_generator
))
{
bss_needed
=
0
;
...
...
@@ -160,15 +160,16 @@ class ZiprImpl_t : public Zipr_t
ZiprPluginManager_t
plugman
;
std
::
map
<
libIRDB
::
Instruction_t
*
,
DLFunctionHandle_t
>
plopping_plugins
;
// For default seed generation.
std
::
default_random_engine
random_generator
;
std
::
uniform_int_distribution
<
int
>
random_int_distribution
;
// Options
ZiprStringOption_t
m_output_filename
,
m_callbacks
,
m_objcopy
;
ZiprBooleanOption_t
m_replop
,
m_verbose
;
ZiprIntegerOption_t
m_variant
,
m_architecture
,
m_seed
;
// For default seed generation.
std
::
default_random_engine
random_generator
;
std
::
uniform_int_distribution
<
int
>
random_int_distribution
;
};
#endif
This diff is collapsed.
Click to expand it.
src/zipr_options.cpp
+
20
−
30
View file @
d800f095
...
...
@@ -31,17 +31,15 @@ using namespace Zipr_SDK;
using
namespace
std
;
void
ZiprOptionsNamespace_t
::
PrintNamespace
()
{
ZiprOptionsNamespace_t
::
const_iterator
it
=
begin
();
ZiprOptionsNamespace_t
::
const_iterator
it_end
=
end
();
for
(
it
;
it
!=
it_end
;
it
++
)
{
ZiprOptionsNamespace_t
::
const_iterator
it
,
it_end
=
end
();
for
(
it
=
begin
();
it
!=
it_end
;
it
++
)
{
cout
<<
(
*
it
)
->
Key
()
<<
": "
<<
(
*
it
)
->
StringValue
()
<<
endl
;
}
}
bool
ZiprOptionsNamespace_t
::
RequirementsMet
()
{
ZiprOptionsNamespace_t
::
const_iterator
it
=
begin
();
ZiprOptionsNamespace_t
::
const_iterator
it_end
=
end
();
for
(
it
;
it
!=
it_end
;
it
++
)
{
ZiprOptionsNamespace_t
::
const_iterator
it
,
it_end
=
end
();
for
(
it
=
begin
();
it
!=
it_end
;
it
++
)
{
if
(
!
(
*
it
)
->
RequirementMet
())
return
false
;
}
...
...
@@ -62,9 +60,8 @@ void ZiprOptionsNamespace_t::AddOption(ZiprOption_t *option) {
}
ZiprOption_t
*
ZiprOptionsNamespace_t
::
OptionByKey
(
string
key
)
{
ZiprOptionsNamespace_t
::
const_iterator
it
=
begin
();
ZiprOptionsNamespace_t
::
const_iterator
it_end
=
end
();
for
(
it
;
it
!=
it_end
;
it
++
)
{
ZiprOptionsNamespace_t
::
const_iterator
it
,
it_end
=
end
();
for
(
it
=
begin
();
it
!=
it_end
;
it
++
)
{
if
((
*
it
)
->
Key
()
==
key
)
return
*
it
;
}
...
...
@@ -72,9 +69,8 @@ ZiprOption_t *ZiprOptionsNamespace_t::OptionByKey(string key) {
}
void
ZiprOptionsNamespace_t
::
PrintUsage
(
int
tabs
,
ostream
&
out
)
{
ZiprOptionsNamespace_t
::
const_iterator
it
=
begin
();
ZiprOptionsNamespace_t
::
const_iterator
it_end
=
end
();
for
(
it
;
it
!=
it_end
;
it
++
)
{
ZiprOptionsNamespace_t
::
const_iterator
it
,
it_end
=
end
();
for
(
it
=
begin
();
it
!=
it_end
;
it
++
)
{
string
description
=
(
*
it
)
->
Description
();
{
int
t
=
0
;
for
(;
t
<
tabs
;
t
++
)
cout
<<
"
\t
"
;
}
out
<<
std
::
setw
(
2
);
...
...
@@ -90,16 +86,14 @@ void ZiprOptionsNamespace_t::PrintUsage(int tabs, ostream &out) {
}
void
ZiprOptions_t
::
PrintUsage
(
ostream
&
out
)
{
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it
=
m_namespaces
.
begin
();
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it_end
=
m_namespaces
.
end
();
for
(
it
;
it
!=
it_end
;
it
++
)
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it
,
it_end
=
m_namespaces
.
end
();
for
(
it
=
m_namespaces
.
begin
();
it
!=
it_end
;
it
++
)
(
*
it
)
->
PrintUsage
(
1
,
out
);
}
bool
ZiprOptions_t
::
RequirementsMet
()
{
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it
=
m_namespaces
.
begin
();
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it_end
=
m_namespaces
.
end
();
for
(
it
;
it
!=
it_end
;
it
++
)
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it
,
it_end
=
m_namespaces
.
end
();
for
(
it
=
m_namespaces
.
begin
();
it
!=
it_end
;
it
++
)
if
(
!
(
*
it
)
->
RequirementsMet
())
return
false
;
return
true
;
...
...
@@ -113,10 +107,9 @@ ZiprOptions_t::ZiprOptions_t(int argc, char **argv) {
}
bool
ZiprOptions_t
::
Parse
(
ostream
&
error
,
ostream
&
warn
)
{
vector
<
string
>::
const_iterator
it
=
m_arguments
.
begin
();
vector
<
string
>::
const_iterator
it_end
=
m_arguments
.
end
();
vector
<
string
>::
const_iterator
it
,
it_end
=
m_arguments
.
end
();
for
(
it
;
it
!=
it_end
;
it
++
)
{
for
(
it
=
m_arguments
.
begin
()
;
it
!=
it_end
;
it
++
)
{
string
ns
,
key
,
argument
=
*
it
;
string
::
size_type
location
=
0
;
ZiprOptionsNamespace_t
*
option_ns
;
...
...
@@ -188,9 +181,8 @@ bool ZiprOptions_t::Parse(ostream &error, ostream &warn) {
}
ZiprOptionsNamespace_t
*
ZiprOptions_t
::
Namespace
(
string
ns
)
{
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it
=
m_namespaces
.
begin
();
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it_end
=
m_namespaces
.
end
();
for
(
it
;
it
!=
it_end
;
it
++
)
{
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it
,
it_end
=
m_namespaces
.
end
();
for
(
it
=
m_namespaces
.
begin
();
it
!=
it_end
;
it
++
)
{
if
((
*
it
)
->
Namespace
()
==
ns
)
return
*
it
;
}
...
...
@@ -204,17 +196,15 @@ void ZiprOptions_t::AddNamespace(ZiprOptionsNamespace_t *ns) {
void
ZiprOptionsNamespace_t
::
MergeNamespace
(
ZiprOptionsNamespace_t
*
in
)
{
if
(
!
in
)
return
;
set
<
ZiprOption_t
*>::
const_iterator
it
=
in
->
begin
();
set
<
ZiprOption_t
*>::
const_iterator
it_end
=
in
->
end
();
for
(
it
;
it
!=
it_end
;
it
++
)
set
<
ZiprOption_t
*>::
const_iterator
it
,
it_end
=
in
->
end
();
for
(
it
=
in
->
begin
();
it
!=
it_end
;
it
++
)
AddOption
(
*
it
);
}
void
ZiprOptions_t
::
PrintNamespaces
()
{
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it
=
m_namespaces
.
begin
();
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it_end
=
m_namespaces
.
end
();
set
<
ZiprOptionsNamespace_t
*>::
const_iterator
it
,
it_end
=
m_namespaces
.
end
();
for
(
it
;
it
!=
it_end
;
it
++
)
{
for
(
it
=
m_namespaces
.
begin
()
;
it
!=
it_end
;
it
++
)
{
cout
<<
(
*
it
)
->
Namespace
()
<<
endl
;
(
*
it
)
->
PrintNamespace
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment