Skip to content

Commit cba259c

Browse files
author
Daniel Kroening
authored
Merge pull request #647 from reuk/remove-broken-debug
Remove DEBUG ifdefs which broke the debug build
2 parents 384bd7c + 1a5c69d commit cba259c

37 files changed

+40
-115
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,8 @@ script:
7575
COMMAND="env UBSAN_OPTIONS=print_stacktrace=1 make -C regression test" &&
7676
eval ${PRE_COMMAND} ${COMMAND} &&
7777
COMMAND="make -C src CXX=$COMPILER CXXFLAGS=$FLAGS -j2 cegis.dir clobber.dir memory-models.dir musketeer.dir" &&
78+
eval ${PRE_COMMAND} ${COMMAND} &&
79+
COMMAND="make -C src clean" &&
80+
eval ${PRE_COMMAND} ${COMMAND} &&
81+
COMMAND="make -C src CXX=$COMPILER CXXFLAGS=\"-Wall -O0 -ggdb3 -Werror -Wno-deprecated-register -pedantic -Wno-sign-compare -DDEBUG\" -j2" &&
7882
eval ${PRE_COMMAND} ${COMMAND}

src/analyses/cfg_dominators.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ void dominators_pretty_print_node(const T &node, std::ostream &out)
224224
out << node;
225225
}
226226

227+
inline void dominators_pretty_print_node(
228+
const goto_programt::targett& target,
229+
std::ostream& out)
230+
{
231+
out << target->code.pretty();
232+
}
233+
227234
/*******************************************************************\
228235
229236
Function: cfg_dominators_templatet::output
@@ -241,7 +248,7 @@ void cfg_dominators_templatet<P, T, post_dom>::output(std::ostream &out) const
241248
{
242249
for(const auto &node : cfg.entry_map)
243250
{
244-
T n=node.first;
251+
auto n=node.first;
245252

246253
dominators_pretty_print_node(n, out);
247254
if(post_dom)

src/analyses/constant_propagator.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Author: Peter Schrammel
66
77
\*******************************************************************/
88

9-
// #define DEBUG
10-
119
#ifdef DEBUG
1210
#include <iostream>
1311
#endif

src/analyses/natural_loops.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Author: Georg Weissenbacher, [email protected]
1010

1111
#include "natural_loops.h"
1212

13-
// #define DEBUG
14-
1513
/*******************************************************************\
1614
1715
Function: show_natural_loops

src/analyses/natural_loops.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ Function: natural_loops_templatet::compute
8181
8282
\*******************************************************************/
8383

84-
// #define DEBUG
85-
8684
#ifdef DEBUG
8785
#include <iostream>
8886
#endif

src/cbmc/bmc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ void bmct::setup_unwind()
687687

