Skip to content

Commit

Permalink
Use #pragma once instead of #include guards
Browse files Browse the repository at this point in the history
#pragma once is supported by all modern compilers:
http://en.wikipedia.org/wiki/Pragma_once#Portability
  • Loading branch information
stepancheg committed May 2, 2013
1 parent 0c043f1 commit c4714bc
Show file tree
Hide file tree
Showing 31 changed files with 56 additions and 126 deletions.
6 changes: 2 additions & 4 deletions compiler/analyzer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __ANALYZER_HPP
#define __ANALYZER_HPP
#pragma once


#include "clay.hpp"

Expand Down Expand Up @@ -150,5 +150,3 @@ enum StatementAnalysis {
ExprPtr implicitUnpackExpr(size_t wantCount, ExprListPtr exprs);

}

#endif // __ANALYZER_HPP
6 changes: 1 addition & 5 deletions compiler/analyzer_op.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef __CLAY_ANALYZER_OP_HPP
#define __CLAY_ANALYZER_OP_HPP
#pragma once


#include "clay.hpp"
Expand All @@ -11,6 +10,3 @@ MultiPValuePtr analyzePrimOp(PrimOpPtr x, MultiPValuePtr args);


}


#endif
6 changes: 1 addition & 5 deletions compiler/checkedcast.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef __CLAY_DEBUGCAST_HPP
#define __CLAY_DEBUGCAST_HPP
#pragma once


#include "assert.h"
Expand All @@ -17,6 +16,3 @@ To checked_cast(From* from) {


}


#endif
6 changes: 2 additions & 4 deletions compiler/clay.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __CLAY_HPP
#define __CLAY_HPP
#pragma once


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
Expand Down Expand Up @@ -2736,5 +2736,3 @@ struct MultiStatic : public Object {
};

}

#endif
3 changes: 3 additions & 0 deletions compiler/claydoc.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#pragma once


#include <string>
#include <vector>
#include <iostream>
Expand Down
6 changes: 2 additions & 4 deletions compiler/clone.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __CLONE_HPP
#define __CLONE_HPP
#pragma once


#include <vector>

Expand Down Expand Up @@ -28,5 +28,3 @@ CatchPtr clone(CatchPtr x);
void clone(llvm::ArrayRef<CatchPtr> x, vector<CatchPtr> &out);

} // namespace clay

#endif // __CLONE_HPP
6 changes: 2 additions & 4 deletions compiler/codegen.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __CODEGEN_HPP
#define __CODEGEN_HPP
#pragma once


#include "clay.hpp"
#include "types.hpp"
Expand Down Expand Up @@ -248,5 +248,3 @@ CValuePtr staticCValue(ObjectPtr obj, CodegenContext* ctx);
std::string getCodeName(InvokeEntry* entry);

}

#endif // __CODEGEN_HPP
5 changes: 1 addition & 4 deletions compiler/codegen_op.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef __CLAY_CODEGEN_OP_HPP
#define __CLAY_CODEGEN_OP_HPP
#pragma once


#include "clay.hpp"
Expand All @@ -15,5 +14,3 @@ void codegenPrimOp(PrimOpPtr x,


}

#endif
6 changes: 2 additions & 4 deletions compiler/constructors.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __CONSTRUCTORS_HPP
#define __CONSTRUCTORS_HPP
#pragma once


#include "clay.hpp"

Expand All @@ -11,5 +11,3 @@ vector<OverloadPtr> &getPatternOverloads();
void initBuiltinConstructor(RecordDeclPtr x);

}

#endif // __CONSTRUCTORS_HPP
6 changes: 2 additions & 4 deletions compiler/desugar.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __DESUGAR_HPP
#define __DESUGAR_HPP
#pragma once


#include "clay.hpp"

Expand All @@ -21,5 +21,3 @@ llvm::ArrayRef<TopLevelItemPtr> desugarEvalTopLevel(EvalTopLevelPtr eval, EnvPtr
OverloadPtr desugarAsOverload(OverloadPtr &x);

}

#endif // __DESUGAR_HPP
5 changes: 1 addition & 4 deletions compiler/env.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef __ENV_HPP
#define __ENV_HPP
#pragma once


#include "clay.hpp"
Expand Down Expand Up @@ -33,5 +32,3 @@ Location safeLookupCallByNameLocation(EnvPtr env);
bool lookupExceptionAvailable(const Env* env);

} // namespace clay

#endif // __ENV_HPP
6 changes: 2 additions & 4 deletions compiler/error.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __ERROR_HPP
#define __ERROR_HPP
#pragma once


#include "clay.hpp"
#include "invoketables.hpp"
Expand Down Expand Up @@ -128,5 +128,3 @@ class CompilerError : std::exception {
};

}

#endif // __ERROR_HPP
6 changes: 2 additions & 4 deletions compiler/evaluator.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __EVALUATOR_HPP
#define __EVALUATOR_HPP
#pragma once


#include "clay.hpp"

Expand Down Expand Up @@ -92,5 +92,3 @@ EValuePtr evalAllocValue(TypePtr t);
EValuePtr evalOneAsRef(ExprPtr expr, EnvPtr env);

}

#endif // __EVALUATOR_HPP
7 changes: 1 addition & 6 deletions compiler/evaluator_op.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef __CLAY_EVALUATOR_OP_HPP
#define __CLAY_EVALUATOR_OP_HPP
#pragma once


#include "clay.hpp"
Expand All @@ -12,7 +11,3 @@ void evalPrimOp(PrimOpPtr x, MultiEValuePtr args, MultiEValuePtr out);


}



