Changes in src/Common/SemanticError.cc [244b934:a16764a6]
- File:
-
- 1 edited
-
src/Common/SemanticError.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/SemanticError.cc
r244b934 ra16764a6 14 14 // 15 15 16 #include <cstdarg>17 16 #include <cstdio> // for fileno, stderr 18 17 #include <unistd.h> // for isatty … … 51 50 } 52 51 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); 52 void SemanticWarningImpl( CodeLocation location, std::string msg ) { 75 53 std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl; 76 54 }
Note:
See TracChangeset
for help on using the changeset viewer.