Skip to content

Commit 467664d

Browse files
author
Daniel Kroening
authored
Merge pull request #343 from thk123/lint/fix-for-338
Fixing lint errors in files touched by PR #338
2 parents 5a8b82a + fc59e01 commit 467664d

File tree

4 files changed

+111
-79
lines changed

4 files changed

+111
-79
lines changed

src/ansi-c/ansi_c_entry_point.cpp

+14-11
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ exprt::operandst build_function_environment(
5151

5252
for(const auto & p : parameters)
5353
{
54-
irep_idt base_name=p.get_base_name();
55-
if(base_name.empty()) base_name="argument#"+i2string(i);
54+
irep_idt base_name=p.get_base_name().empty()?
55+
("argument#"+i2string(i)):p.get_base_name();
5656
irep_idt identifier=id2string(goto_functionst::entry_point())+
5757
"::"+id2string(base_name);
5858

@@ -109,15 +109,12 @@ void record_function_outputs(
109109
code_blockt &init_code,
110110
symbol_tablet &symbol_table)
111111
{
112-
//const code_typet::parameterst &parameters=
113-
// to_code_type(function.type).parameters();
114-
115112
bool has_return_value=
116113
to_code_type(function.type).return_type()!=empty_typet();
117114

118115
if(has_return_value)
119116
{
120-
//record return value
117+
// record return value
121118
codet output(ID_output);
122119
output.operands().resize(2);
123120

@@ -138,10 +135,12 @@ void record_function_outputs(
138135

139136
for(const auto & p : parameters)
140137
{
138+
if(p.get_identifier().empty())
139+
continue;
140+
141141
irep_idt identifier=p.get_identifier();
142-
if(identifier.empty()) continue;
143142

144-
const symbolt &symbol = symbol_table.lookup(identifier);
143+
const symbolt &symbol=symbol_table.lookup(identifier);
145144

146145
if(symbol.type.id()==ID_pointer)
147146
{
@@ -194,9 +193,11 @@ bool ansi_c_entry_point(
194193
forall_symbol_base_map(it, symbol_table.symbol_base_map, config.main)
195194
{
196195
// look it up
197-
symbol_tablet::symbolst::const_iterator s_it=symbol_table.symbols.find(it->second);
196+
symbol_tablet::symbolst::const_iterator s_it=
197+
symbol_table.symbols.find(it->second);
198198

199-
if(s_it==symbol_table.symbols.end()) continue;
199+
if(s_it==symbol_table.symbols.end())
200+
continue;
200201

201202
if(s_it->second.type.id()==ID_code)
202203
matches.push_back(it->second);
@@ -456,7 +457,9 @@ bool ansi_c_entry_point(
456457
const exprt &arg1=parameters[1];
457458

458459
exprt index_expr(ID_index, arg1.type().subtype());
459-
index_expr.copy_to_operands(argv_symbol.symbol_expr(), gen_zero(index_type()));
460+
index_expr.copy_to_operands(
461+
argv_symbol.symbol_expr(),
462+
gen_zero(index_type()));
460463

461464
// disable bounds check on that one
462465
index_expr.set("bounds_check", false);

src/ansi-c/ansi_c_language.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,14 @@ bool ansi_c_languaget::typecheck(
166166
{
167167
symbol_tablet new_symbol_table;
168168

169-
if(ansi_c_typecheck(parse_tree, new_symbol_table, module, get_message_handler()))
169+
if(ansi_c_typecheck(
170+
parse_tree,
171+
new_symbol_table,
172+
module,
173+
get_message_handler()))
174+
{
170175
return true;
176+
}
171177

172178
remove_internal_symbols(new_symbol_table);
173179

0 commit comments

Comments
 (0)