Skip to content

Commit a257a6a

Browse files
committed
Remove unnecessary uses of ""
Appending "" to a string has no effect.
1 parent 9aac51d commit a257a6a

13 files changed

+22
-37
lines changed

src/ansi-c/expr2c.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,7 @@ std::string expr2ct::convert_rec(
477477

478478
if(parameters.empty())
479479
{
480-
if(code_type.has_ellipsis())
481-
dest+=""; // empty!
482-
else
480+
if(!code_type.has_ellipsis())
483481
dest+="void"; // means 'no parameters'
484482
}
485483
else

src/cbmc/all_properties_class.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class bmc_all_propertiest:
5959

6060
// make some poor compilers happy
6161
UNREACHABLE;
62-
return "";
6362
}
6463

6564
explicit goalt(

src/cpp/parse.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -841,9 +841,8 @@ bool Parser::rNamespaceSpec(cpp_namespace_spect &namespace_spec)
841841

842842
irep_idt name;
843843

844-
if(lex.LookAhead(0)=='{')
845-
name=""; // an anonymous namespace
846-
else
844+
// namespace might be anonymous
845+
if(lex.LookAhead(0) != '{')
847846
{
848847
if(lex.get_token(tk2)==TOK_IDENTIFIER)
849848
name=tk2.data.get(ID_C_base_name);

src/goto-instrument/dot.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ void dott::write_dot_subgraph(
192192
std::set<goto_programt::const_targett> fres;
193193
find_next(instructions, it, tres, fres);
194194

195-
std::string tlabel="true";
196-
std::string flabel="false";
197-
if(fres.empty() || tres.empty())
195+
std::string tlabel;
196+
std::string flabel;
197+
if(!fres.empty() && !tres.empty())
198198
{
199-
tlabel="";
200-
flabel="";
199+
tlabel = "true";
200+
flabel = "false";
201201
}
202202

203203
typedef std::set<goto_programt::const_targett> t;

src/goto-programs/property_checker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ std::string property_checkert::as_string(resultt result)
2121
case property_checkert::resultt::UNKNOWN: return "UNKNOWN";
2222
}
2323

24-
return "";
24+
UNREACHABLE;
2525
}
2626

2727
property_checkert::property_checkert(

src/goto-symex/partial_order_concurrency.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ irep_idt partial_order_concurrencyt::rw_clock_id(
133133
return id2string(id(event))+"$rclk$"+std::to_string(axiom);
134134
else
135135
UNREACHABLE;
136-
137-
return "";
138136
}
139137

140138
symbol_exprt partial_order_concurrencyt::clock(

src/pointer-analysis/value_set.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void value_sett::output(
150150
result="<"+from_expr(ns, identifier, o)+", ";
151151

152152
if(o_it->second)
153-
result += integer2string(*o_it->second) + "";
153+
result += integer2string(*o_it->second);
154154
else
155155
result+='*';
156156

src/pointer-analysis/value_set_fi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void value_set_fit::output(
102102
result="<"+from_expr(ns, identifier, o)+", ";
103103

104104
if(o_it->second)
105-
result += integer2string(*o_it->second) + "";
105+
result += integer2string(*o_it->second);
106106
else
107107
result+='*';
108108

src/pointer-analysis/value_set_fivr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void value_set_fivrt::output(
143143
result+=from_expr(ns, identifier, o)+", ";
144144

145145
if(o_it->second)
146-
result += integer2string(*o_it->second) + "";
146+
result += integer2string(*o_it->second);
147147
else
148148
result+='*';
149149

src/pointer-analysis/value_set_fivrns.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void value_set_fivrnst::output_entry(
134134
result+=from_expr(ns, identifier, o)+", ";
135135

136136
if(o_it->second)
137-
result += integer2string(*o_it->second) + "";
137+
result += integer2string(*o_it->second);
138138
else
139139
result+='*';
140140

src/solvers/smt2/smt2_conv.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,6 @@ std::string smt2_convt::type2id(const typet &type) const
726726
else
727727
{
728728
UNREACHABLE;
729-
return "";
730729
}
731730
}
732731

src/solvers/strings/string_constraint_generator_format.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ class format_specifiert
7979
class format_textt
8080
{
8181
public:
82+
format_textt() = default;
83+
8284
explicit format_textt(std::string _content) : content(_content)
8385
{
8486
}
@@ -106,15 +108,15 @@ class format_elementt
106108
TEXT
107109
} format_typet;
108110

109-
explicit format_elementt(format_typet _type) : type(_type), fstring("")
111+
explicit format_elementt(format_typet _type) : type(_type)
110112
{
111113
}
112114

113115
explicit format_elementt(std::string s) : type(TEXT), fstring(s)
114116
{
115117
}
116118

117-
explicit format_elementt(format_specifiert fs) : type(SPECIFIER), fstring("")
119+
explicit format_elementt(format_specifiert fs) : type(SPECIFIER)
118120
{
119121
fspec.push_back(fs);
120122
}
@@ -194,7 +196,7 @@ static bool check_format_string(std::string s)
194196
static format_specifiert format_specifier_of_match(std::smatch &m)
195197
{
196198
int index = m[1].str().empty() ? -1 : std::stoi(m[1].str());
197-
std::string flag = m[2].str().empty() ? "" : m[2].str();
199+
std::string flag = m[2].str();
198200
int width = m[3].str().empty() ? -1 : std::stoi(m[3].str());
199201
int precision = m[4].str().empty() ? -1 : std::stoi(m[4].str());
200202
std::string tT = m[5].str();

src/util/cmdline.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,8 @@ std::string cmdlinet::get_value(char option) const
4646
{
4747
auto i=getoptnr(option);
4848

49-
if(i.has_value())
50-
{
51-
if(options[*i].values.empty())
52-
return "";
53-
else
54-
return options[*i].values.front();
55-
}
49+
if(i.has_value() && !options[*i].values.empty())
50+
return options[*i].values.front();
5651
else
5752
return "";
5853
}
@@ -96,13 +91,8 @@ std::string cmdlinet::get_value(const char *option) const
9691
{
9792
auto i=getoptnr(option);
9893

99-
if(i.has_value())
100-
{
101-
if(options[*i].values.empty())
102-
return "";
103-
else
104-
return options[*i].values.front();
105-
}
94+
if(i.has_value() && !options[*i].values.empty())
95+
return options[*i].values.front();
10696
else
10797
return "";
10898
}

0 commit comments

Comments
 (0)