Skip to content

Commit

Permalink
remove '#include <iostream>' from headers and from unneeded places
Browse files Browse the repository at this point in the history
It's harmful to have iostream everywhere as it injects functions in the compiled files
  • Loading branch information
nunoplopes committed Jun 17, 2022
1 parent 70bcf0b commit 73a24ca
Show file tree
Hide file tree
Showing 90 changed files with 99 additions and 95 deletions.
1 change: 0 additions & 1 deletion scripts/update_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,6 @@ def write_log_h_preamble(log_h):

def write_log_c_preamble(log_c):
log_c.write('// Automatically generated file\n')
log_c.write('#include<iostream>\n')
log_c.write('#include\"api/z3.h\"\n')
log_c.write('#include\"api/api_log_macros.h\"\n')
log_c.write('#include\"api/z3_logger.h\"\n')
Expand Down
1 change: 0 additions & 1 deletion src/api/api_ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Module Name:
Revision History:
--*/
#include<iostream>
#include "api/api_log_macros.h"
#include "api/api_context.h"
#include "api/api_util.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_ast_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Module Name:
Revision History:
--*/
#include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_ast_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Module Name:
Revision History:
--*/
#include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_fpa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Module Name:
Notes:
--*/
#include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_goal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Module Name:
Revision History:
--*/
#include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_numeral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Revision History:
--*/
#include<cmath>
#include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Module Name:
Revision History:
--*/
#include<iostream>
#include "util/cancel_eh.h"
#include "util/scoped_timer.h"
#include "util/scoped_ctrl_c.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Module Name:
Revision History:
--*/
#include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Module Name:
Revision History:
--*/
#include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_qe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Module Name:
--*/

#include <iostream>
#include "ast/expr_map.h"
#include "api/z3.h"
#include "api/api_log_macros.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_rcf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Module Name:
Notes:
--*/
#include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Module Name:
Revision History:
--*/
#include<iostream>
#include<thread>
#include "util/scoped_ctrl_c.h"
#include "util/cancel_eh.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_special_relations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Revision History:
--*/

#include <iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Module Name:
Revision History:
--*/
#include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
1 change: 0 additions & 1 deletion src/api/api_tactic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Module Name:
Revision History:
--*/
#include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
Expand Down
2 changes: 1 addition & 1 deletion src/api/c++/z3++.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Copyright (c) 2012 Microsoft Corporation
#pragma once

#include<cassert>
#include<iostream>
#include<ostream>
#include<string>
#include<sstream>
#include<memory>
Expand Down
1 change: 0 additions & 1 deletion src/api/z3_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Module Name:
--*/

#include<iostream>
#include "util/rational.h"
#include "api/z3_macros.h"

Expand Down
1 change: 1 addition & 0 deletions src/api/z3_replayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Module Name:
#include "util/stream_buffer.h"
#include "util/symbol.h"
#include "util/trace.h"
#include<iostream>
#include<sstream>
#include<vector>

Expand Down
1 change: 0 additions & 1 deletion src/api/z3_replayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Module Name:
--*/
#pragma once

#include<iostream>
#include "api/z3.h"
#include "util/z3_exception.h"

Expand Down
1 change: 1 addition & 0 deletions src/ast/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Revision History:
#include "ast/arith_decl_plugin.h"
#include "ast/ast_translation.h"
#include "util/z3_version.h"
#include <iostream>


// -----------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/ast/ast_ll_pp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Revision History:

--*/

#include<iostream>
#include "ast/ast_ll_pp.h"
#include "ast/for_each_ast.h"
#include "ast/arith_decl_plugin.h"
#include "ast/datatype_decl_plugin.h"
Expand Down
2 changes: 1 addition & 1 deletion src/ast/ast_ll_pp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Revision History:
#pragma once

#include "ast/ast.h"
#include<iostream>
#include<ostream>

