Changes in / [3bd1eb4:dbfb35d]
- Files:
-
- 2 added
- 14 deleted
- 46 edited
-
Jenkins/FullBuild (modified) (1 diff)
-
Jenkins/TestRegen (deleted)
-
Jenkinsfile (modified) (1 diff)
-
doc/LaTeXmacros/common.tex (modified) (7 diffs)
-
doc/LaTeXmacros/lstlang.sty (deleted)
-
doc/generic_types/generic_types.tex (modified) (6 diffs)
-
doc/nda/Aaron_Moss-Rob_Schluntz-Thierry_Delisle.pdf (deleted)
-
doc/nda/Cover_Letter.pdf (deleted)
-
doc/nda/Daniel_Caccamo.pdf (deleted)
-
doc/nda/NDA.pdf (deleted)
-
doc/nda/Neda_Paryab.pdf (deleted)
-
doc/nda/Peter_Buhr-30-jul-2014.pdf (deleted)
-
doc/rob_thesis/thesis.bib (modified) (1 prop)
-
doc/user/Makefile (modified) (1 diff)
-
src/CodeGen/CodeGenerator.cc (modified) (9 diffs)
-
src/CodeGen/CodeGenerator.h (modified) (7 diffs)
-
src/CodeGen/GenType.cc (modified) (8 diffs)
-
src/CodeGen/GenType.h (modified) (1 diff)
-
src/CodeGen/Generate.cc (modified) (3 diffs)
-
src/CodeGen/Generate.h (modified) (1 diff)
-
src/CodeGen/LineStream.cc (added)
-
src/CodeGen/LineStream.h (added)
-
src/Common/utility.h (modified) (4 diffs)
-
src/GenPoly/Box.cc (modified) (11 diffs)
-
src/InitTweak/FixInit.cc (modified) (6 diffs)
-
src/InitTweak/GenInit.cc (modified) (1 diff)
-
src/libcfa/Makefile.am (modified) (2 diffs)
-
src/libcfa/Makefile.in (modified) (2 diffs)
-
src/libcfa/gmp (deleted)
-
src/libcfa/iostream.c (modified) (2 diffs)
-
src/libcfa/rational (modified) (2 diffs)
-
src/libcfa/rational.c (modified) (12 diffs)
-
src/libcfa/stdlib (modified) (3 diffs)
-
src/libcfa/stdlib.c (modified) (10 diffs)
-
src/main.cc (modified) (7 diffs)
-
src/prelude/Makefile.am (modified) (1 diff)
-
src/prelude/Makefile.in (modified) (1 diff)
-
src/tests/.expect/32/KRfunctions.txt (modified) (1 diff)
-
src/tests/.expect/32/attributes.txt (modified) (7 diffs)
-
src/tests/.expect/32/declarationSpecifier.txt (modified) (24 diffs)
-
src/tests/.expect/32/extension.txt (modified) (2 diffs)
-
src/tests/.expect/32/gccExtensions.txt (modified) (4 diffs)
-
src/tests/.expect/64/KRfunctions.txt (modified) (1 diff)
-
src/tests/.expect/64/attributes.txt (modified) (7 diffs)
-
src/tests/.expect/64/declarationSpecifier.txt (modified) (24 diffs)
-
src/tests/.expect/64/extension.txt (modified) (2 diffs)
-
src/tests/.expect/64/gccExtensions.txt (modified) (4 diffs)
-
src/tests/.expect/concurrent/sched-int-wait.txt (modified) (1 diff)
-
src/tests/.expect/genericUnion.txt (deleted)
-
src/tests/.expect/gmp.txt (deleted)
-
src/tests/.expect/memberCtors-ERR1.txt (modified) (1 diff)
-
src/tests/.expect/memberCtors.txt (modified) (6 diffs)
-
src/tests/.expect/rational.txt (modified) (1 diff)
-
src/tests/Makefile.am (modified) (3 diffs)
-
src/tests/Makefile.in (modified) (3 diffs)
-
src/tests/genericUnion.c (deleted)
-
src/tests/gmp.c (deleted)
-
src/tests/memberCtors.c (modified) (1 diff)
-
src/tests/rational.c (modified) (3 diffs)
-
src/tests/sched-int-wait.c (modified) (2 diffs)
-
src/tests/test.py (modified) (7 diffs)
-
tools/cfa.nanorc (deleted)
Legend:
- Unmodified
- Added
- Removed
-
Jenkins/FullBuild
r3bd1eb4 rdbfb35d 161 161 """ 162 162 163 def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com , ajbeach@edu.uwaterloo.ca"163 def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com" 164 164 165 165 //send email notification -
Jenkinsfile
r3bd1eb4 rdbfb35d 153 153 do_sendemail = ! (pSilent == 'true') 154 154 155 echo """Compiler : ${compiler.cc_name} (${compiler.cpp_cc}/${compiler.cfa_cc})156 Architecture : ${arch_name}157 Arc Flags : ${architecture}158 Run All Tests : ${ pRunAllTests.toString() }159 Run Benchmark : ${ pRunBenchmark.toString() }160 Build Documentation : ${ pBuildDocumentation.toString() }161 Publish : ${ pPublish.toString() }162 Silent : ${ pSilent.toString() }155 echo """Compiler : ${compiler.cc_name} (${compiler.cpp_cc}/${compiler.cfa_cc}) 156 Architecture : ${arch_name} 157 Arc Flags : ${architecture} 158 Run All Tests : ${ pRunAllTests.toString() } 159 Run Benchmark : ${ pRunBenchmark.toString() } 160 Build Documentation : ${ pBuildDocumentation.toString() } 161 Publish : ${ pPublish.toString() } 162 Silent : ${ pSilent.toString() } 163 163 """ 164 164 -
doc/LaTeXmacros/common.tex
r3bd1eb4 rdbfb35d 11 11 %% Created On : Sat Apr 9 10:06:17 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Sun May 14 18:17:09201714 %% Update Count : 2 9513 %% Last Modified On : Tue Apr 18 17:16:13 2017 14 %% Update Count : 270 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 36 36 % Names used in the document. 37 37 38 \newcommand{\CFA}{C \raisebox{\depth}{\rotatebox{180}{\textscale{1.05}{\textsf{A}}}}\xspace} % Cforall symbolic name38 \newcommand{\CFA}{C$\mathbf\forall$\xspace} % Cforall symbolic name 39 39 \newcommand{\CFL}{Cforall\xspace} % Cforall symbolic name 40 \newcommand{\Celeven}{C11\xspace} % C11 symbolic name41 40 \newcommand{\CC}{\rm C\kern-.1em\hbox{+\kern-.25em+}\xspace} % C++ symbolic name 42 41 \newcommand{\CCeleven}{\rm C\kern-.1em\hbox{+\kern-.25em+}11\xspace} % C++11 symbolic name … … 44 43 \newcommand{\CCseventeen}{\rm C\kern-.1em\hbox{+\kern-.25em+}17\xspace} % C++17 symbolic name 45 44 \newcommand{\CCtwenty}{\rm C\kern-.1em\hbox{+\kern-.25em+}20\xspace} % C++20 symbolic name 45 \newcommand{\Celeven}{C11\xspace} % C11 symbolic name 46 46 \newcommand{\Csharp}{C\raisebox{-0.7ex}{\Large$^\sharp$}\xspace} % C# symbolic name 47 47 … … 67 67 \usepackage{pslatex} % reduce size of san serif font 68 68 \usepackage{relsize} % must be after change to small or selects old size 69 \usepackage{rotating}70 69 71 70 % reduce size of chapter/section titles … … 98 97 \newcommand{\italic}[1]{\emph{\hyperpage{#1}}} 99 98 \newcommand{\definition}[1]{\textbf{\hyperpage{#1}}} 100 \newcommand{\see}[1]{\emph{see} ~#1}99 \newcommand{\see}[1]{\emph{see} #1} 101 100 102 101 % Define some commands that produce formatted index entries suitable for cross-references. … … 222 221 }% 223 222 224 \usepackage{lstlang} 223 % Go programming language: https://github.com/julienc91/listings-golang/blob/master/listings-golang.sty 224 \lstdefinelanguage{Golang}{ 225 morekeywords=[1]{package,import,func,type,struct,return,defer,panic,recover,select,var,const,iota,},% 226 morekeywords=[2]{string,uint,uint8,uint16,uint32,uint64,int,int8,int16,int32,int64, 227 bool,float32,float64,complex64,complex128,byte,rune,uintptr, error,interface},% 228 morekeywords=[3]{map,slice,make,new,nil,len,cap,copy,close,true,false,delete,append,real,imag,complex,chan,},% 229 morekeywords=[4]{for,break,continue,range,goto,switch,case,fallthrough,if,else,default,},% 230 morekeywords=[5]{Println,Printf,Error,},% 231 sensitive=true,% 232 morecomment=[l]{//},% 233 morecomment=[s]{/*}{*/},% 234 morestring=[b]',% 235 morestring=[b]",% 236 morestring=[s]{`}{`},% 237 } 238 239 % CFA programming language, based on ANSI C (with some gcc additions) 240 \lstdefinelanguage{Pseudo}{ 241 morekeywords={string,uint,int,bool,float},% 242 sensitive=true,% 243 morecomment=[l]{//},% 244 morecomment=[s]{/*}{*/},% 245 morestring=[b]',% 246 morestring=[b]",% 247 morestring=[s]{`}{`},% 248 }% 249 250 % CFA programming language, based on ANSI C (with some gcc additions) 251 \lstdefinelanguage{CFA}[ANSI]{C}{ 252 morekeywords={_Alignas,_Alignof,__alignof,__alignof__,asm,__asm,__asm__,_At,_Atomic,__attribute,__attribute__,auto, 253 _Bool,catch,catchResume,choose,_Complex,__complex,__complex__,__const,__const__,disable,dtype,enable,__extension__, 254 fallthrough,fallthru,finally,forall,ftype,_Generic,_Imaginary,inline,__label__,lvalue,_Noreturn,one_t,otype,restrict,_Static_assert, 255 _Thread_local,throw,throwResume,trait,try,ttype,typeof,__typeof,__typeof__,zero_t}, 256 }% 225 257 226 258 \newcommand{\CFADefaults}{% … … 260 292 {} 261 293 294 262 295 % Local Variables: % 263 296 % tab-width: 4 % -
doc/generic_types/generic_types.tex
r3bd1eb4 rdbfb35d 6 6 \usepackage{upquote} % switch curled `'" to straight 7 7 \usepackage{listings} % format program code 8 \usepackage{rotating}9 8 \usepackage[usenames]{color} 10 9 … … 49 48 50 49 % Useful macros 51 \newcommand{\CFA}{C\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\hspace{-1pt}\xspace} % Cforall symbolic name 52 %\newcommand{\CFA}{C$\mathbf\forall$\xspace} % Cforall symbolic name 50 \newcommand{\CFA}{C$\mathbf\forall$\xspace} % Cforall symbolic name 53 51 \newcommand{\CC}{\rm C\kern-.1em\hbox{+\kern-.25em+}\xspace} % C++ symbolic name 54 52 \newcommand{\CCeleven}{\rm C\kern-.1em\hbox{+\kern-.25em+}11\xspace} % C++11 symbolic name … … 99 97 \acmJournal{PACMPL} 100 98 101 \title{Generic and Tuple Types with Efficient Dynamic Layout in \ protect\CFA}99 \title{Generic and Tuple Types with Efficient Dynamic Layout in \CFA} 102 100 103 101 \author{Aaron Moss} … … 199 197 \label{sec:poly-fns} 200 198 201 \CFA {}\hspace{1pt}'s polymorphism was originally formalized by \citet{Ditchfield92}, and first implemented by \citet{Bilson03}.199 \CFA's polymorphism was originally formalized by \citet{Ditchfield92}, and first implemented by \citet{Bilson03}. 202 200 The signature feature of \CFA is parametric-polymorphic functions~\citep{forceone:impl,Cormack90,Duggan96} with functions generalized using a @forall@ clause (giving the language its name): 203 201 \begin{lstlisting} … … 952 950 } 953 951 \end{lstlisting} 954 \caption{\ protect\CFA Benchmark Test}952 \caption{\CFA Benchmark Test} 955 953 \label{fig:BenchmarkTest} 956 954 \end{figure} … … 1022 1020 While \CC provides good backwards compatibility with C, it has a steep learning curve for many of its extensions. 1023 1021 For example, polymorphism is provided via three disjoint mechanisms: overloading, inheritance, and templates. 1024 The overloading is restricted because resolution does not us ethe return type, inheritance requires learning object-oriented programming and coping with a restricted nominal-inheritance hierarchy, templates cannot be separately compiled resulting in compilation/code bloat and poor error messages, and determining how these mechanisms interact and which to use is confusing.1022 The overloading is restricted because resolution does not using the return type, inheritance requires learning object-oriented programming and coping with a restricted nominal-inheritance hierarchy, templates cannot be separately compiled resulting in compilation/code bloat and poor error messages, and determining how these mechanisms interact and which to use is confusing. 1025 1023 In contrast, \CFA has a single facility for polymorphic code supporting type-safe separate-compilation of polymorphic functions and generic (opaque) types, which uniformly leverage the C procedural paradigm. 1026 1024 The key mechanism to support separate compilation is \CFA's \emph{explicit} use of assumed properties for a type. -
doc/rob_thesis/thesis.bib
-
Property mode
changed from
100644to100755
-
Property mode
changed from
-
doc/user/Makefile
r3bd1eb4 rdbfb35d 47 47 48 48 ${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \ 49 ../LaTeXmacros/common.tex ../LaTeXmacros/ lstlang.sty ../LaTeXmacros/indexstyle ../bibliography/cfa.bib49 ../LaTeXmacros/common.tex ../LaTeXmacros/indexstyle ../bibliography/cfa.bib 50 50 # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run. 51 51 if [ ! -r ${basename $@}.ind ] ; then touch ${basename $@}.ind ; fi -
src/CodeGen/CodeGenerator.cc
r3bd1eb4 rdbfb35d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 10 14:45:00 201712 // Last Modified On : Tus May 9 16:50:00 2017 13 13 // Update Count : 484 14 14 // … … 41 41 namespace CodeGen { 42 42 int CodeGenerator::tabsize = 4; 43 44 // Pseudo Function: output << lineDirective(currentNode); 45 struct lineDirective { 46 CodeLocation const & loc; 47 lineDirective(CodeLocation const & location) : loc(location) {} 48 lineDirective(BaseSyntaxNode const * node) : loc(node->location) {} 49 }; 50 std::ostream & operator<<(std::ostream & out, lineDirective const & ld) { 51 if (ld.loc.isSet()) 52 return out << "\n# " << ld.loc.linenumber << " \"" 53 << ld.loc.filename << "\"\n"; 54 return out << "\n// Unset Location\n"; 55 } 43 56 44 57 // the kinds of statements that would ideally be followed by whitespace … … 89 102 } 90 103 91 CodeGenerator::LineMarker::LineMarker( 92 CodeLocation const & loc, bool toPrint) : 93 loc(loc), toPrint(toPrint) 94 {} 95 96 CodeGenerator::LineMarker CodeGenerator::lineDirective( 97 BaseSyntaxNode const * node) { 98 return LineMarker(node->location, lineMarks); 99 } 100 101 std::ostream & operator<<(std::ostream & out, 102 CodeGenerator::LineMarker const & marker) { 103 if (marker.toPrint && marker.loc.isSet()) { 104 return out << "\n# " << marker.loc.linenumber << " \"" 105 << marker.loc.filename << "\"\n"; 106 } else if (marker.toPrint) { 107 return out << "\n/* Missing CodeLocation */\n"; 108 } else { 109 return out; 110 } 111 } 112 113 CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {} 104 CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ) {} 114 105 115 106 CodeGenerator::CodeGenerator( std::ostream & os, std::string init, int indentation, bool infunp ) … … 152 143 // *** Declarations 153 144 void CodeGenerator::visit( FunctionDecl * functionDecl ) { 145 output << lineDirective( functionDecl ); 146 154 147 extension( functionDecl ); 155 148 genAttributes( functionDecl->get_attributes() ); … … 175 168 } 176 169 170 output << lineDirective( objectDecl ); 171 177 172 extension( objectDecl ); 178 173 genAttributes( objectDecl->get_attributes() ); … … 226 221 227 222 void CodeGenerator::visit( StructDecl * structDecl ) { 223 output << lineDirective( structDecl ); 224 228 225 extension( structDecl ); 229 226 handleAggregate( structDecl, "struct " ); … … 231 228 232 229 void CodeGenerator::visit( UnionDecl * unionDecl ) { 230 output << lineDirective( unionDecl ); 231 233 232 extension( unionDecl ); 234 233 handleAggregate( unionDecl, "union " ); … … 709 708 void CodeGenerator::visit( UntypedTupleExpr * tupleExpr ) { 710 709 assertf( ! genC, "UntypedTupleExpr should not reach code generation." ); 711 extension( tupleExpr );712 710 output << "["; 713 711 genCommaList( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end() ); … … 717 715 void CodeGenerator::visit( TupleExpr * tupleExpr ) { 718 716 assertf( ! genC, "TupleExpr should not reach code generation." ); 719 extension( tupleExpr );720 717 output << "["; 721 718 genCommaList( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end() ); 722 719 output << "]"; 723 }724 725 void CodeGenerator::visit( TupleIndexExpr * tupleExpr ) {726 assertf( ! genC, "TupleIndexExpr should not reach code generation." );727 extension( tupleExpr );728 tupleExpr->get_tuple()->accept( *this );729 output << "." << tupleExpr->get_index();730 720 } 731 721 -
src/CodeGen/CodeGenerator.h
r3bd1eb4 rdbfb35d 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 Ma y 10 10:57:00201713 // Update Count : 5 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 1 16:20:04 2017 13 // Update Count : 50 14 14 // 15 15 … … 25 25 #include "SymTab/Indexer.h" 26 26 27 #include "Common/utility.h"28 29 27 namespace CodeGen { 30 28 class CodeGenerator : public Visitor { … … 32 30 static int tabsize; 33 31 34 CodeGenerator( std::ostream &os, bool pretty = false, bool genC = false , bool lineMarks = false);32 CodeGenerator( std::ostream &os, bool pretty = false, bool genC = false ); 35 33 CodeGenerator( std::ostream &os, std::string, int indent = 0, bool infun = false ); 36 34 CodeGenerator( std::ostream &os, char *, int indent = 0, bool infun = false ); … … 76 74 virtual void visit( UntypedTupleExpr *tupleExpr ); 77 75 virtual void visit( TupleExpr *tupleExpr ); 78 virtual void visit( TupleIndexExpr * tupleExpr );79 76 virtual void visit( TypeExpr *typeExpr ); 80 77 virtual void visit( AsmExpr * ); … … 113 110 }; 114 111 115 struct LineMarker {116 CodeLocation const & loc;117 bool toPrint;118 119 LineMarker(CodeLocation const & loc, bool toPrint);120 };121 122 LineMarker lineDirective(BaseSyntaxNode const * node);123 124 112 void asmName( DeclarationWithType *decl ); 125 113 … … 134 122 bool pretty = false; // pretty print 135 123 bool genC = false; // true if output has to be C code 136 bool lineMarks = false;137 124 138 125 void printDesignators( std::list< Expression * > & ); … … 162 149 /// returns C-compatible name of declaration 163 150 std::string genName( DeclarationWithType * decl ); 164 165 std::ostream & operator<<(std::ostream &,166 CodeGenerator::LineMarker const &);167 151 } // namespace CodeGen 168 152 -
src/CodeGen/GenType.cc
r3bd1eb4 rdbfb35d 28 28 class GenType : public Visitor { 29 29 public: 30 GenType( const std::string &typeString, bool pretty = false, bool genC = false , bool lineMarks = false);30 GenType( const std::string &typeString, bool pretty = false, bool genC = false ); 31 31 std::string get_typeString() const { return typeString; } 32 32 void set_typeString( const std::string &newValue ) { typeString = newValue; } … … 54 54 bool pretty = false; // pretty print 55 55 bool genC = false; // generating C code? 56 bool lineMarks = false;57 56 }; 58 57 59 std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC , bool lineMarks) {60 GenType gt( baseString, pretty, genC , lineMarks);58 std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC ) { 59 GenType gt( baseString, pretty, genC ); 61 60 std::ostringstream os; 62 61 63 62 if ( ! type->get_attributes().empty() ) { 64 CodeGenerator cg( os, pretty, genC , lineMarks);63 CodeGenerator cg( os, pretty, genC ); 65 64 cg.genAttributes( type->get_attributes() ); 66 65 } // if … … 74 73 } 75 74 76 GenType::GenType( const std::string &typeString, bool pretty, bool genC , bool lineMarks ) : typeString( typeString ), pretty( pretty ), genC( genC ), lineMarks( lineMarks) {}75 GenType::GenType( const std::string &typeString, bool pretty, bool genC ) : typeString( typeString ), pretty( pretty ), genC( genC ) {} 77 76 78 77 void GenType::visit( VoidType *voidType ) { … … 115 114 } // if 116 115 if ( dimension != 0 ) { 117 CodeGenerator cg( os, pretty, genC , lineMarks);116 CodeGenerator cg( os, pretty, genC ); 118 117 dimension->accept( cg ); 119 118 } else if ( isVarLen ) { … … 169 168 } // if 170 169 } else { 171 CodeGenerator cg( os, pretty, genC , lineMarks);170 CodeGenerator cg( os, pretty, genC ); 172 171 os << "(" ; 173 172 … … 192 191 // assertf( ! genC, "Aggregate type parameters should not reach code generation." ); 193 192 std::ostringstream os; 194 CodeGenerator cg( os, pretty, genC , lineMarks);193 CodeGenerator cg( os, pretty, genC ); 195 194 os << "forall("; 196 195 cg.genCommaList( funcType->get_forall().begin(), funcType->get_forall().end() ); … … 203 202 if ( ! refType->get_parameters().empty() ) { 204 203 std::ostringstream os; 205 CodeGenerator cg( os, pretty, genC , lineMarks);204 CodeGenerator cg( os, pretty, genC ); 206 205 os << "("; 207 206 cg.genCommaList( refType->get_parameters().begin(), refType->get_parameters().end() ); … … 243 242 for ( Type * t : *tupleType ) { 244 243 i++; 245 os << genType( t, "", pretty, genC , lineMarks) << (i == tupleType->size() ? "" : ", ");244 os << genType( t, "", pretty, genC ) << (i == tupleType->size() ? "" : ", "); 246 245 } 247 246 os << "]"; -
src/CodeGen/GenType.h
r3bd1eb4 rdbfb35d 21 21 22 22 namespace CodeGen { 23 std::string genType( Type *type, const std::string &baseString, bool pretty = false, bool genC = false , bool lineMarks = false);23 std::string genType( Type *type, const std::string &baseString, bool pretty = false, bool genC = false ); 24 24 std::string genPrettyType( Type * type, const std::string & baseString ); 25 25 } // namespace CodeGen -
src/CodeGen/Generate.cc
r3bd1eb4 rdbfb35d 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 May 19 13:05:00 201713 // Update Count : 611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 4 14:04:25 2015 13 // Update Count : 5 14 14 // 15 15 … … 31 31 32 32 namespace CodeGen { 33 void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC , bool lineMarks) {34 CodeGen::CodeGenerator cgv( os, pretty, generateC , lineMarks);33 void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC ) { 34 CodeGen::CodeGenerator cgv( os, pretty, generateC ); 35 35 for ( auto & dcl : translationUnit ) { 36 36 if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) { 37 os << cgv.lineDirective(dcl);38 37 dcl->accept(cgv); 39 38 if ( doSemicolon( dcl ) ) { … … 49 48 os << CodeGen::genPrettyType( type, "" ); 50 49 } else { 51 CodeGen::CodeGenerator cgv( os, true, false , false);50 CodeGen::CodeGenerator cgv( os, true, false ); 52 51 node->accept( cgv ); 53 52 } -
src/CodeGen/Generate.h
r3bd1eb4 rdbfb35d 24 24 namespace CodeGen { 25 25 /// Generates code. doIntrinsics determines if intrinsic functions are printed, pretty formats output nicely (e.g., uses unmangled names, etc.), generateC is true when the output must consist only of C code (allows some assertions, etc.) 26 void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false , bool lineMarks = false);26 void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false ); 27 27 28 28 /// Generate code for a single node -- helpful for debugging in gdb -
src/Common/utility.h
r3bd1eb4 rdbfb35d 322 322 std::string filename; 323 323 324 /// Create a new unset CodeLocation.324 /// Create a new unset CodeLocation. 325 325 CodeLocation() 326 326 : linenumber( -1 ) … … 328 328 {} 329 329 330 /// Create a new CodeLocation with the given values.330 /// Create a new CodeLocation with the given values. 331 331 CodeLocation( const char* filename, int lineno ) 332 332 : linenumber( lineno ) … … 334 334 {} 335 335 336 bool isSet () const {337 return -1 != linenumber;338 }339 340 bool isUnset () const {341 return !isSet();342 }336 bool isSet () const { 337 return -1 != linenumber; 338 } 339 340 bool isUnset () const { 341 return !isSet(); 342 } 343 343 344 344 void unset () { … … 353 353 return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + " " : ""; 354 354 } 355 356 355 #endif // _UTILITY_H 357 356 -
src/GenPoly/Box.cc
r3bd1eb4 rdbfb35d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 13 09:26:38201713 // Update Count : 3 4112 // Last Modified On : Fri Mar 17 09:06:37 2017 13 // Update Count : 339 14 14 // 15 15 … … 706 706 Type *concrete = env->lookup( typeInst->get_name() ); 707 707 if ( concrete == 0 ) { 708 return typeInst;709 708 // xxx - should this be an assertion? 710 //std::string x = env ? toString( *env ) : "missing env";711 //throw SemanticError( x + "\n" + "Unbound type variable " + typeInst->get_name() + " in ", appExpr );709 std::string x = env ? toString( *env ) : "missing env"; 710 throw SemanticError( x + "\n" + "Unbound type variable " + typeInst->get_name() + " in ", appExpr ); 712 711 } // if 713 712 return concrete; … … 765 764 } else { 766 765 arg = new AddressExpr( arg ); 767 }768 if ( ! ResolvExpr::typesCompatible( param, arg->get_result(), SymTab::Indexer() ) ) {769 // silence warnings by casting boxed parameters when the actual type does not match up with the formal type.770 arg = new CastExpr( arg, param->clone() );771 766 } 772 767 } else { … … 907 902 } // if 908 903 UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) ); 909 UntypedExpr *deref = UntypedExpr::createDeref( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->get_returnVals().front()->get_type()->clone() ) ) ); 904 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 905 deref->get_args().push_back( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->get_returnVals().front()->get_type()->clone() ) ) ); 910 906 assign->get_args().push_back( deref ); 911 907 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars ); … … 1221 1217 1222 1218 Statement * Pass1::mutate( ReturnStmt *returnStmt ) { 1219 // maybe need access to the env when mutating the expr 1220 if ( Expression * expr = returnStmt->get_expr() ) { 1221 if ( expr->get_env() ) { 1222 env = expr->get_env(); 1223 } 1224 } 1225 1223 1226 if ( retval && returnStmt->get_expr() ) { 1224 1227 assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() ); … … 1299 1302 FunctionType * ftype = functionDecl->get_functionType(); 1300 1303 if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) { 1301 if ( ! isPrefix( functionDecl->get_name(), "_thunk" ) && ! isPrefix( functionDecl->get_name(), "_adapter" ) ) { // xxx -remove check for prefix once thunks properly use ctor/dtors1304 if ( functionDecl->get_name() != "?=?" && ! isPrefix( functionDecl->get_name(), "_thunk" ) && ! isPrefix( functionDecl->get_name(), "_adapter" ) ) { // xxx - remove check for ?=? once reference types are in; remove check for prefix once thunks properly use ctor/dtors 1302 1305 assert( ftype->get_returnVals().size() == 1 ); 1303 1306 DeclarationWithType * retval = ftype->get_returnVals().front(); … … 1536 1539 Type *declType = objectDecl->get_type(); 1537 1540 std::string bufName = bufNamer.newName(); 1538 ObjectDecl *newBuf = new ObjectDecl( bufName, Type::StorageClasses(), LinkageSpec::C, 0, 1539 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Kind::Char), new NameExpr( sizeofName( mangleType(declType) ) ), 1541 ObjectDecl *newBuf = new ObjectDecl( bufName, Type::StorageClasses(), LinkageSpec::C, 0, 1542 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Kind::Char), new NameExpr( sizeofName( mangleType(declType) ) ), 1540 1543 true, false, std::list<Attribute*>{ new Attribute( std::string{"aligned"}, std::list<Expression*>{ new ConstantExpr( Constant::from_int(8) ) } ) } ), 0 ); 1541 1544 stmtsToAdd.push_back( new DeclStmt( noLabels, newBuf ) ); … … 1575 1578 } 1576 1579 1580 /// Returns an expression dereferenced n times 1581 Expression *makeDerefdVar( Expression *derefdVar, long n ) { 1582 for ( int i = 1; i < n; ++i ) { 1583 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) ); 1584 derefExpr->get_args().push_back( derefdVar ); 1585 // xxx - should set results on derefExpr 1586 derefdVar = derefExpr; 1587 } 1588 return derefdVar; 1589 } 1590 1577 1591 Expression *PolyGenericCalculator::mutate( MemberExpr *memberExpr ) { 1578 1592 // mutate, exiting early if no longer MemberExpr … … 1581 1595 if ( ! memberExpr ) return expr; 1582 1596 1597 // get declaration for base struct, exiting early if not found 1598 int varDepth; 1599 VariableExpr *varExpr = getBaseVar( memberExpr->get_aggregate(), &varDepth ); 1600 if ( ! varExpr ) return memberExpr; 1601 ObjectDecl *objectDecl = dynamic_cast< ObjectDecl* >( varExpr->get_var() ); 1602 if ( ! objectDecl ) return memberExpr; 1603 1583 1604 // only mutate member expressions for polymorphic types 1584 1605 int tyDepth; 1585 Type *objectType = hasPolyBase( memberExpr->get_aggregate()->get_result(), scopeTyVars, &tyDepth );1606 Type *objectType = hasPolyBase( objectDecl->get_type(), scopeTyVars, &tyDepth ); 1586 1607 if ( ! objectType ) return memberExpr; 1587 1608 findGeneric( objectType ); // ensure layout for this type is available … … 1601 1622 fieldLoc->get_args().push_back( aggr ); 1602 1623 fieldLoc->get_args().push_back( makeOffsetIndex( objectType, i ) ); 1603 fieldLoc->set_result( memberExpr->get_result()->clone() );1604 1624 newMemberExpr = fieldLoc; 1605 1625 } else if ( dynamic_cast< UnionInstType* >( objectType ) ) { 1606 // union members are all at offset zero, so just use the aggregate expr 1607 Expression * aggr = memberExpr->get_aggregate()->clone(); 1608 delete aggr->get_env(); // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it 1609 aggr->set_env( nullptr ); 1610 newMemberExpr = aggr; 1611 newMemberExpr->set_result( memberExpr->get_result()->clone() ); 1626 // union members are all at offset zero, so build appropriately-dereferenced variable 1627 newMemberExpr = makeDerefdVar( varExpr->clone(), varDepth ); 1612 1628 } else return memberExpr; 1613 1629 assert( newMemberExpr ); … … 1617 1633 // Not all members of a polymorphic type are themselves of polymorphic type; in this case the member expression should be wrapped and dereferenced to form an lvalue 1618 1634 CastExpr *ptrCastExpr = new CastExpr( newMemberExpr, new PointerType( Type::Qualifiers(), memberType->clone() ) ); 1619 UntypedExpr *derefExpr = UntypedExpr::createDeref( ptrCastExpr ); 1635 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) ); 1636 derefExpr->get_args().push_back( ptrCastExpr ); 1620 1637 newMemberExpr = derefExpr; 1621 1638 } -
src/InitTweak/FixInit.cc
r3bd1eb4 rdbfb35d 361 361 FunctionType * ftype = dynamic_cast< FunctionType * >( GenPoly::getFunctionType( funcDecl->get_type() ) ); 362 362 assert( ftype ); 363 if ( isConstructor( funcDecl->get_name()) && ftype->get_parameters().size() == 2 ) {363 if ( (isConstructor( funcDecl->get_name() ) || funcDecl->get_name() == "?=?") && ftype->get_parameters().size() == 2 ) { 364 364 Type * t1 = ftype->get_parameters().front()->get_type(); 365 365 Type * t2 = ftype->get_parameters().back()->get_type(); … … 367 367 368 368 if ( ResolvExpr::typesCompatible( ptrType->get_base(), t2, SymTab::Indexer() ) ) { 369 // optimization: don't need to copy construct in order to call a copy constructor 369 // optimization: don't need to copy construct in order to call a copy constructor or 370 // assignment operator 370 371 return appExpr; 371 372 } // if … … 635 636 assert( ! stmtExpr->get_returnDecls().empty() ); 636 637 body->get_kids().push_back( new ExprStmt( noLabels, new VariableExpr( stmtExpr->get_returnDecls().front() ) ) ); 637 stmtExpr->get_returnDecls().clear(); 638 stmtExpr->get_dtors().clear(); 639 } 640 assert( stmtExpr->get_returnDecls().empty() ); 641 assert( stmtExpr->get_dtors().empty() ); 638 } 639 stmtExpr->get_returnDecls().clear(); 640 stmtExpr->get_dtors().clear(); 642 641 return stmtExpr; 643 642 } … … 656 655 unqExpr->set_result( maybeClone( unqExpr->get_expr()->get_result() ) ); 657 656 if ( unqCount[ unqExpr->get_id() ] == 0 ) { // insert destructor after the last use of the unique expression 658 stmtsToAdd After.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );657 stmtsToAdd.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] ); 659 658 } 660 659 if ( addDeref.count( unqExpr->get_id() ) ) { … … 668 667 stmtsToAdd.splice( stmtsToAdd.end(), fixer.stmtsToAdd ); 669 668 unqMap[unqExpr->get_id()] = unqExpr; 670 if ( unqCount[ unqExpr->get_id() ] == 0 ) { // insert destructor after the last use of the unique expression671 stmtsToAddAfter.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );672 } else { // remember dtors for last instance of unique expr673 dtors[ unqExpr->get_id() ] = fixer.stmtsToAddAfter;674 }675 669 if ( UntypedExpr * deref = dynamic_cast< UntypedExpr * >( unqExpr->get_expr() ) ) { 676 670 // unique expression is now a dereference, because the inner expression is an lvalue returning function call. … … 681 675 getCallArg( deref, 0 ) = unqExpr; 682 676 addDeref.insert( unqExpr->get_id() ); 677 if ( unqCount[ unqExpr->get_id() ] == 0 ) { // insert destructor after the last use of the unique expression 678 stmtsToAdd.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] ); 679 } else { // remember dtors for last instance of unique expr 680 dtors[ unqExpr->get_id() ] = fixer.stmtsToAddAfter; 681 } 683 682 return deref; 684 683 } -
src/InitTweak/GenInit.cc
r3bd1eb4 rdbfb35d 142 142 // hands off if the function returns an lvalue - we don't want to allocate a temporary if a variable's address 143 143 // is being returned 144 if ( returnStmt->get_expr() && returnVals.size() == 1 && ! returnVals.front()->get_type()->get_lvalue() ) { 144 // Note: under the assumption that assignments return *this, checking for ?=? here is an optimization, since it shouldn't be necessary to copy construct `this`. This is a temporary optimization until reference types are added, at which point this should be removed, along with the analogous optimization in copy constructor generation. 145 if ( returnStmt->get_expr() && returnVals.size() == 1 && funcName != "?=?" && ! returnVals.front()->get_type()->get_lvalue() ) { 145 146 // explicitly construct the return value using the return expression and the retVal object 146 147 assertf( returnVals.front()->get_name() != "", "Function %s has unnamed return value\n", funcName.c_str() ); -
src/libcfa/Makefile.am
r3bd1eb4 rdbfb35d 11 11 ## Created On : Sun May 31 08:54:01 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : S un May 14 21:04:21201714 ## Update Count : 21 413 ## Last Modified On : Sat Mar 25 18:00:10 2017 14 ## Update Count : 212 15 15 ############################################################################### 16 16 … … 76 76 77 77 cfa_includedir = $(CFA_INCDIR) 78 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} gmpconcurrency/invoke.h78 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} concurrency/invoke.h 79 79 80 80 CLEANFILES = libcfa-prelude.c -
src/libcfa/Makefile.in
r3bd1eb4 rdbfb35d 183 183 containers/vector concurrency/coroutine concurrency/thread \ 184 184 concurrency/kernel concurrency/monitor ${shell echo stdhdr/*} \ 185 gmpconcurrency/invoke.h185 concurrency/invoke.h 186 186 HEADERS = $(nobase_cfa_include_HEADERS) 187 187 ETAGS = etags … … 324 324 stdhdr = ${shell echo stdhdr/*} 325 325 cfa_includedir = $(CFA_INCDIR) 326 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} gmpconcurrency/invoke.h326 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} concurrency/invoke.h 327 327 CLEANFILES = libcfa-prelude.c 328 328 all: all-am -
src/libcfa/iostream.c
r3bd1eb4 rdbfb35d 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 8 18:24:23201713 // Update Count : 36 912 // Last Modified On : Thu Mar 23 08:20:40 2017 13 // Update Count : 367 14 14 // 15 15 … … 160 160 [(unsigned char)'¡'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open, 161 161 // closing delimiters, no space before 162 [','] : Close, ['.'] : Close, [' ;'] : Close, ['!'] : Close, ['?'] : Close,162 [','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close, 163 163 ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close, 164 164 [')'] : Close, [']'] : Close, ['}'] : Close, 165 165 // opening-closing delimiters, no space before or after 166 ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose, [':'] : OpenClose,166 ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose, 167 167 [' '] : OpenClose, ['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace 168 168 }; // mask -
src/libcfa/rational
r3bd1eb4 rdbfb35d 12 12 // Created On : Wed Apr 6 17:56:25 2016 13 13 // Last Modified By : Peter A. Buhr 14 // Last Modified On : Sun May 14 16:49:13201715 // Update Count : 7814 // Last Modified On : Mon May 1 08:25:06 2017 15 // Update Count : 33 16 16 // 17 17 … … 21 21 #include "iostream" 22 22 23 trait scalar( otype T ) {24 };25 26 trait arithmetic( otype T | scalar( T ) ) {27 int !?( T );28 int ?==?( T, T );29 int ?!=?( T, T );30 int ?<?( T, T );31 int ?<=?( T, T );32 int ?>?( T, T );33 int ?>=?( T, T );34 void ?{}( T *, zero_t );35 void ?{}( T *, one_t );36 T +?( T );37 T -?( T );38 T ?+?( T, T );39 T ?-?( T, T );40 T ?*?( T, T );41 T ?/?( T, T );42 T ?%?( T, T );43 T ?/=?( T *, T );44 T abs( T );45 };46 47 23 // implementation 48 49 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 24 typedef long int RationalImpl; 50 25 struct Rational { 51 RationalImpl numerator, denominator; // invariant: denominator > 026 RationalImpl numerator, denominator; // invariant: denominator > 0 52 27 }; // Rational 53 28 29 // constants 30 extern struct Rational 0; 31 extern struct Rational 1; 32 54 33 // constructors 55 56 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 57 void ?{}( Rational(RationalImpl) * r ); 58 59 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 60 void ?{}( Rational(RationalImpl) * r, RationalImpl n ); 61 62 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 63 void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d ); 64 65 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 66 void ?{}( Rational(RationalImpl) * r, zero_t ); 67 68 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 69 void ?{}( Rational(RationalImpl) * r, one_t ); 34 void ?{}( Rational * r ); 35 void ?{}( Rational * r, RationalImpl n ); 36 void ?{}( Rational * r, RationalImpl n, RationalImpl d ); 70 37 71 38 // getter for numerator/denominator 72 73 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 74 RationalImpl numerator( Rational(RationalImpl) r ); 75 76 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 77 RationalImpl denominator( Rational(RationalImpl) r ); 78 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 79 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src ); 80 39 RationalImpl numerator( Rational r ); 40 RationalImpl denominator( Rational r ); 41 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational src ); 81 42 // setter for numerator/denominator 82 83 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 84 RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n ); 85 86 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 87 RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d ); 43 RationalImpl numerator( Rational r, RationalImpl n ); 44 RationalImpl denominator( Rational r, RationalImpl d ); 88 45 89 46 // comparison 90 91 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 92 int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 93 94 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 95 int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 96 97 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 98 int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 99 100 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 101 int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 102 103 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 104 int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 105 106 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 107 int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 47 int ?==?( Rational l, Rational r ); 48 int ?!=?( Rational l, Rational r ); 49 int ?<?( Rational l, Rational r ); 50 int ?<=?( Rational l, Rational r ); 51 int ?>?( Rational l, Rational r ); 52 int ?>=?( Rational l, Rational r ); 108 53 109 54 // arithmetic 110 111 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 112 Rational(RationalImpl) +?( Rational(RationalImpl) r ); 113 114 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 115 Rational(RationalImpl) -?( Rational(RationalImpl) r ); 116 117 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 118 Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 119 120 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 121 Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 122 123 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 124 Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 125 126 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 127 Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 55 Rational -?( Rational r ); 56 Rational ?+?( Rational l, Rational r ); 57 Rational ?-?( Rational l, Rational r ); 58 Rational ?*?( Rational l, Rational r ); 59 Rational ?/?( Rational l, Rational r ); 128 60 129 61 // conversion 130 // forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 131 // double widen( Rational(RationalImpl) r ); 132 // forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 133 // Rational(RationalImpl) narrow( double f, RationalImpl md ); 62 double widen( Rational r ); 63 Rational narrow( double f, RationalImpl md ); 134 64 135 65 // I/O 136 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 137 forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } ) 138 istype * ?|?( istype *, Rational(RationalImpl) * ); 139 140 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 141 forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } ) 142 ostype * ?|?( ostype *, Rational(RationalImpl ) ); 66 forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, Rational * ); 67 forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, Rational ); 143 68 144 69 #endif // RATIONAL_H -
src/libcfa/rational.c
r3bd1eb4 rdbfb35d 10 10 // Created On : Wed Apr 6 17:54:28 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 14 17:25:19201713 // Update Count : 13112 // Last Modified On : Thu Apr 27 17:05:06 2017 13 // Update Count : 51 14 14 // 15 15 … … 17 17 #include "fstream" 18 18 #include "stdlib" 19 #include "math" // floor 20 21 22 // constants 23 24 struct Rational 0 = {0, 1}; 25 struct Rational 1 = {1, 1}; 26 19 27 20 28 // helper routines … … 22 30 // Calculate greatest common denominator of two numbers, the first of which may be negative. Used to reduce rationals. 23 31 // alternative: https://en.wikipedia.org/wiki/Binary_GCD_algorithm 24 forall ( otype RationalImpl | arithmetic( RationalImpl ) )25 32 static RationalImpl gcd( RationalImpl a, RationalImpl b ) { 26 33 for ( ;; ) { // Euclid's algorithm 27 34 RationalImpl r = a % b; 28 if ( r == (RationalImpl){0}) break;35 if ( r == 0 ) break; 29 36 a = b; 30 37 b = r; … … 33 40 } // gcd 34 41 35 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 36 static RationalImpl simplify( RationalImpl * n, RationalImpl * d ) { 37 if ( *d == (RationalImpl){0} ) { 42 static RationalImpl simplify( RationalImpl *n, RationalImpl *d ) { 43 if ( *d == 0 ) { 38 44 serr | "Invalid rational number construction: denominator cannot be equal to 0." | endl; 39 45 exit( EXIT_FAILURE ); 40 46 } // exit 41 if ( *d < (RationalImpl){0} ) { *d = -*d; *n = -*n; }// move sign to numerator47 if ( *d < 0 ) { *d = -*d; *n = -*n; } // move sign to numerator 42 48 return gcd( abs( *n ), *d ); // simplify 43 49 } // Rationalnumber::simplify … … 46 52 // constructors 47 53 48 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 49 void ?{}( Rational(RationalImpl) * r ) { 50 r{ (RationalImpl){0}, (RationalImpl){1} }; 54 void ?{}( Rational * r ) { 55 r{ 0, 1 }; 51 56 } // rational 52 57 53 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 54 void ?{}( Rational(RationalImpl) * r, RationalImpl n ) { 55 r{ n, (RationalImpl){1} }; 58 void ?{}( Rational * r, RationalImpl n ) { 59 r{ n, 1 }; 56 60 } // rational 57 61 58 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 59 void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d ) { 62 void ?{}( Rational * r, RationalImpl n, RationalImpl d ) { 60 63 RationalImpl t = simplify( &n, &d ); // simplify 61 64 r->numerator = n / t; … … 66 69 // getter for numerator/denominator 67 70 68 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 69 RationalImpl numerator( Rational(RationalImpl) r ) { 71 RationalImpl numerator( Rational r ) { 70 72 return r.numerator; 71 73 } // numerator 72 74 73 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 74 RationalImpl denominator( Rational(RationalImpl) r ) { 75 RationalImpl denominator( Rational r ) { 75 76 return r.denominator; 76 77 } // denominator 77 78 78 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 79 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src ) { 79 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational src ) { 80 80 return *dest = src.[ numerator, denominator ]; 81 81 } … … 83 83 // setter for numerator/denominator 84 84 85 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 86 RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n ) { 85 RationalImpl numerator( Rational r, RationalImpl n ) { 87 86 RationalImpl prev = r.numerator; 88 87 RationalImpl t = gcd( abs( n ), r.denominator ); // simplify … … 92 91 } // numerator 93 92 94 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 95 RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d ) { 93 RationalImpl denominator( Rational r, RationalImpl d ) { 96 94 RationalImpl prev = r.denominator; 97 95 RationalImpl t = simplify( &r.numerator, &d ); // simplify … … 104 102 // comparison 105 103 106 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 107 int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 104 int ?==?( Rational l, Rational r ) { 108 105 return l.numerator * r.denominator == l.denominator * r.numerator; 109 106 } // ?==? 110 107 111 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 112 int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 108 int ?!=?( Rational l, Rational r ) { 113 109 return ! ( l == r ); 114 110 } // ?!=? 115 111 116 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 117 int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 112 int ?<?( Rational l, Rational r ) { 118 113 return l.numerator * r.denominator < l.denominator * r.numerator; 119 114 } // ?<? 120 115 121 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 122 int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 123 return l.numerator * r.denominator <= l.denominator * r.numerator; 116 int ?<=?( Rational l, Rational r ) { 117 return l < r || l == r; 124 118 } // ?<=? 125 119 126 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 127 int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 120 int ?>?( Rational l, Rational r ) { 128 121 return ! ( l <= r ); 129 122 } // ?>? 130 123 131 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 132 int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 124 int ?>=?( Rational l, Rational r ) { 133 125 return ! ( l < r ); 134 126 } // ?>=? … … 137 129 // arithmetic 138 130 139 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 140 Rational(RationalImpl) +?( Rational(RationalImpl) r ) { 141 Rational(RationalImpl) t = { r.numerator, r.denominator }; 142 return t; 143 } // +? 144 145 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 146 Rational(RationalImpl) -?( Rational(RationalImpl) r ) { 147 Rational(RationalImpl) t = { -r.numerator, r.denominator }; 131 Rational -?( Rational r ) { 132 Rational t = { -r.numerator, r.denominator }; 148 133 return t; 149 134 } // -? 150 135 151 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 152 Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 136 Rational ?+?( Rational l, Rational r ) { 153 137 if ( l.denominator == r.denominator ) { // special case 154 Rational (RationalImpl)t = { l.numerator + r.numerator, l.denominator };138 Rational t = { l.numerator + r.numerator, l.denominator }; 155 139 return t; 156 140 } else { 157 Rational (RationalImpl)t = { l.numerator * r.denominator + l.denominator * r.numerator, l.denominator * r.denominator };141 Rational t = { l.numerator * r.denominator + l.denominator * r.numerator, l.denominator * r.denominator }; 158 142 return t; 159 143 } // if 160 144 } // ?+? 161 145 162 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 163 Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 146 Rational ?-?( Rational l, Rational r ) { 164 147 if ( l.denominator == r.denominator ) { // special case 165 Rational (RationalImpl)t = { l.numerator - r.numerator, l.denominator };148 Rational t = { l.numerator - r.numerator, l.denominator }; 166 149 return t; 167 150 } else { 168 Rational (RationalImpl)t = { l.numerator * r.denominator - l.denominator * r.numerator, l.denominator * r.denominator };151 Rational t = { l.numerator * r.denominator - l.denominator * r.numerator, l.denominator * r.denominator }; 169 152 return t; 170 153 } // if 171 154 } // ?-? 172 155 173 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 174 Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 175 Rational(RationalImpl) t = { l.numerator * r.numerator, l.denominator * r.denominator }; 156 Rational ?*?( Rational l, Rational r ) { 157 Rational t = { l.numerator * r.numerator, l.denominator * r.denominator }; 176 158 return t; 177 159 } // ?*? 178 160 179 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 180 Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 181 if ( r.numerator < (RationalImpl){0} ) { 161 Rational ?/?( Rational l, Rational r ) { 162 if ( r.numerator < 0 ) { 182 163 r.numerator = -r.numerator; 183 164 r.denominator = -r.denominator; 184 165 } // if 185 Rational (RationalImpl)t = { l.numerator * r.denominator, l.denominator * r.numerator };166 Rational t = { l.numerator * r.denominator, l.denominator * r.numerator }; 186 167 return t; 187 168 } // ?/? … … 190 171 // conversion 191 172 192 // forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 193 // double widen( Rational(RationalImpl) r ) { 194 // return (double)r.numerator / (double)r.denominator; 195 // } // widen 196 197 // // http://www.ics.uci.edu/~eppstein/numth/frap.c 198 // forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 199 // Rational(RationalImpl) narrow( double f, RationalImpl md ) { 200 // if ( md <= 1 ) { // maximum fractional digits too small? 201 // return (Rational(RationalImpl)){ f, 1}; // truncate fraction 202 // } // if 203 204 // // continued fraction coefficients 205 // RationalImpl m00 = 1, m11 = 1, m01 = 0, m10 = 0; 206 // RationalImpl ai, t; 207 208 // // find terms until denom gets too big 209 // for ( ;; ) { 210 // ai = (RationalImpl)f; 211 // if ( ! (m10 * ai + m11 <= md) ) break; 212 // t = m00 * ai + m01; 213 // m01 = m00; 214 // m00 = t; 215 // t = m10 * ai + m11; 216 // m11 = m10; 217 // m10 = t; 218 // t = (double)ai; 219 // if ( f == t ) break; // prevent division by zero 220 // f = 1 / (f - (double)t); 221 // if ( f > (double)0x7FFFFFFF ) break; // representation failure 222 // } 223 // return (Rational(RationalImpl)){ m00, m10 }; 224 // } // narrow 173 double widen( Rational r ) { 174 return (double)r.numerator / (double)r.denominator; 175 } // widen 176 177 // http://www.ics.uci.edu/~eppstein/numth/frap.c 178 Rational narrow( double f, RationalImpl md ) { 179 if ( md <= 1 ) { // maximum fractional digits too small? 180 return (Rational){ f, 1}; // truncate fraction 181 } // if 182 183 // continued fraction coefficients 184 RationalImpl m00 = 1, m11 = 1, m01 = 0, m10 = 0; 185 RationalImpl ai, t; 186 187 // find terms until denom gets too big 188 for ( ;; ) { 189 ai = (RationalImpl)f; 190 if ( ! (m10 * ai + m11 <= md) ) break; 191 t = m00 * ai + m01; 192 m01 = m00; 193 m00 = t; 194 t = m10 * ai + m11; 195 m11 = m10; 196 m10 = t; 197 t = (double)ai; 198 if ( f == t ) break; // prevent division by zero 199 f = 1 / (f - t); 200 if ( f > (double)0x7FFFFFFF ) break; // representation failure 201 } 202 return (Rational){ m00, m10 }; 203 } // narrow 225 204 226 205 227 206 // I/O 228 207 229 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 230 forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } ) 231 istype * ?|?( istype * is, Rational(RationalImpl) * r ) { 208 forall( dtype istype | istream( istype ) ) 209 istype * ?|?( istype *is, Rational *r ) { 232 210 RationalImpl t; 233 211 is | &(r->numerator) | &(r->denominator); … … 238 216 } // ?|? 239 217 240 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 241 forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } ) 242 ostype * ?|?( ostype * os, Rational(RationalImpl ) r ) { 218 forall( dtype ostype | ostream( ostype ) ) 219 ostype * ?|?( ostype *os, Rational r ) { 243 220 return os | r.numerator | '/' | r.denominator; 244 221 } // ?|? -
src/libcfa/stdlib
r3bd1eb4 rdbfb35d 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 9 08:42:44 201713 // Update Count : 10 712 // Last Modified On : Sat Apr 1 17:35:24 2017 13 // Update Count : 104 14 14 // 15 15 … … 84 84 forall( otype T | { int ?<?( T, T ); } ) 85 85 T * bsearch( T key, const T * arr, size_t dimension ); 86 87 86 forall( otype T | { int ?<?( T, T ); } ) 88 87 unsigned int bsearch( T key, const T * arr, size_t dimension ); 89 90 88 91 89 forall( otype T | { int ?<?( T, T ); } ) … … 109 107 double abs( double _Complex ); 110 108 long double abs( long double _Complex ); 111 forall ( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )112 T abs( T );113 109 114 110 //--------------------------------------- -
src/libcfa/stdlib.c
r3bd1eb4 rdbfb35d 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 9 08:43:00201713 // Update Count : 1 9112 // Last Modified On : Sun Apr 16 10:41:05 2017 13 // Update Count : 189 14 14 // 15 15 … … 27 27 } // extern "C" 28 28 29 forall( dtype T | sized(T) ) T * malloc( void ) { // type-safe 30 return (T *)(void *)malloc( (size_t)sizeof(T) ); 31 } // malloc 32 33 forall( dtype T | sized(T) ) T * malloc( char fill ) { // initial with fill value (like calloc) 34 T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) ); 29 forall( dtype T | sized(T) ) T * malloc( void ) { 30 //printf( "malloc1\n" ); 31 return (T *)(void*)malloc( (size_t)sizeof(T) ); 32 } // malloc 33 forall( dtype T | sized(T) ) T * malloc( char fill ) { 34 //printf( "malloc3\n" ); 35 T * ptr = (T *)(void*)malloc( (size_t)sizeof(T) ); 35 36 return memset( ptr, (int)fill, sizeof(T) ); 36 37 } // malloc 37 38 38 forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size ) { // alternative realloc 39 return (T *)realloc( ptr, size ); 40 } // malloc 41 42 forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size, unsigned char fill ) { // alternative realloc with fill value 43 return (T *)realloc( ptr, size, fill ); 44 } // malloc 45 46 47 forall( dtype T | sized(T) ) T * calloc( size_t nmemb ) { // type-safe array initialization with fill 0 39 forall( dtype T | sized(T) ) T * calloc( size_t nmemb ) { 40 //printf( "calloc\n" ); 48 41 return (T *)calloc( nmemb, sizeof(T) ); 49 42 } // calloc 50 43 51 52 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ) { // type-safe 44 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ) { 45 //printf( "realloc1\n" ); 53 46 return (T *)(void *)realloc( (void *)ptr, size ); 54 47 } // realloc 55 56 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill ) { // alternative realloc with fill value 48 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill ) { 49 //printf( "realloc2\n" ); 57 50 char * nptr = (T *)(void *)realloc( (void *)ptr, size ); 58 51 size_t unused = malloc_usable_size( nptr ); … … 61 54 } // realloc 62 55 63 64 forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment ) { // aligned allocation 56 forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size ) { 57 //printf( "malloc4\n" ); 58 return (T *)realloc( ptr, size ); 59 } // malloc 60 forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size, unsigned char fill ) { 61 //printf( "malloc5\n" ); 62 return (T *)realloc( ptr, size, fill ); 63 } // malloc 64 65 forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment ) { 66 //printf( "aligned_alloc\n" ); 65 67 return (T *)memalign( alignment, sizeof(T) ); 66 68 } // aligned_alloc 67 69 68 70 forall( dtype T | sized(T) ) T * memalign( size_t alignment ) { 71 //printf( "memalign\n" ); 69 72 return (T *)memalign( alignment, sizeof(T) ); 70 73 } // memalign 71 74 72 75 forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment ) { 76 //printf( "posix_memalign\n" ); 73 77 return posix_memalign( (void **)ptr, alignment, sizeof(T) ); 74 78 } // posix_memalign 75 79 76 77 forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params ); } ) // new 80 forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params ); } ) 78 81 T * new( Params p ) { 79 82 return ((T *)malloc()){ p }; 80 } // new81 82 forall( dtype T | { void ^?{}(T *); } ) // delete83 } 84 85 forall( dtype T | { void ^?{}(T *); } ) 83 86 void delete( T * ptr ) { 84 if ( ptr ) {85 ^ptr{};86 free( ptr );87 }88 } // delete87 if ( ptr ) { 88 ^ptr{}; 89 free( ptr ); 90 } 91 } 89 92 90 93 forall( dtype T, ttype Params | { void ^?{}(T *); void delete(Params); } ) … … 95 98 } 96 99 delete( rest ); 97 } // delete100 } 98 101 99 102 //--------------------------------------- … … 103 106 if ( sscanf( ptr, "%d", &i ) == EOF ) {} 104 107 return i; 105 } // ato 106 108 } 107 109 unsigned int ato( const char * ptr ) { 108 110 unsigned int ui; 109 111 if ( sscanf( ptr, "%u", &ui ) == EOF ) {} 110 112 return ui; 111 } // ato 112 113 } 113 114 long int ato( const char * ptr ) { 114 115 long int li; 115 116 if ( sscanf( ptr, "%ld", &li ) == EOF ) {} 116 117 return li; 117 } // ato 118 118 } 119 119 unsigned long int ato( const char * ptr ) { 120 120 unsigned long int uli; 121 121 if ( sscanf( ptr, "%lu", &uli ) == EOF ) {} 122 122 return uli; 123 } // ato 124 123 } 125 124 long long int ato( const char * ptr ) { 126 125 long long int lli; 127 126 if ( sscanf( ptr, "%lld", &lli ) == EOF ) {} 128 127 return lli; 129 } // ato 130 128 } 131 129 unsigned long long int ato( const char * ptr ) { 132 130 unsigned long long int ulli; 133 131 if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {} 134 132 return ulli; 135 } // ato 136 133 } 137 134 138 135 float ato( const char * ptr ) { … … 140 137 if ( sscanf( ptr, "%f", &f ) == EOF ) {} 141 138 return f; 142 } // ato 143 139 } 144 140 double ato( const char * ptr ) { 145 141 double d; 146 142 if ( sscanf( ptr, "%lf", &d ) == EOF ) {} 147 143 return d; 148 } // ato 149 144 } 150 145 long double ato( const char * ptr ) { 151 146 long double ld; 152 147 if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {} 153 148 return ld; 154 } // ato 155 149 } 156 150 157 151 float _Complex ato( const char * ptr ) { … … 159 153 if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {} 160 154 return re + im * _Complex_I; 161 } // ato 162 155 } 163 156 double _Complex ato( const char * ptr ) { 164 157 double re, im; 165 158 if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {} 166 159 return re + im * _Complex_I; 167 } // ato 168 160 } 169 161 long double _Complex ato( const char * ptr ) { 170 162 long double re, im; 171 163 if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {} 172 164 return re + im * _Complex_I; 173 } // ato 174 165 } 175 166 176 167 int strto( const char * sptr, char ** eptr, int base ) { 177 168 return (int)strtol( sptr, eptr, base ); 178 } // strto 179 169 } 180 170 unsigned int strto( const char * sptr, char ** eptr, int base ) { 181 171 return (unsigned int)strtoul( sptr, eptr, base ); 182 } // strto 183 172 } 184 173 long int strto( const char * sptr, char ** eptr, int base ) { 185 174 return strtol( sptr, eptr, base ); 186 } // strto 187 175 } 188 176 unsigned long int strto( const char * sptr, char ** eptr, int base ) { 189 177 return strtoul( sptr, eptr, base ); 190 } // strto 191 178 } 192 179 long long int strto( const char * sptr, char ** eptr, int base ) { 193 180 return strtoll( sptr, eptr, base ); 194 } // strto 195 181 } 196 182 unsigned long long int strto( const char * sptr, char ** eptr, int base ) { 197 183 return strtoull( sptr, eptr, base ); 198 } // strto 199 184 } 200 185 201 186 float strto( const char * sptr, char ** eptr ) { 202 187 return strtof( sptr, eptr ); 203 } // strto 204 188 } 205 189 double strto( const char * sptr, char ** eptr ) { 206 190 return strtod( sptr, eptr ); 207 } // strto 208 191 } 209 192 long double strto( const char * sptr, char ** eptr ) { 210 193 return strtold( sptr, eptr ); 211 } // strto 212 194 } 213 195 214 196 float _Complex strto( const char * sptr, char ** eptr ) { … … 219 201 if ( sptr == *eptr ) return 0.0; 220 202 return re + im * _Complex_I; 221 } // strto 222 203 } 223 204 double _Complex strto( const char * sptr, char ** eptr ) { 224 205 double re, im; … … 228 209 if ( sptr == *eptr ) return 0.0; 229 210 return re + im * _Complex_I; 230 } // strto 231 211 } 232 212 long double _Complex strto( const char * sptr, char ** eptr ) { 233 213 long double re, im; … … 237 217 if ( sptr == *eptr ) return 0.0; 238 218 return re + im * _Complex_I; 239 } // strto219 } 240 220 241 221 //--------------------------------------- -
src/main.cc
r3bd1eb4 rdbfb35d 1 2 1 // 3 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo … … 10 9 // Author : Richard C. Bilson 11 10 // Created On : Fri May 15 23:12:02 2015 12 // Last Modified By : Andrew Beach13 // Last Modified On : Wed May 10 14:45:00 201714 // Update Count : 43 711 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 14 14:35:54 2016 13 // Update Count : 436 15 14 // 16 15 … … 80 79 errorp = false, 81 80 codegenp = false, 82 prettycodegenp = false, 83 nolinemarks = false; 81 prettycodegenp = false; 84 82 85 83 static void parse_cmdline( int argc, char *argv[], const char *& filename ); … … 312 310 313 311 CodeTools::fillLocations( translationUnit ); 314 CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true , ! nolinemarks);312 CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true ); 315 313 316 314 CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c" ); … … 338 336 } catch ( CompilerError &e ) { 339 337 cerr << "Compiler Error: " << e.get_what() << endl; 340 cerr << "(please report bugs to [REDACTED])" << endl;338 cerr << "(please report bugs to " << endl; 341 339 if ( output != &cout ) { 342 340 delete output; … … 377 375 378 376 int c; 379 while ( (c = getopt_long( argc, argv, "abBcdefgl LmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {377 while ( (c = getopt_long( argc, argv, "abBcdefglmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) { 380 378 switch ( c ) { 381 379 case Ast: … … 413 411 case 'l': // generate libcfa.c 414 412 libcfap = true; 415 break;416 case 'L': // surpress lines marks417 nolinemarks = true;418 413 break; 419 414 case Nopreamble: -
src/prelude/Makefile.am
r3bd1eb4 rdbfb35d 42 42 43 43 bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 44 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpm Lbootloader.cf $@ # use src/cfa-cpp as not in lib until after install44 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpm bootloader.cf $@ # use src/cfa-cpp as not in lib until after install 45 45 46 46 MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}} -
src/prelude/Makefile.in
r3bd1eb4 rdbfb35d 439 439 440 440 bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 441 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpm Lbootloader.cf $@ # use src/cfa-cpp as not in lib until after install441 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpm bootloader.cf $@ # use src/cfa-cpp as not in lib until after install 442 442 443 443 # Tell versions [3.59,3.63) of GNU make to not export all variables. -
src/tests/.expect/32/KRfunctions.txt
r3bd1eb4 rdbfb35d 31 31 } 32 32 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 33 struct S ___ret__2sS_1;34 33 ((void)((*___dst__P2sS_1).__i__i_1=___src__2sS_1.__i__i_1)); 35 ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1)); 36 return ((struct S )___ret__2sS_1); 34 return ((struct S )___src__2sS_1); 37 35 } 38 36 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __i__i_1){ -
src/tests/.expect/32/attributes.txt
r3bd1eb4 rdbfb35d 22 22 } 23 23 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 24 struct __anonymous0 ___ret__13s__anonymous0_1; 25 ((void)___constructor__F_P13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1)); 26 return ((struct __anonymous0 )___ret__13s__anonymous0_1); 24 return ((struct __anonymous0 )___src__13s__anonymous0_1); 27 25 } 28 26 __attribute__ ((unused)) struct Agn1; … … 40 38 } 41 39 static inline struct Agn2 ___operator_assign__F5sAgn2_P5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__P5sAgn2_1, struct Agn2 ___src__5sAgn2_1){ 42 struct Agn2 ___ret__5sAgn2_1; 43 ((void)___constructor__F_P5sAgn25sAgn2_autogen___1((&___ret__5sAgn2_1), ___src__5sAgn2_1)); 44 return ((struct Agn2 )___ret__5sAgn2_1); 40 return ((struct Agn2 )___src__5sAgn2_1); 45 41 } 46 42 enum __attribute__ ((unused)) __anonymous1 { … … 103 99 } 104 100 static inline struct Fdl ___operator_assign__F4sFdl_P4sFdl4sFdl_autogen___1(struct Fdl *___dst__P4sFdl_1, struct Fdl ___src__4sFdl_1){ 105 struct Fdl ___ret__4sFdl_1;106 101 ((void)((*___dst__P4sFdl_1).__f1__i_1=___src__4sFdl_1.__f1__i_1)); 107 102 ((void)((*___dst__P4sFdl_1).__f2__i_1=___src__4sFdl_1.__f2__i_1)); … … 113 108 ((void)((*___dst__P4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1)); 114 109 ((void)((*___dst__P4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1)); 115 ((void)___constructor__F_P4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), ___src__4sFdl_1)); 116 return ((struct Fdl )___ret__4sFdl_1); 110 return ((struct Fdl )___src__4sFdl_1); 117 111 } 118 112 static inline void ___constructor__F_P4sFdli_autogen___1(struct Fdl *___dst__P4sFdl_1, int __f1__i_1){ … … 298 292 } 299 293 inline struct __anonymous4 ___operator_assign__F13s__anonymous4_P13s__anonymous413s__anonymous4_autogen___2(struct __anonymous4 *___dst__P13s__anonymous4_2, struct __anonymous4 ___src__13s__anonymous4_2){ 300 struct __anonymous4 ___ret__13s__anonymous4_2;301 294 ((void)((*___dst__P13s__anonymous4_2).__i__i_2=___src__13s__anonymous4_2.__i__i_2)); 302 ((void)___constructor__F_P13s__anonymous413s__anonymous4_autogen___2((&___ret__13s__anonymous4_2), ___src__13s__anonymous4_2)); 303 return ((struct __anonymous4 )___ret__13s__anonymous4_2); 295 return ((struct __anonymous4 )___src__13s__anonymous4_2); 304 296 } 305 297 inline void ___constructor__F_P13s__anonymous4i_autogen___2(struct __anonymous4 *___dst__P13s__anonymous4_2, int __i__i_2){ … … 318 310 } 319 311 inline enum __anonymous5 ___operator_assign__F13e__anonymous5_P13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__P13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){ 320 enum __anonymous5 ___ret__13e__anonymous5_2; 321 ((void)(___ret__13e__anonymous5_2=((*___dst__P13e__anonymous5_2)=___src__13e__anonymous5_2)) /* ?{} */); 322 return ((enum __anonymous5 )___ret__13e__anonymous5_2); 312 return ((enum __anonymous5 )((*___dst__P13e__anonymous5_2)=___src__13e__anonymous5_2)); 323 313 } 324 314 ((void)sizeof(enum __anonymous5 )); … … 348 338 } 349 339 static inline struct Vad ___operator_assign__F4sVad_P4sVad4sVad_autogen___1(struct Vad *___dst__P4sVad_1, struct Vad ___src__4sVad_1){ 350 struct Vad ___ret__4sVad_1; 351 ((void)___constructor__F_P4sVad4sVad_autogen___1((&___ret__4sVad_1), ___src__4sVad_1)); 352 return ((struct Vad )___ret__4sVad_1); 353 } 340 return ((struct Vad )___src__4sVad_1); 341 } -
src/tests/.expect/32/declarationSpecifier.txt
r3bd1eb4 rdbfb35d 30 30 } 31 31 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 32 struct __anonymous0 ___ret__13s__anonymous0_1;33 32 ((void)((*___dst__P13s__anonymous0_1).__i__i_1=___src__13s__anonymous0_1.__i__i_1)); 34 ((void)___constructor__F_P13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1)); 35 return ((struct __anonymous0 )___ret__13s__anonymous0_1); 33 return ((struct __anonymous0 )___src__13s__anonymous0_1); 36 34 } 37 35 static inline void ___constructor__F_P13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, int __i__i_1){ … … 56 54 } 57 55 static inline struct __anonymous1 ___operator_assign__F13s__anonymous1_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1){ 58 struct __anonymous1 ___ret__13s__anonymous1_1;59 56 ((void)((*___dst__P13s__anonymous1_1).__i__i_1=___src__13s__anonymous1_1.__i__i_1)); 60 ((void)___constructor__F_P13s__anonymous113s__anonymous1_autogen___1((&___ret__13s__anonymous1_1), ___src__13s__anonymous1_1)); 61 return ((struct __anonymous1 )___ret__13s__anonymous1_1); 57 return ((struct __anonymous1 )___src__13s__anonymous1_1); 62 58 } 63 59 static inline void ___constructor__F_P13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, int __i__i_1){ … … 82 78 } 83 79 static inline struct __anonymous2 ___operator_assign__F13s__anonymous2_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){ 84 struct __anonymous2 ___ret__13s__anonymous2_1;85 80 ((void)((*___dst__P13s__anonymous2_1).__i__i_1=___src__13s__anonymous2_1.__i__i_1)); 86 ((void)___constructor__F_P13s__anonymous213s__anonymous2_autogen___1((&___ret__13s__anonymous2_1), ___src__13s__anonymous2_1)); 87 return ((struct __anonymous2 )___ret__13s__anonymous2_1); 81 return ((struct __anonymous2 )___src__13s__anonymous2_1); 88 82 } 89 83 static inline void ___constructor__F_P13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, int __i__i_1){ … … 108 102 } 109 103 static inline struct __anonymous3 ___operator_assign__F13s__anonymous3_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1){ 110 struct __anonymous3 ___ret__13s__anonymous3_1;111 104 ((void)((*___dst__P13s__anonymous3_1).__i__i_1=___src__13s__anonymous3_1.__i__i_1)); 112 ((void)___constructor__F_P13s__anonymous313s__anonymous3_autogen___1((&___ret__13s__anonymous3_1), ___src__13s__anonymous3_1)); 113 return ((struct __anonymous3 )___ret__13s__anonymous3_1); 105 return ((struct __anonymous3 )___src__13s__anonymous3_1); 114 106 } 115 107 static inline void ___constructor__F_P13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, int __i__i_1){ … … 134 126 } 135 127 static inline struct __anonymous4 ___operator_assign__F13s__anonymous4_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1){ 136 struct __anonymous4 ___ret__13s__anonymous4_1;137 128 ((void)((*___dst__P13s__anonymous4_1).__i__i_1=___src__13s__anonymous4_1.__i__i_1)); 138 ((void)___constructor__F_P13s__anonymous413s__anonymous4_autogen___1((&___ret__13s__anonymous4_1), ___src__13s__anonymous4_1)); 139 return ((struct __anonymous4 )___ret__13s__anonymous4_1); 129 return ((struct __anonymous4 )___src__13s__anonymous4_1); 140 130 } 141 131 static inline void ___constructor__F_P13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, int __i__i_1){ … … 160 150 } 161 151 static inline struct __anonymous5 ___operator_assign__F13s__anonymous5_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1){ 162 struct __anonymous5 ___ret__13s__anonymous5_1;163 152 ((void)((*___dst__P13s__anonymous5_1).__i__i_1=___src__13s__anonymous5_1.__i__i_1)); 164 ((void)___constructor__F_P13s__anonymous513s__anonymous5_autogen___1((&___ret__13s__anonymous5_1), ___src__13s__anonymous5_1)); 165 return ((struct __anonymous5 )___ret__13s__anonymous5_1); 153 return ((struct __anonymous5 )___src__13s__anonymous5_1); 166 154 } 167 155 static inline void ___constructor__F_P13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, int __i__i_1){ … … 186 174 } 187 175 static inline struct __anonymous6 ___operator_assign__F13s__anonymous6_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1){ 188 struct __anonymous6 ___ret__13s__anonymous6_1;189 176 ((void)((*___dst__P13s__anonymous6_1).__i__i_1=___src__13s__anonymous6_1.__i__i_1)); 190 ((void)___constructor__F_P13s__anonymous613s__anonymous6_autogen___1((&___ret__13s__anonymous6_1), ___src__13s__anonymous6_1)); 191 return ((struct __anonymous6 )___ret__13s__anonymous6_1); 177 return ((struct __anonymous6 )___src__13s__anonymous6_1); 192 178 } 193 179 static inline void ___constructor__F_P13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, int __i__i_1){ … … 212 198 } 213 199 static inline struct __anonymous7 ___operator_assign__F13s__anonymous7_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1){ 214 struct __anonymous7 ___ret__13s__anonymous7_1;215 200 ((void)((*___dst__P13s__anonymous7_1).__i__i_1=___src__13s__anonymous7_1.__i__i_1)); 216 ((void)___constructor__F_P13s__anonymous713s__anonymous7_autogen___1((&___ret__13s__anonymous7_1), ___src__13s__anonymous7_1)); 217 return ((struct __anonymous7 )___ret__13s__anonymous7_1); 201 return ((struct __anonymous7 )___src__13s__anonymous7_1); 218 202 } 219 203 static inline void ___constructor__F_P13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, int __i__i_1){ … … 246 230 } 247 231 static inline struct __anonymous8 ___operator_assign__F13s__anonymous8_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1){ 248 struct __anonymous8 ___ret__13s__anonymous8_1;249 232 ((void)((*___dst__P13s__anonymous8_1).__i__s_1=___src__13s__anonymous8_1.__i__s_1)); 250 ((void)___constructor__F_P13s__anonymous813s__anonymous8_autogen___1((&___ret__13s__anonymous8_1), ___src__13s__anonymous8_1)); 251 return ((struct __anonymous8 )___ret__13s__anonymous8_1); 233 return ((struct __anonymous8 )___src__13s__anonymous8_1); 252 234 } 253 235 static inline void ___constructor__F_P13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, short __i__s_1){ … … 272 254 } 273 255 static inline struct __anonymous9 ___operator_assign__F13s__anonymous9_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1){ 274 struct __anonymous9 ___ret__13s__anonymous9_1;275 256 ((void)((*___dst__P13s__anonymous9_1).__i__s_1=___src__13s__anonymous9_1.__i__s_1)); 276 ((void)___constructor__F_P13s__anonymous913s__anonymous9_autogen___1((&___ret__13s__anonymous9_1), ___src__13s__anonymous9_1)); 277 return ((struct __anonymous9 )___ret__13s__anonymous9_1); 257 return ((struct __anonymous9 )___src__13s__anonymous9_1); 278 258 } 279 259 static inline void ___constructor__F_P13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, short __i__s_1){ … … 298 278 } 299 279 static inline struct __anonymous10 ___operator_assign__F14s__anonymous10_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1){ 300 struct __anonymous10 ___ret__14s__anonymous10_1;301 280 ((void)((*___dst__P14s__anonymous10_1).__i__s_1=___src__14s__anonymous10_1.__i__s_1)); 302 ((void)___constructor__F_P14s__anonymous1014s__anonymous10_autogen___1((&___ret__14s__anonymous10_1), ___src__14s__anonymous10_1)); 303 return ((struct __anonymous10 )___ret__14s__anonymous10_1); 281 return ((struct __anonymous10 )___src__14s__anonymous10_1); 304 282 } 305 283 static inline void ___constructor__F_P14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, short __i__s_1){ … … 324 302 } 325 303 static inline struct __anonymous11 ___operator_assign__F14s__anonymous11_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1){ 326 struct __anonymous11 ___ret__14s__anonymous11_1;327 304 ((void)((*___dst__P14s__anonymous11_1).__i__s_1=___src__14s__anonymous11_1.__i__s_1)); 328 ((void)___constructor__F_P14s__anonymous1114s__anonymous11_autogen___1((&___ret__14s__anonymous11_1), ___src__14s__anonymous11_1)); 329 return ((struct __anonymous11 )___ret__14s__anonymous11_1); 305 return ((struct __anonymous11 )___src__14s__anonymous11_1); 330 306 } 331 307 static inline void ___constructor__F_P14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, short __i__s_1){ … … 350 326 } 351 327 static inline struct __anonymous12 ___operator_assign__F14s__anonymous12_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1){ 352 struct __anonymous12 ___ret__14s__anonymous12_1;353 328 ((void)((*___dst__P14s__anonymous12_1).__i__s_1=___src__14s__anonymous12_1.__i__s_1)); 354 ((void)___constructor__F_P14s__anonymous1214s__anonymous12_autogen___1((&___ret__14s__anonymous12_1), ___src__14s__anonymous12_1)); 355 return ((struct __anonymous12 )___ret__14s__anonymous12_1); 329 return ((struct __anonymous12 )___src__14s__anonymous12_1); 356 330 } 357 331 static inline void ___constructor__F_P14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, short __i__s_1){ … … 376 350 } 377 351 static inline struct __anonymous13 ___operator_assign__F14s__anonymous13_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1){ 378 struct __anonymous13 ___ret__14s__anonymous13_1;379 352 ((void)((*___dst__P14s__anonymous13_1).__i__s_1=___src__14s__anonymous13_1.__i__s_1)); 380 ((void)___constructor__F_P14s__anonymous1314s__anonymous13_autogen___1((&___ret__14s__anonymous13_1), ___src__14s__anonymous13_1)); 381 return ((struct __anonymous13 )___ret__14s__anonymous13_1); 353 return ((struct __anonymous13 )___src__14s__anonymous13_1); 382 354 } 383 355 static inline void ___constructor__F_P14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, short __i__s_1){ … … 402 374 } 403 375 static inline struct __anonymous14 ___operator_assign__F14s__anonymous14_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1){ 404 struct __anonymous14 ___ret__14s__anonymous14_1;405 376 ((void)((*___dst__P14s__anonymous14_1).__i__s_1=___src__14s__anonymous14_1.__i__s_1)); 406 ((void)___constructor__F_P14s__anonymous1414s__anonymous14_autogen___1((&___ret__14s__anonymous14_1), ___src__14s__anonymous14_1)); 407 return ((struct __anonymous14 )___ret__14s__anonymous14_1); 377 return ((struct __anonymous14 )___src__14s__anonymous14_1); 408 378 } 409 379 static inline void ___constructor__F_P14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, short __i__s_1){ … … 428 398 } 429 399 static inline struct __anonymous15 ___operator_assign__F14s__anonymous15_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1){ 430 struct __anonymous15 ___ret__14s__anonymous15_1;431 400 ((void)((*___dst__P14s__anonymous15_1).__i__s_1=___src__14s__anonymous15_1.__i__s_1)); 432 ((void)___constructor__F_P14s__anonymous1514s__anonymous15_autogen___1((&___ret__14s__anonymous15_1), ___src__14s__anonymous15_1)); 433 return ((struct __anonymous15 )___ret__14s__anonymous15_1); 401 return ((struct __anonymous15 )___src__14s__anonymous15_1); 434 402 } 435 403 static inline void ___constructor__F_P14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, short __i__s_1){ … … 470 438 } 471 439 static inline struct __anonymous16 ___operator_assign__F14s__anonymous16_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1){ 472 struct __anonymous16 ___ret__14s__anonymous16_1;473 440 ((void)((*___dst__P14s__anonymous16_1).__i__i_1=___src__14s__anonymous16_1.__i__i_1)); 474 ((void)___constructor__F_P14s__anonymous1614s__anonymous16_autogen___1((&___ret__14s__anonymous16_1), ___src__14s__anonymous16_1)); 475 return ((struct __anonymous16 )___ret__14s__anonymous16_1); 441 return ((struct __anonymous16 )___src__14s__anonymous16_1); 476 442 } 477 443 static inline void ___constructor__F_P14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, int __i__i_1){ … … 496 462 } 497 463 static inline struct __anonymous17 ___operator_assign__F14s__anonymous17_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1){ 498 struct __anonymous17 ___ret__14s__anonymous17_1;499 464 ((void)((*___dst__P14s__anonymous17_1).__i__i_1=___src__14s__anonymous17_1.__i__i_1)); 500 ((void)___constructor__F_P14s__anonymous1714s__anonymous17_autogen___1((&___ret__14s__anonymous17_1), ___src__14s__anonymous17_1)); 501 return ((struct __anonymous17 )___ret__14s__anonymous17_1); 465 return ((struct __anonymous17 )___src__14s__anonymous17_1); 502 466 } 503 467 static inline void ___constructor__F_P14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, int __i__i_1){ … … 522 486 } 523 487 static inline struct __anonymous18 ___operator_assign__F14s__anonymous18_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1){ 524 struct __anonymous18 ___ret__14s__anonymous18_1;525 488 ((void)((*___dst__P14s__anonymous18_1).__i__i_1=___src__14s__anonymous18_1.__i__i_1)); 526 ((void)___constructor__F_P14s__anonymous1814s__anonymous18_autogen___1((&___ret__14s__anonymous18_1), ___src__14s__anonymous18_1)); 527 return ((struct __anonymous18 )___ret__14s__anonymous18_1); 489 return ((struct __anonymous18 )___src__14s__anonymous18_1); 528 490 } 529 491 static inline void ___constructor__F_P14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, int __i__i_1){ … … 548 510 } 549 511 static inline struct __anonymous19 ___operator_assign__F14s__anonymous19_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1){ 550 struct __anonymous19 ___ret__14s__anonymous19_1;551 512 ((void)((*___dst__P14s__anonymous19_1).__i__i_1=___src__14s__anonymous19_1.__i__i_1)); 552 ((void)___constructor__F_P14s__anonymous1914s__anonymous19_autogen___1((&___ret__14s__anonymous19_1), ___src__14s__anonymous19_1)); 553 return ((struct __anonymous19 )___ret__14s__anonymous19_1); 513 return ((struct __anonymous19 )___src__14s__anonymous19_1); 554 514 } 555 515 static inline void ___constructor__F_P14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, int __i__i_1){ … … 574 534 } 575 535 static inline struct __anonymous20 ___operator_assign__F14s__anonymous20_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1){ 576 struct __anonymous20 ___ret__14s__anonymous20_1;577 536 ((void)((*___dst__P14s__anonymous20_1).__i__i_1=___src__14s__anonymous20_1.__i__i_1)); 578 ((void)___constructor__F_P14s__anonymous2014s__anonymous20_autogen___1((&___ret__14s__anonymous20_1), ___src__14s__anonymous20_1)); 579 return ((struct __anonymous20 )___ret__14s__anonymous20_1); 537 return ((struct __anonymous20 )___src__14s__anonymous20_1); 580 538 } 581 539 static inline void ___constructor__F_P14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, int __i__i_1){ … … 600 558 } 601 559 static inline struct __anonymous21 ___operator_assign__F14s__anonymous21_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1){ 602 struct __anonymous21 ___ret__14s__anonymous21_1;603 560 ((void)((*___dst__P14s__anonymous21_1).__i__i_1=___src__14s__anonymous21_1.__i__i_1)); 604 ((void)___constructor__F_P14s__anonymous2114s__anonymous21_autogen___1((&___ret__14s__anonymous21_1), ___src__14s__anonymous21_1)); 605 return ((struct __anonymous21 )___ret__14s__anonymous21_1); 561 return ((struct __anonymous21 )___src__14s__anonymous21_1); 606 562 } 607 563 static inline void ___constructor__F_P14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, int __i__i_1){ … … 626 582 } 627 583 static inline struct __anonymous22 ___operator_assign__F14s__anonymous22_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1){ 628 struct __anonymous22 ___ret__14s__anonymous22_1;629 584 ((void)((*___dst__P14s__anonymous22_1).__i__i_1=___src__14s__anonymous22_1.__i__i_1)); 630 ((void)___constructor__F_P14s__anonymous2214s__anonymous22_autogen___1((&___ret__14s__anonymous22_1), ___src__14s__anonymous22_1)); 631 return ((struct __anonymous22 )___ret__14s__anonymous22_1); 585 return ((struct __anonymous22 )___src__14s__anonymous22_1); 632 586 } 633 587 static inline void ___constructor__F_P14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, int __i__i_1){ … … 652 606 } 653 607 static inline struct __anonymous23 ___operator_assign__F14s__anonymous23_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1){ 654 struct __anonymous23 ___ret__14s__anonymous23_1;655 608 ((void)((*___dst__P14s__anonymous23_1).__i__i_1=___src__14s__anonymous23_1.__i__i_1)); 656 ((void)___constructor__F_P14s__anonymous2314s__anonymous23_autogen___1((&___ret__14s__anonymous23_1), ___src__14s__anonymous23_1)); 657 return ((struct __anonymous23 )___ret__14s__anonymous23_1); 609 return ((struct __anonymous23 )___src__14s__anonymous23_1); 658 610 } 659 611 static inline void ___constructor__F_P14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, int __i__i_1){ -
src/tests/.expect/32/extension.txt
r3bd1eb4 rdbfb35d 33 33 } 34 34 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 35 struct S ___ret__2sS_1;36 35 ((void)((*___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1)); 37 36 ((void)((*___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1)); 38 37 ((void)((*___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1)); 39 ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1)); 40 return ((struct S )___ret__2sS_1); 38 return ((struct S )___src__2sS_1); 41 39 } 42 40 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __a__i_1){ … … 68 66 } 69 67 static inline union U ___operator_assign__F2uU_P2uU2uU_autogen___1(union U *___dst__P2uU_1, union U ___src__2uU_1){ 70 union U ___ret__2uU_1;71 68 ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U ))); 72 ((void)___constructor__F_P2uU2uU_autogen___1((&___ret__2uU_1), ___src__2uU_1)); 73 return ((union U )___ret__2uU_1); 69 return ((union U )___src__2uU_1); 74 70 } 75 71 static inline void ___constructor__F_P2uUi_autogen___1(union U *___dst__P2uU_1, int __src__i_1){ -
src/tests/.expect/32/gccExtensions.txt
r3bd1eb4 rdbfb35d 59 59 } 60 60 inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___2(struct S *___dst__P2sS_2, struct S ___src__2sS_2){ 61 struct S ___ret__2sS_2;62 61 ((void)((*___dst__P2sS_2).__a__i_2=___src__2sS_2.__a__i_2)); 63 62 ((void)((*___dst__P2sS_2).__b__i_2=___src__2sS_2.__b__i_2)); 64 63 ((void)((*___dst__P2sS_2).__c__i_2=___src__2sS_2.__c__i_2)); 65 ((void)___constructor__F_P2sS2sS_autogen___2((&___ret__2sS_2), ___src__2sS_2)); 66 return ((struct S )___ret__2sS_2); 64 return ((struct S )___src__2sS_2); 67 65 } 68 66 inline void ___constructor__F_P2sSi_autogen___2(struct S *___dst__P2sS_2, int __a__i_2){ … … 111 109 } 112 110 inline struct s2 ___operator_assign__F3ss2_P3ss23ss2_autogen___2(struct s2 *___dst__P3ss2_2, struct s2 ___src__3ss2_2){ 113 struct s2 ___ret__3ss2_2;114 111 ((void)((*___dst__P3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2)); 115 ((void)___constructor__F_P3ss23ss2_autogen___2((&___ret__3ss2_2), ___src__3ss2_2)); 116 return ((struct s2 )___ret__3ss2_2); 112 return ((struct s2 )___src__3ss2_2); 117 113 } 118 114 inline void ___constructor__F_P3ss2i_autogen___2(struct s2 *___dst__P3ss2_2, int __i__i_2){ … … 132 128 } 133 129 inline struct s3 ___operator_assign__F3ss3_P3ss33ss3_autogen___2(struct s3 *___dst__P3ss3_2, struct s3 ___src__3ss3_2){ 134 struct s3 ___ret__3ss3_2;135 130 ((void)((*___dst__P3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2)); 136 ((void)___constructor__F_P3ss33ss3_autogen___2((&___ret__3ss3_2), ___src__3ss3_2)); 137 return ((struct s3 )___ret__3ss3_2); 131 return ((struct s3 )___src__3ss3_2); 138 132 } 139 133 inline void ___constructor__F_P3ss3i_autogen___2(struct s3 *___dst__P3ss3_2, int __i__i_2){ … … 155 149 } 156 150 inline struct s4 ___operator_assign__F3ss4_P3ss43ss4_autogen___2(struct s4 *___dst__P3ss4_2, struct s4 ___src__3ss4_2){ 157 struct s4 ___ret__3ss4_2;158 151 ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2)); 159 ((void)___constructor__F_P3ss43ss4_autogen___2((&___ret__3ss4_2), ___src__3ss4_2)); 160 return ((struct s4 )___ret__3ss4_2); 152 return ((struct s4 )___src__3ss4_2); 161 153 } 162 154 inline void ___constructor__F_P3ss4i_autogen___2(struct s4 *___dst__P3ss4_2, int __i__i_2){ -
src/tests/.expect/64/KRfunctions.txt
r3bd1eb4 rdbfb35d 31 31 } 32 32 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 33 struct S ___ret__2sS_1;34 33 ((void)((*___dst__P2sS_1).__i__i_1=___src__2sS_1.__i__i_1)); 35 ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1)); 36 return ((struct S )___ret__2sS_1); 34 return ((struct S )___src__2sS_1); 37 35 } 38 36 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __i__i_1){ -
src/tests/.expect/64/attributes.txt
r3bd1eb4 rdbfb35d 22 22 } 23 23 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 24 struct __anonymous0 ___ret__13s__anonymous0_1; 25 ((void)___constructor__F_P13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1)); 26 return ((struct __anonymous0 )___ret__13s__anonymous0_1); 24 return ((struct __anonymous0 )___src__13s__anonymous0_1); 27 25 } 28 26 __attribute__ ((unused)) struct Agn1; … … 40 38 } 41 39 static inline struct Agn2 ___operator_assign__F5sAgn2_P5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__P5sAgn2_1, struct Agn2 ___src__5sAgn2_1){ 42 struct Agn2 ___ret__5sAgn2_1; 43 ((void)___constructor__F_P5sAgn25sAgn2_autogen___1((&___ret__5sAgn2_1), ___src__5sAgn2_1)); 44 return ((struct Agn2 )___ret__5sAgn2_1); 40 return ((struct Agn2 )___src__5sAgn2_1); 45 41 } 46 42 enum __attribute__ ((unused)) __anonymous1 { … … 103 99 } 104 100 static inline struct Fdl ___operator_assign__F4sFdl_P4sFdl4sFdl_autogen___1(struct Fdl *___dst__P4sFdl_1, struct Fdl ___src__4sFdl_1){ 105 struct Fdl ___ret__4sFdl_1;106 101 ((void)((*___dst__P4sFdl_1).__f1__i_1=___src__4sFdl_1.__f1__i_1)); 107 102 ((void)((*___dst__P4sFdl_1).__f2__i_1=___src__4sFdl_1.__f2__i_1)); … … 113 108 ((void)((*___dst__P4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1)); 114 109 ((void)((*___dst__P4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1)); 115 ((void)___constructor__F_P4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), ___src__4sFdl_1)); 116 return ((struct Fdl )___ret__4sFdl_1); 110 return ((struct Fdl )___src__4sFdl_1); 117 111 } 118 112 static inline void ___constructor__F_P4sFdli_autogen___1(struct Fdl *___dst__P4sFdl_1, int __f1__i_1){ … … 298 292 } 299 293 inline struct __anonymous4 ___operator_assign__F13s__anonymous4_P13s__anonymous413s__anonymous4_autogen___2(struct __anonymous4 *___dst__P13s__anonymous4_2, struct __anonymous4 ___src__13s__anonymous4_2){ 300 struct __anonymous4 ___ret__13s__anonymous4_2;301 294 ((void)((*___dst__P13s__anonymous4_2).__i__i_2=___src__13s__anonymous4_2.__i__i_2)); 302 ((void)___constructor__F_P13s__anonymous413s__anonymous4_autogen___2((&___ret__13s__anonymous4_2), ___src__13s__anonymous4_2)); 303 return ((struct __anonymous4 )___ret__13s__anonymous4_2); 295 return ((struct __anonymous4 )___src__13s__anonymous4_2); 304 296 } 305 297 inline void ___constructor__F_P13s__anonymous4i_autogen___2(struct __anonymous4 *___dst__P13s__anonymous4_2, int __i__i_2){ … … 318 310 } 319 311 inline enum __anonymous5 ___operator_assign__F13e__anonymous5_P13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__P13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){ 320 enum __anonymous5 ___ret__13e__anonymous5_2; 321 ((void)(___ret__13e__anonymous5_2=((*___dst__P13e__anonymous5_2)=___src__13e__anonymous5_2)) /* ?{} */); 322 return ((enum __anonymous5 )___ret__13e__anonymous5_2); 312 return ((enum __anonymous5 )((*___dst__P13e__anonymous5_2)=___src__13e__anonymous5_2)); 323 313 } 324 314 ((void)sizeof(enum __anonymous5 )); … … 348 338 } 349 339 static inline struct Vad ___operator_assign__F4sVad_P4sVad4sVad_autogen___1(struct Vad *___dst__P4sVad_1, struct Vad ___src__4sVad_1){ 350 struct Vad ___ret__4sVad_1; 351 ((void)___constructor__F_P4sVad4sVad_autogen___1((&___ret__4sVad_1), ___src__4sVad_1)); 352 return ((struct Vad )___ret__4sVad_1); 353 } 340 return ((struct Vad )___src__4sVad_1); 341 } -
src/tests/.expect/64/declarationSpecifier.txt
r3bd1eb4 rdbfb35d 30 30 } 31 31 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 32 struct __anonymous0 ___ret__13s__anonymous0_1;33 32 ((void)((*___dst__P13s__anonymous0_1).__i__i_1=___src__13s__anonymous0_1.__i__i_1)); 34 ((void)___constructor__F_P13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1)); 35 return ((struct __anonymous0 )___ret__13s__anonymous0_1); 33 return ((struct __anonymous0 )___src__13s__anonymous0_1); 36 34 } 37 35 static inline void ___constructor__F_P13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, int __i__i_1){ … … 56 54 } 57 55 static inline struct __anonymous1 ___operator_assign__F13s__anonymous1_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1){ 58 struct __anonymous1 ___ret__13s__anonymous1_1;59 56 ((void)((*___dst__P13s__anonymous1_1).__i__i_1=___src__13s__anonymous1_1.__i__i_1)); 60 ((void)___constructor__F_P13s__anonymous113s__anonymous1_autogen___1((&___ret__13s__anonymous1_1), ___src__13s__anonymous1_1)); 61 return ((struct __anonymous1 )___ret__13s__anonymous1_1); 57 return ((struct __anonymous1 )___src__13s__anonymous1_1); 62 58 } 63 59 static inline void ___constructor__F_P13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, int __i__i_1){ … … 82 78 } 83 79 static inline struct __anonymous2 ___operator_assign__F13s__anonymous2_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){ 84 struct __anonymous2 ___ret__13s__anonymous2_1;85 80 ((void)((*___dst__P13s__anonymous2_1).__i__i_1=___src__13s__anonymous2_1.__i__i_1)); 86 ((void)___constructor__F_P13s__anonymous213s__anonymous2_autogen___1((&___ret__13s__anonymous2_1), ___src__13s__anonymous2_1)); 87 return ((struct __anonymous2 )___ret__13s__anonymous2_1); 81 return ((struct __anonymous2 )___src__13s__anonymous2_1); 88 82 } 89 83 static inline void ___constructor__F_P13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, int __i__i_1){ … … 108 102 } 109 103 static inline struct __anonymous3 ___operator_assign__F13s__anonymous3_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1){ 110 struct __anonymous3 ___ret__13s__anonymous3_1;111 104 ((void)((*___dst__P13s__anonymous3_1).__i__i_1=___src__13s__anonymous3_1.__i__i_1)); 112 ((void)___constructor__F_P13s__anonymous313s__anonymous3_autogen___1((&___ret__13s__anonymous3_1), ___src__13s__anonymous3_1)); 113 return ((struct __anonymous3 )___ret__13s__anonymous3_1); 105 return ((struct __anonymous3 )___src__13s__anonymous3_1); 114 106 } 115 107 static inline void ___constructor__F_P13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, int __i__i_1){ … … 134 126 } 135 127 static inline struct __anonymous4 ___operator_assign__F13s__anonymous4_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1){ 136 struct __anonymous4 ___ret__13s__anonymous4_1;137 128 ((void)((*___dst__P13s__anonymous4_1).__i__i_1=___src__13s__anonymous4_1.__i__i_1)); 138 ((void)___constructor__F_P13s__anonymous413s__anonymous4_autogen___1((&___ret__13s__anonymous4_1), ___src__13s__anonymous4_1)); 139 return ((struct __anonymous4 )___ret__13s__anonymous4_1); 129 return ((struct __anonymous4 )___src__13s__anonymous4_1); 140 130 } 141 131 static inline void ___constructor__F_P13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, int __i__i_1){ … … 160 150 } 161 151 static inline struct __anonymous5 ___operator_assign__F13s__anonymous5_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1){ 162 struct __anonymous5 ___ret__13s__anonymous5_1;163 152 ((void)((*___dst__P13s__anonymous5_1).__i__i_1=___src__13s__anonymous5_1.__i__i_1)); 164 ((void)___constructor__F_P13s__anonymous513s__anonymous5_autogen___1((&___ret__13s__anonymous5_1), ___src__13s__anonymous5_1)); 165 return ((struct __anonymous5 )___ret__13s__anonymous5_1); 153 return ((struct __anonymous5 )___src__13s__anonymous5_1); 166 154 } 167 155 static inline void ___constructor__F_P13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, int __i__i_1){ … … 186 174 } 187 175 static inline struct __anonymous6 ___operator_assign__F13s__anonymous6_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1){ 188 struct __anonymous6 ___ret__13s__anonymous6_1;189 176 ((void)((*___dst__P13s__anonymous6_1).__i__i_1=___src__13s__anonymous6_1.__i__i_1)); 190 ((void)___constructor__F_P13s__anonymous613s__anonymous6_autogen___1((&___ret__13s__anonymous6_1), ___src__13s__anonymous6_1)); 191 return ((struct __anonymous6 )___ret__13s__anonymous6_1); 177 return ((struct __anonymous6 )___src__13s__anonymous6_1); 192 178 } 193 179 static inline void ___constructor__F_P13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, int __i__i_1){ … … 212 198 } 213 199 static inline struct __anonymous7 ___operator_assign__F13s__anonymous7_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1){ 214 struct __anonymous7 ___ret__13s__anonymous7_1;215 200 ((void)((*___dst__P13s__anonymous7_1).__i__i_1=___src__13s__anonymous7_1.__i__i_1)); 216 ((void)___constructor__F_P13s__anonymous713s__anonymous7_autogen___1((&___ret__13s__anonymous7_1), ___src__13s__anonymous7_1)); 217 return ((struct __anonymous7 )___ret__13s__anonymous7_1); 201 return ((struct __anonymous7 )___src__13s__anonymous7_1); 218 202 } 219 203 static inline void ___constructor__F_P13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, int __i__i_1){ … … 246 230 } 247 231 static inline struct __anonymous8 ___operator_assign__F13s__anonymous8_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1){ 248 struct __anonymous8 ___ret__13s__anonymous8_1;249 232 ((void)((*___dst__P13s__anonymous8_1).__i__s_1=___src__13s__anonymous8_1.__i__s_1)); 250 ((void)___constructor__F_P13s__anonymous813s__anonymous8_autogen___1((&___ret__13s__anonymous8_1), ___src__13s__anonymous8_1)); 251 return ((struct __anonymous8 )___ret__13s__anonymous8_1); 233 return ((struct __anonymous8 )___src__13s__anonymous8_1); 252 234 } 253 235 static inline void ___constructor__F_P13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, short __i__s_1){ … … 272 254 } 273 255 static inline struct __anonymous9 ___operator_assign__F13s__anonymous9_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1){ 274 struct __anonymous9 ___ret__13s__anonymous9_1;275 256 ((void)((*___dst__P13s__anonymous9_1).__i__s_1=___src__13s__anonymous9_1.__i__s_1)); 276 ((void)___constructor__F_P13s__anonymous913s__anonymous9_autogen___1((&___ret__13s__anonymous9_1), ___src__13s__anonymous9_1)); 277 return ((struct __anonymous9 )___ret__13s__anonymous9_1); 257 return ((struct __anonymous9 )___src__13s__anonymous9_1); 278 258 } 279 259 static inline void ___constructor__F_P13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, short __i__s_1){ … … 298 278 } 299 279 static inline struct __anonymous10 ___operator_assign__F14s__anonymous10_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1){ 300 struct __anonymous10 ___ret__14s__anonymous10_1;301 280 ((void)((*___dst__P14s__anonymous10_1).__i__s_1=___src__14s__anonymous10_1.__i__s_1)); 302 ((void)___constructor__F_P14s__anonymous1014s__anonymous10_autogen___1((&___ret__14s__anonymous10_1), ___src__14s__anonymous10_1)); 303 return ((struct __anonymous10 )___ret__14s__anonymous10_1); 281 return ((struct __anonymous10 )___src__14s__anonymous10_1); 304 282 } 305 283 static inline void ___constructor__F_P14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, short __i__s_1){ … … 324 302 } 325 303 static inline struct __anonymous11 ___operator_assign__F14s__anonymous11_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1){ 326 struct __anonymous11 ___ret__14s__anonymous11_1;327 304 ((void)((*___dst__P14s__anonymous11_1).__i__s_1=___src__14s__anonymous11_1.__i__s_1)); 328 ((void)___constructor__F_P14s__anonymous1114s__anonymous11_autogen___1((&___ret__14s__anonymous11_1), ___src__14s__anonymous11_1)); 329 return ((struct __anonymous11 )___ret__14s__anonymous11_1); 305 return ((struct __anonymous11 )___src__14s__anonymous11_1); 330 306 } 331 307 static inline void ___constructor__F_P14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, short __i__s_1){ … … 350 326 } 351 327 static inline struct __anonymous12 ___operator_assign__F14s__anonymous12_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1){ 352 struct __anonymous12 ___ret__14s__anonymous12_1;353 328 ((void)((*___dst__P14s__anonymous12_1).__i__s_1=___src__14s__anonymous12_1.__i__s_1)); 354 ((void)___constructor__F_P14s__anonymous1214s__anonymous12_autogen___1((&___ret__14s__anonymous12_1), ___src__14s__anonymous12_1)); 355 return ((struct __anonymous12 )___ret__14s__anonymous12_1); 329 return ((struct __anonymous12 )___src__14s__anonymous12_1); 356 330 } 357 331 static inline void ___constructor__F_P14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, short __i__s_1){ … … 376 350 } 377 351 static inline struct __anonymous13 ___operator_assign__F14s__anonymous13_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1){ 378 struct __anonymous13 ___ret__14s__anonymous13_1;379 352 ((void)((*___dst__P14s__anonymous13_1).__i__s_1=___src__14s__anonymous13_1.__i__s_1)); 380 ((void)___constructor__F_P14s__anonymous1314s__anonymous13_autogen___1((&___ret__14s__anonymous13_1), ___src__14s__anonymous13_1)); 381 return ((struct __anonymous13 )___ret__14s__anonymous13_1); 353 return ((struct __anonymous13 )___src__14s__anonymous13_1); 382 354 } 383 355 static inline void ___constructor__F_P14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, short __i__s_1){ … … 402 374 } 403 375 static inline struct __anonymous14 ___operator_assign__F14s__anonymous14_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1){ 404 struct __anonymous14 ___ret__14s__anonymous14_1;405 376 ((void)((*___dst__P14s__anonymous14_1).__i__s_1=___src__14s__anonymous14_1.__i__s_1)); 406 ((void)___constructor__F_P14s__anonymous1414s__anonymous14_autogen___1((&___ret__14s__anonymous14_1), ___src__14s__anonymous14_1)); 407 return ((struct __anonymous14 )___ret__14s__anonymous14_1); 377 return ((struct __anonymous14 )___src__14s__anonymous14_1); 408 378 } 409 379 static inline void ___constructor__F_P14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, short __i__s_1){ … … 428 398 } 429 399 static inline struct __anonymous15 ___operator_assign__F14s__anonymous15_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1){ 430 struct __anonymous15 ___ret__14s__anonymous15_1;431 400 ((void)((*___dst__P14s__anonymous15_1).__i__s_1=___src__14s__anonymous15_1.__i__s_1)); 432 ((void)___constructor__F_P14s__anonymous1514s__anonymous15_autogen___1((&___ret__14s__anonymous15_1), ___src__14s__anonymous15_1)); 433 return ((struct __anonymous15 )___ret__14s__anonymous15_1); 401 return ((struct __anonymous15 )___src__14s__anonymous15_1); 434 402 } 435 403 static inline void ___constructor__F_P14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, short __i__s_1){ … … 470 438 } 471 439 static inline struct __anonymous16 ___operator_assign__F14s__anonymous16_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1){ 472 struct __anonymous16 ___ret__14s__anonymous16_1;473 440 ((void)((*___dst__P14s__anonymous16_1).__i__i_1=___src__14s__anonymous16_1.__i__i_1)); 474 ((void)___constructor__F_P14s__anonymous1614s__anonymous16_autogen___1((&___ret__14s__anonymous16_1), ___src__14s__anonymous16_1)); 475 return ((struct __anonymous16 )___ret__14s__anonymous16_1); 441 return ((struct __anonymous16 )___src__14s__anonymous16_1); 476 442 } 477 443 static inline void ___constructor__F_P14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, int __i__i_1){ … … 496 462 } 497 463 static inline struct __anonymous17 ___operator_assign__F14s__anonymous17_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1){ 498 struct __anonymous17 ___ret__14s__anonymous17_1;499 464 ((void)((*___dst__P14s__anonymous17_1).__i__i_1=___src__14s__anonymous17_1.__i__i_1)); 500 ((void)___constructor__F_P14s__anonymous1714s__anonymous17_autogen___1((&___ret__14s__anonymous17_1), ___src__14s__anonymous17_1)); 501 return ((struct __anonymous17 )___ret__14s__anonymous17_1); 465 return ((struct __anonymous17 )___src__14s__anonymous17_1); 502 466 } 503 467 static inline void ___constructor__F_P14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, int __i__i_1){ … … 522 486 } 523 487 static inline struct __anonymous18 ___operator_assign__F14s__anonymous18_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1){ 524 struct __anonymous18 ___ret__14s__anonymous18_1;525 488 ((void)((*___dst__P14s__anonymous18_1).__i__i_1=___src__14s__anonymous18_1.__i__i_1)); 526 ((void)___constructor__F_P14s__anonymous1814s__anonymous18_autogen___1((&___ret__14s__anonymous18_1), ___src__14s__anonymous18_1)); 527 return ((struct __anonymous18 )___ret__14s__anonymous18_1); 489 return ((struct __anonymous18 )___src__14s__anonymous18_1); 528 490 } 529 491 static inline void ___constructor__F_P14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, int __i__i_1){ … … 548 510 } 549 511 static inline struct __anonymous19 ___operator_assign__F14s__anonymous19_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1){ 550 struct __anonymous19 ___ret__14s__anonymous19_1;551 512 ((void)((*___dst__P14s__anonymous19_1).__i__i_1=___src__14s__anonymous19_1.__i__i_1)); 552 ((void)___constructor__F_P14s__anonymous1914s__anonymous19_autogen___1((&___ret__14s__anonymous19_1), ___src__14s__anonymous19_1)); 553 return ((struct __anonymous19 )___ret__14s__anonymous19_1); 513 return ((struct __anonymous19 )___src__14s__anonymous19_1); 554 514 } 555 515 static inline void ___constructor__F_P14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, int __i__i_1){ … … 574 534 } 575 535 static inline struct __anonymous20 ___operator_assign__F14s__anonymous20_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1){ 576 struct __anonymous20 ___ret__14s__anonymous20_1;577 536 ((void)((*___dst__P14s__anonymous20_1).__i__i_1=___src__14s__anonymous20_1.__i__i_1)); 578 ((void)___constructor__F_P14s__anonymous2014s__anonymous20_autogen___1((&___ret__14s__anonymous20_1), ___src__14s__anonymous20_1)); 579 return ((struct __anonymous20 )___ret__14s__anonymous20_1); 537 return ((struct __anonymous20 )___src__14s__anonymous20_1); 580 538 } 581 539 static inline void ___constructor__F_P14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, int __i__i_1){ … … 600 558 } 601 559 static inline struct __anonymous21 ___operator_assign__F14s__anonymous21_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1){ 602 struct __anonymous21 ___ret__14s__anonymous21_1;603 560 ((void)((*___dst__P14s__anonymous21_1).__i__i_1=___src__14s__anonymous21_1.__i__i_1)); 604 ((void)___constructor__F_P14s__anonymous2114s__anonymous21_autogen___1((&___ret__14s__anonymous21_1), ___src__14s__anonymous21_1)); 605 return ((struct __anonymous21 )___ret__14s__anonymous21_1); 561 return ((struct __anonymous21 )___src__14s__anonymous21_1); 606 562 } 607 563 static inline void ___constructor__F_P14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, int __i__i_1){ … … 626 582 } 627 583 static inline struct __anonymous22 ___operator_assign__F14s__anonymous22_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1){ 628 struct __anonymous22 ___ret__14s__anonymous22_1;629 584 ((void)((*___dst__P14s__anonymous22_1).__i__i_1=___src__14s__anonymous22_1.__i__i_1)); 630 ((void)___constructor__F_P14s__anonymous2214s__anonymous22_autogen___1((&___ret__14s__anonymous22_1), ___src__14s__anonymous22_1)); 631 return ((struct __anonymous22 )___ret__14s__anonymous22_1); 585 return ((struct __anonymous22 )___src__14s__anonymous22_1); 632 586 } 633 587 static inline void ___constructor__F_P14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, int __i__i_1){ … … 652 606 } 653 607 static inline struct __anonymous23 ___operator_assign__F14s__anonymous23_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1){ 654 struct __anonymous23 ___ret__14s__anonymous23_1;655 608 ((void)((*___dst__P14s__anonymous23_1).__i__i_1=___src__14s__anonymous23_1.__i__i_1)); 656 ((void)___constructor__F_P14s__anonymous2314s__anonymous23_autogen___1((&___ret__14s__anonymous23_1), ___src__14s__anonymous23_1)); 657 return ((struct __anonymous23 )___ret__14s__anonymous23_1); 609 return ((struct __anonymous23 )___src__14s__anonymous23_1); 658 610 } 659 611 static inline void ___constructor__F_P14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, int __i__i_1){ -
src/tests/.expect/64/extension.txt
r3bd1eb4 rdbfb35d 33 33 } 34 34 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 35 struct S ___ret__2sS_1;36 35 ((void)((*___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1)); 37 36 ((void)((*___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1)); 38 37 ((void)((*___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1)); 39 ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1)); 40 return ((struct S )___ret__2sS_1); 38 return ((struct S )___src__2sS_1); 41 39 } 42 40 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __a__i_1){ … … 68 66 } 69 67 static inline union U ___operator_assign__F2uU_P2uU2uU_autogen___1(union U *___dst__P2uU_1, union U ___src__2uU_1){ 70 union U ___ret__2uU_1;71 68 ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U ))); 72 ((void)___constructor__F_P2uU2uU_autogen___1((&___ret__2uU_1), ___src__2uU_1)); 73 return ((union U )___ret__2uU_1); 69 return ((union U )___src__2uU_1); 74 70 } 75 71 static inline void ___constructor__F_P2uUi_autogen___1(union U *___dst__P2uU_1, int __src__i_1){ -
src/tests/.expect/64/gccExtensions.txt
r3bd1eb4 rdbfb35d 59 59 } 60 60 inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___2(struct S *___dst__P2sS_2, struct S ___src__2sS_2){ 61 struct S ___ret__2sS_2;62 61 ((void)((*___dst__P2sS_2).__a__i_2=___src__2sS_2.__a__i_2)); 63 62 ((void)((*___dst__P2sS_2).__b__i_2=___src__2sS_2.__b__i_2)); 64 63 ((void)((*___dst__P2sS_2).__c__i_2=___src__2sS_2.__c__i_2)); 65 ((void)___constructor__F_P2sS2sS_autogen___2((&___ret__2sS_2), ___src__2sS_2)); 66 return ((struct S )___ret__2sS_2); 64 return ((struct S )___src__2sS_2); 67 65 } 68 66 inline void ___constructor__F_P2sSi_autogen___2(struct S *___dst__P2sS_2, int __a__i_2){ … … 111 109 } 112 110 inline struct s2 ___operator_assign__F3ss2_P3ss23ss2_autogen___2(struct s2 *___dst__P3ss2_2, struct s2 ___src__3ss2_2){ 113 struct s2 ___ret__3ss2_2;114 111 ((void)((*___dst__P3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2)); 115 ((void)___constructor__F_P3ss23ss2_autogen___2((&___ret__3ss2_2), ___src__3ss2_2)); 116 return ((struct s2 )___ret__3ss2_2); 112 return ((struct s2 )___src__3ss2_2); 117 113 } 118 114 inline void ___constructor__F_P3ss2i_autogen___2(struct s2 *___dst__P3ss2_2, int __i__i_2){ … … 132 128 } 133 129 inline struct s3 ___operator_assign__F3ss3_P3ss33ss3_autogen___2(struct s3 *___dst__P3ss3_2, struct s3 ___src__3ss3_2){ 134 struct s3 ___ret__3ss3_2;135 130 ((void)((*___dst__P3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2)); 136 ((void)___constructor__F_P3ss33ss3_autogen___2((&___ret__3ss3_2), ___src__3ss3_2)); 137 return ((struct s3 )___ret__3ss3_2); 131 return ((struct s3 )___src__3ss3_2); 138 132 } 139 133 inline void ___constructor__F_P3ss3i_autogen___2(struct s3 *___dst__P3ss3_2, int __i__i_2){ … … 155 149 } 156 150 inline struct s4 ___operator_assign__F3ss4_P3ss43ss4_autogen___2(struct s4 *___dst__P3ss4_2, struct s4 ___src__3ss4_2){ 157 struct s4 ___ret__3ss4_2;158 151 ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2)); 159 ((void)___constructor__F_P3ss43ss4_autogen___2((&___ret__3ss4_2), ___src__3ss4_2)); 160 return ((struct s4 )___ret__3ss4_2); 152 return ((struct s4 )___src__3ss4_2); 161 153 } 162 154 inline void ___constructor__F_P3ss4i_autogen___2(struct s4 *___dst__P3ss4_2, int __i__i_2){ -
src/tests/.expect/concurrent/sched-int-wait.txt
r3bd1eb4 rdbfb35d 1 Starting2 Done -
src/tests/.expect/memberCtors-ERR1.txt
r3bd1eb4 rdbfb35d 1 memberCtors.c: 71error: in void ?{}(B *b), field a2 used before being constructed1 memberCtors.c:62 error: in void ?{}(B *b), field a2 used before being constructed -
src/tests/.expect/memberCtors.txt
r3bd1eb4 rdbfb35d 16 16 assigning int: 0 0 17 17 end construct A 18 copy constructing int: 019 copy constructing int: 020 begin copy construct A21 copy construct this->x22 copy constructing int: 100123 assign this->y24 copy constructing int: 025 destructing int: 026 destructing int: 027 end copy construct A28 begin ?=? A29 copy constructing int: 100130 destructing int: 100131 destructing int: 100132 copy constructing int: 033 destructing int: 034 destructing int: 035 copy constructing int: 036 destructing int: 037 destructing int: 038 end ?=? A39 copy constructing int: 040 copy constructing int: 041 begin copy construct A42 copy construct this->x43 copy constructing int: 100144 assign this->y45 copy constructing int: 046 destructing int: 047 destructing int: 048 end copy construct A49 destructing int: 050 destructing int: 051 destructing int: 100152 destructing int: 053 destructing int: 054 destructing int: 100155 18 construct b->a1 56 19 constructing int … … 73 36 copy constructing int: 1000 74 37 assign this->y 75 copy constructing int: 076 destructing int: 077 destructing int: 078 38 end copy construct A 79 39 copy constructing int: 0 … … 83 43 copy constructing int: 1001 84 44 assign this->y 85 copy constructing int: 086 destructing int: 087 destructing int: 088 45 end copy construct A 89 46 copy constructing int: 0 … … 93 50 copy constructing int: 0 94 51 assign this->y 95 copy constructing int: 096 destructing int: 097 destructing int: 098 52 end copy construct A 99 53 End of main … … 106 60 assigning int: 0 0 107 61 end construct A 108 copy constructing int: 0109 copy constructing int: 0110 begin copy construct A111 copy construct this->x112 copy constructing int: 999113 assign this->y114 copy constructing int: 0115 destructing int: 0116 destructing int: 0117 end copy construct A118 begin ?=? A119 copy constructing int: 999120 destructing int: 999121 destructing int: 999122 copy constructing int: 0123 destructing int: 0124 destructing int: 0125 copy constructing int: 0126 destructing int: 0127 destructing int: 0128 end ?=? A129 copy constructing int: 0130 copy constructing int: 0131 begin copy construct A132 copy construct this->x133 copy constructing int: 999134 assign this->y135 copy constructing int: 0136 destructing int: 0137 destructing int: 0138 end copy construct A139 destructing int: 0140 destructing int: 0141 destructing int: 999142 destructing int: 0143 destructing int: 0144 destructing int: 999145 62 destructing int: 0 146 63 destructing int: 0 … … 163 80 assigning int: 0 0 164 81 end construct A 165 copy constructing int: 0166 copy constructing int: 0167 begin copy construct A168 copy construct this->x169 copy constructing int: 999170 assign this->y171 copy constructing int: 0172 destructing int: 0173 destructing int: 0174 end copy construct A175 begin ?=? A176 copy constructing int: 999177 destructing int: 999178 destructing int: 999179 copy constructing int: 0180 destructing int: 0181 destructing int: 0182 copy constructing int: 0183 destructing int: 0184 destructing int: 0185 end ?=? A186 copy constructing int: 0187 copy constructing int: 0188 begin copy construct A189 copy construct this->x190 copy constructing int: 999191 assign this->y192 copy constructing int: 0193 destructing int: 0194 destructing int: 0195 end copy construct A196 destructing int: 0197 destructing int: 0198 destructing int: 999199 destructing int: 0200 destructing int: 0201 destructing int: 999202 82 destructing int: 0 203 83 destructing int: 0 -
src/tests/.expect/rational.txt
r3bd1eb4 rdbfb35d 17 17 3/1 18 18 4/3 19 conversion 20 0.75 21 0.142857142857143 22 3.14159292035398 23 3/4 24 1/7 25 355/113 19 26 decompose 20 27 more tests -
src/tests/Makefile.am
r3bd1eb4 rdbfb35d 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Sun May 14 14:43:48201714 ## Update Count : 4 213 ## Last Modified On : Thu Feb 16 15:27:50 2017 14 ## Update Count : 41 15 15 ############################################################################### 16 16 17 17 debug=yes 18 18 19 quick_test=vector_test avl_test operators numericConstants expression enum array typeof cast dtor-early-exit init_once attributes19 quick_test=vector_test avl_test operators numericConstants expression enum array typeof cast dtor-early-exit init_once 20 20 21 21 if BUILD_CONCURRENCY … … 30 30 # applies to both programs 31 31 EXTRA_FLAGS = 32 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet@CFA_FLAGS@ ${EXTRA_FLAGS}32 BUILD_FLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS} 33 33 TEST_FLAGS = $(if $(test), 2> .err/${@}.log, ) 34 34 CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS} … … 76 76 77 77 declarationSpecifier: declarationSpecifier.c 78 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L${<} -o ${@}78 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 79 79 80 80 gccExtensions : gccExtensions.c 81 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L${<} -o ${@}81 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 82 82 83 83 extension : extension.c 84 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L${<} -o ${@}84 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 85 85 86 86 attributes : attributes.c 87 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L${<} -o ${@}87 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 88 88 89 89 KRfunctions : KRfunctions.c 90 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 91 92 gmp : gmp.c 93 ${CC} ${CFLAGS} -lgmp ${<} -o ${@} 90 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 94 91 95 92 memberCtors-ERR1: memberCtors.c -
src/tests/Makefile.in
r3bd1eb4 rdbfb35d 226 226 quick_test = vector_test avl_test operators numericConstants \ 227 227 expression enum array typeof cast dtor-early-exit init_once \ 228 attributes$(am__append_1)228 $(am__append_1) 229 229 @BUILD_CONCURRENCY_FALSE@concurrent = no 230 230 @BUILD_CONCURRENCY_TRUE@concurrent = yes … … 234 234 # applies to both programs 235 235 EXTRA_FLAGS = 236 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet@CFA_FLAGS@ ${EXTRA_FLAGS}236 BUILD_FLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS} 237 237 TEST_FLAGS = $(if $(test), 2> .err/${@}.log, ) 238 238 fstream_test_SOURCES = fstream_test.c … … 695 695 696 696 declarationSpecifier: declarationSpecifier.c 697 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L${<} -o ${@}697 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 698 698 699 699 gccExtensions : gccExtensions.c 700 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L${<} -o ${@}700 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 701 701 702 702 extension : extension.c 703 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L${<} -o ${@}703 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 704 704 705 705 attributes : attributes.c 706 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L${<} -o ${@}706 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 707 707 708 708 KRfunctions : KRfunctions.c 709 ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@} 710 711 gmp : gmp.c 712 ${CC} ${CFLAGS} -lgmp ${<} -o ${@} 709 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 713 710 714 711 memberCtors-ERR1: memberCtors.c -
src/tests/memberCtors.c
r3bd1eb4 rdbfb35d 53 53 } // z never constructed - will be automatically copy constructed 54 54 55 A ?=?(A * this, A other) {56 printf("begin ?=? A\n");57 this->x = other.x;58 this->y = other.y;59 this->z = other.z;60 printf("end ?=? A\n");61 return *this;62 }63 64 55 struct B { 65 56 A a1, a2, a3; -
src/tests/rational.c
r3bd1eb4 rdbfb35d 10 10 // Created On : Mon Mar 28 08:43:12 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 14 18:10:28201713 // Update Count : 5712 // Last Modified On : Tue May 2 22:11:05 2017 13 // Update Count : 41 14 14 // 15 15 16 #include <limits> 16 17 #include <rational> 17 #include <limits>18 #include <stdlib>19 18 #include <fstream> 20 21 // UNNECESSARY, FIX ME22 void ?{}( int * this ) { *this = 0; }23 void ?{}( int * this, zero_t ) { *this = 0; }24 void ?{}( int * this, one_t ) { *this = 1; }25 19 26 20 int main() { 27 21 sout | "constructor" | endl; 28 Rational (int)a = { 3 }, b = { 4 }, c;22 Rational a = { 3 }, b = { 4 }, c; 29 23 sout | a | b | c | endl; 30 31 a = (Rational(int)){ 4, 8 }; 32 b = (Rational(int)){ 5, 7 }; 24 a = (Rational){ 4, 8 }; 25 b = (Rational){ 5, 7 }; 33 26 sout | a | b | endl; 34 a = (Rational (int)){ -2, -3 };35 b = (Rational (int)){ 3, -2 };27 a = (Rational){ -2, -3 }; 28 b = (Rational){ 3, -2 }; 36 29 sout | a | b | endl; 37 a = (Rational (int)){ -2, 3 };38 b = (Rational (int)){ 3, 2 };30 a = (Rational){ -2, 3 }; 31 b = (Rational){ 3, 2 }; 39 32 sout | a | b | endl; 40 33 41 34 sout | "logical" | endl; 42 a = (Rational (int)){ -2 };43 b = (Rational (int)){ -3, 2 };35 a = (Rational){ -2 }; 36 b = (Rational){ -3, 2 }; 44 37 sout | a | b | endl; 45 38 // sout | a == 1 | endl; // FIX ME … … 57 50 sout | a / b | endl; 58 51 59 //sout | "conversion" | endl;60 // a = (Rational(int)){ 3, 4 };61 //sout | widen( a ) | endl;62 // a = (Rational(int)){ 1, 7 };63 //sout | widen( a ) | endl;64 // a = (Rational(int)){ 355, 113 };65 //sout | widen( a ) | endl;66 //sout | narrow( 0.75, 4 ) | endl;67 //sout | narrow( 0.14285714285714, 16 ) | endl;68 //sout | narrow( 3.14159265358979, 256 ) | endl;52 sout | "conversion" | endl; 53 a = (Rational){ 3, 4 }; 54 sout | widen( a ) | endl; 55 a = (Rational){ 1, 7 }; 56 sout | widen( a ) | endl; 57 a = (Rational){ 355, 113 }; 58 sout | widen( a ) | endl; 59 sout | narrow( 0.75, 4 ) | endl; 60 sout | narrow( 0.14285714285714, 16 ) | endl; 61 sout | narrow( 3.14159265358979, 256 ) | endl; 69 62 70 63 sout | "decompose" | endl; 71 intn, d;64 RationalImpl n, d; 72 65 // [n, d] = a; 73 66 // sout | a | n | d | endl; 74 67 75 68 sout | "more tests" | endl; 76 Rational (int)x = { 1, 2 }, y = { 2 };69 Rational x = { 1, 2 }, y = { 2 }; 77 70 sout | x - y | endl; 78 71 sout | x > y | endl; … … 80 73 sout | y | denominator( y, -2 ) | y | endl; 81 74 82 Rational (int)z = { 0, 5 };75 Rational z = { 0, 5 }; 83 76 sout | z | endl; 84 77 85 78 sout | x | numerator( x, 0 ) | x | endl; 86 79 87 x = (Rational (int)){ 1, MAX } + (Rational(int)){ 1, MAX };80 x = (Rational){ 1, MAX } + (Rational){ 1, MAX }; 88 81 sout | x | endl; 89 x = (Rational (int)){ 3, MAX } + (Rational(int)){ 2, MAX };82 x = (Rational){ 3, MAX } + (Rational){ 2, MAX }; 90 83 sout | x | endl; 91 84 -
src/tests/sched-int-wait.c
r3bd1eb4 rdbfb35d 113 113 waiter_left = 4; 114 114 processor p; 115 sout | "Starting" | endl;116 115 { 117 116 Signaler e; … … 123 122 } 124 123 } 125 sout | "Done" | endl;126 124 } -
src/tests/test.py
r3bd1eb4 rdbfb35d 24 24 self.name, self.path = name, path 25 25 26 class TestResult:27 SUCCESS = 028 FAILURE = 129 TIMEOUT = 12430 31 26 # parses the Makefile to find the machine type (32-bit / 64-bit) 32 27 def getMachineType(): 33 28 sh('echo "void ?{}(int*a,int b){}int main(){return 0;}" > .dummy.c') 34 29 ret, out = sh("make .dummy -s", print2stdout=True) 35 30 36 31 if ret != 0: 37 32 print("Failed to identify architecture:") … … 166 161 167 162 # build, skipping to next test on error 168 make_ret, _ = sh("""%s test=yes EXTRA_FLAGS="%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run) 169 170 retcode = 0 171 error = None 163 make_ret, _ = sh("""%s test=yes EXTRA_FLAGS="-quiet %s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run) 172 164 173 165 # if the make command succeds continue otherwise skip to diff … … 178 170 if fileIsExecutable(test.name) : 179 171 # run test 180 retcode, _ = sh("timeout 60./%s %s > %s 2>&1" % (test.name, stdinput, out_file), dry_run)172 sh("./%s %s > %s 2>&1" % (test.name, stdinput, out_file), dry_run) 181 173 else : 182 174 # simply cat the result into the output … … 187 179 sh("mv %s %s" % (err_file, out_file), dry_run) 188 180 189 if retcode == 0: 190 if generate : 191 # if we are ounly generating the output we still need to check that the test actually exists 192 if not dry_run and fileContainsOnly(out_file, "make: *** No rule to make target `%s'. Stop." % test.name) : 193 retcode = 1; 194 error = "\t\tNo make target for test %s!" % test.name 195 sh("rm %s" % out_file, False) 196 else : 197 # fetch return code and error from the diff command 198 retcode, error = diff(".expect/%s.txt" % test.path, ".out/%s.log" % test.name, dry_run) 181 retcode = 0 182 error = None 183 184 if generate : 185 # if we are ounly generating the output we still need to check that the test actually exists 186 if not dry_run and fileContainsOnly(out_file, "make: *** No rule to make target `%s'. Stop." % test.name) : 187 retcode = 1; 188 error = "\t\tNo make target for test %s!" % test.name 189 sh("rm %s" % out_file, False) 190 191 else : 192 # fetch return code and error from the diff command 193 retcode, error = diff(".expect/%s.txt" % test.path, ".out/%s.log" % test.name, dry_run) 194 199 195 # clean the executable 200 196 sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run) … … 209 205 name_txt = "%20s " % t.name 210 206 211 retcode, error = run_single_test(t, generate, dry_run, debug) 207 #run the test instance and collect the result 208 test_failed, error = run_single_test(t, generate, dry_run, debug) 212 209 213 210 # update output based on current action 214 211 if generate : 215 if retcode == TestResult.SUCCESS: result_txt = "Done" 216 elif retcode == TestResult.TIMEOUT: result_txt = "TIMEOUT" 217 else : result_txt = "ERROR" 218 else : 219 if retcode == TestResult.SUCCESS: result_txt = "PASSED" 220 elif retcode == TestResult.TIMEOUT: result_txt = "TIMEOUT" 221 else : result_txt = "FAILED" 212 failed_txt = "ERROR" 213 success_txt = "Done" 214 else : 215 failed_txt = "FAILED" 216 success_txt = "PASSED" 222 217 223 218 #print result with error if needed 224 text = name_txt + result_txt219 text = name_txt + (failed_txt if test_failed else success_txt) 225 220 out = sys.stdout 226 221 if error : … … 228 223 out = sys.stderr 229 224 230 print(text, file = out) 225 print(text, file = out); 231 226 sys.stdout.flush() 232 227 sys.stderr.flush() 233 228 signal.signal(signal.SIGINT, signal.SIG_IGN) 234 229 235 return retcode != TestResult.SUCCESS230 return test_failed 236 231 237 232 # run the given list of tests with the given parameters … … 274 269 if __name__ == "__main__": 275 270 #always run from same folder 276 chdir() 277 271 chdir() 272 278 273 # parse the command line arguments 279 274 options = getOptions()
Note:
See TracChangeset
for help on using the changeset viewer.