Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.cc

    r244b934 ra16764a6  
    1414//
    1515
    16 #include <cstdarg>
    1716#include <cstdio>                                                                               // for fileno, stderr
    1817#include <unistd.h>                                                                             // for isatty
     
    5150}
    5251
    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);
     52void SemanticWarningImpl( CodeLocation location, std::string msg ) {
    7553        std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl;
    7654}
Note: See TracChangeset for help on using the changeset viewer.