Ignore:
Timestamp:
Dec 13, 2023, 9:17:13 AM (7 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
4c2fe47
Parents:
c40157e
Message:

first attempt at simplifying SemanticError? and its usage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.cc

    rc40157e rb1f2007  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun  7 08:05:26 2018
    13 // Update Count     : 10
     12// Last Modified On : Mon Dec 11 15:59:09 2023
     13// Update Count     : 14
    1414//
    1515
     
    7070//-----------------------------------------------------------------------------
    7171// Semantic Error
     72
    7273bool SemanticErrorThrow = false;
    7374
     
    101102                std::cerr << ErrorHelpers::bold() << err.location << ErrorHelpers::error_str() << ErrorHelpers::reset_font() << err.description << std::endl;
    102103        }
     104}
     105
     106void SemanticError( CodeLocation location, const char * fmt, ... ) {
     107        char msg[2048];                                                                         // worst-case error-message buffer
     108        va_list args;
     109        va_start( args, fmt );
     110        vsnprintf( msg, sizeof(msg), fmt, args );                       // always null terminated, but may be truncated
     111        va_end( args );
     112
     113        SemanticErrorThrow = true;
     114        throw SemanticErrorException( location, msg );          // convert msg to string
    103115}
    104116
Note: See TracChangeset for help on using the changeset viewer.