aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/c.cpp4
-rw-r--r--src/compile.cpp3
-rw-r--r--src/constrain.cpp2
-rw-r--r--src/cps.cpp3
-rw-r--r--src/gc.cpp8
-rw-r--r--src/lift.cpp3
-rw-r--r--src/llvm.cpp5
-rw-r--r--src/parse.cpp3
-rw-r--r--src/pprint.cpp2
-rw-r--r--src/repl.cpp5
-rw-r--r--src/resp.cpp5
-rw-r--r--src/resp.hpp24
12 files changed, 50 insertions, 17 deletions
diff --git a/src/c.cpp b/src/c.cpp
index 3ebd608..a19f005 100644
--- a/src/c.cpp
+++ b/src/c.cpp
@@ -21,7 +21,11 @@
#include <map>
#include <sstream>
+#include <string>
+#include <vector>
+
#include <boost/format.hpp>
+
#include "resp.hpp"
using namespace std;
diff --git a/src/compile.cpp b/src/compile.cpp
index 2132c91..f94967f 100644
--- a/src/compile.cpp
+++ b/src/compile.cpp
@@ -19,6 +19,9 @@
* @brief Compile all code (compilation pass 2)
*/
+#include <string>
+#include <vector>
+
#include "resp.hpp"
using namespace std;
diff --git a/src/constrain.cpp b/src/constrain.cpp
index 047a5b0..2520bca 100644
--- a/src/constrain.cpp
+++ b/src/constrain.cpp
@@ -20,6 +20,8 @@
*/
#include <set>
+#include <string>
+
#include "resp.hpp"
static void
diff --git a/src/cps.cpp b/src/cps.cpp
index f7c3892..3358089 100644
--- a/src/cps.cpp
+++ b/src/cps.cpp
@@ -20,6 +20,9 @@
*/
#include <set>
+#include <utility>
+#include <vector>
+
#include "resp.hpp"
/** (cps x cont) => (cont x) */
diff --git a/src/gc.cpp b/src/gc.cpp
index 7dd0d15..5b73cf7 100644
--- a/src/gc.cpp
+++ b/src/gc.cpp
@@ -19,14 +19,14 @@
* @brief Garbage collection
*/
-#include <cassert>
-#include <iostream>
-#include <set>
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <cassert>
+#include <iostream>
+#include <set>
+
#include "resp.hpp"
#include "tlsf.h"
diff --git a/src/lift.cpp b/src/lift.cpp
index e3a741b..6bd991b 100644
--- a/src/lift.cpp
+++ b/src/lift.cpp
@@ -23,6 +23,9 @@
* a closure (a tuple with the function and necessary context)
*/
+#include <algorithm>
+#include <string>
+
#include "resp.hpp"
using namespace std;
diff --git a/src/llvm.cpp b/src/llvm.cpp
index 391c9dd..c3f4d2c 100644
--- a/src/llvm.cpp
+++ b/src/llvm.cpp
@@ -24,7 +24,11 @@
#include <map>
#include <sstream>
+#include <string>
+#include <vector>
+
#include <boost/format.hpp>
+
#include "llvm/Value.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Assembly/AsmAnnotationWriter.h"
@@ -40,6 +44,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetSelect.h"
#include "llvm/Transforms/Scalar.h"
+
#include "resp.hpp"
using namespace llvm;
diff --git a/src/parse.cpp b/src/parse.cpp
index 8b563cf..73925b3 100644
--- a/src/parse.cpp
+++ b/src/parse.cpp
@@ -20,7 +20,10 @@
*/
#include <stdio.h>
+
#include <stack>
+#include <string>
+
#include "resp.hpp"
using namespace std;
diff --git a/src/pprint.cpp b/src/pprint.cpp
index 5ceb039..c948865 100644
--- a/src/pprint.cpp
+++ b/src/pprint.cpp
@@ -19,6 +19,8 @@
* @brief Pretty-print AST expressions
*/
+#include <string>
+
#include "resp.hpp"
ostream&
diff --git a/src/repl.cpp b/src/repl.cpp
index 88fefab..f5f7fd4 100644
--- a/src/repl.cpp
+++ b/src/repl.cpp
@@ -21,7 +21,10 @@
#include <cerrno>
#include <cstring>
-#include <fstream>
+#include <limits>
+#include <list>
+#include <string>
+
#include "resp.hpp"
using namespace std;
diff --git a/src/resp.cpp b/src/resp.cpp
index 49c4643..3f9766c 100644
--- a/src/resp.cpp
+++ b/src/resp.cpp
@@ -22,6 +22,11 @@
#include <cerrno>
#include <cstring>
#include <fstream>
+#include <limits>
+#include <list>
+#include <map>
+#include <string>
+
#include "resp.hpp"
using namespace std;
diff --git a/src/resp.hpp b/src/resp.hpp
index d5ea459..24e79ff 100644
--- a/src/resp.hpp
+++ b/src/resp.hpp
@@ -22,6 +22,10 @@
#ifndef RESP_HPP
#define RESP_HPP
+#include <stdarg.h>
+#include <stdint.h>
+#include <string.h>
+
#include <iostream>
#include <list>
#include <map>
@@ -31,10 +35,6 @@
#include <string>
#include <vector>
-#include <stdarg.h>
-#include <stdint.h>
-#include <string.h>
-
#include <boost/format.hpp>
#define FOREACH(IT, i, c) for (IT i = (c).begin(); i != (c).end(); ++i)
@@ -44,7 +44,6 @@
using namespace std;
using boost::format;
-
/***************************************************************************
* Basic Utility Classes *
***************************************************************************/
@@ -98,7 +97,7 @@ enum Tag {
struct GC {
typedef std::list<const Object*> Roots;
typedef std::list<Object*> Heap;
- GC(size_t pool_size);
+ explicit GC(size_t pool_size);
~GC();
void* alloc(size_t size);
void collect(const Roots& roots);
@@ -226,7 +225,7 @@ private:
/// Tuple (heterogeneous sequence of fixed length), e.g. "(a b c)"
struct ATuple : public AST {
- ATuple(Cursor c) : AST(T_TUPLE, c), _len(0), _vec(0) {}
+ explicit ATuple(Cursor c) : AST(T_TUPLE, c), _len(0), _vec(0) {}
ATuple(const ATuple& exp) : AST(T_TUPLE, exp.loc), _len(exp._len) {
_vec = (const AST**)malloc(sizeof(AST*) * _len);
memcpy(_vec, exp._vec, sizeof(AST*) * _len);
@@ -280,7 +279,7 @@ struct ATuple : public AST {
void last(AST* ast) { _vec[_len - 1] = ast; }
struct const_iterator {
- const_iterator(const ATuple* n) : node(n) {
+ explicit const_iterator(const ATuple* n) : node(n) {
assert(!n || n->tup_len() == 0 || n->tup_len() == 2);
if (!n || n->tup_len() == 0)
node = NULL;
@@ -386,7 +385,7 @@ struct AType : public ATuple {
// Utility class for easily building lists from left to right
template<typename CT, typename ET> // ConsType, ElementType
struct List {
- List(CT* h=0) : head(h), tail(0) {}
+ explicit List(CT* h=0) : head(h), tail(0) {}
List(Cursor c, ET* ast, ...) : head(0), tail(0) {
push_back(ast);
assert(*head->begin() == ast);
@@ -465,7 +464,7 @@ AST::operator==(const AST& rhs) const
if (!rt || me->kind != rt->kind) {
assert(str() != rt->str());
return false;
- } else
+ } else {
switch (me->kind) {
case AType::VAR: return me->id == rt->id;
case AType::NAME: return me->head()->str() == rt->head()->str();
@@ -473,6 +472,7 @@ AST::operator==(const AST& rhs) const
case AType::EXPR: return list_equals(me, rt);
case AType::DOTS: return true;
}
+ }
return false; // never reached
}
case T_STRING:
@@ -628,7 +628,7 @@ inline ostream& operator<<(ostream& out, const Subst& s) {
/// Type constraint set
struct Constraints : public list<Constraint> {
Constraints() : list<Constraint>() {}
- Constraints(const Subst& subst) : list<Constraint>() {
+ explicit Constraints(const Subst& subst) : list<Constraint>() {
FOREACH(Subst::const_iterator, i, subst)
push_back(Constraint(new AType(*i->first), new AType(*i->second)));
}
@@ -645,7 +645,7 @@ inline ostream& operator<<(ostream& out, const Constraints& c) {
/// Type-Time Environment
struct TEnv : public Env<const AType*> {
- TEnv(PEnv& p)
+ explicit TEnv(PEnv& p)
: penv(p)
, varID(1)
, Closure(new AType(penv.sym("Closure"), AType::NAME))