688688
for(auto &val : unwindset_loops)
689689
{
690-
unsigned thread_nr;
690+
unsigned thread_nr=0;
691691
bool thread_nr_set=false;
692692

693693
if(!val.empty() &&

src/cpp/parse.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ Author: Daniel Kroening, [email protected]
2121
#include "cpp_member_spec.h"
2222
#include "cpp_enum_type.h"
2323

24-
// #define DEBUG
25-
2624
#ifdef DEBUG
2725
#include <iostream>
2826

@@ -642,7 +640,7 @@ bool Parser::rDefinition(cpp_itemt &item)
642640
#ifdef DEBUG
643641
indenter _i;
644642
std::cout << std::string(__indent, ' ') << "Parser::rDefinition 1 " << t
645-
<< "\n";
643+
<< '\n';
646644
#endif
647645

648646
if(t==';')
@@ -1238,11 +1236,11 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
12381236
{
12391237
case tdk_decl:
12401238
#ifdef DEBUG
1241-
std::cout << std::string(__indent, ' ') << "BODY: " << body << std::endl;
1239+
std::cout << std::string(__indent, ' ') << "BODY: "
1240+
<< body.pretty() << '\n';
12421241
std::cout << std::string(__indent, ' ') << "TEMPLATE_TYPE: "
1243-
<< template_type << std::endl;
1242+
<< template_type.pretty() << '\n';
12441243
#endif
1245-
12461244
body.add(ID_template_type).swap(template_type);
12471245
body.set(ID_is_template, true);
12481246
decl.swap(body);
@@ -1912,9 +1910,8 @@ bool Parser::rIntegralDeclaration(
19121910
#ifdef DEBUG
19131911
std::cout << std::string(__indent, ' ')
19141912
<< "Parser::rIntegralDeclaration 8 "
1915-
<< declaration << "\n";
1913+
<< declaration.pretty() << '\n';
19161914
#endif
1917-
19181915
lex.get_token(tk);
19191916
return true;
19201917
}
@@ -5118,10 +5115,9 @@ bool Parser::rClassBody(exprt &body)
51185115
// body=Ptree::List(ob, nil, new Leaf(tk));
51195116
return true; // error recovery
51205117
}
5121-
51225118
#ifdef DEBUG
5123-
std::cout << std::string(__indent, ' ') << "Parser::rClassBody " << member
5124-
<< std::endl;
5119+
std::cout << std::string(__indent, ' ') << "Parser::rClassBody "
5120+
<< member.pretty() << '\n';
51255121
#endif
51265122

51275123
members.move_to_operands(
@@ -7583,7 +7579,7 @@ bool Parser::rPrimaryExpr(exprt &exp)
75837579
#ifdef DEBUG
75847580
indenter _i;
75857581
std::cout << std::string(__indent, ' ') << "Parser::rPrimaryExpr 0 "
7586-
<< lex.LookAhead(0) << " " << lex.current_token().text <<"\n";
7582+
<< lex.LookAhead(0) << ' ' << lex.current_token().text << '\n';
75877583
#endif
75887584

75897585
switch(lex.LookAhead(0))
@@ -9245,8 +9241,8 @@ bool Parser::rExprStatement(codet &statement)
92459241
if(rDeclarationStatement(statement))
92469242
{
92479243
#ifdef DEBUG
9248-
std::cout << std::string(__indent, ' ') << "rDe: " << statement
9249-
<< std::endl;
9244+
std::cout << std::string(__indent, ' ') << "rDe "
9245+
<< statement.pretty() << '\n';
92509246
#endif
92519247
return true;
92529248
}

src/goto-instrument/accelerate/accelerate.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ Author: Matt Lewis
2727
#include "overflow_instrumenter.h"
2828
#include "util.h"
2929

30-
#define DEBUG
31-
3230
goto_programt::targett acceleratet::find_back_jump(
3331
goto_programt::targett loop_header)
3432
{

src/goto-instrument/accelerate/acceleration_utils.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ Author: Matt Lewis
4242
#include "cone_of_influence.h"
4343
#include "overflow_instrumenter.h"
4444

45-
#define DEBUG
46-
4745
void acceleration_utilst::gather_rvalues(
4846
const exprt &expr,
4947
expr_sett &rvalues)

src/goto-instrument/accelerate/all_paths_enumerator.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Author: Matt Lewis
1010

1111
#include "all_paths_enumerator.h"
1212

13-
// #define DEBUG
14-
1513
bool all_paths_enumeratort::next(patht &path)
1614
{
1715
if(last_path.empty())

src/goto-instrument/accelerate/cone_of_influence.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Author: Matt Lewis
1212

1313
#include "cone_of_influence.h"
1414

15-
// #define DEBUG
16-
1715
void cone_of_influencet::cone_of_influence(
1816
const expr_sett &targets,
1917
expr_sett &cone)

src/goto-instrument/accelerate/disjunctive_polynomial_acceleration.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ Author: Matt Lewis
4343
#include "cone_of_influence.h"
4444
#include "overflow_instrumenter.h"
4545

46-
#define DEBUG
47-
48-
4946
bool disjunctive_polynomial_accelerationt::accelerate(
5047
path_acceleratort &accelerator)
5148
{

src/goto-instrument/accelerate/enumerating_loop_acceleration.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Author: Matt Lewis
1010

1111
#include "enumerating_loop_acceleration.h"
1212

13-
// #define DEBUG
14-
1513
bool enumerating_loop_accelerationt::accelerate(
1614
path_acceleratort &accelerator)
1715
{

src/goto-instrument/accelerate/overflow_instrumenter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Author: Matt Lewis
1818
#include "overflow_instrumenter.h"
1919
#include "util.h"
2020

21-
// #define DEBUG
22-
2321
/*
2422
* This code is copied wholesale from analyses/goto_check.cpp.
2523
*/

src/goto-instrument/accelerate/polynomial_accelerator.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ Author: Matt Lewis
3939
#include "cone_of_influence.h"
4040
#include "overflow_instrumenter.h"
4141

42-
#define DEBUG
43-
44-
4542
bool polynomial_acceleratort::accelerate(
4643
patht &loop,
4744
path_acceleratort &accelerator)

src/goto-instrument/accelerate/sat_path_enumerator.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ Author: Matt Lewis
4242
#include "util.h"
4343
#include "overflow_instrumenter.h"
4444

45-
#define DEBUG
46-
4745
bool sat_path_enumeratort::next(patht &path)
4846
{
4947
scratch_programt program(symbol_table);

src/goto-instrument/accelerate/scratch_program.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ Author: Matt Lewis
1515

1616
#include "scratch_program.h"
1717

18-
// #define DEBUG
19-
2018
#ifdef DEBUG
2119
#include <iostream>
2220
#endif
@@ -31,8 +29,8 @@ bool scratch_programt::check_sat(bool do_slice)
3129
update();
3230

3331
#ifdef DEBUG
34-
std::cout << "Checking following program for satness:" << endl;
35-
output(ns, "scratch", cout);
32+
std::cout << "Checking following program for satness:\n";
33+
output(ns, "scratch", std::cout);
3634
#endif
3735

3836
symex.constant_propagation=constant_propagation;
@@ -49,15 +47,15 @@ bool scratch_programt::check_sat(bool do_slice)
4947
{
5048
// Symex sliced away all our assertions.
5149
#ifdef DEBUG
52-
std::cout << "Trivially unsat" << std::endl;
50+
std::cout << "Trivially unsat\n";
5351
#endif
5452
return false;
5553
}
5654

5755
equation.convert(*checker);
5856

5957
#ifdef DEBUG
60-
cout << "Finished symex, invoking decision procedure." << endl;
58+
std::cout << "Finished symex, invoking decision procedure.\n";
6159
#endif
6260

6361
return (checker->dec_solve()==decision_proceduret::D_SATISFIABLE);

src/goto-instrument/accelerate/trace_automaton.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Author: Matt Lewis
1212
#include "trace_automaton.h"
1313
#include "path.h"
1414

15-
// #define DEBUG
16-
1715
void trace_automatont::build()
1816
{
1917
#ifdef DEBUG
@@ -76,8 +74,10 @@ void trace_automatont::add_path(patht &path)
7674
for(const auto &step : path)
7775
{
7876
goto_programt::targett l=step.loc;
77+
7978
#ifdef DEBUG
80-
std::cout << ", " << l->location_number << ":" << l->location;
79+
std::cout << ", " << l->location_number << ':'
80+
<< l->source_location.as_string();
8181
#endif
8282

8383
if(in_alphabet(l))
@@ -112,7 +112,7 @@ void trace_automatont::determinise()
112112
std::cout << "Determinising automaton with " << nta.num_states
113113
<< " states and " << nta.accept_states.size()
114114
<< " accept states and " << nta.count_transitions()
115-
<< " transitions" << endl;
115+
<< " transitions\n";
116116
#endif
117117

118118
dstates.clear();
@@ -124,7 +124,7 @@ void trace_automatont::determinise()
124124
epsilon_closure(init_states);
125125

126126
#ifdef DEBUG
127-
std::cout << "There are " << init_states.size() << " init states" << endl;
127+
std::cout << "There are " << init_states.size() << " init states\n";
128128
#endif
129129

130130
dta.init_state=add_dstate(init_states);
@@ -387,7 +387,7 @@ void automatont::reverse(goto_programt::targett epsilon)
387387

388388
std::cout << "Reversing automaton, old init=" << init_state
389389
<< ", new init=" << new_init << ", old accept="
390-
<< *(accept_states.begin()) << "/" << accept_states.size()
390+
<< *(accept_states.begin()) << '/' << accept_states.size()
391391
<< " new accept=" << init_state << std::endl;
392392

393393
accept_states.clear();
@@ -471,7 +471,7 @@ void automatont::output(std::ostream &str)
471471
str << "Accept states: ";
472472

473473
for(const auto &state : accept_states)
474-
str << state << " ";
474+
str << state << ' ';
475475

476476
str << std::endl;
477477

src/goto-programs/goto_inline_class.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Author: Daniel Kroening, [email protected]
66
77
\*******************************************************************/
88

9-
// #define DEBUG
10-
119
#ifdef DEBUG
1210
#include <iostream>
1311
#endif

src/java_bytecode/java_local_variable_table.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ static void populate_predecessor_map(
352352
// handling is presently vague (any subroutine is assumed to
353353
// be able to return to any callsite)
354354
msg.warning() << "Local variable table: ignoring flow from "
355-
<< "out of range for " << it->var.name << " "
355+
<< "out of range for " << it->var.name << ' '
356356
<< pred << " -> " << amapit->first
357357
<< messaget::eom;
358358
continue;
@@ -375,7 +375,7 @@ static void populate_predecessor_map(
375375
// assumed to be able to return to any callsite)
376376
msg.warning() << "Local variable table: ignoring flow from "
377377
<< "clashing variable for "
378-
<< it->var.name << " " << pred << " -> "
378+
<< it->var.name << ' ' << pred << " -> "
379379
<< amapit->first << messaget::eom;
380380
continue;
381381
}
@@ -549,9 +549,8 @@ static void merge_variable_table_entries(
549549
#ifdef DEBUG
550550
debug_out << "Merged " << merge_vars.size() << " variables named "
551551
<< merge_into.var.name << "; new live range "
552-
<< merge_into.var.start_pc << "-"
553-
<< merge_into.var.start_pc + merge_into.var.length
554-
<< messaget::eom;
552+
<< merge_into.var.start_pc << '-'
553+
<< merge_into.var.start_pc + merge_into.var.length << '\n';
555554
#endif
556555

557556
// Nuke the now-subsumed var-table entries:

src/linking/linking.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,6 @@ bool linkingt::adjust_object_type_rec(
936936
else if(t1.id()!=t2.id())
937937
{
938938
// type classes do not match and can't be fixed
939-
#ifdef DEBUG
940-
str << "LINKING: cannot join " << t1.id() << " vs. " << t2.id();
941-
debug_msg();
942-
#endif
943-
944939
return true;
945940
}
946941

@@ -1041,11 +1036,6 @@ bool linkingt::adjust_object_type(
10411036
const symbolt &new_symbol,
10421037
bool &set_to_new)
10431038
{
1044-
#ifdef DEBUG
1045-
str << "LINKING: trying to adjust types of " << old_symbol.name;
1046-
debug_msg();
1047-
#endif
1048-
10491039
const typet &old_type=follow_tags_symbols(ns, old_symbol.type);
10501040
const typet &new_type=follow_tags_symbols(ns, new_symbol.type);
10511041

src/path-symex/path_symex.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ Author: Daniel Kroening, [email protected]
2222
#include "path_symex.h"
2323
#include "path_symex_class.h"
2424

25-
// #define DEBUG
26-
2725
#ifdef DEBUG
2826
#include <iostream>
2927
#endif

0 commit comments

Comments
 (0)