Index: src/Common/SemanticError.cc
===================================================================
--- src/Common/SemanticError.cc	(revision b1f2007d03a9290ff9a472f7132714791f65e6b4)
+++ src/Common/SemanticError.cc	(revision 58c5821c0de1fbb02e91546c9adf1700666b2f9f)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Dec 11 15:59:09 2023
-// Update Count     : 14
+// Last Modified On : Thu Dec 14 13:45:28 2023
+// Update Count     : 34
 //
 
@@ -23,4 +23,6 @@
 #include <vector>
 
+using namespace std;
+
 #include "Common/utility.h"								// for to_string, CodeLocation (ptr only)
 #include "SemanticError.h"
@@ -28,6 +30,6 @@
 //-----------------------------------------------------------------------------
 // Severity Handling
-std::vector<Severity> & get_severities() {
-	static std::vector<Severity> severities;
+vector<Severity> & get_severities() {
+	static vector<Severity> severities;
 	if(severities.empty()) {
 		severities.reserve((size_t)Warning::NUMBER_OF_WARNINGS);
@@ -60,5 +62,5 @@
 	size_t idx = 0;
 	for ( const auto & w : WarningFormats ) {
-		if ( std::strcmp( name, w.name ) == 0 ) {
+		if ( strcmp( name, w.name ) == 0 ) {
 			get_severities()[idx] = s;
 			break;
@@ -73,5 +75,5 @@
 bool SemanticErrorThrow = false;
 
-SemanticErrorException::SemanticErrorException( CodeLocation location, std::string error ) {
+SemanticErrorException::SemanticErrorException( CodeLocation location, string error ) {
 	append( location, error );
 }
@@ -81,5 +83,5 @@
 }
 
-void SemanticErrorException::append( CodeLocation location, const std::string & msg ) {
+void SemanticErrorException::append( CodeLocation location, const string & msg ) {
 	errors.emplace_back( location, msg );
 }
@@ -90,5 +92,5 @@
 
 void SemanticErrorException::print() {
-	using std::to_string;
+//	using to_string;
 
 	errors.sort([](const error & lhs, const error & rhs) -> bool {
@@ -100,5 +102,5 @@
 
 	for( auto err : errors ) {
-		std::cerr << ErrorHelpers::bold() << err.location << ErrorHelpers::error_str() << ErrorHelpers::reset_font() << err.description << std::endl;
+		cerr << ErrorHelpers::bold() << err.location << ErrorHelpers::error_str() << ErrorHelpers::reset_font() << err.description << endl;
 	}
 }
@@ -115,47 +117,24 @@
 }
 
-void SemanticError( CodeLocation location, std::string error ) {
-	SemanticErrorThrow = true;
-	throw SemanticErrorException( location, error );
-}
+void SemanticWarning( CodeLocation location, Warning warning, ... ) {
+	Severity severity = get_severities()[(int)warning];
 
-namespace {
-	// convert format string and arguments into a single string
-	std::string fmtToString(const char * fmt, va_list ap) {
-		int size = 128;
-		while ( true ) {
-			char buf[size];
-			va_list args;
-			va_copy( args, ap );
-			int n = vsnprintf(&buf[0], size, fmt, args);
-			va_end( args );
-			if ( n < size && n >= 0 ) return buf;
-			size *= 2;
-		}
-		assert( false );
-	}
-}
-
-void SemanticWarningImpl( CodeLocation location, Warning warning, const char * const fmt, ... ) {
-	Severity severity = get_severities()[(int)warning];
-	switch(severity) {
+	switch ( severity ) {
 	case Severity::Suppress :
 		break;
 	case Severity::Warn :
-		{
-			va_list args;
-			va_start(args, fmt);
-			std::string msg = fmtToString( fmt, args );
-			va_end(args);
-			std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl;
-		}
-		break;
 	case Severity::Error :
 		{
+			char msg[2048];								// worst-case error-message buffer
 			va_list args;
-			va_start(args, fmt);
-			std::string msg = fmtToString( fmt, args );
-			va_end(args);
-			SemanticError(location, msg);
+			va_start( args, warning );
+			vsnprintf( msg, sizeof(msg), WarningFormats[(int)warning].message, args ); // always null terminated, but may be truncated
+			va_end( args );
+
+			if ( severity == Severity::Warn ) {
+				cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << endl;
+			} else {
+				SemanticError( location, string( msg ) );
+			}
 		}
 		break;
@@ -175,34 +154,34 @@
 	}
 
-	const std::string & error_str() {
-		static std::string str = with_colors() ? "\e[31merror:\e[39m " : "error: ";
+	const string & error_str() {
+		static string str = with_colors() ? "\e[31merror:\e[39m " : "error: ";
 		return str;
 	}
 
-	const std::string & warning_str() {
-		static std::string str = with_colors() ? "\e[95mwarning:\e[39m " : "warning: ";
+	const string & warning_str() {
+		static string str = with_colors() ? "\e[95mwarning:\e[39m " : "warning: ";
 		return str;
 	}
 
-	const std::string & bold_ttycode() {
-		static std::string str = with_colors() ? "\e[1m" : "";
+	const string & bold_ttycode() {
+		static string str = with_colors() ? "\e[1m" : "";
 		return str;
 	}
 
-	const std::string & reset_font_ttycode() {
-		static std::string str = with_colors() ? "\e[0m" : "";
+	const string & reset_font_ttycode() {
+		static string str = with_colors() ? "\e[0m" : "";
 		return str;
 	}
 
-	std::string make_bold( const std::string & str ) {
+	string make_bold( const string & str ) {
 		return bold_ttycode() + str + reset_font_ttycode();
 	}
 
-	std::ostream & operator<<(std::ostream & os, bold) {
+	ostream & operator<<(ostream & os, bold) {
 		os << bold_ttycode();
 		return os;
 	}
 
-	std::ostream & operator<<(std::ostream & os, reset_font) {
+	ostream & operator<<(ostream & os, reset_font) {
 		os << reset_font_ttycode();
 		return os;
