Skip to content

Commit 580d54c

Browse files
committed
coding style fixes
1 parent 1886d4f commit 580d54c

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

src/goto-instrument/unwind.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ Author: Daniel Kroening, [email protected]
77
88
\*******************************************************************/
99

10-
#include <stdexcept>
11-
#include <iostream>
12-
1310
#include <util/std_expr.h>
14-
#include <goto-programs/goto_functions.h>
1511
#include <util/string_utils.h>
12+
#include <goto-programs/goto_functions.h>
1613

1714
#include "unwind.h"
1815
#include "loop_utils.h"
@@ -54,7 +51,7 @@ void parse_unwindset(const std::string &us, unwind_sett &unwind_set)
5451
int loop_bound=std::stoi(bound);
5552

5653
if(loop_bound<-1)
57-
throw std::invalid_argument("given unwind bound < -1");
54+
throw "given unwind bound < -1";
5855

5956
unwind_set[func][loop_id]=loop_bound;
6057
}
@@ -144,8 +141,6 @@ void goto_unwindt::unwind(
144141
const unsigned k,
145142
const unwind_strategyt unwind_strategy) const
146143
{
147-
assert(k>=0);
148-
149144
std::vector<goto_programt::targett> iteration_points;
150145
unwind(goto_program, loop_head, loop_exit, k, unwind_strategy,
151146
iteration_points);
@@ -171,13 +166,11 @@ void goto_unwindt::unwind(
171166
const unwind_strategyt unwind_strategy,
172167
std::vector<goto_programt::targett> &iteration_points) const
173168
{
174-
assert(k>=0);
175169
assert(iteration_points.empty());
176170
assert(loop_head->location_number<loop_exit->location_number);
177171

178172
// rest program after unwound part
179173
goto_programt rest_program;
180-
assert(rest_program.instructions.empty());
181174

182175
if(unwind_strategy==PARTIAL)
183176
{
@@ -286,8 +279,6 @@ void goto_unwindt::unwind(
286279
}
287280
else
288281
{
289-
assert(k==0);
290-
291282
// insert skip for loop body
292283

293284
goto_programt::targett t_skip=goto_program.insert_before(loop_head);
@@ -379,18 +370,18 @@ void goto_unwindt::unwind(
379370
{
380371
assert(k>=-1);
381372

382-
const irep_idt func=goto_program.instructions.begin()->function;
383-
assert(!func.empty());
384-
385373
for(goto_programt::const_targett i_it=goto_program.instructions.begin();
386374
i_it!=goto_program.instructions.end(); i_it++)
387375
{
388376
if(!i_it->is_backwards_goto())
389377
continue;
390378

391-
unsigned loop_id=i_it->loop_number;
379+
const irep_idt func=i_it->function;
380+
assert(!func.empty());
381+
382+
unsigned loop_number=i_it->loop_number;
392383

393-
int final_k=get_k(func, loop_id, k, unwind_set);
384+
int final_k=get_k(func, loop_number, k, unwind_set);
394385

395386
if(final_k==-1)
396387
continue;

src/goto-programs/goto_program_template.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ class goto_program_templatet
307307
return instructions.insert(target, instructiont());
308308
}
309309

310-
311310
//! Insertion after the given target
312311
//! \return newly inserted location
313312
inline targett insert_after(targett target)

src/util/string_utils.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Author: Daniel Poetzl
77
\*******************************************************************/
88

99
#include <cassert>
10-
#include <stdexcept>
1110

1211
#include "string_utils.h"
1312

@@ -133,7 +132,7 @@ void split_string(
133132

134133
split_string(s, delim, result, strip);
135134
if(result.size()!=2)
136-
throw std::invalid_argument("number of parts != 2");
135+
throw "split string did not generate exactly 2 parts";
137136

138137
left=result[0];
139138
right=result[1];

0 commit comments

Comments
 (0)