void ast_ll_pp(std::ostream & out, ast_manager & m, ast * n, bool only_exprs=true, bool compact=true);
void ast_ll_pp(std::ostream & out, ast_manager & m, ast * n, ast_mark & visited, bool only_exprs=true, bool compact=true);
Expand Down
2 changes: 1 addition & 1 deletion src/ast/ast_pp_dot.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Abstract: Pretty-printer for proofs in Graphviz format

#pragma once

#include <iostream>
#include <ostream>
#include "ast/ast_pp.h"

class ast_pp_dot {
Expand Down
4 changes: 4 additions & 0 deletions src/ast/ast_printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Revision History:
--*/
#include "ast/ast_printer.h"
#include "ast/pp.h"
#include <iostream>

class simple_ast_printer_context : public ast_printer_context {
ast_manager & m_manager;
Expand Down Expand Up @@ -51,3 +52,6 @@ class simple_ast_printer_context : public ast_printer_context {
ast_printer_context * mk_simple_ast_printer_context(ast_manager & m) {
return alloc(simple_ast_printer_context, m);
}

std::ostream & ast_printer_context::regular_stream() { return std::cout; }
std::ostream & ast_printer_context::diagnostic_stream() { return std::cerr; }
5 changes: 3 additions & 2 deletions src/ast/ast_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Revision History:

#include "ast/ast.h"
#include "ast/ast_smt2_pp.h"
#include <ostream>

class ast_printer {
public:
Expand All @@ -46,8 +47,8 @@ class ast_printer_context : public ast_printer {
public:
~ast_printer_context() override {}
virtual ast_manager & get_ast_manager() = 0;
virtual std::ostream & regular_stream() { return std::cout; }
virtual std::ostream & diagnostic_stream() { return std::cerr; }
virtual std::ostream & regular_stream();
virtual std::ostream & diagnostic_stream();
};


Expand Down
2 changes: 1 addition & 1 deletion src/ast/ast_smt_pp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Revision History:
--*/

#include<sstream>
#include<iostream>
#include<ostream>
#include "util/vector.h"
#include "util/smt2_util.h"
#include "ast/ast_smt_pp.h"
Expand Down
2 changes: 1 addition & 1 deletion src/ast/fpa/bv2fpa_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ expr_ref bv2fpa_converter::convert_bv2rm(expr * bv_rm) {
}
}
else {
std::cout << expr_ref(bv_rm, m) << " not converted\n";
//std::cout << expr_ref(bv_rm, m) << " not converted\n";
}

return res;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/fpa/fpa2bv_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void fpa2bv_converter::mk_ite(expr * c, expr * t, expr * f, expr_ref & result) {
result = m_util.mk_bv2rm(result);
}
else {
std::cout << mk_pp(t, m) << " " << mk_pp(f, m) << "\n";
//std::cout << mk_pp(t, m) << " " << mk_pp(f, m) << "\n";
UNREACHABLE();

}
Expand Down
1 change: 1 addition & 0 deletions src/cmd_context/cmd_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Module Name:
#include "solver/smt_logics.h"
#include "cmd_context/basic_cmds.h"
#include "cmd_context/cmd_context.h"
#include <iostream>

func_decls::func_decls(ast_manager & m, func_decl * f):
m_decls(TAG(func_decl*, f, 0)) {
Expand Down
1 change: 1 addition & 0 deletions src/math/lp/lp_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Revision History:
#include <algorithm>
#include <limits>
#include <iomanip>
#include <iostream>
#include <cstring>
#include "util/stopwatch.h"
#include "util/statistics.h"
Expand Down
2 changes: 1 addition & 1 deletion src/math/lp/lu.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Revision History:
#include "math/lp/static_matrix.h"
#include <string>
#include "math/lp/numeric_pair.h"
#include <iostream>
#include <ostream>
#include <fstream>
#include "math/lp/row_eta_matrix.h"
#include "math/lp/square_dense_submatrix.h"
Expand Down
2 changes: 1 addition & 1 deletion src/math/lp/mps_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Revision History:
#include <string>
#include "util/vector.h"
#include <unordered_map>
#include <iostream>
#include <ostream>
#include <fstream>
#include <locale>
#include "math/lp/lp_primal_simplex.h"
Expand Down
1 change: 1 addition & 0 deletions src/math/realclosure/realclosure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Module Name:
#include "util/ref_vector.h"
#include "util/ref_buffer.h"
#include "util/common_msgs.h"
#include <iostream>

#ifndef REALCLOSURE_INI_BUFFER_SIZE
#define REALCLOSURE_INI_BUFFER_SIZE 32
Expand Down
2 changes: 1 addition & 1 deletion src/math/simplex/sparse_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ namespace simplex {
vector<_row> const& m_rows;
void move_to_next() {
while (m_curr < m_rows.size() && m_rows[m_curr].size() == 0) {
std::cout << "size is 0 for " << m_curr << "\n";
//std::cout << "size is 0 for " << m_curr << "\n";
++m_curr;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/math/subpaving/subpaving_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Revision History:
--*/
#pragma once

#include<iostream>
#include<ostream>
#include "util/tptr.h"
#include "util/small_object_allocator.h"
#include "util/chashtable.h"
Expand Down
1 change: 1 addition & 0 deletions src/math/subpaving/tactic/subpaving_tactic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Revision History:
#include "util/mpff.h"
#include "util/mpfx.h"
#include "util/f2n.h"
#include <iostream>

class subpaving_tactic : public tactic {

Expand Down
2 changes: 1 addition & 1 deletion src/model/model_pp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Revision History:
--*/
#pragma once

#include<iostream>
#include<ostream>
class model_core;

void model_pp(std::ostream & out, model_core const & m);
Expand Down
1 change: 1 addition & 0 deletions src/model/model_v2_pp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Revision History:
#include "model/model_v2_pp.h"
#include "model/model_core.h"
#include "ast/ast_pp.h"
#include <iostream>

static void display_function(std::ostream & out, model_core const & md, func_decl * f, bool partial) {
ast_manager & m = md.get_manager();
Expand Down
2 changes: 1 addition & 1 deletion src/model/model_v2_pp.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Revision History:
--*/
#pragma once

#include<iostream>
#include<ostream>
class model_core;

void model_v2_pp(std::ostream & out, model_core const & m, bool partial = false);
Expand Down
6 changes: 3 additions & 3 deletions src/muz/base/dl_boogie_proof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ namespace datalog {
}

void boogie_proof::set_proof(proof* p) {
std::cout << "set proof\n";
//std::cout << "set proof\n";
m_proof = p;
proof_utils::push_instantiations_up(m_proof);
mk_input_resolution(m_proof);
std::cout << "proof set\n";
//std::cout << "proof set\n";
}

void boogie_proof::set_model(model* m) {
Expand Down Expand Up @@ -201,7 +201,7 @@ namespace datalog {
ptr_vector<proof> todo;
todo.push_back(p);
ast_mark visited;
std::cout << "get_subst\n" << mk_pp(p, m) << "\n";
//std::cout << "get_subst\n" << mk_pp(p, m) << "\n";
while (!todo.empty()) {
proof* p = todo.back();
todo.pop_back();
Expand Down
1 change: 1 addition & 0 deletions src/muz/base/dl_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Revision History:

--*/

#include<iostream>
#include<sstream>
#include<limits>
#include "ast/arith_decl_plugin.h"
Expand Down
2 changes: 2 additions & 0 deletions src/muz/base/dl_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,14 @@ namespace datalog {
}
container[i-ofs] = container[i];
}
#if 0
if (r_i != removed_col_cnt) {
for (unsigned i = 0; i < removed_col_cnt; ++i) {
std::cout << removed_cols[i] << " ";
}
std::cout << " container size: " << n << "\n";
}
#endif
SASSERT(r_i==removed_col_cnt);
container.resize(n-removed_col_cnt);
}
Expand Down
Loading

0 comments on commit 73a24ca

Please sign in to comment.