Changes in / [97f9619:68ea8d2]
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
r97f9619 r68ea8d2 11 11 ## Created On : Sun May 31 22:14:18 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Tue Jul 16 16:59:12 202414 ## Update Count : 5 713 ## Last Modified On : Wed May 17 11:02:34 2023 14 ## Update Count : 56 15 15 ############################################################################### 16 16 … … 35 35 man1_MANS = doc/man/cfa.1 36 36 37 EXTRA_DIST = LICENSE doc/man/cfa.1 libcfa/configure libcfa/Makefile.dist.am libcfa/Makefile.dist.in tools/build/distcc_hash tools/build/push2dist.sh tools/prettyprinter37 EXTRA_DIST = LICENSE doc/man/cfa.1 libcfa/configure libcfa/Makefile.dist.am libcfa/Makefile.dist.in tools/build/distcc_hash tools/build/push2dist.sh 38 38 39 39 debug ?= yes -
doc/bibliography/pl.bib
r97f9619 r68ea8d2 1863 1863 key = {concurrent locking}, 1864 1864 author = {Peter A. Buhr and David Dice and Wim H. Hesselink}, 1865 title = { Concurrent locking algorithms},1865 title = {concurrent-locking}, 1866 1866 howpublished= {\url{https://github.com/pabuhr/concurrent-locking}}, 1867 1867 } … … 4001 4001 organization= {Google}, 4002 4002 year = 2009, 4003 note = {\url{http s://go.dev/ref/spec}},4003 note = {\url{http://golang.org/ref/spec}}, 4004 4004 } 4005 4005 … … 4180 4180 number = 12, 4181 4181 pages = {2463-2500}, 4182 note = {\url{https://onlinelibrary.wiley.com/doi/10.1002/spe.3262}}, 4182 4183 } 4183 4184 … … 7801 7802 @book{Scott24, 7802 7803 author = {Michael L. Scott and Trevor Brown}, 7803 title = {Shared-Memory Synchronization},7804 booktitle = {Shared-Memory Synchronization}, 7804 7805 series = {Synthesis Lectures on Computer Architecture}, 7805 7806 edition = {2nd}, … … 8531 8532 key = {TIOBE Index}, 8532 8533 author = {{TIOBE Index}}, 8533 howpublished= {\url{http s://www.tiobe.com/tiobe-index}},8534 howpublished= {\url{http://www.tiobe.com/tiobe_index}}, 8534 8535 } 8535 8536 -
doc/user/Makefile
r97f9619 r68ea8d2 6 6 TeXLIB = .:${Macros}:${Build}: 7 7 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build} 8 BibDir = ../bibliography 9 BibTeX = BIBINPUTS=${BibDir}: && export BIBINPUTS && bibtex 8 BibTeX = BIBINPUTS=../bibliography: && export BIBINPUTS && bibtex 10 9 11 10 MAKEFLAGS = --no-print-directory --silent # … … 62 61 63 62 ${BASE}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${Macros}/common.tex ${Macros}/common.sty \ 64 ${Macros}/lstlang.sty ${Macros}/indexstyle ${BibDir}/pl.bib build/version | ${Build}63 ${Macros}/lstlang.sty ${Macros}/indexstyle ../bibliography/pl.bib build/version | ${Build} 65 64 # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run. 66 65 if [ ! -r ${basename $@}.ind ] ; then touch ${Build}/${basename $@}.ind ; fi -
libcfa/src/enum.cfa
r97f9619 r68ea8d2 42 42 if ( eof( is ) ) throwResume ExceptionInst( missing_data ); 43 43 44 // Match longest input enumerator string to enumerator labels, where enumerator names are unique. 45 44 // Match input enumerator string to enumerator labels. 46 45 int N = Countof( e ), lnths[N], max = 0; 47 46 // printf( "N %d\n", N ); … … 61 60 for ( c; max ) { 62 61 int args = fmt( is, "%c", &ch ); // read character 63 62 if ( eof( is ) ) { 64 63 // fprintf( stderr, "Eof1\n" ); 65 64 if ( c == 0 ) return is; // no characters read ? 66 clear( is ); // => re ad something => reset EOF => detect again on next read65 clear( is ); // => reset EOF => detect again on next read 67 66 // fprintf( stderr, "Eof2\n" ); 68 break;69 } // if67 goto W; 68 } 70 69 if ( args != 1 ) throwResume ExceptionInst( missing_data ); 71 72 70 // printf( "read '%c'\n", ch ); 73 for ( i; N ) { // scan enumeration strings for winner71 for ( i; N ) { 74 72 // printf( "%d %d %d\n", c, i, lnths[i] ); 75 73 if ( c < lnths[i] ) { // eligible for this checking round ? 76 74 char match = label( fromInt( i ) )[c]; // optimization 77 75 // printf( "%c '%c'\n", match, ch ); 78 // Stop on first match, could be other matches.79 76 if ( (match == ch) && (c == 0 || curr == label( fromInt( i ) )[c - 1]) ) { 80 77 // printf( "match %d %d %d '%c' '%c' '%c' '%c' 'c'\n", c, i, lnths[i], match, ch, prev, label( fromInt( i ) )[c - 1] ); … … 95 92 // fprintf( stderr, "finished2 %d\n", win ); 96 93 } // for 97 W :;98 for ( i; N ) { // scan enumeration strings for winner94 W :; 95 for ( i; N ) { // scan for winner, must succeed 99 96 if ( win == lnths[i] - 1 ) { 100 97 char match = label( fromInt( i ) )[win]; // optimization … … 103 100 e = fromInt( i ); 104 101 break; 105 } // if102 } 106 103 } // if 107 104 } else { -
libcfa/src/iostream.cfa
r97f9619 r68ea8d2 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 15 08:16:48202413 // Update Count : 20 2012 // Last Modified On : Fri Jul 12 05:45:45 2024 13 // Update Count : 2019 14 14 // 15 15 … … 781 781 // Optional leading whitespace at start of strings. 782 782 fmt( is, " " FALSE "%n", &len ); // try false 783 if ( len != sizeof( FALSE ) - 1 ) { // -1 removesnull terminate783 if ( len != sizeof( FALSE ) - 1 ) { // remove null terminate 784 784 fmt( is, " " TRUE "%n", &len ); // try true 785 785 if ( len != sizeof( TRUE ) - 1 ) throwResume ExceptionInst( missing_data ); -
src/AST/Print.cpp
r97f9619 r68ea8d2 566 566 ++indent; 567 567 safe_print( node->cond ); 568 os << indent-1 << "... with body:" << endl; 569 safe_print( node->body ); 568 570 569 571 if ( ! node->inits.empty() ) { … … 571 573 printAll( node->inits ); 572 574 } 573 574 os << indent-1 << "... with body:" << endl;575 safe_print( node->body );576 577 if ( node->else_ ) {578 os << indent-1 << "... with else:" << endl;579 os << indent;580 node->else_->accept( *this );581 }582 583 575 --indent; 584 576 … … 622 614 --indent; 623 615 } 624 625 if ( node->else_ ) {626 os << indent << "... with else:" << endl;627 ++indent;628 os << indent;629 node->else_->accept( *this );630 --indent;631 }632 633 616 os << endl; 634 617 print( node->labels ); -
src/CodeGen/CodeGenerator.cpp
r97f9619 r68ea8d2 1195 1195 stmt->body->accept( *visitor ); 1196 1196 1197 output << indent; 1198 1197 1199 if ( stmt->isDoWhile ) { 1198 1200 output << " while ("; 1199 1201 stmt->cond->accept( *visitor ); 1200 output << ( ( nullptr == stmt->else_ ) ? ");" : ")" ); 1201 } 1202 if ( stmt->else_ ) { 1203 output << " else "; 1204 stmt->else_->accept( *visitor ); 1202 output << ");"; 1205 1203 } 1206 1204 } … … 1227 1225 stmt->body->accept( *visitor ); 1228 1226 } 1229 1230 if ( nullptr != stmt->else_ ) {1231 assertf( !options.genC, "Loop else should not reach code generation." );1232 output << " else ";1233 stmt->else_->accept( *visitor );1234 }1235 1227 } 1236 1228 -
src/ControlStruct/MultiLevelExit.cpp
r97f9619 r68ea8d2 78 78 stmt( stmt ), firstTarget( breakExit ), secondTarget(), kind( TryStmtK ) {} 79 79 80 // Check if this entry can be the target of the given type of control flow.81 80 bool isContTarget() const { return kind <= WhileDoStmtK; } 82 81 bool isBreakTarget() const { return kind != CaseClauseK; } … … 208 207 209 208 // If the label is empty, do not add unused attribute. 210 209 if ( originalTarget.empty() ) return size; 211 210 212 211 // Search for a label that matches the originalTarget. … … 344 343 assert(0); 345 344 } 346 assert( !exitLabel.empty() );347 345 348 346 // Add unused attribute to silence warnings. … … 488 486 } 489 487 490 auto mutCase = mutStmt->cases.back().get_and_mutate(); 488 auto caseStmt = mutStmt->cases.back().get(); 489 auto mutCase = mutate( caseStmt ); 490 mutStmt->cases.back() = mutCase; 491 491 492 492 Label label( mutCase->location, "breakLabel" ); … … 597 597 template<typename LoopNode> 598 598 void MultiLevelExitCore::prehandleLoopStmt( const LoopNode * loopStmt ) { 599 // Create temporary labels and mark the enclosing loop before traversal.599 // Remember is loop before going onto mutate the body. 600 600 // The labels will be folded in if they are used. 601 601 Label breakLabel = newLabel( "loopBreak", loopStmt ); 602 602 Label contLabel = newLabel( "loopContinue", loopStmt ); 603 603 enclosing_control_structures.emplace_back( loopStmt, breakLabel, contLabel ); 604 604 // labels are added temporarily to see if they are used and then added permanently in postvisit if ther are used 605 // children will tag labels as being used during their traversal which occurs before postvisit 606 607 // GuardAction calls the lambda after the node is done being visited 605 608 GuardAction( [this](){ enclosing_control_structures.pop_back(); } ); 606 607 // Because of fixBlock, this should be empty now (and must be).608 assert( nullptr == loopStmt->else_ );609 609 } 610 610 … … 617 617 // Now check if the labels are used and add them if so. 618 618 return mutate_field( loopStmt, &LoopNode::body, mutateLoop( loopStmt->body, entry ) ); 619 // this call to mutate_field compares loopStmt->body and the result of mutateLoop 620 // if they are the same the node isn't mutated, if they differ then the new mutated node is returned 621 // the stmts will only differ if a label is used 619 622 } 620 623 … … 636 639 637 640 ptr<Stmt> else_stmt = nullptr; 638 const Stmt * to_visit;641 const Stmt * loop_kid = nullptr; 639 642 // check if loop node and if so add else clause if it exists 640 if ( auto ptr = kid.as<WhileDoStmt>() ; ptr && ptr->else_ ) {641 else_stmt = ptr->else_;642 to_visit = mutate_field( ptr, &WhileDoStmt::else_, nullptr );643 } else if ( auto ptr = kid.as<ForStmt>() ; ptr && ptr->else_ ) {644 else_stmt = ptr->else_;645 to_visit = mutate_field( ptr, &ForStmt::else_, nullptr);646 } else{647 to_visit = kid.get();648 }649 650 // This is the main (safe) visit of the child node. 643 const WhileDoStmt * whilePtr = kid.as<WhileDoStmt>(); 644 if ( whilePtr && whilePtr->else_ ) { 645 else_stmt = whilePtr->else_; 646 loop_kid = mutate_field( whilePtr, &WhileDoStmt::else_, nullptr ); 647 } 648 const ForStmt * forPtr = kid.as<ForStmt>(); 649 if ( forPtr && forPtr->else_ ) { 650 else_stmt = forPtr->else_; 651 loop_kid = mutate_field( forPtr, &ForStmt::else_, nullptr ); 652 } 653 651 654 try { 652 ret.push_back( to_visit->accept( *visitor ) ); 655 if (else_stmt) ret.push_back( loop_kid->accept( *visitor ) ); 656 else ret.push_back( kid->accept( *visitor ) ); 653 657 } catch ( SemanticErrorException & e ) { 654 658 errors.append( e ); 655 659 } 656 660 657 // The following sections handle visiting loop else clause and makes 658 // sure breaking from a loop body does not execute that clause. 659 Label local_break_label = std::move( break_label ); 660 break_label = Label( CodeLocation(), "" ); 661 662 if ( else_stmt ) try { 663 ret.push_back( else_stmt->accept( *visitor ) ); 664 } catch ( SemanticErrorException & e ) { 665 errors.append( e ); 666 } 667 668 if ( !break_label.empty() ) { 661 if (else_stmt) ret.push_back(else_stmt); 662 663 if ( ! break_label.empty() ) { 669 664 ret.push_back( labelledNullStmt( ret.back()->location, break_label ) ); 670 665 break_label = Label( CodeLocation(), "" ); 671 666 } 672 673 // This handles a break from the body or non-loop statement. 674 if ( !local_break_label.empty() ) { 675 ret.push_back( labelledNullStmt( ret.back()->location, local_break_label ) ); 676 } 677 } 678 679 if ( !errors.isEmpty() ) { 667 } 668 669 if ( ! errors.isEmpty() ) { 680 670 throw errors; 681 671 } -
tests/ctrl-flow/.expect/loop_else.txt
r97f9619 r68ea8d2 63 63 (10 10)(9 9)(8 8)(7 7)(6 6)(5 5)(4 4)(3 3)(2 2)(1 1)(0 0)else 64 64 65 before begin else after -
tests/ctrl-flow/loop_else.cfa
r97f9619 r68ea8d2 74 74 i -= 1.7; 75 75 } else { sout | "else"; } sout | nl | nl; 76 76 77 77 enum { N = 10 }; 78 78 for ( N ) { sout | "N"; } else { sout | "else"; } sout | nl; … … 109 109 for ( s; (S){0} -~ (S){10,10} ~ (S){1} ) { sout | s; } else { sout | "else"; } sout | nl; 110 110 for ( s; (S){0} -~= (S){10,10} ) { sout | s; } else { sout | "else"; } sout | nl; 111 for ( s; (S){0} -~= (S){10,10} ~ (S){1} ) { sout | s; } else { sout | "else"; } sout | nl; 112 sout | nl; 113 114 // A break (or a continue) in an else clause should target an outer loop. 115 sout | "before"; 116 while ( true ) { 117 sout | " begin"; 118 while ( false ) { 119 sout | "never"; 120 } else { 121 sout | " else"; 122 break; 123 } 124 sout | " end"; 125 } 126 sout | " after" | nl; 111 for ( s; (S){0} -~= (S){10,10} ~ (S){1} ) { sout | s; } else { sout | "else"; } sout | nl | nl; 127 112 }
Note: See TracChangeset
for help on using the changeset viewer.