- Timestamp:
- Dec 16, 2023, 1:01:44 AM (22 months ago)
- Branches:
- master
- Children:
- b7898ac
- Parents:
- 0fa0201d (diff), 69ab896 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.cpp
r0fa0201d r5546eee4 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu May 9 10:00:00 2019 11 // Last Modified By : Andrew Beach12 // Last Modified On : Thu May 5 12:10:00 202213 // Update Count : 2411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Dec 9 16:28:51 2023 13 // Update Count : 31 14 14 // 15 15 … … 113 113 // --- EnumDecl 114 114 115 bool EnumDecl::valueOf( const Decl * enumerator, long long & value ) const {115 bool EnumDecl::valueOf( const Decl * enumerator, long long & value ) const { 116 116 if ( enumValues.empty() ) { 117 117 Evaluation crntVal = {0, true, true}; // until expression is given, we know to start counting from 0 118 118 for ( const Decl * member : members ) { 119 const ObjectDecl * field = strict_dynamic_cast< const ObjectDecl* >( member );119 const ObjectDecl * field = strict_dynamic_cast< const ObjectDecl * >( member ); 120 120 if ( field->init ) { 121 const SingleInit * init = strict_dynamic_cast< const SingleInit * >( field->init.get() );121 const SingleInit * init = strict_dynamic_cast< const SingleInit * >( field->init.get() ); 122 122 crntVal = eval( init->value ); 123 123 if ( ! crntVal.isEvaluableInGCC ) { 124 SemanticError( init->location, ::toString( "Non-constexpr in initialization of " 125 "enumerator: ", field ) ); 124 SemanticError( init->location, "Non-constexpr in initialization of enumerator %s", field->name.c_str() ); 126 125 } 127 126 } 128 127 if ( enumValues.count( field->name ) != 0 ) { 129 SemanticError( location, ::toString( "Enum ", name, " has multiple members with the " "name ", field->name) );128 SemanticError( location, "Enum %s has multiple members with %s", name.c_str(), field->name.c_str() ); 130 129 } 131 130 if (crntVal.hasKnownValue) { -
src/AST/Expr.cpp
r0fa0201d r5546eee4 9 9 // Author : Aaron B. Moss 10 10 // Created On : Wed May 15 17:00:00 2019 11 // Last Modified By : Andrew Beach11 // Last Modified By : Peter A. Buhr 12 12 // Created On : Wed May 18 13:56:00 2022 13 // Update Count : 813 // Update Count : 12 14 14 // 15 15 … … 168 168 return addrType( refType->base ); 169 169 } else { 170 SemanticError( loc, arg->result.get(),171 "Attempt to take address of non-lvalue expression: ");170 SemanticError( loc, "Attempt to take address of non-lvalue expression %s", 171 toString( arg->result.get() ).c_str() ); 172 172 } 173 173 } … … 240 240 return 1; 241 241 } 242 SemanticError( this, "Constant expression of non-integral type " ); 242 SemanticError( this->location, "Constant expression of non-integral type %s", 243 toString( this ).c_str() ); 243 244 } 244 245 -
src/AST/LinkageSpec.cpp
r0fa0201d r5546eee4 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu May 9 10:00:00 2019 11 // Last Modified By : Aaron B. Moss12 // Last Modified On : Thu May 9 10:00:00 201913 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Dec 11 16:08:58 2023 13 // Update Count : 2 14 14 // 15 15 … … 37 37 return spec; 38 38 } else { 39 SemanticError( loc, "Invalid linkage specifier " + *cmd);39 SemanticError( loc, "Invalid linkage specifier %s", cmd->c_str() ); 40 40 } 41 41 } -
src/AST/TypeSubstitution.hpp
r0fa0201d r5546eee4 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 : Thr May 25 12:31:00 202313 // Update Count : 1 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Dec 11 16:07:30 2023 13 // Update Count : 15 14 14 // 15 15 … … 156 156 } // if 157 157 } else { 158 SemanticError( formal, toString( "Attempt to provide non-type parameter: ", toString( *actualIt ).c_str(), " for type parameter " ) ); 158 SemanticError( formal->location, "Attempt to provide non-type parameter %s for type parameter %s", 159 toString( *actualIt ).c_str(), formal->name.c_str() ); 159 160 } // if 160 161 } else { -
src/CodeGen/CodeGenerator.cpp
r0fa0201d r5546eee4 1026 1026 output << " ) "; 1027 1027 1028 output << "{" ;1028 output << "{" << endl; 1029 1029 ++indent; 1030 1030 for ( auto node : stmt->cases ) { -
src/CodeGen/FixMain.cc
r0fa0201d r5546eee4 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
r0fa0201d r5546eee4 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/Common/ErrorObjects.h
r0fa0201d r5546eee4 46 46 std::list< error > errors; 47 47 }; 48 49 void SemanticWarningImpl( CodeLocation location, std::string error );50 51 template< typename T >52 static inline void SemanticWarningImpl( const T * obj, const std::string & error ) {53 SemanticWarning( obj->location, toString( error, obj ) );54 }55 56 template< typename T >57 static inline void SemanticWarningImpl( CodeLocation location, const T * obj, const std::string & error ) {58 SemanticWarningImpl( location, toString( error, obj ) );59 } -
src/Common/SemanticError.cc
r0fa0201d r5546eee4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 7 08:05:26 201813 // Update Count : 1012 // Last Modified On : Thu Dec 14 13:45:28 2023 13 // Update Count : 34 14 14 // 15 15 … … 23 23 #include <vector> 24 24 25 using namespace std; 26 25 27 #include "Common/utility.h" // for to_string, CodeLocation (ptr only) 26 28 #include "SemanticError.h" … … 28 30 //----------------------------------------------------------------------------- 29 31 // Severity Handling 30 std::vector<Severity> & get_severities() {31 static std::vector<Severity> severities;32 vector<Severity> & get_severities() { 33 static vector<Severity> severities; 32 34 if(severities.empty()) { 33 35 severities.reserve((size_t)Warning::NUMBER_OF_WARNINGS); … … 60 62 size_t idx = 0; 61 63 for ( const auto & w : WarningFormats ) { 62 if ( st d::strcmp( name, w.name ) == 0 ) {64 if ( strcmp( name, w.name ) == 0 ) { 63 65 get_severities()[idx] = s; 64 66 break; … … 70 72 //----------------------------------------------------------------------------- 71 73 // Semantic Error 74 72 75 bool SemanticErrorThrow = false; 73 76 74 SemanticErrorException::SemanticErrorException( CodeLocation location, st d::string error ) {77 SemanticErrorException::SemanticErrorException( CodeLocation location, string error ) { 75 78 append( location, error ); 76 79 } … … 80 83 } 81 84 82 void SemanticErrorException::append( CodeLocation location, const st d::string & msg ) {85 void SemanticErrorException::append( CodeLocation location, const string & msg ) { 83 86 errors.emplace_back( location, msg ); 84 87 } … … 89 92 90 93 void SemanticErrorException::print() { 91 using std::to_string;94 // using to_string; 92 95 93 96 errors.sort([](const error & lhs, const error & rhs) -> bool { … … 99 102 100 103 for( auto err : errors ) { 101 std::cerr << ErrorHelpers::bold() << err.location << ErrorHelpers::error_str() << ErrorHelpers::reset_font() << err.description << std::endl;104 cerr << ErrorHelpers::bold() << err.location << ErrorHelpers::error_str() << ErrorHelpers::reset_font() << err.description << endl; 102 105 } 103 106 } 104 107 105 void SemanticError( CodeLocation location, std::string error ) { 108 void SemanticError( CodeLocation location, const char * fmt, ... ) { 109 char msg[2048]; // worst-case error-message buffer 110 va_list args; 111 va_start( args, fmt ); 112 vsnprintf( msg, sizeof(msg), fmt, args ); // always null terminated, but may be truncated 113 va_end( args ); 114 106 115 SemanticErrorThrow = true; 107 throw SemanticErrorException( location, error );116 throw SemanticErrorException( location, msg ); // convert msg to string 108 117 } 109 118 110 namespace { 111 // convert format string and arguments into a single string 112 std::string fmtToString(const char * fmt, va_list ap) { 113 int size = 128; 114 while ( true ) { 115 char buf[size]; 116 va_list args; 117 va_copy( args, ap ); 118 int n = vsnprintf(&buf[0], size, fmt, args); 119 va_end( args ); 120 if ( n < size && n >= 0 ) return buf; 121 size *= 2; 122 } 123 assert( false ); 124 } 125 } 119 void SemanticWarning( CodeLocation location, Warning warning, ... ) { 120 Severity severity = get_severities()[(int)warning]; 126 121 127 void SemanticWarningImpl( CodeLocation location, Warning warning, const char * const fmt, ... ) { 128 Severity severity = get_severities()[(int)warning]; 129 switch(severity) { 122 switch ( severity ) { 130 123 case Severity::Suppress : 131 124 break; 132 125 case Severity::Warn : 133 {134 va_list args;135 va_start(args, fmt);136 std::string msg = fmtToString( fmt, args );137 va_end(args);138 std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl;139 }140 break;141 126 case Severity::Error : 142 127 { 128 char msg[2048]; // worst-case error-message buffer 143 129 va_list args; 144 va_start(args, fmt); 145 std::string msg = fmtToString( fmt, args ); 146 va_end(args); 147 SemanticError(location, msg); 130 va_start( args, warning ); 131 vsnprintf( msg, sizeof(msg), WarningFormats[(int)warning].message, args ); // always null terminated, but may be truncated 132 va_end( args ); 133 134 if ( severity == Severity::Warn ) { 135 cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << endl; 136 } else { 137 SemanticError( location, string( msg ) ); 138 } 148 139 } 149 140 break; … … 163 154 } 164 155 165 const st d::string & error_str() {166 static st d::string str = with_colors() ? "\e[31merror:\e[39m " : "error: ";156 const string & error_str() { 157 static string str = with_colors() ? "\e[31merror:\e[39m " : "error: "; 167 158 return str; 168 159 } 169 160 170 const st d::string & warning_str() {171 static st d::string str = with_colors() ? "\e[95mwarning:\e[39m " : "warning: ";161 const string & warning_str() { 162 static string str = with_colors() ? "\e[95mwarning:\e[39m " : "warning: "; 172 163 return str; 173 164 } 174 165 175 const st d::string & bold_ttycode() {176 static st d::string str = with_colors() ? "\e[1m" : "";166 const string & bold_ttycode() { 167 static string str = with_colors() ? "\e[1m" : ""; 177 168 return str; 178 169 } 179 170 180 const st d::string & reset_font_ttycode() {181 static st d::string str = with_colors() ? "\e[0m" : "";171 const string & reset_font_ttycode() { 172 static string str = with_colors() ? "\e[0m" : ""; 182 173 return str; 183 174 } 184 175 185 st d::string make_bold( const std::string & str ) {176 string make_bold( const string & str ) { 186 177 return bold_ttycode() + str + reset_font_ttycode(); 187 178 } 188 179 189 std::ostream & operator<<(std::ostream & os, bold) {180 ostream & operator<<(ostream & os, bold) { 190 181 os << bold_ttycode(); 191 182 return os; 192 183 } 193 184 194 std::ostream & operator<<(std::ostream & os, reset_font) {185 ostream & operator<<(ostream & os, reset_font) { 195 186 os << reset_font_ttycode(); 196 187 return os; -
src/Common/SemanticError.h
r0fa0201d r5546eee4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Feb 25 12:01:31202313 // Update Count : 3712 // Last Modified On : Thu Dec 14 13:48:07 2023 13 // Update Count : 72 14 14 // 15 15 … … 18 18 #include "ErrorObjects.h" 19 19 #include "AST/Node.hpp" 20 #include "AST/ParseNode.hpp" 20 21 #include <cstring> 21 22 … … 25 26 extern bool SemanticErrorThrow; 26 27 27 __attribute__((noreturn )) void SemanticError( CodeLocation location, std::string error);28 __attribute__((noreturn, format(printf, 2, 3))) void SemanticError( CodeLocation location, const char fmt[], ... ); 28 29 29 template< typename T > 30 __attribute__((noreturn)) static inline void SemanticError( const T * obj, const std::string & error ) { 30 __attribute__((noreturn)) static inline void SemanticError( CodeLocation location, std::string error ) { 31 SemanticErrorThrow = true; 32 throw SemanticErrorException( location, error ); 33 } 34 35 __attribute__((noreturn)) static inline void SemanticError( const ast::ParseNode * obj, const std::string & error ) { 31 36 SemanticError( obj->location, toString( error, obj ) ); 32 37 } 33 38 34 template< typename T > 35 __attribute__((noreturn)) static inline void SemanticError( CodeLocation location, const T * obj, const std::string & error ) { 39 __attribute__((noreturn)) static inline void SemanticError( CodeLocation location, const ast::Node * obj, const std::string & error ) { 36 40 SemanticError( location, toString( error, obj ) ); 37 41 } … … 54 58 55 59 constexpr WarningData WarningFormats[] = { 56 {"self-assign" , Severity::Warn 57 {"reference-conversion" , Severity::Warn 58 {"qualifiers-zero_t-one_t" , Severity::Warn 59 {"aggregate-forward-decl" , Severity::Warn 60 {"superfluous-decl" , Severity::Warn 61 {"superfluous-else" , Severity::Warn 62 {"gcc-attributes" , Severity::Warn 63 {"c++-like-copy" , Severity::Warn 64 {"depreciated-trait-syntax" , Severity::Warn 60 {"self-assign" , Severity::Warn, "self assignment of expression: %s" }, 61 {"reference-conversion" , Severity::Warn, "rvalue to reference conversion of rvalue: %s" }, 62 {"qualifiers-zero_t-one_t" , Severity::Warn, "questionable use of type qualifier(s) with %s" }, 63 {"aggregate-forward-decl" , Severity::Warn, "forward declaration of nested aggregate: %s" }, 64 {"superfluous-decl" , Severity::Warn, "declaration does not allocate storage: %s" }, 65 {"superfluous-else" , Severity::Warn, "else clause never executed for empty loop conditional" }, 66 {"gcc-attributes" , Severity::Warn, "invalid attribute: %s" }, 67 {"c++-like-copy" , Severity::Warn, "Constructor from reference is not a valid copy constructor" }, 68 {"depreciated-trait-syntax" , Severity::Warn, "trait type-parameters are now specified using the forall clause" }, 65 69 }; 66 70 … … 75 79 CppCopy, 76 80 DeprecTraitSyntax, 77 NUMBER_OF_WARNINGS, // This MUST be the last warning81 NUMBER_OF_WARNINGS, // MUST be last warning 78 82 }; 79 83 … … 83 87 ); 84 88 85 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id].message, ##__VA_ARGS__) 89 void SemanticWarning( CodeLocation loc, Warning warn, ... ); 86 90 87 void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4))); 88 89 void SemanticWarning_SuppressAll (); 90 void SemanticWarning_EnableAll (); 91 void SemanticWarning_SuppressAll(); 92 void SemanticWarning_EnableAll(); 91 93 void SemanticWarning_WarningAsError(); 92 void SemanticWarning_Set 94 void SemanticWarning_Set(const char * const name, Severity s); 93 95 94 96 // SKULLDUGGERY: cfa.cc is built before SemanticError.cc but needs this routine. -
src/Concurrency/Corun.cpp
r0fa0201d r5546eee4 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
r0fa0201d r5546eee4 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/FixLabels.cpp
r0fa0201d r5546eee4 10 10 // Created On : Mon Nov 1 09:39:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 31 22:19:17 202213 // Update Count : 912 // Last Modified On : Sun Nov 26 15:06:51 2023 13 // Update Count : 10 14 14 // 15 15 … … 47 47 for ( auto kvp : labelTable ) { 48 48 if ( nullptr == kvp.second ) { 49 SemanticError( kvp.first.location, 50 "Use of undefined label: " + kvp.first.name ); 49 SemanticError( kvp.first.location, "Use of undefined label %s.", kvp.first.name.c_str() ); 51 50 } 52 51 } -
src/ControlStruct/MultiLevelExit.cpp
r0fa0201d r5546eee4 9 9 // Author : Andrew Beach 10 10 // Created On : Mon Nov 1 13:48:00 2021 11 // Last Modified By : Andrew Beach12 // Last Modified On : Fri Sep 8 17:04:00202313 // Update Count : 3 611 // Last Modified By : Peter A. Buhr 12 // 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, toString( "'return' may not appear in a ", context ));523 SemanticError( stmt->location, "\"return\" may not appear in a %s", context ); 524 524 } 525 525 -
src/GenPoly/Box.cpp
r0fa0201d r5546eee4 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
r0fa0201d r5546eee4 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
r0fa0201d r5546eee4 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
r0fa0201d r5546eee4 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/ParseNode.h
r0fa0201d r5546eee4 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:28:16 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Apr 3 17:55:00202313 // Update Count : 94 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Dec 9 17:39:34 2023 13 // Update Count : 945 14 14 // 15 15 … … 37 37 class ExpressionNode; 38 38 struct StatementNode; 39 39 40 40 41 //############################################################################## … … 97 98 std::ostream & operator<<( std::ostream & out, const ParseNode * node ); 98 99 100 __attribute__((noreturn)) static inline void SemanticError( const ParseNode * obj, const std::string & error ) { 101 SemanticError( obj->location, toString( error, obj ) ); 102 } 103 99 104 // Local Variables: // 100 105 // tab-width: 4 // -
src/Parser/TypeData.cc
r0fa0201d r5546eee4 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:12:51 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : T ue Apr 4 13:39:00202313 // Update Count : 68 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 14 18:59:12 2023 13 // Update Count : 684 14 14 // 15 15 … … 864 864 865 865 static string genTSError( string msg, DeclarationNode::BasicType basictype ) { 866 SemanticError( yylloc, string( "invalid type specifier \"" ) + msg + "\" for type \"" + DeclarationNode::basicTypeNames[basictype] + "\".");866 SemanticError( yylloc, "invalid type specifier \"%s\" for type \"%s\".", msg.c_str(), DeclarationNode::basicTypeNames[basictype] ); 867 867 } // genTSError 868 868 … … 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 … … 1507 1507 } // for 1508 1508 // declaration type still set => type not moved to a matching parameter so there is a missing parameter name 1509 if ( decl->type ) SemanticError( decl->location, string( "missing name in parameter list " ) + *decl->name);1509 if ( decl->type ) SemanticError( decl->location, "missing name in parameter list %s", decl->name->c_str() ); 1510 1510 } // for 1511 1511 -
src/Parser/parser.yy
r0fa0201d r5546eee4 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Oct 3 17:14:12202313 // Update Count : 639 612 // Last Modified On : Sun Nov 26 13:18:06 2023 13 // Update Count : 6398 14 14 // 15 15 … … 260 260 } // if 261 261 } else { 262 SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed. ." ); return nullptr;262 SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed." ); return nullptr; 263 263 } // if 264 264 } // forCtrl 265 265 266 266 static void IdentifierBeforeIdentifier( string & identifier1, string & identifier2, const char * kind ) { 267 SemanticError( yylloc, ::toString( "syntax error, adjacent identifiers \"", identifier1, "\" and \"", identifier2, "\" are not meaningful in a", kind, ".\n" 268 "Possible cause is misspelled type name or missing generic parameter." ) ); 267 SemanticError( yylloc, "syntax error, adjacent identifiers \"%s\" and \"%s\" are not meaningful in an %s.\n" 268 "Possible cause is misspelled type name or missing generic parameter.", 269 identifier1.c_str(), identifier2.c_str(), kind ); 269 270 } // IdentifierBeforeIdentifier 270 271 271 272 static void IdentifierBeforeType( string & identifier, const char * kind ) { 272 SemanticError( yylloc, ::toString( "syntax error, identifier \"", identifier, "\" cannot appear before a ", kind, ".\n" 273 "Possible cause is misspelled storage/CV qualifier, misspelled typename, or missing generic parameter." ) ); 273 SemanticError( yylloc, "syntax error, identifier \"%s\" cannot appear before a %s.\n" 274 "Possible cause is misspelled storage/CV qualifier, misspelled typename, or missing generic parameter.", 275 identifier.c_str(), kind ); 274 276 } // IdentifierBeforeType 275 277 … … 689 691 // { SemanticError( yylloc, "Resume expression is currently unimplemented." ); $$ = nullptr; } 690 692 | IDENTIFIER IDENTIFIER // invalid syntax rule 691 { IdentifierBeforeIdentifier( *$1.str, *$2.str, " nexpression" ); $$ = nullptr; }693 { IdentifierBeforeIdentifier( *$1.str, *$2.str, "expression" ); $$ = nullptr; } 692 694 | IDENTIFIER type_qualifier // invalid syntax rule 693 695 { IdentifierBeforeType( *$1.str, "type qualifier" ); $$ = nullptr; } … … 1155 1157 | identifier_or_type_name ':' attribute_list_opt error // invalid syntax rule 1156 1158 { 1157 SemanticError( yylloc, ::toString( "syntx error, label \"", *$1.str, "\" must be associated with a statement, "1158 "where a declaration, case, or default is not a statement."1159 "Move the label or terminate with a semi-colon.") );1159 SemanticError( yylloc, "syntx error, label \"%s\" must be associated with a statement, " 1160 "where a declaration, case, or default is not a statement.\n" 1161 "Move the label or terminate with a semicolon.", $1.str->c_str() ); 1160 1162 $$ = nullptr; 1161 1163 } … … 2101 2103 | sue_declaration_specifier invalid_types // invalid syntax rule 2102 2104 { 2103 SemanticError( yylloc, ::toString( "syntax error, expecting ';' at end of ", 2104 $1->type->enumeration.name ? "enum" : ast::AggregateDecl::aggrString( $1->type->aggregate.kind ), 2105 " declaration." ) ); 2105 SemanticError( yylloc, "syntax error, expecting ';' at end of \"%s\" declaration.", 2106 $1->type->enumeration.name ? "enum" : ast::AggregateDecl::aggrString( $1->type->aggregate.kind ) ); 2106 2107 $$ = nullptr; 2107 2108 } … … 2161 2162 type_qualifier: 2162 2163 type_qualifier_name 2163 | attribute // trick handles most at rribute locations2164 | attribute // trick handles most attribute locations 2164 2165 ; 2165 2166 … … 2585 2586 | type_specifier field_declaring_list_opt '}' // invalid syntax rule 2586 2587 { 2587 SemanticError( yylloc, ::toString( "syntax error, expecting ';' at end of previous declaration." ));2588 SemanticError( yylloc, "syntax error, expecting ';' at end of previous declaration." ); 2588 2589 $$ = nullptr; 2589 2590 } -
src/ResolvExpr/CurrentObject.cc
r0fa0201d r5546eee4 9 9 // Author : Rob Schluntz 10 10 // Created On : Tue Jun 13 15:28:32 2017 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Apr 10 9:40:00202313 // Update Count : 1811 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Dec 9 17:49:51 2023 13 // Update Count : 20 14 14 // 15 15 … … 181 181 auto res = eval( expr ); 182 182 if ( !res.hasKnownValue ) { 183 SemanticError( location, toString( "Array designator must be a constant expression: ", expr) );183 SemanticError( location, "Array designator must be a constant expression %s", toString( expr ).c_str() ); 184 184 } 185 185 return res.knownValue; -
src/ResolvExpr/Resolver.cc
r0fa0201d r5546eee4 9 9 // Author : Aaron B. Moss 10 10 // Created On : Sun May 17 12:17:01 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Apr 20 10:41:00 202213 // Update Count : 2 4811 // Last Modified By : Peter A. Buhr 12 // 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 } … … 958 959 ++n_mutex_param; 959 960 960 // Check if the argument matches the parameter type in the current 961 // scope 961 // Check if the argument matches the parameter type in the current scope. 962 962 // ast::ptr< ast::Type > paramType = (*param)->get_type(); 963 963 964 if ( 964 965 ! unify( -
src/Validate/FixQualifiedTypes.cpp
r0fa0201d r5546eee4 9 9 // Author : Andrew Beach 10 10 // Created On : Thr Apr 21 11:13:00 2022 11 // Last Modified By : Andrew Beach12 // Last Modified On : Tue Sep 20 16:15:00 202213 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 13 09:00:25 2023 13 // Update Count : 6 14 14 // 15 15 … … 41 41 auto td = symtab.globalLookupType( inst->name ); 42 42 if ( !td ) { 43 SemanticError( *location, toString("Use of undefined global type ", inst->name) );43 SemanticError( *location, "Use of undefined global type %s.", inst->name.c_str() ); 44 44 } 45 45 auto base = td->base; … … 50 50 } else { 51 51 // .T => T is not a type name. 52 assertf( false, "unhandled global qualified child type: %s", toCString( child) );52 assertf( false, "unhandled global qualified child type: %s", toCString( child ) ); 53 53 } 54 54 } else { … … 63 63 instp = inst; 64 64 } else { 65 SemanticError( *location, toString("Qualified type requires an aggregate on the left, but has: ", parent) );65 SemanticError( *location, "Qualified type requires an aggregate on the left, but has %s.", toCString( parent ) ); 66 66 } 67 67 // TODO: Need to handle forward declarations. … … 81 81 } else { 82 82 // S.T - S is not an aggregate => error. 83 assertf( false, "unhandled qualified child type : %s", toCString(type) );83 assertf( false, "unhandled qualified child type %s.", toCString( type ) ); 84 84 } 85 85 } 86 86 // failed to find a satisfying definition of type 87 SemanticError( *location, toString("Undefined type in qualified type: ", type) );87 SemanticError( *location, "Undefined type in qualified type %s", toCString( type ) ); 88 88 } 89 89 } -
src/Validate/ForallPointerDecay.cpp
r0fa0201d r5546eee4 9 9 // Author : Andrew Beach 10 10 // Created On : Tue Dec 7 16:15:00 2021 11 // Last Modified By : Andrew Beach12 // Last Modified On : S at Apr 23 13:10:00 202213 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Nov 26 18:49:57 2023 13 // Update Count : 2 14 14 // 15 15 … … 213 213 auto type = obj->type->stripDeclarator(); 214 214 if ( dynamic_cast< const ast::FunctionType * >( type ) ) return; 215 SemanticError( obj->location, 216 toCString( "operator ", obj->name.c_str(), 217 " is not a function or function pointer." ) ); 215 SemanticError( obj->location, "operator %s is not a function or function pointer.", obj->name.c_str() ); 218 216 } 219 217 }; -
src/Validate/ReplaceTypedef.cpp
r0fa0201d r5546eee4 9 9 // Author : Andrew Beach 10 10 // Created On : Tue Jun 29 14:59:00 2022 11 // Last Modified By : Andrew Beach12 // Last Modified On : T ue Sep 20 17:00:00 202213 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 14 16:11:51 2023 13 // Update Count : 4 14 14 // 15 15 … … 111 111 if ( !rtt ) { 112 112 assert( location ); 113 SemanticError( *location, "Cannot apply type parameters to base type of " + type->name);113 SemanticError( *location, "Cannot apply type parameters to base type of %s.", type->name.c_str() ); 114 114 } 115 115 rtt->params.clear(); … … 125 125 if ( base == typedeclNames.end() ) { 126 126 assert( location ); 127 SemanticError( *location, toString( "Use of undefined type ", type->name) );127 SemanticError( *location, "Use of undefined type %s.", type->name.c_str() ); 128 128 } 129 129 return ast::mutate_field( type, &ast::TypeInstType::base, base->second ); … … 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 { -
src/Virtual/ExpandCasts.cc
r0fa0201d r5546eee4 9 9 // Author : Andrew Beach 10 10 // Created On : Mon Jul 24 13:59:00 2017 11 // Last Modified By : Andrew Beach12 // Last Modified On : Thu Aug 11 12:06:00 202213 // Update Count : 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Nov 27 09:28:20 2023 13 // Update Count : 10 14 14 // 15 15 … … 160 160 161 161 // Helper function for throwing semantic errors. 162 auto throwError = [&fieldName, &errorLocation, &oldDecl]( 163 std::string const & message ) { 164 std::string const & context = "While following head pointer of " + 165 oldDecl->name + " named '" + fieldName + "': "; 166 SemanticError( errorLocation, context + message ); 162 auto throwError = [&fieldName, &errorLocation, &oldDecl]( std::string const & message ) { 163 SemanticError( errorLocation, "While following head pointer of %s named \"%s\": %s", 164 oldDecl->name.c_str(), fieldName.c_str(), message.c_str() ); 167 165 }; 168 166
Note:
See TracChangeset
for help on using the changeset viewer.