- Timestamp:
- Dec 14, 2023, 9:05:55 PM (22 months ago)
- Branches:
- master
- Children:
- 19a2890
- Parents:
- 21ad568
- Location:
- src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/FixMain.cc
r21ad568 rca9d65e 11 11 // Last Modified By : 12 12 // Last Modified On : 13 // Update Count : 013 // Update Count : 1 14 14 // 15 15 … … 39 39 if ( isMain( decl ) ) { 40 40 if ( main_declaration ) { 41 SemanticError( decl, "Multiple definition of main routine \n" );41 SemanticError( decl, "Multiple definition of main routine" ); 42 42 } 43 43 main_declaration = decl; -
src/CodeGen/FixNames.cc
r21ad568 rca9d65e 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Jul 20 11:49:00 202213 // Update Count : 2 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 14 16:16:51 2023 13 // Update Count : 25 14 14 // 15 15 … … 57 57 int nargs = mutDecl->params.size(); 58 58 if ( 0 != nargs && 2 != nargs && 3 != nargs ) { 59 SemanticError( functionDecl, "Main expected to have 0, 2 or 3 arguments \n" );59 SemanticError( functionDecl, "Main expected to have 0, 2 or 3 arguments" ); 60 60 } 61 61 ast::chain_mutate( mutDecl->stmts )->kids.push_back( -
src/Concurrency/Corun.cpp
r21ad568 rca9d65e 9 9 // Author : Colby Parsons 10 10 // Created On : Monday October 9 15:16:42 2023 11 // Last Modified By : Colby Parsons12 // Last Modified On : Monday October 9 15:16:42202313 // Update Count : 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 14 17:32:17 2023 13 // Update Count : 1 14 14 // 15 15 … … 57 57 Stmt * postvisit( const CoforStmt * stmt ) { 58 58 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>" ); 60 60 61 61 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" ); 63 63 64 64 if ( !stmt->body ) … … 77 77 const DeclStmt * declStmtPtr = dynamic_cast<const DeclStmt *>(stmt->inits.at(0).get()); 78 78 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?" ); 80 80 81 81 const Decl * declPtr = dynamic_cast<const Decl *>(declStmtPtr->decl.get()); 82 82 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?" ); 84 84 85 85 Type * initType = new TypeofType( new NameExpr( loc, declPtr->name ) ); … … 246 246 Stmt * postvisit( const CorunStmt * stmt ) { 247 247 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>" ); 249 249 250 250 if ( !stmt->stmt ) -
src/Concurrency/Keywords.cpp
r21ad568 rca9d65e 9 9 // Author : Andrew Beach 10 10 // Created On : Tue Nov 16 9:53:00 2021 11 // Last Modified By : Andrew Beach12 // Last Modified On : Fri Mar 11 10:40:00 202213 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 14 18:02:25 2023 13 // Update Count : 6 14 14 // 15 15 … … 682 682 683 683 if ( 0 != decl->returns.size() ) { 684 SemanticError( decl->location, "Generator main must return void " );684 SemanticError( decl->location, "Generator main must return void." ); 685 685 } 686 686 … … 789 789 case ast::SuspendStmt::Generator: 790 790 // 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." ); 792 792 return make_generator_suspend( stmt ); 793 793 } … … 847 847 848 848 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>." ); 850 850 } 851 851 if ( stmt->then ) { … … 918 918 // If it is a monitor, then it is a monitor. 919 919 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 " ); 921 921 } 922 922 } … … 926 926 // Monitors can't be constructed with mutual exclusion. 927 927 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 " ); 929 929 } 930 930 931 931 // It makes no sense to have multiple mutex parameters for the destructor. 932 932 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 " ); 934 934 } 935 935 … … 945 945 // Check to if the required headers have been seen. 946 946 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>." ); 948 948 } 949 949 … … 952 952 if ( isDtor && isThread( mutexArgs.front() ) ) { 953 953 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>." ); 955 955 } 956 956 newBody = addThreadDtorStatements( decl, body, mutexArgs ); … … 987 987 const ast::Stmt * MutexKeyword::postvisit( const ast::MutexStmt * stmt ) { 988 988 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>." ); 990 990 } 991 991 ast::CompoundStmt * body = … … 1547 1547 if ( !type->base->is_thread() ) return decl; 1548 1548 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>." ); 1550 1550 } 1551 1551 const ast::CompoundStmt * stmt = decl->stmts; -
src/ControlStruct/MultiLevelExit.cpp
r21ad568 rca9d65e 10 10 // Created On : Mon Nov 1 13:48:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Dec 11 13:44:45202313 // Update Count : 3 812 // Last Modified On : Thu Dec 14 17:34:12 2023 13 // Update Count : 39 14 14 // 15 15 … … 254 254 if ( enclosing_control_structures.empty() ) { 255 255 SemanticError( stmt->location, 256 " 'break' outside a loop, 'switch', or labelled block" );256 "\"break\" outside a loop, \"switch\", or labelled block" ); 257 257 } 258 258 targetEntry = findEnclosingControlStructure( isBreakTarget ); … … 268 268 // Ensure that selected target is valid. 269 269 if ( targetEntry == enclosing_control_structures.rend() || ( isContinue && ! isContinueTarget( *targetEntry ) ) ) { 270 SemanticError( stmt->location, toString( (isContinue ? " 'continue'" : "'break'"),270 SemanticError( stmt->location, toString( (isContinue ? "\"continue\"" : "\"break\""), 271 271 " target must be an enclosing ", (isContinue ? "loop: " : "control structure: "), 272 272 stmt->originalTarget ) ); … … 279 279 // Check that target is valid. 280 280 if ( targetEntry == enclosing_control_structures.rend() ) { 281 SemanticError( stmt->location, " 'fallthrough' must be enclosed in a 'switch' or 'choose'" );281 SemanticError( stmt->location, "\"fallthrough\" must be enclosed in a \"switch\" or \"choose\"" ); 282 282 } 283 283 if ( ! stmt->target.empty() ) { 284 284 // Labelled fallthrough: target must be a valid fallthough label. 285 285 if ( ! fallthrough_labels.count( stmt->target ) ) { 286 SemanticError( stmt->location, toString( " 'fallthrough'target must be a later case statement: ",286 SemanticError( stmt->location, toString( "\"fallthrough\" target must be a later case statement: ", 287 287 stmt->originalTarget ) ); 288 288 } … … 296 296 // Check if in switch or choose statement. 297 297 if ( targetEntry == enclosing_control_structures.rend() ) { 298 SemanticError( stmt->location, " 'fallthrough' must be enclosed in a 'switch' or 'choose'" );298 SemanticError( stmt->location, "\"fallthrough\" must be enclosed in a \"switch\" or \"choose\"" ); 299 299 } 300 300 … … 309 309 } 310 310 if ( ! foundDefault ) { 311 SemanticError( stmt->location, " 'fallthrough default' must be enclosed in a 'switch' or 'choose'"312 "control structure with a 'default'clause" );311 SemanticError( stmt->location, "\"fallthrough default\" must be enclosed in a \"switch\" or \"choose\"" 312 "control structure with a \"default\" clause" ); 313 313 } 314 314 break; … … 338 338 // Check that fallthrough default comes before the default clause. 339 339 if ( ! targetEntry->isFallDefaultValid() ) { 340 SemanticError( stmt->location, " 'fallthrough default' must precede the 'default'clause" );340 SemanticError( stmt->location, "\"fallthrough default\" must precede the \"default\" clause" ); 341 341 } 342 342 break; … … 521 521 assert(0); 522 522 } 523 SemanticError( stmt->location, " 'return'may not appear in a %s", context );523 SemanticError( stmt->location, "\"return\" may not appear in a %s", context ); 524 524 } 525 525 -
src/GenPoly/Box.cpp
r21ad568 rca9d65e 9 9 // Author : Andrew Beach 10 10 // Created On : Thr Oct 6 13:39:00 2022 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Oct 2 17:00:00202313 // Update Count : 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 14 17:42:17 2023 13 // Update Count : 7 14 14 // 15 15 … … 777 777 if ( !concrete ) { 778 778 // Should this be an assertion? 779 SemanticError( expr, toString( typeSubs, 780 "\nunbound type variable: ", typeVar->typeString(), 781 " in application " ) ); 779 SemanticError( expr->location, "\nunbound type variable %s in application %s", 780 toString( typeSubs ).c_str(), typeVar->typeString().c_str() ); 782 781 } 783 782 arg = expr->args.insert( arg, -
src/InitTweak/FixInit.cpp
r21ad568 rca9d65e 1057 1057 ) 1058 1058 if ( ! diff.empty() ) { 1059 SemanticError( stmt, std::string("jump to label '") + stmt->target.name + "' crosses initialization of " + (*diff.begin())->name + " " ); 1059 SemanticError( stmt->location, "jump to label \"%s\" crosses initialization of \"%s\".", 1060 stmt->target.name.c_str(), (*diff.begin())->name.c_str() ); 1060 1061 } // if 1061 1062 } … … 1076 1077 1077 1078 bool checkWarnings( const ast::FunctionDecl * funcDecl ) { 1078 // only check for warnings if the current function is a user-defined 1079 // constructor or destructor 1079 // only check for warnings if the current function is a user-defined constructor or destructor 1080 1080 if ( ! funcDecl ) return false; 1081 1081 if ( ! funcDecl->stmts ) return false; -
src/Parser/DeclarationNode.cc
r21ad568 rca9d65e 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jun 17 14:41:48202313 // Update Count : 140 512 // Last Modified On : Thu Dec 14 19:05:17 2023 13 // Update Count : 1407 14 14 // 15 15 … … 632 632 dst->basictype = src->basictype; 633 633 } else if ( src->basictype != DeclarationNode::NoBasicType ) 634 SemanticError( yylloc, string( "multiple declaration types \"" ) + DeclarationNode::basicTypeNames[ dst->basictype ] +635 "\" and \"" + DeclarationNode::basicTypeNames[ src->basictype ] + "\"." );636 634 SemanticError( yylloc, "multiple declaration types \"%s\" and \"%s\".", 635 DeclarationNode::basicTypeNames[ dst->basictype ], 636 DeclarationNode::basicTypeNames[ src->basictype ] ); 637 637 if ( dst->complextype == DeclarationNode::NoComplexType ) { 638 638 dst->complextype = src->complextype; 639 639 } else if ( src->complextype != DeclarationNode::NoComplexType ) 640 SemanticError( yylloc, string( "multiple declaration types \"" ) + DeclarationNode::complexTypeNames[ src->complextype ] +641 "\" and \"" + DeclarationNode::complexTypeNames[ src->complextype ] + "\"." );642 640 SemanticError( yylloc, "multiple declaration types \"%s\" and \"%s\".", 641 DeclarationNode::complexTypeNames[ src->complextype ], 642 DeclarationNode::complexTypeNames[ src->complextype ] ); 643 643 if ( dst->signedness == DeclarationNode::NoSignedness ) { 644 644 dst->signedness = src->signedness; 645 645 } else if ( src->signedness != DeclarationNode::NoSignedness ) 646 SemanticError( yylloc, string( "conflicting type specifier \"" ) + DeclarationNode::signednessNames[ dst->signedness ] +647 "\" and \"" + DeclarationNode::signednessNames[ src->signedness ] + "\"." );648 646 SemanticError( yylloc, "conflicting type specifier \"%s\" and \"%s\".", 647 DeclarationNode::signednessNames[ dst->signedness ], 648 DeclarationNode::signednessNames[ src->signedness ] ); 649 649 if ( dst->length == DeclarationNode::NoLength ) { 650 650 dst->length = src->length; … … 652 652 dst->length = DeclarationNode::LongLong; 653 653 } else if ( src->length != DeclarationNode::NoLength ) 654 SemanticError( yylloc, string( "conflicting type specifier \"" ) + DeclarationNode::lengthNames[ dst->length ] + 655 "\" and \"" + DeclarationNode::lengthNames[ src->length ] + "\"." ); 654 SemanticError( yylloc, "conflicting type specifier \"%s\" and \"%s\".", 655 DeclarationNode::lengthNames[ dst->length ], 656 DeclarationNode::lengthNames[ src->length ] ); 656 657 } // if 657 658 break; -
src/Parser/ExpressionNode.cc
r21ad568 rca9d65e 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat May 16 13:17:07 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : T ue Apr 4 11:07:00202313 // Update Count : 108 311 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 14 18:57:07 2023 13 // Update Count : 1087 14 14 // 15 15 … … 193 193 194 194 #if ! defined(__SIZEOF_INT128__) 195 if ( type == 5 ) SemanticError( yylloc, "int128 constant is not supported on this target " + str);195 if ( type == 5 ) SemanticError( yylloc, "int128 constant is not supported on this target \"%s\"", str.c_str() ); 196 196 #endif // ! __SIZEOF_INT128__ 197 197 … … 204 204 } else { // hex int128 constant 205 205 unsigned int len = str.length(); 206 if ( len > (2 + 16 + 16) ) SemanticError( yylloc, "128-bit hexadecimal constant to large " + str);206 if ( len > (2 + 16 + 16) ) SemanticError( yylloc, "128-bit hexadecimal constant to large \"%s\"", str.c_str() ); 207 207 // hex digits < 2^64 208 208 if ( len > (2 + 16) ) { … … 219 219 unsigned int len = str.length(); 220 220 if ( type == 5 && len > 2 + 64 ) { 221 if ( len > 2 + 64 + 64 ) SemanticError( yylloc, "128-bit binary constant to large " + str);221 if ( len > 2 + 64 + 64 ) SemanticError( yylloc, "128-bit binary constant to large \"%s\".", str.c_str() ); 222 222 str2 = "0b" + str.substr( len - 64 ); 223 223 str = str.substr( 0, len - 64 ); … … 233 233 } else { // octal int128 constant 234 234 unsigned int len = str.length(); 235 if ( len > 1 + 43 || (len == 1 + 43 && str[0] > '3') ) SemanticError( yylloc, "128-bit octal constant to large " + str);235 if ( len > 1 + 43 || (len == 1 + 43 && str[0] > '3') ) SemanticError( yylloc, "128-bit octal constant to large \"%s\"", str.c_str() ); 236 236 char buf[32]; 237 237 if ( len <= 1 + 21 ) { // value < 21 octal digitis … … 266 266 unsigned int len = str.length(); 267 267 if ( str.length() == 39 && str > (Unsigned ? "340282366920938463463374607431768211455" : "170141183460469231731687303715884105727") ) 268 SemanticError( yylloc, "128-bit decimal constant to large " + str);268 SemanticError( yylloc, "128-bit decimal constant to large \"%s\".", str.c_str() ); 269 269 char buf[32]; 270 270 if ( len <= 19 ) { // value < 19 decimal digitis … … 502 502 ast::Expr * build_field_name_FLOATING_FRACTIONconstant( 503 503 const CodeLocation & location, const string & str ) { 504 if ( str.find_first_not_of( "0123456789", 1 ) != string::npos ) SemanticError( yylloc, "invalid tuple index " + str);504 if ( str.find_first_not_of( "0123456789", 1 ) != string::npos ) SemanticError( yylloc, "invalid tuple index \"%s\".", str.c_str() ); 505 505 ast::Expr * ret = build_constantInteger( location, 506 506 *new string( str.substr(1) ) ); … … 511 511 ast::Expr * build_field_name_FLOATING_DECIMALconstant( 512 512 const CodeLocation & location, const string & str ) { 513 if ( str[str.size() - 1] != '.' ) SemanticError( yylloc, "invalid tuple index " + str);513 if ( str[str.size() - 1] != '.' ) SemanticError( yylloc, "invalid tuple index \"%s\".", str.c_str() ); 514 514 ast::Expr * ret = build_constantInteger( 515 515 location, *new string( str.substr( 0, str.size()-1 ) ) ); -
src/Parser/TypeData.cc
r21ad568 rca9d65e 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Nov 26 15:51:05202313 // Update Count : 68 112 // Last Modified On : Thu Dec 14 18:59:12 2023 13 // Update Count : 684 14 14 // 15 15 … … 1496 1496 // type set => parameter name already transformed by a declaration names so there is a duplicate 1497 1497 // declaration name attempting a second transformation 1498 if ( param->type ) SemanticError( param->location, string( "duplicate declaration name " ) + *param->name);1498 if ( param->type ) SemanticError( param->location, "duplicate declaration name \"%s\".", param->name->c_str() ); 1499 1499 // declaration type reset => declaration already transformed by a parameter name so there is a duplicate 1500 1500 // parameter name attempting a second transformation 1501 if ( ! decl->type ) SemanticError( param->location, string( "duplicate parameter name " ) + *param->name);1501 if ( ! decl->type ) SemanticError( param->location, "duplicate parameter name \"%s\".", param->name->c_str() ); 1502 1502 param->type = decl->type; // set copy declaration type to parameter type 1503 1503 decl->type = nullptr; // reset declaration type -
src/ResolvExpr/Resolver.cc
r21ad568 rca9d65e 10 10 // Created On : Sun May 17 12:17:01 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Dec 9 17:45:57202313 // Update Count : 2 4912 // Last Modified On : Thu Dec 14 18:44:43 2023 13 // Update Count : 251 14 14 // 15 15 … … 632 632 maybe_accept( mutDecl->init.get(), res ); 633 633 if ( !res.core.result ) { 634 SemanticError( mutDecl, "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n" ); 634 SemanticError( mutDecl, "Cannot include designations in the initializer for a managed Object.\n" 635 "If this is really what you want, initialize with @=." ); 635 636 } 636 637 } -
src/Validate/ReplaceTypedef.cpp
r21ad568 rca9d65e 10 10 // Created On : Tue Jun 29 14:59:00 2022 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Nov 27 08:55:06202313 // Update Count : 312 // Last Modified On : Thu Dec 14 16:11:51 2023 13 // Update Count : 4 14 14 // 15 15 … … 152 152 || ast::Pass<VarLenChecker>::read( t0 ) 153 153 || ast::Pass<VarLenChecker>::read( t1 ) ) { 154 SemanticError( decl->location, "Cannot redefine typedef : " + decl->name);154 SemanticError( decl->location, "Cannot redefine typedef %s", decl->name.c_str() ); 155 155 } 156 156 } else {
Note:
See TracChangeset
for help on using the changeset viewer.