#endif
6 changes: 2 additions & 4 deletions compiler/externals.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __EXTERNALS_HPP
#define __EXTERNALS_HPP
#pragma once


#include "clay.hpp"
#include "codegen.hpp"
Expand Down Expand Up @@ -139,5 +139,3 @@ ExternalTargetPtr getExternalTarget();


}

#endif // __EXTERNALS_HPP
6 changes: 2 additions & 4 deletions compiler/hirestimer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __CLAY_HIRESTIMER_HPP
#define __CLAY_HIRESTIMER_HPP
#pragma once


namespace clay {
struct HiResTimer {
Expand All @@ -14,5 +14,3 @@ struct HiResTimer {
double elapsedMillis() { return (double)elapsedNanos() / (1000 * 1000); }
};
}

#endif
6 changes: 2 additions & 4 deletions compiler/invoketables.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __INVOKETABLES_HPP
#define __INVOKETABLES_HPP
#pragma once


#include "clay.hpp"
#include "matchinvoke.hpp"
Expand Down Expand Up @@ -129,5 +129,3 @@ InvokeEntry* lookupInvokeEntry(ObjectPtr callable,
void setFinalOverloadsEnabled(bool enabled);

}

#endif // __INVOKETABLES_HPP
6 changes: 2 additions & 4 deletions compiler/lambdas.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __LAMBDAS_HPP
#define __LAMBDAS_HPP
#pragma once


#include "clay.hpp"

Expand All @@ -8,5 +8,3 @@ namespace clay {
void initializeLambda(LambdaPtr x, EnvPtr env);

}

#endif // __LAMBDAS_HPP
6 changes: 2 additions & 4 deletions compiler/lexer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __LEXER_HPP
#define __LEXER_HPP
#pragma once


#include "clay.hpp"

Expand Down Expand Up @@ -49,5 +49,3 @@ void tokenize(SourcePtr source, unsigned offset, size_t length,
bool isSpace(char c);

}

#endif // __LEXER_HPP
6 changes: 2 additions & 4 deletions compiler/literals.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __LITERALS_HPP
#define __LITERALS_HPP
#pragma once


#include "clay.hpp"

Expand All @@ -9,5 +9,3 @@ ValueHolderPtr parseIntLiteral(ModulePtr module, IntLiteral *x);
ValueHolderPtr parseFloatLiteral(ModulePtr module, FloatLiteral *x);

}

#endif // __LITERALS_HPP
6 changes: 2 additions & 4 deletions compiler/loader.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __LOADER_HPP
#define __LOADER_HPP
#pragma once


#include "clay.hpp"

Expand Down Expand Up @@ -244,5 +244,3 @@ static inline llvm::StringRef primOpName(const PrimOpPtr& x) {
}

}

#endif // __LOADER_HPP
6 changes: 2 additions & 4 deletions compiler/matchinvoke.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __MATCHINVOKE_HPP
#define __MATCHINVOKE_HPP
#pragma once


#include "clay.hpp"

Expand Down Expand Up @@ -119,5 +119,3 @@ MatchResultPtr matchInvoke(OverloadPtr overload,
void printMatchError(llvm::raw_ostream &os, const MatchResultPtr& result);

}

#endif // __MATCHINVOKE_HPP
6 changes: 1 addition & 5 deletions compiler/objects.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef __OBJECTS_HPP
#define __OBJECTS_HPP
#pragma once


#include "clay.hpp"
Expand Down Expand Up @@ -68,6 +67,3 @@ private :
};

} // namespace clay


#endif // __OBJECTS_HPP
6 changes: 2 additions & 4 deletions compiler/operators.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __CLAYNAMES_HPP
#define __CLAYNAMES_HPP
#pragma once


namespace clay {

Expand Down Expand Up @@ -156,5 +156,3 @@ ExprPtr operator_expr_doIntegerNegateChecked();
ExprPtr operator_expr_doIntegerConvertChecked();

}

#endif
6 changes: 2 additions & 4 deletions compiler/parachute.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#ifndef __PARACHUTE_HPP
#define __PARACHUTE_HPP
#pragma once


namespace clay {

int parachute(int (*mainfn)(int, char **, char const* const*),
int argc, char **argv, char const* const* envp);

}

#endif
6 changes: 2 additions & 4 deletions compiler/parser.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __PARSER_HPP
#define __PARSER_HPP
#pragma once


#include "clay.hpp"
#include "lexer.hpp"
Expand Down Expand Up @@ -33,5 +33,3 @@ typedef vector<Token>(*AddTokensCallback)();
void setAddTokens(AddTokensCallback f);

}

#endif // __PARSER_HPP
6 changes: 2 additions & 4 deletions compiler/patterns.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __PATTERNS_HPP
#define __PATTERNS_HPP
#pragma once


#include "clay.hpp"

Expand Down Expand Up @@ -31,5 +31,3 @@ void patternPrint(llvm::raw_ostream &out, PatternPtr x);
void patternPrint(llvm::raw_ostream &out, MultiPatternPtr x);

}

#endif // __PATTERNS_HPP
6 changes: 2 additions & 4 deletions compiler/printer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __PRINTER_HPP
#define __PRINTER_HPP
#pragma once


#include "clay.hpp"

Expand Down Expand Up @@ -73,5 +73,3 @@ string shortString(llvm::StringRef in);


}

#endif // __PRINTER_HPP
6 changes: 2 additions & 4 deletions compiler/profiler.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#ifndef __CLAY_PROFILER_HPP
#define __CLAY_PROFILER_HPP
#pragma once


#include "clay.hpp"

namespace clay {
void incrementCount(ObjectPtr obj);
void displayCounts();
}

#endif
Loading

0 comments on commit c4714bc

Please sign in to comment.