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

second attempt at simplifying SemanticError? messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.