Index: src/Common/SemanticError.h
===================================================================
--- src/Common/SemanticError.h	(revision d55d7a68246b165aeaa9e161109032ddd07146d8)
+++ src/Common/SemanticError.h	(revision dcbb03b437bf748276aed3f63bfc0ad59a474e4b)
@@ -16,111 +16,61 @@
 #pragma once
 
-#include <exception>									// for exception
-#include <iostream>										// for ostream
-#include <list>											// for list
-#include <string>										// for string
-#include <unistd.h>										// for isatty
-
-#include "CodeLocation.h"								// for CodeLocation, toString
+#include "ErrorObjects.h"
 
 //-----------------------------------------------------------------------------
 // Errors
-struct error {
-	CodeLocation location;
-	std::string description;
 
-	error() = default;
-	error( CodeLocation loc, const std::string & str ) : location( loc ), description( str ) {}
-};
-
-class SemanticError : public std::exception {
-  public:
-  	SemanticError() = default;
-	SemanticError( CodeLocation location, std::string error );
-	~SemanticError() throw() {}
-
-	// constructs an exception using the given message and the printed representation of the obj (T must have a print method)
-	template< typename T > SemanticError(const T * obj, const std::string & error);
-	template< typename T > SemanticError( CodeLocation location, const T * obj, const std::string & error);
-
-	static inline const std::string & error_str() {
-		static std::string str = isatty( STDERR_FILENO ) ? "\e[31merror:\e[39m " : "error: ";
-		return str;
-	}
-
-	void append( SemanticError & other );
-	void append( CodeLocation location, const std::string & );
-	bool isEmpty() const;
-	void print();
-  private:
-	std::list< error > errors;
-};
+__attribute__((noreturn)) void SemanticError( CodeLocation location, std::string error );
 
 template< typename T >
-SemanticError::SemanticError( const T * obj, const std::string & error )
-	: SemanticError( obj->location, toString( error, obj ) )
-{}
+__attribute__((noreturn)) static inline void SemanticError( const T * obj, const std::string & error ) {
+	SemanticError( obj->location, toString( error, obj ) );
+}
 
 template< typename T >
-SemanticError::SemanticError( CodeLocation location, const T * obj, const std::string & error )
-	: SemanticError( location, toString( error, obj ) )
-{}
+__attribute__((noreturn)) static inline void SemanticError( CodeLocation location, const T * obj, const std::string & error ) {
+	SemanticError( location, toString( error, obj ) );
+}
 
 //-----------------------------------------------------------------------------
 // Warnings
-class SemanticWarning {
-  public:
-  	SemanticWarning( CodeLocation location, std::string error );
-	~SemanticWarning() throw() {}
 
-	// constructs an exception using the given message and the printed representation of the obj (T must have a print method)
-	template< typename T > SemanticWarning(const T * obj, const std::string & error);
-	template< typename T > SemanticWarning( CodeLocation location, const T * obj, const std::string & error);
+constexpr const char * const WarningFormats[] = {
 
-	static inline const std::string & warning_str() {
-		static std::string str = isatty( STDERR_FILENO ) ? "\e[95mwarning:\e[39m " : "warning: ";
-		return str;
-	}
-
-  private:
 };
 
-template< typename T >
-SemanticWarning::SemanticWarning( const T * obj, const std::string & error )
-	: SemanticWarning( obj->location, toString( error, obj ) )
-{}
+enum class Warning {
+	NUMBER_OF_WARNINGS, //This MUST be the last warning
+};
 
-template< typename T >
-SemanticWarning::SemanticWarning( CodeLocation location, const T * obj, const std::string & error )
-	: SemanticWarning( location, toString( error, obj ) )
-{}
+static_assert(
+	(sizeof(WarningFormats) / sizeof(WarningFormats[0])) == ((unsigned long)Warning::NUMBER_OF_WARNINGS),
+	"Each warning format should have a corresponding warning enum value"
+);
+
+#define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[id], __VA_ARGS__)
+
+void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4)));
+
 
 //-----------------------------------------------------------------------------
 // Helpers
-static inline const std::string & bold_ttycode() {
-	static std::string str = isatty( STDERR_FILENO ) ? "\e[1m" : "";
-	return str;
+namespace ErrorHelpers {
+	const std::string & error_str();
+	const std::string & warning_str();
+	const std::string & bold_ttycode();
+	const std::string & reset_font_ttycode();
+
+	std::string make_bold( const std::string & str );
+
+	struct bold {};
+	std::ostream & operator<<(std::ostream & os, bold);
+
+	struct reset_font {};
+	std::ostream & operator<<(std::ostream & os, reset_font);
 }
 
-static inline const std::string & reset_font_ttycode() {
-	static std::string str = isatty( STDERR_FILENO ) ? "\e[0m" : "";
-	return str;
-}
 
-static inline std::string make_bold( const std::string & str ) {
-	return bold_ttycode() + str + reset_font_ttycode();
-}
 
-struct bold {};
-static inline std::ostream & operator<<(std::ostream & os, bold) {
-	os << bold_ttycode();
-	return os;
-}
-
-struct reset_font {};
-static inline std::ostream & operator<<(std::ostream & os, reset_font) {
-	os << reset_font_ttycode();
-	return os;
-}
 
 // Local Variables: //
