Changes in src/Common/SemanticError.cc [a16764a6:244b934]
- File:
-
- 1 edited
-
src/Common/SemanticError.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/SemanticError.cc
ra16764a6 r244b934 14 14 // 15 15 16 #include <cstdarg> 16 17 #include <cstdio> // for fileno, stderr 17 18 #include <unistd.h> // for isatty … … 50 51 } 51 52 52 void SemanticWarningImpl( CodeLocation location, std::string msg ) { 53 namespace { 54 // convert format string and arguments into a single string 55 std::string fmtToString(const char * fmt, va_list ap) { 56 int size = 128; 57 while ( true ) { 58 char buf[size]; 59 va_list args; 60 va_copy( args, ap ); 61 int n = vsnprintf(&buf[0], size, fmt, args); 62 va_end( args ); 63 if ( n < size && n >= 0 ) return buf; 64 size *= 2; 65 } 66 assert( false ); 67 } 68 } 69 70 void SemanticWarningImpl( CodeLocation location, Warning, const char * const fmt, ... ) { 71 va_list args; 72 va_start(args, fmt); 73 std::string msg = fmtToString( fmt, args ); 74 va_end(args); 53 75 std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl; 54 76 }
Note:
See TracChangeset
for help on using the changeset viewer.