Changeset ca9d65e for src/Concurrency


Ignore:
Timestamp:
Dec 14, 2023, 9:05:55 PM (12 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
19a2890
Parents:
21ad568
Message:

second attempt at simplifying SemanticError? messages

Location:
src/Concurrency
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Concurrency/Corun.cpp

    r21ad568 rca9d65e  
    99// Author           : Colby Parsons
    1010// Created On       : Monday October 9 15:16:42 2023
    11 // Last Modified By : Colby Parsons
    12 // Last Modified On : Monday October 9 15:16:42 2023
    13 // Update Count     : 0
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Dec 14 17:32:17 2023
     13// Update Count     : 1
    1414//
    1515
     
    5757    Stmt * postvisit( const CoforStmt * stmt ) {
    5858        if ( !runnerBlockDecl || !coforRunnerDecl )
    59             SemanticError( stmt->location, "To use cofor statements add #include <cofor.hfa>\n" );
     59            SemanticError( stmt->location, "To use cofor statements add #include <cofor.hfa>" );
    6060
    6161        if ( stmt->inits.size() != 1 )
    62             SemanticError( stmt->location, "Cofor statements must have a single initializer in the loop control\n" );
     62            SemanticError( stmt->location, "Cofor statements must have a single initializer in the loop control" );
    6363
    6464        if ( !stmt->body )
     
    7777        const DeclStmt * declStmtPtr = dynamic_cast<const DeclStmt *>(stmt->inits.at(0).get());
    7878        if ( ! declStmtPtr )
    79             SemanticError( stmt->location, "Cofor statement initializer is somehow not a decl statement?\n" );
     79            SemanticError( stmt->location, "Cofor statement initializer is somehow not a decl statement?" );
    8080
    8181        const Decl * declPtr = dynamic_cast<const Decl *>(declStmtPtr->decl.get());
    8282        if ( ! declPtr )
    83             SemanticError( stmt->location, "Cofor statement initializer is somehow not a decl?\n" );
     83            SemanticError( stmt->location, "Cofor statement initializer is somehow not a decl?" );
    8484
    8585        Type * initType = new TypeofType( new NameExpr( loc, declPtr->name ) );
     
    246246    Stmt * postvisit( const CorunStmt * stmt ) {
    247247        if ( !runnerBlockDecl || !coforRunnerDecl )
    248             SemanticError( stmt->location, "To use corun statements add #include <cofor.hfa>\n" );
     248            SemanticError( stmt->location, "To use corun statements add #include <cofor.hfa>" );
    249249
    250250        if ( !stmt->stmt )
  • src/Concurrency/Keywords.cpp

    r21ad568 rca9d65e  
    99// Author           : Andrew Beach
    1010// Created On       : Tue Nov 16  9:53:00 2021
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Mar 11 10:40:00 2022
    13 // Update Count     : 2
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Dec 14 18:02:25 2023
     13// Update Count     : 6
    1414//
    1515
     
    682682
    683683        if ( 0 != decl->returns.size() ) {
    684                 SemanticError( decl->location, "Generator main must return void" );
     684                SemanticError( decl->location, "Generator main must return void." );
    685685        }
    686686
     
    789789        case ast::SuspendStmt::Generator:
    790790                // Generator suspends must be directly in a generator.
    791                 if ( !in_generator ) SemanticError( stmt->location, "'suspend generator' must be used inside main of generator type." );
     791                if ( !in_generator ) SemanticError( stmt->location, "\"suspend generator\" must be used inside main of generator type." );
    792792                return make_generator_suspend( stmt );
    793793        }
     
    847847
    848848        if ( !decl_suspend ) {
    849                 SemanticError( location, "suspend keyword applied to coroutines requires coroutines to be in scope, add #include <coroutine.hfa>\n" );
     849                SemanticError( location, "suspend keyword applied to coroutines requires coroutines to be in scope, add #include <coroutine.hfa>." );
    850850        }
    851851        if ( stmt->then ) {
     
    918918                        // If it is a monitor, then it is a monitor.
    919919                        if( baseStruct->base->is_monitor() || baseStruct->base->is_thread() ) {
    920                                 SemanticError( decl, "destructors for structures declared as \"monitor\" must use mutex parameters\n" );
     920                                SemanticError( decl, "destructors for structures declared as \"monitor\" must use mutex parameters " );
    921921                        }
    922922                }
     
    926926        // Monitors can't be constructed with mutual exclusion.
    927927        if ( CodeGen::isConstructor( decl->name ) && is_first_argument_mutex ) {
    928                 SemanticError( decl, "constructors cannot have mutex parameters\n" );
     928                SemanticError( decl, "constructors cannot have mutex parameters " );
    929929        }
    930930
    931931        // It makes no sense to have multiple mutex parameters for the destructor.
    932932        if ( isDtor && mutexArgs.size() != 1 ) {
    933                 SemanticError( decl, "destructors can only have 1 mutex argument\n" );
     933                SemanticError( decl, "destructors can only have 1 mutex argument " );
    934934        }
    935935
     
    945945        // Check to if the required headers have been seen.
    946946        if ( !monitor_decl || !guard_decl || !dtor_guard_decl ) {
    947                 SemanticError( decl, "mutex keyword requires monitors to be in scope, add #include <monitor.hfa>\n" );
     947                SemanticError( decl, "mutex keyword requires monitors to be in scope, add #include <monitor.hfa>." );
    948948        }
    949949
     
    952952        if ( isDtor && isThread( mutexArgs.front() ) ) {
    953953                if ( !thread_guard_decl ) {
    954                         SemanticError( decl, "thread destructor requires threads to be in scope, add #include <thread.hfa>\n" );
     954                        SemanticError( decl, "thread destructor requires threads to be in scope, add #include <thread.hfa>." );
    955955                }
    956956                newBody = addThreadDtorStatements( decl, body, mutexArgs );
     
    987987const ast::Stmt * MutexKeyword::postvisit( const ast::MutexStmt * stmt ) {
    988988        if ( !lock_guard_decl ) {
    989                 SemanticError( stmt->location, "mutex stmt requires a header, add #include <mutex_stmt.hfa>\n" );
     989                SemanticError( stmt->location, "mutex stmt requires a header, add #include <mutex_stmt.hfa>." );
    990990        }
    991991        ast::CompoundStmt * body =
     
    15471547        if ( !type->base->is_thread() ) return decl;
    15481548        if ( !thread_decl || !thread_ctor_seen ) {
    1549                 SemanticError( type->base->location, "thread keyword requires threads to be in scope, add #include <thread.hfa>" );
     1549                SemanticError( type->base->location, "thread keyword requires threads to be in scope, add #include <thread.hfa>." );
    15501550        }
    15511551        const ast::CompoundStmt * stmt = decl->stmts;
Note: See TracChangeset for help on using the changeset viewer.