Changes in / [becb85b9:67e86ae6]
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/stdhdr/pthread.h
rbecb85b9 r67e86ae6 10 10 // Created On : Wed Jun 16 13:39:06 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 16 13:39:42 202113 // Update Count : 1 12 // Last Modified On : Thu Feb 3 21:53:26 2022 13 // Update Count : 13 14 14 // 15 15 16 // pthread.h and setjmp.h cannot agree on the type of __sigsetjmp: 17 // 18 // extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__)); 19 // extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __attribute__ ((__nothrow__)); 20 // 21 // With -Wall, gcc-11 warns about the disagreement unless the CPP directive 22 // 23 // # 1 "/usr/include/pthread.h" 1 3 4 24 // 25 // appears, which appears to be witchcraft. Unfortunately, this directive is removed by the CFA preprocessor, so the 26 // batchtest fails because of the spurious warning message. Hence, the warning is elided. 27 16 28 extern "C" { 29 #if defined(__GNUC__) && __GNUC__ == 11 30 #pragma GCC diagnostic push 31 #pragma GCC diagnostic ignored "-Warray-parameter" 32 #endif // defined(__GNUC__) && __GNUC__ == 11 33 17 34 #include_next <pthread.h> // has internal check for multiple expansion 35 36 #if defined(__GNUC__) && __GNUC__ == 11 37 #pragma GCC diagnostic pop 38 #endif // defined(__GNUC__) && __GNUC__ == 11 18 39 } // extern "C" 19 40 20 41 // Local Variables: // 21 // tab-width: 4 //22 42 // mode: c++ // 23 // compile-command: "make install" //24 43 // End: // -
libcfa/src/stdhdr/setjmp.h
rbecb85b9 r67e86ae6 10 10 // Created On : Mon Jul 4 23:25:26 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Jul 5 20:38:33 201613 // Update Count : 1 212 // Last Modified On : Thu Feb 3 21:53:28 2022 13 // Update Count : 18 14 14 // 15 15 16 // pthread.h and setjmp.h cannot agree on the type of __sigsetjmp: 17 // 18 // extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__)); 19 // extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __attribute__ ((__nothrow__)); 20 // 21 // With -Wall, gcc-11 warns about the disagreement unless the CPP directive 22 // 23 // # 1 "/usr/include/pthread.h" 1 3 4 24 // 25 // appears, which appears to be witchcraft. Unfortunately, this directive is removed by the CFA preprocessor, so the 26 // batchtest fails because of the spurious warning message. Hence, the warning is elided. 27 16 28 extern "C" { 29 #if defined(__GNUC__) && __GNUC__ == 11 30 #pragma GCC diagnostic push 31 #pragma GCC diagnostic ignored "-Warray-parameter" 32 #endif // defined(__GNUC__) && __GNUC__ == 11 33 17 34 #include_next <setjmp.h> // has internal check for multiple expansion 35 36 #if defined(__GNUC__) && __GNUC__ == 11 37 #pragma GCC diagnostic pop 38 #endif // defined(__GNUC__) && __GNUC__ == 11 18 39 } // extern "C" 19 40 20 41 // Local Variables: // 21 // tab-width: 4 //22 42 // mode: c++ // 23 // compile-command: "make install" //24 43 // End: // -
src/AST/Stmt.cpp
rbecb85b9 r67e86ae6 9 9 // Author : Aaron B. Moss 10 10 // Created On : Wed May 8 13:00:00 2019 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed May 15 15:53:00 201913 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 2 19:01:20 2022 13 // Update Count : 3 14 14 // 15 15 … … 56 56 57 57 // --- BranchStmt 58 BranchStmt::BranchStmt( const CodeLocation& loc, Kind kind, Label target, std::vector<Label>&& labels )59 : Stmt(loc, std::move(labels)), originalTarget(target), target(target), kind(kind) {58 BranchStmt::BranchStmt( const CodeLocation& loc, Kind kind, Label target, const std::vector<Label>&& labels ) 59 : Stmt(loc, std::move(labels)), originalTarget(target), target(target), kind(kind) { 60 60 // Make sure a syntax error hasn't slipped through. 61 61 assert( Goto != kind || !target.empty() ); -
src/AST/Stmt.hpp
rbecb85b9 r67e86ae6 10 10 // Created On : Wed May 8 13:00:00 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 17:44:46202213 // Update Count : 2412 // Last Modified On : Wed Feb 2 20:06:41 2022 13 // Update Count : 34 14 14 // 15 15 … … 39 39 std::vector<Label> labels; 40 40 41 Stmt( const CodeLocation & loc, std::vector<Label> && labels = {} )41 Stmt( const CodeLocation & loc, const std::vector<Label> && labels = {} ) 42 42 : ParseNode(loc), labels(std::move(labels)) {} 43 43 … … 55 55 std::list<ptr<Stmt>> kids; 56 56 57 CompoundStmt(const CodeLocation & loc, std::list<ptr<Stmt>> && ks = {}, 58 std::vector<Label> && labels = {} ) 57 CompoundStmt(const CodeLocation & loc, const std::list<ptr<Stmt>> && ks = {}, const std::vector<Label> && labels = {} ) 59 58 : Stmt(loc, std::move(labels)), kids(std::move(ks)) {} 60 59 … … 74 73 class NullStmt final : public Stmt { 75 74 public: 76 NullStmt( const CodeLocation & loc, std::vector<Label> && labels = {} )75 NullStmt( const CodeLocation & loc, const std::vector<Label> && labels = {} ) 77 76 : Stmt(loc, std::move(labels)) {} 78 77 … … 88 87 ptr<Expr> expr; 89 88 90 ExprStmt( const CodeLocation & loc, const Expr* e, std::vector<Label> && labels = {} )89 ExprStmt( const CodeLocation & loc, const Expr* e, const std::vector<Label> && labels = {} ) 91 90 : Stmt(loc, std::move(labels)), expr(e) {} 92 91 … … 107 106 108 107 AsmStmt( const CodeLocation & loc, bool isVolatile, const Expr * instruction, 109 std::vector<ptr<Expr>> && output,std::vector<ptr<Expr>> && input,110 std::vector<ptr<ConstantExpr>> && clobber,std::vector<Label> && gotoLabels,111 std::vector<Label> && labels = {})108 const std::vector<ptr<Expr>> && output, const std::vector<ptr<Expr>> && input, 109 const std::vector<ptr<ConstantExpr>> && clobber, const std::vector<Label> && gotoLabels, 110 const std::vector<Label> && labels = {}) 112 111 : Stmt(loc, std::move(labels)), isVolatile(isVolatile), instruction(instruction), 113 112 output(std::move(output)), input(std::move(input)), clobber(std::move(clobber)), … … 144 143 145 144 IfStmt( const CodeLocation & loc, const Expr * cond, const Stmt * then, 146 const Stmt * else_ = nullptr, std::vector<ptr<Stmt>> && inits = {},147 std::vector<Label> && labels = {} )145 const Stmt * else_ = nullptr, const std::vector<ptr<Stmt>> && inits = {}, 146 const std::vector<Label> && labels = {} ) 148 147 : Stmt(loc, std::move(labels)), cond(cond), then(then), else_(else_), 149 148 inits(std::move(inits)) {} … … 161 160 std::vector<ptr<Stmt>> stmts; 162 161 163 SwitchStmt( const CodeLocation & loc, const Expr * cond, std::vector<ptr<Stmt>> && stmts,164 std::vector<Label> && labels = {} )162 SwitchStmt( const CodeLocation & loc, const Expr * cond, const std::vector<ptr<Stmt>> && stmts, 163 const std::vector<Label> && labels = {} ) 165 164 : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {} 166 165 … … 178 177 std::vector<ptr<Stmt>> stmts; 179 178 180 CaseStmt( const CodeLocation & loc, const Expr * cond, std::vector<ptr<Stmt>> && stmts,181 std::vector<Label> && labels = {} )179 CaseStmt( const CodeLocation & loc, const Expr * cond, const std::vector<ptr<Stmt>> && stmts, 180 const std::vector<Label> && labels = {} ) 182 181 : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {} 183 182 … … 200 199 201 200 WhileDoStmt( const CodeLocation & loc, const Expr * cond, const Stmt * body, 202 std::vector<ptr<Stmt>> && inits, bool isDoWhile = false,std::vector<Label> && labels = {} )201 const std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, const std::vector<Label> && labels = {} ) 203 202 : Stmt(loc, std::move(labels)), cond(cond), body(body), else_(nullptr), inits(std::move(inits)), isDoWhile(isDoWhile) {} 204 203 205 204 WhileDoStmt( const CodeLocation & loc, const Expr * cond, const Stmt * body, const Stmt * else_, 206 std::vector<ptr<Stmt>> && inits, bool isDoWhile = false,std::vector<Label> && labels = {} )205 const std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, const std::vector<Label> && labels = {} ) 207 206 : Stmt(loc, std::move(labels)), cond(cond), body(body), else_(else_), inits(std::move(inits)), isDoWhile(isDoWhile) {} 208 207 … … 222 221 ptr<Stmt> else_; 223 222 224 ForStmt( const CodeLocation & loc, std::vector<ptr<Stmt>> && inits, const Expr * cond,225 const Expr * inc, const Stmt * body, std::vector<Label> && label = {} )223 ForStmt( const CodeLocation & loc, const std::vector<ptr<Stmt>> && inits, const Expr * cond, 224 const Expr * inc, const Stmt * body, const std::vector<Label> && label = {} ) 226 225 : Stmt(loc, std::move(label)), inits(std::move(inits)), cond(cond), inc(inc), body(body), else_(nullptr) {} 227 226 228 ForStmt( const CodeLocation & loc, std::vector<ptr<Stmt>> && inits, const Expr * cond,229 const Expr * inc, const Stmt * body, const Stmt * else_, std::vector<Label> && labels = {} )227 ForStmt( const CodeLocation & loc, const std::vector<ptr<Stmt>> && inits, const Expr * cond, 228 const Expr * inc, const Stmt * body, const Stmt * else_, const std::vector<Label> && labels = {} ) 230 229 : Stmt(loc, std::move(labels)), inits(std::move(inits)), cond(cond), inc(inc), body(body), else_(else_) {} 231 230 … … 247 246 Kind kind; 248 247 249 BranchStmt( const CodeLocation & loc, Kind kind, Label target, 250 std::vector<Label> && labels = {} ); 251 BranchStmt( const CodeLocation & loc, const Expr * computedTarget, 252 std::vector<Label> && labels = {} ) 253 : Stmt(loc, std::move(labels)), originalTarget(loc), target(loc), 254 computedTarget(computedTarget), kind(Goto) {} 248 BranchStmt( const CodeLocation & loc, Kind kind, Label target, const std::vector<Label> && labels = {} ); 249 BranchStmt( const CodeLocation & loc, const Expr * computedTarget, const std::vector<Label> && labels = {} ) 250 : Stmt(loc, std::move(labels)), originalTarget(loc), target(loc), computedTarget(computedTarget), kind(Goto) {} 255 251 256 252 const char * kindName() const { return kindNames[kind]; } … … 269 265 ptr<Expr> expr; 270 266 271 ReturnStmt( const CodeLocation & loc, const Expr * expr, std::vector<Label> && labels = {} )267 ReturnStmt( const CodeLocation & loc, const Expr * expr, const std::vector<Label> && labels = {} ) 272 268 : Stmt(loc, std::move(labels)), expr(expr) {} 273 269 … … 288 284 ExceptionKind kind; 289 285 290 ThrowStmt( 291 const CodeLocation & loc, ExceptionKind kind, const Expr * expr, const Expr * target, 292 std::vector<Label> && labels = {} ) 286 ThrowStmt( const CodeLocation & loc, ExceptionKind kind, const Expr * expr, 287 const Expr * target, const std::vector<Label> && labels = {} ) 293 288 : Stmt(loc, std::move(labels)), expr(expr), target(target), kind(kind) {} 294 289 … … 306 301 ptr<FinallyStmt> finally; 307 302 308 TryStmt( 309 const CodeLocation & loc, const CompoundStmt * body, 310 std::vector<ptr<CatchStmt>> && handlers, const FinallyStmt * finally, 311 std::vector<Label> && labels = {} ) 303 TryStmt( const CodeLocation & loc, const CompoundStmt * body, 304 const std::vector<ptr<CatchStmt>> && handlers, const FinallyStmt * finally, 305 const std::vector<Label> && labels = {} ) 312 306 : Stmt(loc, std::move(labels)), body(body), handlers(std::move(handlers)), finally(finally) {} 313 307 … … 326 320 ExceptionKind kind; 327 321 328 CatchStmt( 329 const CodeLocation & loc, ExceptionKind kind, const Decl * decl, const Expr * cond, 330 const Stmt * body, std::vector<Label> && labels = {} ) 322 CatchStmt( const CodeLocation & loc, ExceptionKind kind, const Decl * decl, const Expr * cond, 323 const Stmt * body, const std::vector<Label> && labels = {} ) 331 324 : Stmt(loc, std::move(labels)), decl(decl), cond(cond), body(body), kind(kind) {} 332 325 … … 358 351 enum Type { None, Coroutine, Generator } type = None; 359 352 360 SuspendStmt( const CodeLocation & loc, const CompoundStmt * then, Type type, std::vector<Label> && labels = {} )353 SuspendStmt( const CodeLocation & loc, const CompoundStmt * then, Type type, const std::vector<Label> && labels = {} ) 361 354 : Stmt(loc, std::move(labels)), then(then), type(type) {} 362 355 … … 396 389 OrElse orElse; 397 390 398 WaitForStmt( const CodeLocation & loc, std::vector<Label> && labels = {} )391 WaitForStmt( const CodeLocation & loc, const std::vector<Label> && labels = {} ) 399 392 : Stmt(loc, std::move(labels)) {} 400 393 … … 410 403 ptr<Decl> decl; 411 404 412 DeclStmt( const CodeLocation & loc, const Decl * decl, std::vector<Label> && labels = {} )405 DeclStmt( const CodeLocation & loc, const Decl * decl, const std::vector<Label> && labels = {} ) 413 406 : Stmt(loc, std::move(labels)), decl(decl) {} 414 407 … … 441 434 442 435 MutexStmt( const CodeLocation & loc, const Stmt * stmt, 443 std::vector<ptr<Expr>> && mutexes,std::vector<Label> && labels = {} )436 const std::vector<ptr<Expr>> && mutexes, const std::vector<Label> && labels = {} ) 444 437 : Stmt(loc, std::move(labels)), stmt(stmt), mutexObjs(std::move(mutexes)) {} 445 438 -
src/CodeGen/CodeGenerator.cc
rbecb85b9 r67e86ae6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 16:29:25202213 // Update Count : 54 012 // Last Modified On : Wed Feb 2 20:30:30 2022 13 // Update Count : 541 14 14 // 15 15 #include "CodeGenerator.h" … … 1020 1020 output << "fallthru"; 1021 1021 break; 1022 default: ; // prevent warning 1022 1023 } // switch 1023 1024 // print branch target for labelled break/continue/fallthru in debug mode -
src/ControlStruct/MLEMutator.cc
rbecb85b9 r67e86ae6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 09:26:28202213 // Update Count : 22 512 // Last Modified On : Wed Feb 2 20:18:57 2022 13 // Update Count : 227 14 14 // 15 15 … … 136 136 } 137 137 } 138 assertf( false, "C ould not find label '%s' on statement %s",138 assertf( false, "CFA internal error: could not find label '%s' on statement %s", 139 139 originalTarget.get_name().c_str(), toString( stmt ).c_str() ); 140 140 } … … 395 395 } 396 396 assert( ! enclosingControlStructures.empty() ); 397 assertf( dynamic_cast<SwitchStmt *>( enclosingControlStructures.back().get_controlStructure() ), "Control structure enclosing a case clause must be a switch, but is: %s", toCString( enclosingControlStructures.back().get_controlStructure() ) ); 397 assertf( dynamic_cast<SwitchStmt *>( enclosingControlStructures.back().get_controlStructure() ), 398 "CFA internal error: control structure enclosing a case clause must be a switch, but is: %s", 399 toCString( enclosingControlStructures.back().get_controlStructure() ) ); 398 400 if ( caseStmt->isDefault() ) { 399 401 if ( enclosingControlStructures.back().isFallDefaultUsed() ) { -
src/ControlStruct/MultiLevelExit.cpp
rbecb85b9 r67e86ae6 10 10 // Created On : Mon Nov 1 13:48:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 18:48:47202213 // Update Count : 2912 // Last Modified On : Wed Feb 2 23:07:54 2022 13 // Update Count : 33 14 14 // 15 15 … … 49 49 return target.label; 50 50 } 51 52 51 public: 53 52 Entry( const ForStmt * stmt, Label breakExit, Label contExit ) : … … 168 167 169 168 // if the stmt is labelled then generate a label to check in postvisit if the label is used 170 bool isLabeled = ! stmt->labels.empty();169 bool isLabeled = ! stmt->labels.empty(); 171 170 if ( isLabeled ) { 172 171 Label breakLabel = newLabel( "blockBreak", stmt ); … … 180 179 181 180 if ( isLabeled ) { 182 assert( ! enclosing_control_structures.empty() );181 assert( ! enclosing_control_structures.empty() ); 183 182 Entry & entry = enclosing_control_structures.back(); 184 if ( ! entry.useBreakExit().empty() ) {183 if ( ! entry.useBreakExit().empty() ) { 185 184 break_label = entry.useBreakExit(); 186 185 } … … 206 205 } 207 206 } 208 assertf( false, "C ould not find label '%s' on statement %s",207 assertf( false, "CFA internal error: could not find label '%s' on statement %s", 209 208 originalTarget.name.c_str(), toString( stmt ).c_str() ); 210 209 } … … 254 253 } 255 254 // Ensure that selected target is valid. 256 if ( targetEntry == enclosing_control_structures.rend() || ( isContinue && ! isContinueTarget( *targetEntry ) ) ) {255 if ( targetEntry == enclosing_control_structures.rend() || ( isContinue && ! isContinueTarget( *targetEntry ) ) ) { 257 256 SemanticError( stmt->location, toString( (isContinue ? "'continue'" : "'break'"), 258 257 " target must be an enclosing ", (isContinue ? "loop: " : "control structure: "), … … 268 267 SemanticError( stmt->location, "'fallthrough' must be enclosed in a 'switch' or 'choose'" ); 269 268 } 270 if ( ! stmt->target.empty() ) {269 if ( ! stmt->target.empty() ) { 271 270 // Labelled fallthrough: target must be a valid fallthough label. 272 if ( ! fallthrough_labels.count( stmt->target ) ) {271 if ( ! fallthrough_labels.count( stmt->target ) ) { 273 272 SemanticError( stmt->location, toString( "'fallthrough' target must be a later case statement: ", 274 273 stmt->originalTarget ) ); 275 274 } 276 return new BranchStmt( 277 stmt->location, BranchStmt::Goto, stmt->originalTarget ); 275 return new BranchStmt( stmt->location, BranchStmt::Goto, stmt->originalTarget ); 278 276 } 279 277 break; … … 307 305 } 308 306 309 // Branch error checks: get the appropriate label name: 310 // (This label is always replaced.) 307 // Branch error checks: get the appropriate label name, which is always replaced. 311 308 Label exitLabel( CodeLocation(), "" ); 312 309 switch ( stmt->kind ) { 313 310 case BranchStmt::Break: 314 assert( ! targetEntry->useBreakExit().empty() );311 assert( ! targetEntry->useBreakExit().empty() ); 315 312 exitLabel = targetEntry->useBreakExit(); 316 313 break; 317 314 case BranchStmt::Continue: 318 assert( ! targetEntry->useContExit().empty() );315 assert( ! targetEntry->useContExit().empty() ); 319 316 exitLabel = targetEntry->useContExit(); 320 317 break; 321 318 case BranchStmt::FallThrough: 322 assert( ! targetEntry->useFallExit().empty() );319 assert( ! targetEntry->useFallExit().empty() ); 323 320 exitLabel = targetEntry->useFallExit(); 324 321 break; 325 322 case BranchStmt::FallThroughDefault: 326 assert( ! targetEntry->useFallDefaultExit().empty() );323 assert( ! targetEntry->useFallDefaultExit().empty() ); 327 324 exitLabel = targetEntry->useFallDefaultExit(); 328 325 // Check that fallthrough default comes before the default clause. 329 if ( ! targetEntry->isFallDefaultValid() ) {326 if ( ! targetEntry->isFallDefaultValid() ) { 330 327 SemanticError( stmt->location, "'fallthrough default' must precede the 'default' clause" ); 331 328 } … … 373 370 // If default, mark seen. 374 371 if ( stmt->isDefault() ) { 375 assert( ! enclosing_control_structures.empty() );372 assert( ! enclosing_control_structures.empty() ); 376 373 enclosing_control_structures.back().seenDefault(); 377 374 } … … 399 396 Entry & entry = enclosing_control_structures.back(); 400 397 if ( entry.isFallUsed() ) { 401 mutStmt->stmts.push_back( 402 labelledNullStmt( mutStmt->location, entry.useFallExit() ) ); 398 mutStmt->stmts.push_back( labelledNullStmt( mutStmt->location, entry.useFallExit() ) ); 403 399 } 404 400 } … … 406 402 Entry & entry = enclosing_control_structures.back(); 407 403 assertf( dynamic_cast< const SwitchStmt * >( entry.stmt ), 408 "C ontrol structure enclosing a case clause must be a switch, but is: %s",404 "CFA internal error: control structure enclosing a case clause must be a switch, but is: %s", 409 405 toString( entry.stmt ).c_str() ); 410 406 if ( mutStmt->isDefault() ) { 411 407 if ( entry.isFallDefaultUsed() ) { 412 408 // Add fallthrough default label if necessary. 413 push_front( mutStmt->stmts, labelledNullStmt( 414 stmt->location, entry.useFallDefaultExit() 415 ) ); 409 push_front( mutStmt->stmts, labelledNullStmt( stmt->location, entry.useFallDefaultExit() ) ); 416 410 } 417 411 } … … 420 414 421 415 void MultiLevelExitCore::previsit( const IfStmt * stmt ) { 422 bool labeledBlock = ! stmt->labels.empty();416 bool labeledBlock = ! stmt->labels.empty(); 423 417 if ( labeledBlock ) { 424 418 Label breakLabel = newLabel( "blockBreak", stmt ); … … 429 423 430 424 const IfStmt * MultiLevelExitCore::postvisit( const IfStmt * stmt ) { 431 bool labeledBlock = ! stmt->labels.empty();425 bool labeledBlock = ! stmt->labels.empty(); 432 426 if ( labeledBlock ) { 433 427 auto this_label = enclosing_control_structures.back().useBreakExit(); 434 if ( ! this_label.empty() ) {428 if ( ! this_label.empty() ) { 435 429 break_label = this_label; 436 430 } … … 448 442 auto it = find_if( stmt->stmts.rbegin(), stmt->stmts.rend(), isDefaultCase ); 449 443 450 const CaseStmt * defaultCase = it != stmt->stmts.rend() 451 ? (it)->strict_as<CaseStmt>() : nullptr; 452 Label defaultLabel = defaultCase 453 ? newLabel( "fallThroughDefault", defaultCase ) 454 : Label( stmt->location, "" ); 444 const CaseStmt * defaultCase = it != stmt->stmts.rend() ? (it)->strict_as<CaseStmt>() : nullptr; 445 Label defaultLabel = defaultCase ? newLabel( "fallThroughDefault", defaultCase ) : Label( stmt->location, "" ); 455 446 enclosing_control_structures.emplace_back( stmt, label, defaultLabel ); 456 447 GuardAction( [this]() { enclosing_control_structures.pop_back(); } ); 457 448 458 // Collect valid labels for fallthrough. It starts with all labels at 459 // t his level, then remove as each is seen during traversal.449 // Collect valid labels for fallthrough. It starts with all labels at this level, then remove as each is seen during 450 // traversal. 460 451 for ( const Stmt * stmt : stmt->stmts ) { 461 452 auto * caseStmt = strict_dynamic_cast< const CaseStmt * >( stmt ); … … 471 462 472 463 const SwitchStmt * MultiLevelExitCore::postvisit( const SwitchStmt * stmt ) { 473 assert( ! enclosing_control_structures.empty() );464 assert( ! enclosing_control_structures.empty() ); 474 465 Entry & entry = enclosing_control_structures.back(); 475 466 assert( entry.stmt == stmt ); … … 477 468 // Only run to generate the break label. 478 469 if ( entry.isBreakUsed() ) { 479 // To keep the switch statements uniform (all direct children of a 480 // SwitchStmt should be CastStmts), append the exit label and break 481 // to the last case, create a default case is there are no cases. 470 // To keep the switch statements uniform (all direct children of a SwitchStmt should be CastStmts), append the 471 // exit label and break to the last case, create a default case if no cases. 482 472 SwitchStmt * mutStmt = mutate( stmt ); 483 473 if ( mutStmt->stmts.empty() ) { 484 mutStmt->stmts.push_back( new CaseStmt( 485 mutStmt->location, nullptr, {} )); 474 mutStmt->stmts.push_back( new CaseStmt( mutStmt->location, nullptr, {} ) ); 486 475 } 487 476 … … 507 496 508 497 void MultiLevelExitCore::previsit( const TryStmt * stmt ) { 509 bool isLabeled = ! stmt->labels.empty();498 bool isLabeled = ! stmt->labels.empty(); 510 499 if ( isLabeled ) { 511 500 Label breakLabel = newLabel( "blockBreak", stmt ); … … 516 505 517 506 void MultiLevelExitCore::postvisit( const TryStmt * stmt ) { 518 bool isLabeled = ! stmt->labels.empty();507 bool isLabeled = ! stmt->labels.empty(); 519 508 if ( isLabeled ) { 520 509 auto this_label = enclosing_control_structures.back().useBreakExit(); 521 if ( ! this_label.empty() ) {510 if ( ! this_label.empty() ) { 522 511 break_label = this_label; 523 512 } … … 526 515 527 516 void MultiLevelExitCore::previsit( const FinallyStmt * ) { 528 GuardAction([this, old = move(enclosing_control_structures)](){ 529 enclosing_control_structures = move(old); 530 }); 517 GuardAction([this, old = move( enclosing_control_structures)](){ enclosing_control_structures = move(old); }); 531 518 enclosing_control_structures = vector<Entry>(); 532 519 GuardValue( inFinally ) = true; … … 575 562 template<typename LoopNode> 576 563 const LoopNode * MultiLevelExitCore::posthandleLoopStmt( const LoopNode * loopStmt ) { 577 assert( ! enclosing_control_structures.empty() );564 assert( ! enclosing_control_structures.empty() ); 578 565 Entry & entry = enclosing_control_structures.back(); 579 566 assert( entry.stmt == loopStmt ); 580 567 581 568 // Now check if the labels are used and add them if so. 582 return mutate_field( 583 loopStmt, &LoopNode::body, mutateLoop( loopStmt->body, entry ) ); 569 return mutate_field( loopStmt, &LoopNode::body, mutateLoop( loopStmt->body, entry ) ); 584 570 // this call to mutate_field compares loopStmt->body and the result of mutateLoop 585 571 // if they are the same the node isn't mutated, if they differ then the new mutated node is returned … … 609 595 } 610 596 611 if ( !break_label.empty() ) { 612 ret.push_back( 613 labelledNullStmt( ret.back()->location, break_label ) ); 597 if ( ! break_label.empty() ) { 598 ret.push_back( labelledNullStmt( ret.back()->location, break_label ) ); 614 599 break_label = Label( CodeLocation(), "" ); 615 600 } 616 601 } 617 602 618 if ( ! errors.isEmpty() ) {603 if ( ! errors.isEmpty() ) { 619 604 throw errors; 620 605 } -
src/Parser/StatementNode.cc
rbecb85b9 r67e86ae6 11 11 // Created On : Sat May 16 14:59:41 2015 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Wed Feb 2 12:27:58202214 // Update Count : 42 413 // Last Modified On : Wed Feb 2 20:29:30 2022 14 // Update Count : 425 15 15 // 16 16 … … 138 138 139 139 Statement * build_case( ExpressionNode * ctl ) { 140 return new CaseStmt( maybeMoveBuild< Expression >(ctl), {} ); // no init140 return new CaseStmt( maybeMoveBuild< Expression >(ctl), {} ); // stmt starts empty and then added to 141 141 } // build_case 142 142 143 143 Statement * build_default() { 144 return new CaseStmt( nullptr, {}, true ); // no init144 return new CaseStmt( nullptr, {}, true ); // stmt starts empty and then added to 145 145 } // build_default 146 146 -
src/SynTree/Statement.cc
rbecb85b9 r67e86ae6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 2 11:55:19202213 // Update Count : 8012 // Last Modified On : Wed Feb 2 20:19:33 2022 13 // Update Count : 90 14 14 // 15 15 … … 29 29 #include "SynTree/Label.h" // for Label, operator<< 30 30 31 using std::string;32 using std::endl; 33 34 Statement::Statement( const std::list<Label> & labels ) : labels( labels ) {}35 36 void Statement::print( std::ostream & os, Indenter indent ) const {31 using namespace std; 32 33 34 Statement::Statement( const list<Label> & labels ) : labels( labels ) {} 35 36 void Statement::print( ostream & os, Indenter indent ) const { 37 37 if ( ! labels.empty() ) { 38 38 os << indent << "... Labels: {"; … … 54 54 } 55 55 56 void ExprStmt::print( std::ostream & os, Indenter indent ) const {57 os << "Expression Statement:" << endl << indent +1;58 expr->print( os, indent +1 );59 } 60 61 62 AsmStmt::AsmStmt( bool voltile, Expression * instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels ) : Statement(), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ), gotolabels( gotolabels ) {}56 void ExprStmt::print( ostream & os, Indenter indent ) const { 57 os << "Expression Statement:" << endl << indent + 1; 58 expr->print( os, indent + 1 ); 59 } 60 61 62 AsmStmt::AsmStmt( bool voltile, Expression * instruction, const list<Expression *> output, const list<Expression *> input, const list<ConstantExpr *> clobber, const list<Label> gotolabels ) : Statement(), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ), gotolabels( gotolabels ) {} 63 63 64 64 AsmStmt::AsmStmt( const AsmStmt & other ) : Statement( other ), voltile( other.voltile ), instruction( maybeClone( other.instruction ) ), gotolabels( other.gotolabels ) { … … 75 75 } 76 76 77 void AsmStmt::print( std::ostream & os, Indenter indent ) const {77 void AsmStmt::print( ostream & os, Indenter indent ) const { 78 78 os << "Assembler Statement:" << endl; 79 os << indent +1 << "instruction: " << endl << indent;80 instruction->print( os, indent +1 );79 os << indent + 1 << "instruction: " << endl << indent; 80 instruction->print( os, indent + 1 ); 81 81 if ( ! output.empty() ) { 82 os << endl << indent +1 << "output: " << endl;83 printAll( output, os, indent +1 );82 os << endl << indent + 1 << "output: " << endl; 83 printAll( output, os, indent + 1 ); 84 84 } // if 85 85 if ( ! input.empty() ) { 86 os << indent +1 << "input: " << endl;87 printAll( input, os, indent +1 );86 os << indent + 1 << "input: " << endl; 87 printAll( input, os, indent + 1 ); 88 88 } // if 89 89 if ( ! clobber.empty() ) { 90 os << indent +1 << "clobber: " << endl;91 printAll( clobber, os, indent +1 );90 os << indent + 1 << "clobber: " << endl; 91 printAll( clobber, os, indent + 1 ); 92 92 } // if 93 93 } 94 94 95 95 96 DirectiveStmt::DirectiveStmt( const st d::string & directive ) : Statement(), directive( directive ) {}97 98 void DirectiveStmt::print( std::ostream & os, Indenter ) const {96 DirectiveStmt::DirectiveStmt( const string & directive ) : Statement(), directive( directive ) {} 97 98 void DirectiveStmt::print( ostream & os, Indenter ) const { 99 99 os << "GCC Directive:" << directive << endl; 100 100 } … … 120 120 } 121 121 122 void BranchStmt::print( std::ostream & os, Indenter indent ) const {123 assert (type < 5);122 void BranchStmt::print( ostream & os, Indenter indent ) const { 123 assertf(type < BranchStmts, "CFA internal error: invalid branch statement" ); 124 124 os << "Branch (" << brType[type] << ")" << endl ; 125 if ( target != "" ) os << indent +1 << "with target: " << target << endl;126 if ( originalTarget != "" ) os << indent +1 << "with original target: " << originalTarget << endl;127 if ( computedTarget != nullptr ) os << indent +1 << "with computed target: " << computedTarget << endl;125 if ( target != "" ) os << indent + 1 << "with target: " << target << endl; 126 if ( originalTarget != "" ) os << indent + 1 << "with original target: " << originalTarget << endl; 127 if ( computedTarget != nullptr ) os << indent + 1 << "with computed target: " << computedTarget << endl; 128 128 } 129 129 … … 136 136 } 137 137 138 void ReturnStmt::print( std::ostream & os, Indenter indent ) const {138 void ReturnStmt::print( ostream & os, Indenter indent ) const { 139 139 os << "Return Statement, returning: "; 140 140 if ( expr != nullptr ) { 141 os << endl << indent +1;142 expr->print( os, indent +1 );141 os << endl << indent + 1; 142 expr->print( os, indent + 1 ); 143 143 } 144 144 os << endl; 145 145 } 146 146 147 IfStmt::IfStmt( Expression * condition, Statement * then, Statement * else_, std::list<Statement *> initialization ):147 IfStmt::IfStmt( Expression * condition, Statement * then, Statement * else_, const list<Statement *> initialization ): 148 148 Statement(), condition( condition ), then( then ), else_( else_ ), initialization( initialization ) {} 149 149 … … 160 160 } 161 161 162 void IfStmt::print( std::ostream & os, Indenter indent ) const {162 void IfStmt::print( ostream & os, Indenter indent ) const { 163 163 os << "If on condition: " << endl; 164 os << indent +1;165 condition->print( os, indent +1 );164 os << indent + 1; 165 condition->print( os, indent + 1 ); 166 166 167 167 if ( !initialization.empty() ) { 168 168 os << indent << "... with initialization: \n"; 169 169 for ( const Statement * stmt : initialization ) { 170 os << indent +1;171 stmt->print( os, indent +1 );170 os << indent + 1; 171 stmt->print( os, indent + 1 ); 172 172 } 173 173 os << endl; … … 176 176 os << indent << "... then: " << endl; 177 177 178 os << indent +1;179 then->print( os, indent +1 );178 os << indent + 1; 179 then->print( os, indent + 1 ); 180 180 181 181 if ( else_ != nullptr ) { 182 182 os << indent << "... else: " << endl; 183 os << indent +1;184 else_->print( os, indent +1 );183 os << indent + 1; 184 else_->print( os, indent + 1 ); 185 185 } // if 186 186 } 187 187 188 SwitchStmt::SwitchStmt( Expression * condition, const std::list<Statement *> & statements ):188 SwitchStmt::SwitchStmt( Expression * condition, const list<Statement *> & statements ): 189 189 Statement(), condition( condition ), statements( statements ) { 190 190 } … … 201 201 } 202 202 203 void SwitchStmt::print( std::ostream & os, Indenter indent ) const {203 void SwitchStmt::print( ostream & os, Indenter indent ) const { 204 204 os << "Switch on condition: "; 205 205 condition->print( os ); … … 207 207 208 208 for ( const Statement * stmt : statements ) { 209 stmt->print( os, indent +1 );210 } 211 } 212 213 CaseStmt::CaseStmt( Expression * condition, const std::list<Statement *> & statements, bool deflt ) throw ( SemanticErrorException ) :214 Statement(), condition( condition ), stmts( statements ), _isDefault( deflt ) {209 stmt->print( os, indent + 1 ); 210 } 211 } 212 213 CaseStmt::CaseStmt( Expression * condition, const list<Statement *> & statements, bool deflt ) throw ( SemanticErrorException ) : 214 Statement(), condition( condition ), stmts( statements ), _isDefault( deflt ) { 215 215 if ( isDefault() && condition != nullptr ) SemanticError( condition, "default case with condition: " ); 216 216 } 217 217 218 218 CaseStmt::CaseStmt( const CaseStmt & other ) : 219 Statement( other ), condition( maybeClone(other.condition ) ), _isDefault( other._isDefault ) {219 Statement( other ), condition( maybeClone(other.condition ) ), _isDefault( other._isDefault ) { 220 220 cloneAll( other.stmts, stmts ); 221 221 } … … 226 226 } 227 227 228 CaseStmt * CaseStmt::makeDefault( const std::list<Label> & labels, std::list<Statement *> stmts ) {228 CaseStmt * CaseStmt::makeDefault( const list<Label> & labels, list<Statement *> stmts ) { 229 229 CaseStmt * stmt = new CaseStmt( nullptr, stmts, true ); 230 230 stmt->labels = labels; … … 232 232 } 233 233 234 void CaseStmt::print( std::ostream & os, Indenter indent ) const {234 void CaseStmt::print( ostream & os, Indenter indent ) const { 235 235 if ( isDefault() ) os << indent << "Default "; 236 236 else { … … 241 241 242 242 for ( Statement * stmt : stmts ) { 243 os << indent +1;244 stmt->print( os, indent +1 );245 } 246 } 247 248 WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, const std::list< Statement * > & initialization, bool isDoWhile ):243 os << indent + 1; 244 stmt->print( os, indent + 1 ); 245 } 246 } 247 248 WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, const list< Statement * > & initialization, bool isDoWhile ): 249 249 Statement(), condition( condition ), body( body ), else_( nullptr ), initialization( initialization ), isDoWhile( isDoWhile) { 250 250 } 251 251 252 WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, Statement * else_, const std::list< Statement * > & initialization, bool isDoWhile ):252 WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, Statement * else_, const list< Statement * > & initialization, bool isDoWhile ): 253 253 Statement(), condition( condition), body( body ), else_( else_ ), initialization( initialization ), isDoWhile( isDoWhile) { 254 254 } … … 263 263 } 264 264 265 void WhileDoStmt::print( std::ostream & os, Indenter indent ) const {265 void WhileDoStmt::print( ostream & os, Indenter indent ) const { 266 266 os << "While on condition: " << endl ; 267 condition->print( os, indent +1 );267 condition->print( os, indent + 1 ); 268 268 269 269 os << indent << "... with body: " << endl; 270 270 271 if ( body != nullptr ) body->print( os, indent +1 );272 } 273 274 ForStmt::ForStmt( std::list<Statement *> initialization, Expression * condition, Expression * increment, Statement * body, Statement * else_ ):271 if ( body != nullptr ) body->print( os, indent + 1 ); 272 } 273 274 ForStmt::ForStmt( const list<Statement *> initialization, Expression * condition, Expression * increment, Statement * body, Statement * else_ ): 275 275 Statement(), initialization( initialization ), condition( condition ), increment( increment ), body( body ), else_( else_ ) { 276 276 } … … 290 290 } 291 291 292 void ForStmt::print( std::ostream & os, Indenter indent ) const {292 void ForStmt::print( ostream & os, Indenter indent ) const { 293 293 Statement::print( os, indent ); // print labels 294 294 … … 298 298 os << indent << "... initialization: \n"; 299 299 for ( Statement * stmt : initialization ) { 300 os << indent +1;301 stmt->print( os, indent +1 );300 os << indent + 1; 301 stmt->print( os, indent + 1 ); 302 302 } 303 303 } 304 304 305 305 if ( condition != nullptr ) { 306 os << indent << "... condition: \n" << indent +1;307 condition->print( os, indent +1 );306 os << indent << "... condition: \n" << indent + 1; 307 condition->print( os, indent + 1 ); 308 308 } 309 309 310 310 if ( increment != nullptr ) { 311 os << "\n" << indent << "... increment: \n" << indent +1;312 increment->print( os, indent +1 );311 os << "\n" << indent << "... increment: \n" << indent + 1; 312 increment->print( os, indent + 1 ); 313 313 } 314 314 315 315 if ( body != nullptr ) { 316 os << "\n" << indent << "... with body: \n" << indent +1;317 body->print( os, indent +1 );316 os << "\n" << indent << "... with body: \n" << indent + 1; 317 body->print( os, indent + 1 ); 318 318 } 319 319 320 320 if ( else_ != nullptr ) { 321 os << "\n" << indent << "... with body: \n" << indent +1;322 else_->print( os, indent +1 );321 os << "\n" << indent << "... with body: \n" << indent + 1; 322 else_->print( os, indent + 1 ); 323 323 } 324 324 os << endl; … … 339 339 } 340 340 341 void ThrowStmt::print( std::ostream & os, Indenter indent) const {341 void ThrowStmt::print( ostream & os, Indenter indent) const { 342 342 if ( target ) os << "Non-Local "; 343 343 os << "Throw Statement, raising: "; 344 expr->print(os, indent +1);344 expr->print(os, indent + 1); 345 345 if ( target ) { 346 346 os << "... at: "; 347 target->print(os, indent +1);348 } 349 } 350 351 TryStmt::TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock ) :347 target->print(os, indent + 1); 348 } 349 } 350 351 TryStmt::TryStmt( CompoundStmt * tryBlock, const list<CatchStmt *> & handlers, FinallyStmt * finallyBlock ) : 352 352 Statement(), block( tryBlock ), handlers( handlers ), finallyBlock( finallyBlock ) { 353 353 } … … 363 363 } 364 364 365 void TryStmt::print( std::ostream & os, Indenter indent ) const {365 void TryStmt::print( ostream & os, Indenter indent ) const { 366 366 os << "Try Statement" << endl; 367 os << indent << "... with block:" << endl << indent +1;368 block->print( os, indent +1 );367 os << indent << "... with block:" << endl << indent + 1; 368 block->print( os, indent + 1 ); 369 369 370 370 // handlers 371 371 os << indent << "... and handlers:" << endl; 372 372 for ( const CatchStmt * stmt : handlers ) { 373 os << indent +1;374 stmt->print( os, indent +1 );373 os << indent + 1; 374 stmt->print( os, indent + 1 ); 375 375 } 376 376 377 377 // finally block 378 378 if ( finallyBlock != nullptr ) { 379 os << indent << "... and finally:" << endl << indent +1;380 finallyBlock->print( os, indent +1 );379 os << indent << "... and finally:" << endl << indent + 1; 380 finallyBlock->print( os, indent + 1 ); 381 381 } // if 382 382 } … … 396 396 } 397 397 398 void CatchStmt::print( std::ostream & os, Indenter indent ) const {398 void CatchStmt::print( ostream & os, Indenter indent ) const { 399 399 os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl; 400 400 401 401 os << indent << "... catching: "; 402 decl->printShort( os, indent +1 );402 decl->printShort( os, indent + 1 ); 403 403 os << endl; 404 404 405 405 if ( cond ) { 406 os << indent << "... with conditional:" << endl << indent +1;407 cond->print( os, indent +1 );406 os << indent << "... with conditional:" << endl << indent + 1; 407 cond->print( os, indent + 1 ); 408 408 } 409 409 410 410 os << indent << "... with block:" << endl; 411 os << indent +1;412 body->print( os, indent +1 );411 os << indent + 1; 412 body->print( os, indent + 1 ); 413 413 } 414 414 … … 424 424 } 425 425 426 void FinallyStmt::print( std::ostream & os, Indenter indent ) const {426 void FinallyStmt::print( ostream & os, Indenter indent ) const { 427 427 os << "Finally Statement" << endl; 428 os << indent << "... with block:" << endl << indent +1;429 block->print( os, indent +1 );428 os << indent << "... with block:" << endl << indent + 1; 429 block->print( os, indent + 1 ); 430 430 } 431 431 … … 439 439 } 440 440 441 void SuspendStmt::print( std::ostream & os, Indenter indent ) const {441 void SuspendStmt::print( ostream & os, Indenter indent ) const { 442 442 os << "Suspend Statement"; 443 443 switch (type) { … … 496 496 } 497 497 498 void WaitForStmt::print( std::ostream & os, Indenter indent ) const {498 void WaitForStmt::print( ostream & os, Indenter indent ) const { 499 499 os << "Waitfor Statement" << endl; 500 500 indent += 1; … … 531 531 532 532 533 WithStmt::WithStmt( const std::list< Expression * > & exprs, Statement * stmt ) : Declaration("", noStorageClasses, LinkageSpec::Cforall), exprs( exprs ), stmt( stmt ) {}533 WithStmt::WithStmt( const list< Expression * > & exprs, Statement * stmt ) : Declaration("", noStorageClasses, LinkageSpec::Cforall), exprs( exprs ), stmt( stmt ) {} 534 534 WithStmt::WithStmt( const WithStmt & other ) : Declaration( other ), stmt( maybeClone( other.stmt ) ) { 535 535 cloneAll( other.exprs, exprs ); … … 540 540 } 541 541 542 void WithStmt::print( std::ostream & os, Indenter indent ) const {542 void WithStmt::print( ostream & os, Indenter indent ) const { 543 543 os << "With statement" << endl; 544 544 os << indent << "... with expressions: " << endl; 545 printAll( exprs, os, indent +1 );546 os << indent << "... with statement:" << endl << indent +1;547 stmt->print( os, indent +1 );548 } 549 550 551 NullStmt::NullStmt( const std::list<Label> & labels ) : Statement( labels ) {552 } 553 554 void NullStmt::print( std::ostream & os, Indenter indent ) const {545 printAll( exprs, os, indent + 1 ); 546 os << indent << "... with statement:" << endl << indent + 1; 547 stmt->print( os, indent + 1 ); 548 } 549 550 551 NullStmt::NullStmt( const list<Label> & labels ) : Statement( labels ) { 552 } 553 554 void NullStmt::print( ostream & os, Indenter indent ) const { 555 555 os << "Null Statement" << endl; 556 556 Statement::print( os, indent ); … … 568 568 } 569 569 570 void ImplicitCtorDtorStmt::print( std::ostream & os, Indenter indent ) const {570 void ImplicitCtorDtorStmt::print( ostream & os, Indenter indent ) const { 571 571 os << "Implicit Ctor Dtor Statement" << endl; 572 572 os << indent << "... with Ctor/Dtor: "; 573 callStmt->print( os, indent +1);573 callStmt->print( os, indent + 1); 574 574 os << endl; 575 575 } 576 576 577 MutexStmt::MutexStmt( Statement * stmt, std::list<Expression *> mutexObjs )577 MutexStmt::MutexStmt( Statement * stmt, const list<Expression *> mutexObjs ) 578 578 : Statement(), stmt( stmt ), mutexObjs( mutexObjs ) { } 579 579 … … 587 587 } 588 588 589 void MutexStmt::print( std::ostream & os, Indenter indent ) const {589 void MutexStmt::print( ostream & os, Indenter indent ) const { 590 590 os << "Mutex Statement" << endl; 591 591 os << indent << "... with Expressions: " << endl; 592 592 for (auto * obj : mutexObjs) { 593 os << indent +1;594 obj->print( os, indent +1);593 os << indent + 1; 594 obj->print( os, indent + 1); 595 595 os << endl; 596 596 } 597 os << indent << "... with Statement: " << endl << indent +1;598 stmt->print( os, indent +1 );597 os << indent << "... with Statement: " << endl << indent + 1; 598 stmt->print( os, indent + 1 ); 599 599 } 600 600 -
src/SynTree/Statement.h
rbecb85b9 r67e86ae6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 2 11:49:17202213 // Update Count : 9 412 // Last Modified On : Wed Feb 2 20:15:30 2022 13 // Update Count : 98 14 14 // 15 15 … … 107 107 std::list<Label> gotolabels; 108 108 109 AsmStmt( bool voltile, Expression * instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber,std::list<Label> gotolabels );109 AsmStmt( bool voltile, Expression * instruction, const std::list<Expression *> output, const std::list<Expression *> input, const std::list<ConstantExpr *> clobber, const std::list<Label> gotolabels ); 110 110 AsmStmt( const AsmStmt & other ); 111 111 virtual ~AsmStmt(); … … 153 153 154 154 IfStmt( Expression * condition, Statement * then, Statement * else_, 155 std::list<Statement *> initialization = std::list<Statement *>() );155 const std::list<Statement *> initialization = std::list<Statement *>() ); 156 156 IfStmt( const IfStmt & other ); 157 157 virtual ~IfStmt(); … … 260 260 Statement * else_; 261 261 262 ForStmt( std::list<Statement *> initialization, Expression * condition = nullptr, Expression * increment = nullptr, Statement * body = nullptr, Statement * else_ = nullptr );262 ForStmt( const std::list<Statement *> initialization, Expression * condition = nullptr, Expression * increment = nullptr, Statement * body = nullptr, Statement * else_ = nullptr ); 263 263 ForStmt( const ForStmt & other ); 264 264 virtual ~ForStmt(); … … 281 281 class BranchStmt : public Statement { 282 282 public: 283 enum Type { Goto = 0, Break, Continue, FallThrough, FallThroughDefault};283 enum Type { Goto, Break, Continue, FallThrough, FallThroughDefault, BranchStmts }; 284 284 285 285 // originalTarget kept for error messages. … … 360 360 FinallyStmt * finallyBlock; 361 361 362 TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = nullptr );362 TryStmt( CompoundStmt * tryBlock, const std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = nullptr ); 363 363 TryStmt( const TryStmt & other ); 364 364 virtual ~TryStmt(); … … 543 543 std::list<Expression *> mutexObjs; // list of mutex objects to acquire 544 544 545 MutexStmt( Statement * stmt, std::list<Expression *> mutexObjs );545 MutexStmt( Statement * stmt, const std::list<Expression *> mutexObjs ); 546 546 MutexStmt( const MutexStmt & other ); 547 547 virtual ~MutexStmt(); -
tests/include/.expect/includes.nast.txt
rbecb85b9 r67e86ae6 1 include/includes.cfa:15 4:25: warning: Compiled1 include/includes.cfa:153:25: warning: Compiled -
tests/include/includes.cfa
rbecb85b9 r67e86ae6 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jun 5 10:06:46 202113 // Update Count : 7 5112 // Last Modified On : Thu Feb 3 22:06:07 2022 13 // Update Count : 774 14 14 // 15 15 … … 18 18 #endif // __CFA__ 19 19 20 #if 1 20 21 //#define _GNU_SOURCE 21 22 #include <aio.h> … … 40 41 #include <errno.h> 41 42 #include <error.h> 42 //#include <eti.h> 43 //#include <eti.h> // may not be installed, comes with ncurses 43 44 #include <execinfo.h> 44 45 #include <expat.h> … … 49 50 #include <fmtmsg.h> 50 51 #include <fnmatch.h> 51 //#include <form.h> 52 //#include <form.h> // may not be installed, comes with ncurses 52 53 #include <fstab.h> 53 54 #include <fts.h> … … 77 78 #include <mcheck.h> 78 79 #include <memory.h> 79 //#include <menu.h> 80 //#include <menu.h> // may not be installed, comes with ncurses 80 81 #include <mntent.h> 81 82 #include <monetary.h> 82 83 #include <mqueue.h> 83 //#include <ncurses_dll.h> 84 //#include <ncurses_dll.h> // may not be installed, comes with ncurses 84 85 #include <netdb.h> 85 86 #include <nl_types.h> 86 87 #include <nss.h> 87 88 #include <obstack.h> 88 //#include <panel.h> 89 //#include <panel.h> // may not be installed, comes with ncurses 89 90 #include <paths.h> 90 91 #include <poll.h> … … 117 118 #include <syslog.h> 118 119 #include <tar.h> 119 //#include <term.h> 120 //#include <termcap.h> 120 //#include <term.h> // may not be installed, comes with ncurses 121 //#include <termcap.h> // may not be installed, comes with ncurses 121 122 #include <termio.h> 122 123 #include <termios.h> … … 130 131 #include <ucontext.h> 131 132 #include <ulimit.h> 132 //#include <unctrl.h> 133 //#include <unctrl.h> // may not be installed, comes with ncurses 133 134 #include <unistd.h> 134 135 #include <utime.h> … … 143 144 #include <wctype.h> 144 145 #include <wordexp.h> 145 146 #if 0147 146 #endif // 0 148 147 … … 151 150 #endif // __CFA__ 152 151 153 int main( int argc, char const * argv[] ) {154 #pragma GCC warning "Compiled" 152 int main( int argc, char const * argv[] ) { 153 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 155 154 } 156 155
Note:
See TracChangeset
for help on using the changeset viewer.