Changeset 3bd1eb4


Ignore:
Timestamp:
May 15, 2017, 3:27:47 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
db0fa7c
Parents:
dbfb35d (diff), 9ff8310 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
14 added
2 deleted
46 edited

Legend:

Unmodified
Added
Removed
  • Jenkins/FullBuild

    rdbfb35d r3bd1eb4  
    161161"""
    162162
    163         def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
     163        def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com, ajbeach@edu.uwaterloo.ca"
    164164
    165165        //send email notification
  • Jenkinsfile

    rdbfb35d r3bd1eb4  
    153153        do_sendemail    = ! (pSilent == 'true')
    154154
    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})
     156Architecture            : ${arch_name}
     157Arc Flags               : ${architecture}
     158Run All Tests           : ${ pRunAllTests.toString() }
     159Run Benchmark           : ${ pRunBenchmark.toString() }
     160Build Documentation     : ${ pBuildDocumentation.toString() }
     161Publish                 : ${ pPublish.toString() }
     162Silent                  : ${ pSilent.toString() }
    163163"""
    164164
  • doc/LaTeXmacros/common.tex

    rdbfb35d r3bd1eb4  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Tue Apr 18 17:16:13 2017
    14 %% Update Count     : 270
     13%% Last Modified On : Sun May 14 18:17:09 2017
     14%% Update Count     : 295
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    3636% Names used in the document.
    3737
    38 \newcommand{\CFA}{C$\mathbf\forall$\xspace} % Cforall symbolic name
     38\newcommand{\CFA}{C\raisebox{\depth}{\rotatebox{180}{\textscale{1.05}{\textsf{A}}}}\xspace} % Cforall symbolic name
    3939\newcommand{\CFL}{Cforall\xspace} % Cforall symbolic name
     40\newcommand{\Celeven}{C11\xspace} % C11 symbolic name
    4041\newcommand{\CC}{\rm C\kern-.1em\hbox{+\kern-.25em+}\xspace} % C++ symbolic name
    4142\newcommand{\CCeleven}{\rm C\kern-.1em\hbox{+\kern-.25em+}11\xspace} % C++11 symbolic name
     
    4344\newcommand{\CCseventeen}{\rm C\kern-.1em\hbox{+\kern-.25em+}17\xspace} % C++17 symbolic name
    4445\newcommand{\CCtwenty}{\rm C\kern-.1em\hbox{+\kern-.25em+}20\xspace} % C++20 symbolic name
    45 \newcommand{\Celeven}{C11\xspace} % C11 symbolic name
    4646\newcommand{\Csharp}{C\raisebox{-0.7ex}{\Large$^\sharp$}\xspace} % C# symbolic name
    4747
     
    6767\usepackage{pslatex}                                    % reduce size of san serif font
    6868\usepackage{relsize}                                    % must be after change to small or selects old size
     69\usepackage{rotating}
    6970
    7071% reduce size of chapter/section titles
     
    9798\newcommand{\italic}[1]{\emph{\hyperpage{#1}}}
    9899\newcommand{\definition}[1]{\textbf{\hyperpage{#1}}}
    99 \newcommand{\see}[1]{\emph{see} #1}
     100\newcommand{\see}[1]{\emph{see}~#1}
    100101
    101102% Define some commands that produce formatted index entries suitable for cross-references.
     
    221222}%
    222223
    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 }%
     224\usepackage{lstlang}
    257225
    258226\newcommand{\CFADefaults}{%
     
    292260{}
    293261
    294 
    295262% Local Variables: %
    296263% tab-width: 4 %
  • doc/generic_types/generic_types.tex

    rdbfb35d r3bd1eb4  
    66\usepackage{upquote}                                                                    % switch curled `'" to straight
    77\usepackage{listings}                                                                   % format program code
     8\usepackage{rotating}
    89\usepackage[usenames]{color}
    910
     
    4849
    4950% Useful macros
    50 \newcommand{\CFA}{C$\mathbf\forall$\xspace} % Cforall symbolic name
     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
    5153\newcommand{\CC}{\rm C\kern-.1em\hbox{+\kern-.25em+}\xspace} % C++ symbolic name
    5254\newcommand{\CCeleven}{\rm C\kern-.1em\hbox{+\kern-.25em+}11\xspace} % C++11 symbolic name
     
    9799\acmJournal{PACMPL}
    98100
    99 \title{Generic and Tuple Types with Efficient Dynamic Layout in \CFA}
     101\title{Generic and Tuple Types with Efficient Dynamic Layout in \protect\CFA}
    100102
    101103\author{Aaron Moss}
     
    197199\label{sec:poly-fns}
    198200
    199 \CFA's polymorphism was originally formalized by \citet{Ditchfield92}, and first implemented by \citet{Bilson03}.
     201\CFA{}\hspace{1pt}'s polymorphism was originally formalized by \citet{Ditchfield92}, and first implemented by \citet{Bilson03}.
    200202The 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):
    201203\begin{lstlisting}
     
    950952}
    951953\end{lstlisting}
    952 \caption{\CFA Benchmark Test}
     954\caption{\protect\CFA Benchmark Test}
    953955\label{fig:BenchmarkTest}
    954956\end{figure}
     
    10201022While \CC provides good backwards compatibility with C, it has a steep learning curve for many of its extensions.
    10211023For example, polymorphism is provided via three disjoint mechanisms: overloading, inheritance, and templates.
    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.
     1024The overloading is restricted because resolution does not use 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.
    10231025In 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.
    10241026The 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 100755 to 100644
  • doc/user/Makefile

    rdbfb35d r3bd1eb4  
    4747
    4848${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \
    49                 ../LaTeXmacros/common.tex ../LaTeXmacros/indexstyle ../bibliography/cfa.bib
     49                ../LaTeXmacros/common.tex ../LaTeXmacros/lstlang.sty ../LaTeXmacros/indexstyle ../bibliography/cfa.bib
    5050        # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run.
    5151        if [ ! -r ${basename $@}.ind ] ; then touch ${basename $@}.ind ; fi
  • src/CodeGen/CodeGenerator.cc

    rdbfb35d r3bd1eb4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tus May  9 16:50:00 2017
     12// Last Modified On : Wed May 10 14:45:00 2017
    1313// Update Count     : 484
    1414//
     
    4141namespace CodeGen {
    4242        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         }
    5643
    5744        // the kinds of statements that would ideally be followed by whitespace
     
    10289        }
    10390
    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 ) {}
     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 ) {}
    105114
    106115        CodeGenerator::CodeGenerator( std::ostream & os, std::string init, int indentation, bool infunp )
     
    143152        // *** Declarations
    144153        void CodeGenerator::visit( FunctionDecl * functionDecl ) {
    145                 output << lineDirective( functionDecl );
    146 
    147154                extension( functionDecl );
    148155                genAttributes( functionDecl->get_attributes() );
     
    168175                }
    169176
    170                 output << lineDirective( objectDecl );
    171 
    172177                extension( objectDecl );
    173178                genAttributes( objectDecl->get_attributes() );
     
    221226
    222227        void CodeGenerator::visit( StructDecl * structDecl ) {
    223                 output << lineDirective( structDecl );
    224 
    225228                extension( structDecl );
    226229                handleAggregate( structDecl, "struct " );
     
    228231
    229232        void CodeGenerator::visit( UnionDecl * unionDecl ) {
    230                 output << lineDirective( unionDecl );
    231 
    232233                extension( unionDecl );
    233234                handleAggregate( unionDecl, "union " );
     
    708709        void CodeGenerator::visit( UntypedTupleExpr * tupleExpr ) {
    709710                assertf( ! genC, "UntypedTupleExpr should not reach code generation." );
     711                extension( tupleExpr );
    710712                output << "[";
    711713                genCommaList( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end() );
     
    715717        void CodeGenerator::visit( TupleExpr * tupleExpr ) {
    716718                assertf( ! genC, "TupleExpr should not reach code generation." );
     719                extension( tupleExpr );
    717720                output << "[";
    718721                genCommaList( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end() );
    719722                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();
    720730        }
    721731
  • src/CodeGen/CodeGenerator.h

    rdbfb35d r3bd1eb4  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  1 16:20:04 2017
    13 // Update Count     : 50
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed May 10 10:57:00 2017
     13// Update Count     : 51
    1414//
    1515
     
    2525#include "SymTab/Indexer.h"
    2626
     27#include "Common/utility.h"
     28
    2729namespace CodeGen {
    2830        class CodeGenerator : public Visitor {
     
    3032                static int tabsize;
    3133
    32                 CodeGenerator( std::ostream &os, bool pretty = false, bool genC = false );
     34                CodeGenerator( std::ostream &os, bool pretty = false, bool genC = false, bool lineMarks = false );
    3335                CodeGenerator( std::ostream &os, std::string, int indent = 0, bool infun = false );
    3436                CodeGenerator( std::ostream &os, char *, int indent = 0, bool infun = false );
     
    7476                virtual void visit( UntypedTupleExpr *tupleExpr );
    7577                virtual void visit( TupleExpr *tupleExpr );
     78                virtual void visit( TupleIndexExpr * tupleExpr );
    7679                virtual void visit( TypeExpr *typeExpr );
    7780                virtual void visit( AsmExpr * );
     
    110113                };
    111114
     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
    112124                void asmName( DeclarationWithType *decl );
    113125
     
    122134                bool pretty = false;  // pretty print
    123135                bool genC = false;    // true if output has to be C code
     136                bool lineMarks = false;
    124137
    125138                void printDesignators( std::list< Expression * > & );
     
    149162        /// returns C-compatible name of declaration
    150163        std::string genName( DeclarationWithType * decl );
     164
     165        std::ostream & operator<<(std::ostream &,
     166                CodeGenerator::LineMarker const &);
    151167} // namespace CodeGen
    152168
  • src/CodeGen/GenType.cc

    rdbfb35d r3bd1eb4  
    2828        class GenType : public Visitor {
    2929          public:
    30                 GenType( const std::string &typeString, bool pretty = false, bool genC = false );
     30                GenType( const std::string &typeString, bool pretty = false, bool genC = false, bool lineMarks = false );
    3131                std::string get_typeString() const { return typeString; }
    3232                void set_typeString( const std::string &newValue ) { typeString = newValue; }
     
    5454                bool pretty = false; // pretty print
    5555                bool genC = false;   // generating C code?
     56                bool lineMarks = false;
    5657        };
    5758
    58         std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC ) {
    59                 GenType gt( baseString, pretty, genC );
     59        std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC , bool lineMarks ) {
     60                GenType gt( baseString, pretty, genC, lineMarks );
    6061                std::ostringstream os;
    6162
    6263                if ( ! type->get_attributes().empty() ) {
    63                         CodeGenerator cg( os, pretty, genC );
     64                        CodeGenerator cg( os, pretty, genC, lineMarks );
    6465                        cg.genAttributes( type->get_attributes() );
    6566                } // if
     
    7374  }
    7475
    75         GenType::GenType( const std::string &typeString, bool pretty, bool genC ) : typeString( typeString ), pretty( pretty ), genC( genC ) {}
     76        GenType::GenType( const std::string &typeString, bool pretty, bool genC, bool lineMarks ) : typeString( typeString ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {}
    7677
    7778        void GenType::visit( VoidType *voidType ) {
     
    114115                } // if
    115116                if ( dimension != 0 ) {
    116                         CodeGenerator cg( os, pretty, genC );
     117                        CodeGenerator cg( os, pretty, genC, lineMarks );
    117118                        dimension->accept( cg );
    118119                } else if ( isVarLen ) {
     
    168169                        } // if
    169170                } else {
    170                         CodeGenerator cg( os, pretty, genC );
     171                        CodeGenerator cg( os, pretty, genC, lineMarks );
    171172                        os << "(" ;
    172173
     
    191192                        // assertf( ! genC, "Aggregate type parameters should not reach code generation." );
    192193                        std::ostringstream os;
    193                         CodeGenerator cg( os, pretty, genC );
     194                        CodeGenerator cg( os, pretty, genC, lineMarks );
    194195                        os << "forall(";
    195196                        cg.genCommaList( funcType->get_forall().begin(), funcType->get_forall().end() );
     
    202203                if ( ! refType->get_parameters().empty() ) {
    203204                        std::ostringstream os;
    204                         CodeGenerator cg( os, pretty, genC );
     205                        CodeGenerator cg( os, pretty, genC, lineMarks );
    205206                        os << "(";
    206207                        cg.genCommaList( refType->get_parameters().begin(), refType->get_parameters().end() );
     
    242243                for ( Type * t : *tupleType ) {
    243244                        i++;
    244                         os << genType( t, "", pretty, genC ) << (i == tupleType->size() ? "" : ", ");
     245                        os << genType( t, "", pretty, genC, lineMarks ) << (i == tupleType->size() ? "" : ", ");
    245246                }
    246247                os << "]";
  • src/CodeGen/GenType.h

    rdbfb35d r3bd1eb4  
    2121
    2222namespace CodeGen {
    23         std::string genType( Type *type, const std::string &baseString, bool pretty = false, bool genC = false );
     23        std::string genType( Type *type, const std::string &baseString, bool pretty = false, bool genC = false, bool lineMarks = false );
    2424  std::string genPrettyType( Type * type, const std::string & baseString );
    2525} // namespace CodeGen
  • src/CodeGen/Generate.cc

    rdbfb35d r3bd1eb4  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun  4 14:04:25 2015
    13 // Update Count     : 5
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed May 19 13:05:00 2017
     13// Update Count     : 6
    1414//
    1515
     
    3131
    3232namespace CodeGen {
    33         void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC ) {
    34                 CodeGen::CodeGenerator cgv( os, pretty, generateC );
     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 );
    3535                for ( auto & dcl : translationUnit ) {
    3636                        if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) {
     37                                os << cgv.lineDirective(dcl);
    3738                                dcl->accept(cgv);
    3839                                if ( doSemicolon( dcl ) ) {
     
    4849                        os << CodeGen::genPrettyType( type, "" );
    4950                } else {
    50                         CodeGen::CodeGenerator cgv( os, true, false );
     51                        CodeGen::CodeGenerator cgv( os, true, false, false );
    5152                        node->accept( cgv );
    5253                }
  • src/CodeGen/Generate.h

    rdbfb35d r3bd1eb4  
    2424namespace CodeGen {
    2525        /// 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 );
     26        void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false , bool lineMarks = false );
    2727
    2828        /// Generate code for a single node -- helpful for debugging in gdb
  • src/Common/utility.h

    rdbfb35d r3bd1eb4  
    322322        std::string filename;
    323323
    324     /// Create a new unset CodeLocation.
     324        /// Create a new unset CodeLocation.
    325325        CodeLocation()
    326326                : linenumber( -1 )
     
    328328        {}
    329329
    330     /// Create a new CodeLocation with the given values.
     330        /// Create a new CodeLocation with the given values.
    331331        CodeLocation( const char* filename, int lineno )
    332332                : linenumber( lineno )
     
    334334        {}
    335335
    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        }
    343343
    344344        void unset () {
     
    353353        return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + " " : "";
    354354}
     355
    355356#endif // _UTILITY_H
    356357
  • src/GenPoly/Box.cc

    rdbfb35d r3bd1eb4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 09:06:37 2017
    13 // Update Count     : 339
     12// Last Modified On : Sat May 13 09:26:38 2017
     13// Update Count     : 341
    1414//
    1515
     
    706706                                Type *concrete = env->lookup( typeInst->get_name() );
    707707                                if ( concrete == 0 ) {
     708                                        return typeInst;
    708709                                        // xxx - should this be an assertion?
    709                                         std::string x = env ? toString( *env ) : "missing env";
    710                                         throw SemanticError( x + "\n" + "Unbound type variable " + typeInst->get_name() + " in ", appExpr );
     710//                                      std::string x = env ? toString( *env ) : "missing env";
     711//                                      throw SemanticError( x + "\n" + "Unbound type variable " + typeInst->get_name() + " in ", appExpr );
    711712                                } // if
    712713                                return concrete;
     
    764765                                        } else {
    765766                                                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() );
    766771                                        }
    767772                                } else {
     
    902907                                } // if
    903908                                UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
    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() ) ) );
     909                                UntypedExpr *deref = UntypedExpr::createDeref( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->get_returnVals().front()->get_type()->clone() ) ) );
    906910                                assign->get_args().push_back( deref );
    907911                                addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
     
    12171221
    12181222                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 
    12261223                        if ( retval && returnStmt->get_expr() ) {
    12271224                                assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() );
     
    13021299                        FunctionType * ftype = functionDecl->get_functionType();
    13031300                        if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) {
    1304                                 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
     1301                                if ( ! isPrefix( functionDecl->get_name(), "_thunk" ) && ! isPrefix( functionDecl->get_name(), "_adapter" ) ) { // xxx - remove check for prefix once thunks properly use ctor/dtors
    13051302                                        assert( ftype->get_returnVals().size() == 1 );
    13061303                                        DeclarationWithType * retval = ftype->get_returnVals().front();
     
    15391536                                        Type *declType = objectDecl->get_type();
    15401537                                        std::string bufName = bufNamer.newName();
    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) ) ), 
     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) ) ),
    15431540                                                true, false, std::list<Attribute*>{ new Attribute( std::string{"aligned"}, std::list<Expression*>{ new ConstantExpr( Constant::from_int(8) ) } ) } ), 0 );
    15441541                                        stmtsToAdd.push_back( new DeclStmt( noLabels, newBuf ) );
     
    15781575                }
    15791576
    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 
    15911577                Expression *PolyGenericCalculator::mutate( MemberExpr *memberExpr ) {
    15921578                        // mutate, exiting early if no longer MemberExpr
     
    15951581                        if ( ! memberExpr ) return expr;
    15961582
    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 
    16041583                        // only mutate member expressions for polymorphic types
    16051584                        int tyDepth;
    1606                         Type *objectType = hasPolyBase( objectDecl->get_type(), scopeTyVars, &tyDepth );
     1585                        Type *objectType = hasPolyBase( memberExpr->get_aggregate()->get_result(), scopeTyVars, &tyDepth );
    16071586                        if ( ! objectType ) return memberExpr;
    16081587                        findGeneric( objectType ); // ensure layout for this type is available
     
    16221601                                fieldLoc->get_args().push_back( aggr );
    16231602                                fieldLoc->get_args().push_back( makeOffsetIndex( objectType, i ) );
     1603                                fieldLoc->set_result( memberExpr->get_result()->clone() );
    16241604                                newMemberExpr = fieldLoc;
    16251605                        } else if ( dynamic_cast< UnionInstType* >( objectType ) ) {
    1626                                 // union members are all at offset zero, so build appropriately-dereferenced variable
    1627                                 newMemberExpr = makeDerefdVar( varExpr->clone(), varDepth );
     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() );
    16281612                        } else return memberExpr;
    16291613                        assert( newMemberExpr );
     
    16331617                                // 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
    16341618                                CastExpr *ptrCastExpr = new CastExpr( newMemberExpr, new PointerType( Type::Qualifiers(), memberType->clone() ) );
    1635                                 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) );
    1636                                 derefExpr->get_args().push_back( ptrCastExpr );
     1619                                UntypedExpr *derefExpr = UntypedExpr::createDeref( ptrCastExpr );
    16371620                                newMemberExpr = derefExpr;
    16381621                        }
  • src/InitTweak/FixInit.cc

    rdbfb35d r3bd1eb4  
    361361                                        FunctionType * ftype = dynamic_cast< FunctionType * >( GenPoly::getFunctionType( funcDecl->get_type() ) );
    362362                                        assert( ftype );
    363                                         if ( (isConstructor( funcDecl->get_name() ) || funcDecl->get_name() == "?=?") && ftype->get_parameters().size() == 2 ) {
     363                                        if ( isConstructor( funcDecl->get_name() ) && ftype->get_parameters().size() == 2 ) {
    364364                                                Type * t1 = ftype->get_parameters().front()->get_type();
    365365                                                Type * t2 = ftype->get_parameters().back()->get_type();
     
    367367
    368368                                                if ( ResolvExpr::typesCompatible( ptrType->get_base(), t2, SymTab::Indexer() ) ) {
    369                                                         // optimization: don't need to copy construct in order to call a copy constructor or
    370                                                         // assignment operator
     369                                                        // optimization: don't need to copy construct in order to call a copy constructor
    371370                                                        return appExpr;
    372371                                                } // if
     
    636635                                assert( ! stmtExpr->get_returnDecls().empty() );
    637636                                body->get_kids().push_back( new ExprStmt( noLabels, new VariableExpr( stmtExpr->get_returnDecls().front() ) ) );
    638                         }
    639                         stmtExpr->get_returnDecls().clear();
    640                         stmtExpr->get_dtors().clear();
     637                                stmtExpr->get_returnDecls().clear();
     638                                stmtExpr->get_dtors().clear();
     639                        }
     640                        assert( stmtExpr->get_returnDecls().empty() );
     641                        assert( stmtExpr->get_dtors().empty() );
    641642                        return stmtExpr;
    642643                }
     
    655656                                unqExpr->set_result( maybeClone( unqExpr->get_expr()->get_result() ) );
    656657                                if ( unqCount[ unqExpr->get_id() ] == 0 ) {  // insert destructor after the last use of the unique expression
    657                                         stmtsToAdd.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );
     658                                        stmtsToAddAfter.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );
    658659                                }
    659660                                if ( addDeref.count( unqExpr->get_id() ) ) {
     
    667668                        stmtsToAdd.splice( stmtsToAdd.end(), fixer.stmtsToAdd );
    668669                        unqMap[unqExpr->get_id()] = unqExpr;
     670                        if ( unqCount[ unqExpr->get_id() ] == 0 ) {  // insert destructor after the last use of the unique expression
     671                                stmtsToAddAfter.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );
     672                        } else { // remember dtors for last instance of unique expr
     673                                dtors[ unqExpr->get_id() ] = fixer.stmtsToAddAfter;
     674                        }
    669675                        if ( UntypedExpr * deref = dynamic_cast< UntypedExpr * >( unqExpr->get_expr() ) ) {
    670676                                // unique expression is now a dereference, because the inner expression is an lvalue returning function call.
     
    675681                                getCallArg( deref, 0 ) = unqExpr;
    676682                                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                                 }
    682683                                return deref;
    683684                        }
  • src/InitTweak/GenInit.cc

    rdbfb35d r3bd1eb4  
    142142                // hands off if the function returns an lvalue - we don't want to allocate a temporary if a variable's address
    143143                // is being returned
    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() ) {
     144                if ( returnStmt->get_expr() && returnVals.size() == 1 && ! returnVals.front()->get_type()->get_lvalue() ) {
    146145                        // explicitly construct the return value using the return expression and the retVal object
    147146                        assertf( returnVals.front()->get_name() != "", "Function %s has unnamed return value\n", funcName.c_str() );
  • src/libcfa/Makefile.am

    rdbfb35d r3bd1eb4  
    1111## Created On       : Sun May 31 08:54:01 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Sat Mar 25 18:00:10 2017
    14 ## Update Count     : 212
     13## Last Modified On : Sun May 14 21:04:21 2017
     14## Update Count     : 214
    1515###############################################################################
    1616
     
    7676
    7777cfa_includedir = $(CFA_INCDIR)
    78 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} concurrency/invoke.h
     78nobase_cfa_include_HEADERS = ${headers} ${stdhdr} gmp concurrency/invoke.h
    7979
    8080CLEANFILES = libcfa-prelude.c
  • src/libcfa/Makefile.in

    rdbfb35d r3bd1eb4  
    183183        containers/vector concurrency/coroutine concurrency/thread \
    184184        concurrency/kernel concurrency/monitor ${shell echo stdhdr/*} \
    185         concurrency/invoke.h
     185        gmp concurrency/invoke.h
    186186HEADERS = $(nobase_cfa_include_HEADERS)
    187187ETAGS = etags
     
    324324stdhdr = ${shell echo stdhdr/*}
    325325cfa_includedir = $(CFA_INCDIR)
    326 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} concurrency/invoke.h
     326nobase_cfa_include_HEADERS = ${headers} ${stdhdr} gmp concurrency/invoke.h
    327327CLEANFILES = libcfa-prelude.c
    328328all: all-am
  • src/libcfa/iostream.c

    rdbfb35d r3bd1eb4  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 23 08:20:40 2017
    13 // Update Count     : 367
     12// Last Modified On : Mon May  8 18:24:23 2017
     13// Update Count     : 369
    1414//
    1515
     
    160160                [(unsigned char)'¡'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open,
    161161                // closing delimiters, no space before
    162                 [','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,
     162                [','] : Close, ['.'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,
    163163                ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,
    164164                [')'] : Close, [']'] : Close, ['}'] : Close,
    165165                // opening-closing delimiters, no space before or after
    166                 ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose,
     166                ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose, [':'] : OpenClose,
    167167                [' '] : OpenClose, ['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace
    168168        }; // mask
  • src/libcfa/rational

    rdbfb35d r3bd1eb4  
    1212// Created On       : Wed Apr  6 17:56:25 2016
    1313// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Mon May  1 08:25:06 2017
    15 // Update Count     : 33
     14// Last Modified On : Sun May 14 16:49:13 2017
     15// Update Count     : 78
    1616//
    1717
     
    2121#include "iostream"
    2222
     23trait scalar( otype T ) {
     24};
     25
     26trait 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
    2347// implementation
    24 typedef long int RationalImpl;
     48
     49forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    2550struct Rational {
    26         RationalImpl numerator, denominator;                                    // invariant: denominator > 0
     51        RationalImpl numerator, denominator;                            // invariant: denominator > 0
    2752}; // Rational
    2853
    29 // constants
    30 extern struct Rational 0;
    31 extern struct Rational 1;
     54// constructors
    3255
    33 // constructors
    34 void ?{}( Rational * r );
    35 void ?{}( Rational * r, RationalImpl n );
    36 void ?{}( Rational * r, RationalImpl n, RationalImpl d );
     56forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     57void ?{}( Rational(RationalImpl) * r );
     58
     59forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     60void ?{}( Rational(RationalImpl) * r, RationalImpl n );
     61
     62forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     63void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d );
     64
     65forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     66void ?{}( Rational(RationalImpl) * r, zero_t );
     67
     68forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     69void ?{}( Rational(RationalImpl) * r, one_t );
    3770
    3871// getter for numerator/denominator
    39 RationalImpl numerator( Rational r );
    40 RationalImpl denominator( Rational r );
    41 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational src );
     72
     73forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     74RationalImpl numerator( Rational(RationalImpl) r );
     75
     76forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     77RationalImpl denominator( Rational(RationalImpl) r );
     78forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     79[ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src );
     80
    4281// setter for numerator/denominator
    43 RationalImpl numerator( Rational r, RationalImpl n );
    44 RationalImpl denominator( Rational r, RationalImpl d );
     82
     83forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     84RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n );
     85
     86forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     87RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d );
    4588
    4689// comparison
    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 );
     90
     91forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     92int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r );
     93
     94forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     95int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
     96
     97forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     98int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r );
     99
     100forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     101int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
     102
     103forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     104int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r );
     105
     106forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     107int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    53108
    54109// arithmetic
    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 );
     110
     111forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     112Rational(RationalImpl) +?( Rational(RationalImpl) r );
     113
     114forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     115Rational(RationalImpl) -?( Rational(RationalImpl) r );
     116
     117forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     118Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r );
     119
     120forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     121Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r );
     122
     123forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     124Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r );
     125
     126forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     127Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    60128
    61129// conversion
    62 double widen( Rational r );
    63 Rational narrow( double f, RationalImpl md );
     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 );
    64134
    65135// I/O
    66 forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, Rational * );
    67 forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, Rational );
     136forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     137forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } )
     138istype * ?|?( istype *, Rational(RationalImpl) * );
     139
     140forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     141forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } )
     142ostype * ?|?( ostype *, Rational(RationalImpl ) );
    68143
    69144#endif // RATIONAL_H
  • src/libcfa/rational.c

    rdbfb35d r3bd1eb4  
    1010// Created On       : Wed Apr  6 17:54:28 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 27 17:05:06 2017
    13 // Update Count     : 51
     12// Last Modified On : Sun May 14 17:25:19 2017
     13// Update Count     : 131
    1414//
    1515
     
    1717#include "fstream"
    1818#include "stdlib"
    19 #include "math"                                                                                 // floor
    20 
    21 
    22 // constants
    23 
    24 struct Rational 0 = {0, 1};
    25 struct Rational 1 = {1, 1};
    26 
    2719
    2820// helper routines
     
    3022// Calculate greatest common denominator of two numbers, the first of which may be negative. Used to reduce rationals.
    3123// alternative: https://en.wikipedia.org/wiki/Binary_GCD_algorithm
     24forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    3225static RationalImpl gcd( RationalImpl a, RationalImpl b ) {
    3326        for ( ;; ) {                                                                            // Euclid's algorithm
    3427                RationalImpl r = a % b;
    35           if ( r == 0 ) break;
     28          if ( r == (RationalImpl){0} ) break;
    3629                a = b;
    3730                b = r;
     
    4033} // gcd
    4134
    42 static RationalImpl simplify( RationalImpl *n, RationalImpl *d ) {
    43         if ( *d == 0 ) {
     35forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     36static RationalImpl simplify( RationalImpl * n, RationalImpl * d ) {
     37        if ( *d == (RationalImpl){0} ) {
    4438                serr | "Invalid rational number construction: denominator cannot be equal to 0." | endl;
    4539                exit( EXIT_FAILURE );
    4640        } // exit
    47         if ( *d < 0 ) { *d = -*d; *n = -*n; }                           // move sign to numerator
     41        if ( *d < (RationalImpl){0} ) { *d = -*d; *n = -*n; } // move sign to numerator
    4842        return gcd( abs( *n ), *d );                                            // simplify
    4943} // Rationalnumber::simplify
     
    5246// constructors
    5347
    54 void ?{}( Rational * r ) {
    55         r{ 0, 1 };
     48forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     49void ?{}( Rational(RationalImpl) * r ) {
     50        r{ (RationalImpl){0}, (RationalImpl){1} };
    5651} // rational
    5752
    58 void ?{}( Rational * r, RationalImpl n ) {
    59         r{ n, 1 };
     53forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     54void ?{}( Rational(RationalImpl) * r, RationalImpl n ) {
     55        r{ n, (RationalImpl){1} };
    6056} // rational
    6157
    62 void ?{}( Rational * r, RationalImpl n, RationalImpl d ) {
     58forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     59void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d ) {
    6360        RationalImpl t = simplify( &n, &d );                            // simplify
    6461        r->numerator = n / t;
     
    6966// getter for numerator/denominator
    7067
    71 RationalImpl numerator( Rational r ) {
     68forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     69RationalImpl numerator( Rational(RationalImpl) r ) {
    7270        return r.numerator;
    7371} // numerator
    7472
    75 RationalImpl denominator( Rational r ) {
     73forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     74RationalImpl denominator( Rational(RationalImpl) r ) {
    7675        return r.denominator;
    7776} // denominator
    7877
    79 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational src ) {
     78forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     79[ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src ) {
    8080        return *dest = src.[ numerator, denominator ];
    8181}
     
    8383// setter for numerator/denominator
    8484
    85 RationalImpl numerator( Rational r, RationalImpl n ) {
     85forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     86RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n ) {
    8687        RationalImpl prev = r.numerator;
    8788        RationalImpl t = gcd( abs( n ), r.denominator );                // simplify
     
    9192} // numerator
    9293
    93 RationalImpl denominator( Rational r, RationalImpl d ) {
     94forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     95RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d ) {
    9496        RationalImpl prev = r.denominator;
    9597        RationalImpl t = simplify( &r.numerator, &d );                  // simplify
     
    102104// comparison
    103105
    104 int ?==?( Rational l, Rational r ) {
     106forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     107int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    105108        return l.numerator * r.denominator == l.denominator * r.numerator;
    106109} // ?==?
    107110
    108 int ?!=?( Rational l, Rational r ) {
     111forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     112int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    109113        return ! ( l == r );
    110114} // ?!=?
    111115
    112 int ?<?( Rational l, Rational r ) {
     116forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     117int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    113118        return l.numerator * r.denominator < l.denominator * r.numerator;
    114119} // ?<?
    115120
    116 int ?<=?( Rational l, Rational r ) {
    117         return l < r || l == r;
     121forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     122int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
     123        return l.numerator * r.denominator <= l.denominator * r.numerator;
    118124} // ?<=?
    119125
    120 int ?>?( Rational l, Rational r ) {
     126forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     127int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    121128        return ! ( l <= r );
    122129} // ?>?
    123130
    124 int ?>=?( Rational l, Rational r ) {
     131forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     132int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    125133        return ! ( l < r );
    126134} // ?>=?
     
    129137// arithmetic
    130138
    131 Rational -?( Rational r ) {
    132         Rational t = { -r.numerator, r.denominator };
     139forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     140Rational(RationalImpl) +?( Rational(RationalImpl) r ) {
     141        Rational(RationalImpl) t = { r.numerator, r.denominator };
     142        return t;
     143} // +?
     144
     145forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     146Rational(RationalImpl) -?( Rational(RationalImpl) r ) {
     147        Rational(RationalImpl) t = { -r.numerator, r.denominator };
    133148        return t;
    134149} // -?
    135150
    136 Rational ?+?( Rational l, Rational r ) {
     151forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     152Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    137153        if ( l.denominator == r.denominator ) {                         // special case
    138                 Rational t = { l.numerator + r.numerator, l.denominator };
     154                Rational(RationalImpl) t = { l.numerator + r.numerator, l.denominator };
    139155                return t;
    140156        } else {
    141                 Rational t = { l.numerator * r.denominator + l.denominator * r.numerator, l.denominator * r.denominator };
     157                Rational(RationalImpl) t = { l.numerator * r.denominator + l.denominator * r.numerator, l.denominator * r.denominator };
    142158                return t;
    143159        } // if
    144160} // ?+?
    145161
    146 Rational ?-?( Rational l, Rational r ) {
     162forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     163Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    147164        if ( l.denominator == r.denominator ) {                         // special case
    148                 Rational t = { l.numerator - r.numerator, l.denominator };
     165                Rational(RationalImpl) t = { l.numerator - r.numerator, l.denominator };
    149166                return t;
    150167        } else {
    151                 Rational t = { l.numerator * r.denominator - l.denominator * r.numerator, l.denominator * r.denominator };
     168                Rational(RationalImpl) t = { l.numerator * r.denominator - l.denominator * r.numerator, l.denominator * r.denominator };
    152169                return t;
    153170        } // if
    154171} // ?-?
    155172
    156 Rational ?*?( Rational l, Rational r ) {
    157         Rational t = { l.numerator * r.numerator, l.denominator * r.denominator };
     173forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     174Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
     175        Rational(RationalImpl) t = { l.numerator * r.numerator, l.denominator * r.denominator };
    158176        return t;
    159177} // ?*?
    160178
    161 Rational ?/?( Rational l, Rational r ) {
    162         if ( r.numerator < 0 ) {
     179forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     180Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
     181        if ( r.numerator < (RationalImpl){0} ) {
    163182                r.numerator = -r.numerator;
    164183                r.denominator = -r.denominator;
    165184        } // if
    166         Rational t = { l.numerator * r.denominator, l.denominator * r.numerator };
     185        Rational(RationalImpl) t = { l.numerator * r.denominator, l.denominator * r.numerator };
    167186        return t;
    168187} // ?/?
     
    171190// conversion
    172191
    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
     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
    204225
    205226
    206227// I/O
    207228
    208 forall( dtype istype | istream( istype ) )
    209 istype * ?|?( istype *is, Rational *r ) {
     229forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     230forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } )
     231istype * ?|?( istype * is, Rational(RationalImpl) * r ) {
    210232        RationalImpl t;
    211233        is | &(r->numerator) | &(r->denominator);
     
    216238} // ?|?
    217239
    218 forall( dtype ostype | ostream( ostype ) )
    219 ostype * ?|?( ostype *os, Rational r ) {
     240forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     241forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } )
     242ostype * ?|?( ostype * os, Rational(RationalImpl ) r ) {
    220243        return os | r.numerator | '/' | r.denominator;
    221244} // ?|?
  • src/libcfa/stdlib

    rdbfb35d r3bd1eb4  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Apr  1 17:35:24 2017
    13 // Update Count     : 104
     12// Last Modified On : Tue May  9 08:42:44 2017
     13// Update Count     : 107
    1414//
    1515
     
    8484forall( otype T | { int ?<?( T, T ); } )
    8585T * bsearch( T key, const T * arr, size_t dimension );
     86
    8687forall( otype T | { int ?<?( T, T ); } )
    8788unsigned int bsearch( T key, const T * arr, size_t dimension );
     89
    8890
    8991forall( otype T | { int ?<?( T, T ); } )
     
    107109double abs( double _Complex );
    108110long double abs( long double _Complex );
     111forall ( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
     112T abs( T );
    109113
    110114//---------------------------------------
  • src/libcfa/stdlib.c

    rdbfb35d r3bd1eb4  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 16 10:41:05 2017
    13 // Update Count     : 189
     12// Last Modified On : Tue May  9 08:43:00 2017
     13// Update Count     : 191
    1414//
    1515
     
    2727} // extern "C"
    2828
    29 forall( dtype T | sized(T) ) T * malloc( void ) {
    30         //printf( "malloc1\n" );
    31     return (T *)(void*)malloc( (size_t)sizeof(T) );
     29forall( dtype T | sized(T) ) T * malloc( void ) {               // type-safe
     30    return (T *)(void *)malloc( (size_t)sizeof(T) );
    3231} // 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) );
     32
     33forall( dtype T | sized(T) ) T * malloc( char fill ) {  // initial with fill value (like calloc)
     34        T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) );
    3635    return memset( ptr, (int)fill, sizeof(T) );
    3736} // malloc
    3837
    39 forall( dtype T | sized(T) ) T * calloc( size_t nmemb ) {
    40         //printf( "calloc\n" );
     38forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size ) { // alternative realloc
     39    return (T *)realloc( ptr, size );
     40} // malloc
     41
     42forall( 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
     47forall( dtype T | sized(T) ) T * calloc( size_t nmemb ) { // type-safe array initialization with fill 0
    4148    return (T *)calloc( nmemb, sizeof(T) );
    4249} // calloc
    4350
    44 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ) {
    45         //printf( "realloc1\n" );
     51
     52forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ) { // type-safe
    4653    return (T *)(void *)realloc( (void *)ptr, size );
    4754} // realloc
    48 forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill ) {
    49         //printf( "realloc2\n" );
     55
     56forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill ) { // alternative realloc with fill value
    5057    char * nptr = (T *)(void *)realloc( (void *)ptr, size );
    5158    size_t unused = malloc_usable_size( nptr );
     
    5461} // realloc
    5562
    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" );
     63
     64forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment ) { // aligned allocation
    6765    return (T *)memalign( alignment, sizeof(T) );
    6866} // aligned_alloc
    6967
    7068forall( dtype T | sized(T) ) T * memalign( size_t alignment ) {
    71         //printf( "memalign\n" );
    7269    return (T *)memalign( alignment, sizeof(T) );
    7370} // memalign
    7471
    7572forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment ) {
    76         //printf( "posix_memalign\n" );
    7773    return posix_memalign( (void **)ptr, alignment, sizeof(T) );
    7874} // posix_memalign
    7975
    80 forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params ); } )
     76
     77forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params ); } ) //  new
    8178T * new( Params p ) {
    8279        return ((T *)malloc()){ p };
    83 }
    84 
    85 forall( dtype T | { void ^?{}(T *); } )
     80} // new
     81
     82forall( dtype T | { void ^?{}(T *); } )                                 // delete
    8683void delete( T * ptr ) {
    87   if ( ptr ) {
    88     ^ptr{};
    89     free( ptr );
    90   }
    91 }
     84        if ( ptr ) {
     85                ^ptr{};
     86                free( ptr );
     87        }
     88} // delete
    9289
    9390forall( dtype T, ttype Params | { void ^?{}(T *); void delete(Params); } )
     
    9895        }
    9996        delete( rest );
    100 }
     97} // delete
    10198
    10299//---------------------------------------
     
    106103        if ( sscanf( ptr, "%d", &i ) == EOF ) {}
    107104        return i;
    108 }
     105} // ato
     106
    109107unsigned int ato( const char * ptr ) {
    110108        unsigned int ui;
    111109        if ( sscanf( ptr, "%u", &ui ) == EOF ) {}
    112110        return ui;
    113 }
     111} // ato
     112
    114113long int ato( const char * ptr ) {
    115114        long int li;
    116115        if ( sscanf( ptr, "%ld", &li ) == EOF ) {}
    117116        return li;
    118 }
     117} // ato
     118
    119119unsigned long int ato( const char * ptr ) {
    120120        unsigned long int uli;
    121121        if ( sscanf( ptr, "%lu", &uli ) == EOF ) {}
    122122        return uli;
    123 }
     123} // ato
     124
    124125long long int ato( const char * ptr ) {
    125126        long long int lli;
    126127        if ( sscanf( ptr, "%lld", &lli ) == EOF ) {}
    127128        return lli;
    128 }
     129} // ato
     130
    129131unsigned long long int ato( const char * ptr ) {
    130132        unsigned long long int ulli;
    131133        if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {}
    132134        return ulli;
    133 }
     135} // ato
     136
    134137
    135138float ato( const char * ptr ) {
     
    137140        if ( sscanf( ptr, "%f", &f ) == EOF ) {}
    138141        return f;
    139 }
     142} // ato
     143
    140144double ato( const char * ptr ) {
    141145        double d;
    142146        if ( sscanf( ptr, "%lf", &d ) == EOF ) {}
    143147        return d;
    144 }
     148} // ato
     149
    145150long double ato( const char * ptr ) {
    146151        long double ld;
    147152        if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {}
    148153        return ld;
    149 }
     154} // ato
     155
    150156
    151157float _Complex ato( const char * ptr ) {
     
    153159        if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {}
    154160        return re + im * _Complex_I;
    155 }
     161} // ato
     162
    156163double _Complex ato( const char * ptr ) {
    157164        double re, im;
    158165        if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {}
    159166        return re + im * _Complex_I;
    160 }
     167} // ato
     168
    161169long double _Complex ato( const char * ptr ) {
    162170        long double re, im;
    163171        if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {}
    164172        return re + im * _Complex_I;
    165 }
     173} // ato
     174
    166175
    167176int strto( const char * sptr, char ** eptr, int base ) {
    168177        return (int)strtol( sptr, eptr, base );
    169 }
     178} // strto
     179
    170180unsigned int strto( const char * sptr, char ** eptr, int base ) {
    171181        return (unsigned int)strtoul( sptr, eptr, base );
    172 }
     182} // strto
     183
    173184long int strto( const char * sptr, char ** eptr, int base ) {
    174185        return strtol( sptr, eptr, base );
    175 }
     186} // strto
     187
    176188unsigned long int strto( const char * sptr, char ** eptr, int base ) {
    177189        return strtoul( sptr, eptr, base );
    178 }
     190} // strto
     191
    179192long long int strto( const char * sptr, char ** eptr, int base ) {
    180193        return strtoll( sptr, eptr, base );
    181 }
     194} // strto
     195
    182196unsigned long long int strto( const char * sptr, char ** eptr, int base ) {
    183197        return strtoull( sptr, eptr, base );
    184 }
     198} // strto
     199
    185200
    186201float strto( const char * sptr, char ** eptr ) {
    187202        return strtof( sptr, eptr );
    188 }
     203} // strto
     204
    189205double strto( const char * sptr, char ** eptr ) {
    190206        return strtod( sptr, eptr );
    191 }
     207} // strto
     208
    192209long double strto( const char * sptr, char ** eptr ) {
    193210        return strtold( sptr, eptr );
    194 }
     211} // strto
     212
    195213
    196214float _Complex strto( const char * sptr, char ** eptr ) {
     
    201219        if ( sptr == *eptr ) return 0.0;
    202220        return re + im * _Complex_I;
    203 }
     221} // strto
     222
    204223double _Complex strto( const char * sptr, char ** eptr ) {
    205224        double re, im;
     
    209228        if ( sptr == *eptr ) return 0.0;
    210229        return re + im * _Complex_I;
    211 }
     230} // strto
     231
    212232long double _Complex strto( const char * sptr, char ** eptr ) {
    213233        long double re, im;
     
    217237        if ( sptr == *eptr ) return 0.0;
    218238        return re + im * _Complex_I;
    219 }
     239} // strto
    220240
    221241//---------------------------------------
  • src/main.cc

    rdbfb35d r3bd1eb4  
     1
    12//
    23// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     
    910// Author           : Richard C. Bilson
    1011// Created On       : Fri May 15 23:12:02 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 14 14:35:54 2016
    13 // Update Count     : 436
     12// Last Modified By : Andrew Beach
     13// Last Modified On : Wed May 10 14:45:00 2017
     14// Update Count     : 437
    1415//
    1516
     
    7980        errorp = false,
    8081        codegenp = false,
    81         prettycodegenp = false;
     82        prettycodegenp = false,
     83        nolinemarks = false;
    8284
    8385static void parse_cmdline( int argc, char *argv[], const char *& filename );
     
    310312
    311313                CodeTools::fillLocations( translationUnit );
    312                 CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true );
     314                CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, ! nolinemarks );
    313315
    314316                CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c" );
     
    336338        } catch ( CompilerError &e ) {
    337339                cerr << "Compiler Error: " << e.get_what() << endl;
    338                 cerr << "(please report bugs to " << endl;
     340                cerr << "(please report bugs to [REDACTED])" << endl;
    339341                if ( output != &cout ) {
    340342                        delete output;
     
    375377
    376378        int c;
    377         while ( (c = getopt_long( argc, argv, "abBcdefglmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
     379        while ( (c = getopt_long( argc, argv, "abBcdefglLmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
    378380                switch ( c ) {
    379381                  case Ast:
     
    411413                  case 'l':                                                                             // generate libcfa.c
    412414                        libcfap = true;
     415                        break;
     416                  case 'L':                                                                             // surpress lines marks
     417                        nolinemarks = true;
    413418                        break;
    414419                  case Nopreamble:
  • src/prelude/Makefile.am

    rdbfb35d r3bd1eb4  
    4242
    4343bootloader.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 bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
     44        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    4545
    4646MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
  • src/prelude/Makefile.in

    rdbfb35d r3bd1eb4  
    439439
    440440bootloader.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 bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
     441        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    442442
    443443# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/tests/.expect/32/KRfunctions.txt

    rdbfb35d r3bd1eb4  
    3131}
    3232static 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;
    3334    ((void)((*___dst__P2sS_1).__i__i_1=___src__2sS_1.__i__i_1));
    34     return ((struct S )___src__2sS_1);
     35    ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1));
     36    return ((struct S )___ret__2sS_1);
    3537}
    3638static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __i__i_1){
  • src/tests/.expect/32/attributes.txt

    rdbfb35d r3bd1eb4  
    2222}
    2323static 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     return ((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);
    2527}
    2628__attribute__ ((unused)) struct Agn1;
     
    3840}
    3941static inline struct Agn2 ___operator_assign__F5sAgn2_P5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__P5sAgn2_1, struct Agn2 ___src__5sAgn2_1){
    40     return ((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);
    4145}
    4246enum __attribute__ ((unused)) __anonymous1 {
     
    99103}
    100104static 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;
    101106    ((void)((*___dst__P4sFdl_1).__f1__i_1=___src__4sFdl_1.__f1__i_1));
    102107    ((void)((*___dst__P4sFdl_1).__f2__i_1=___src__4sFdl_1.__f2__i_1));
     
    108113    ((void)((*___dst__P4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1));
    109114    ((void)((*___dst__P4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1));
    110     return ((struct Fdl )___src__4sFdl_1);
     115    ((void)___constructor__F_P4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), ___src__4sFdl_1));
     116    return ((struct Fdl )___ret__4sFdl_1);
    111117}
    112118static inline void ___constructor__F_P4sFdli_autogen___1(struct Fdl *___dst__P4sFdl_1, int __f1__i_1){
     
    292298    }
    293299    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;
    294301        ((void)((*___dst__P13s__anonymous4_2).__i__i_2=___src__13s__anonymous4_2.__i__i_2));
    295         return ((struct __anonymous4 )___src__13s__anonymous4_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);
    296304    }
    297305    inline void ___constructor__F_P13s__anonymous4i_autogen___2(struct __anonymous4 *___dst__P13s__anonymous4_2, int __i__i_2){
     
    310318    }
    311319    inline enum __anonymous5 ___operator_assign__F13e__anonymous5_P13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__P13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){
    312         return ((enum __anonymous5 )((*___dst__P13e__anonymous5_2)=___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);
    313323    }
    314324    ((void)sizeof(enum __anonymous5 ));
     
    338348}
    339349static inline struct Vad ___operator_assign__F4sVad_P4sVad4sVad_autogen___1(struct Vad *___dst__P4sVad_1, struct Vad ___src__4sVad_1){
    340     return ((struct Vad )___src__4sVad_1);
    341 }
     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}
  • src/tests/.expect/32/declarationSpecifier.txt

    rdbfb35d r3bd1eb4  
    3030}
    3131static 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;
    3233    ((void)((*___dst__P13s__anonymous0_1).__i__i_1=___src__13s__anonymous0_1.__i__i_1));
    33     return ((struct __anonymous0 )___src__13s__anonymous0_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);
    3436}
    3537static inline void ___constructor__F_P13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, int __i__i_1){
     
    5456}
    5557static 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;
    5659    ((void)((*___dst__P13s__anonymous1_1).__i__i_1=___src__13s__anonymous1_1.__i__i_1));
    57     return ((struct __anonymous1 )___src__13s__anonymous1_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);
    5862}
    5963static inline void ___constructor__F_P13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, int __i__i_1){
     
    7882}
    7983static 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;
    8085    ((void)((*___dst__P13s__anonymous2_1).__i__i_1=___src__13s__anonymous2_1.__i__i_1));
    81     return ((struct __anonymous2 )___src__13s__anonymous2_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);
    8288}
    8389static inline void ___constructor__F_P13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, int __i__i_1){
     
    102108}
    103109static 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;
    104111    ((void)((*___dst__P13s__anonymous3_1).__i__i_1=___src__13s__anonymous3_1.__i__i_1));
    105     return ((struct __anonymous3 )___src__13s__anonymous3_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);
    106114}
    107115static inline void ___constructor__F_P13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, int __i__i_1){
     
    126134}
    127135static 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;
    128137    ((void)((*___dst__P13s__anonymous4_1).__i__i_1=___src__13s__anonymous4_1.__i__i_1));
    129     return ((struct __anonymous4 )___src__13s__anonymous4_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);
    130140}
    131141static inline void ___constructor__F_P13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, int __i__i_1){
     
    150160}
    151161static 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;
    152163    ((void)((*___dst__P13s__anonymous5_1).__i__i_1=___src__13s__anonymous5_1.__i__i_1));
    153     return ((struct __anonymous5 )___src__13s__anonymous5_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);
    154166}
    155167static inline void ___constructor__F_P13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, int __i__i_1){
     
    174186}
    175187static 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;
    176189    ((void)((*___dst__P13s__anonymous6_1).__i__i_1=___src__13s__anonymous6_1.__i__i_1));
    177     return ((struct __anonymous6 )___src__13s__anonymous6_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);
    178192}
    179193static inline void ___constructor__F_P13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, int __i__i_1){
     
    198212}
    199213static 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;
    200215    ((void)((*___dst__P13s__anonymous7_1).__i__i_1=___src__13s__anonymous7_1.__i__i_1));
    201     return ((struct __anonymous7 )___src__13s__anonymous7_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);
    202218}
    203219static inline void ___constructor__F_P13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, int __i__i_1){
     
    230246}
    231247static 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;
    232249    ((void)((*___dst__P13s__anonymous8_1).__i__s_1=___src__13s__anonymous8_1.__i__s_1));
    233     return ((struct __anonymous8 )___src__13s__anonymous8_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);
    234252}
    235253static inline void ___constructor__F_P13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, short __i__s_1){
     
    254272}
    255273static 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;
    256275    ((void)((*___dst__P13s__anonymous9_1).__i__s_1=___src__13s__anonymous9_1.__i__s_1));
    257     return ((struct __anonymous9 )___src__13s__anonymous9_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);
    258278}
    259279static inline void ___constructor__F_P13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, short __i__s_1){
     
    278298}
    279299static 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;
    280301    ((void)((*___dst__P14s__anonymous10_1).__i__s_1=___src__14s__anonymous10_1.__i__s_1));
    281     return ((struct __anonymous10 )___src__14s__anonymous10_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);
    282304}
    283305static inline void ___constructor__F_P14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, short __i__s_1){
     
    302324}
    303325static 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;
    304327    ((void)((*___dst__P14s__anonymous11_1).__i__s_1=___src__14s__anonymous11_1.__i__s_1));
    305     return ((struct __anonymous11 )___src__14s__anonymous11_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);
    306330}
    307331static inline void ___constructor__F_P14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, short __i__s_1){
     
    326350}
    327351static 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;
    328353    ((void)((*___dst__P14s__anonymous12_1).__i__s_1=___src__14s__anonymous12_1.__i__s_1));
    329     return ((struct __anonymous12 )___src__14s__anonymous12_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);
    330356}
    331357static inline void ___constructor__F_P14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, short __i__s_1){
     
    350376}
    351377static 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;
    352379    ((void)((*___dst__P14s__anonymous13_1).__i__s_1=___src__14s__anonymous13_1.__i__s_1));
    353     return ((struct __anonymous13 )___src__14s__anonymous13_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);
    354382}
    355383static inline void ___constructor__F_P14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, short __i__s_1){
     
    374402}
    375403static 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;
    376405    ((void)((*___dst__P14s__anonymous14_1).__i__s_1=___src__14s__anonymous14_1.__i__s_1));
    377     return ((struct __anonymous14 )___src__14s__anonymous14_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);
    378408}
    379409static inline void ___constructor__F_P14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, short __i__s_1){
     
    398428}
    399429static 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;
    400431    ((void)((*___dst__P14s__anonymous15_1).__i__s_1=___src__14s__anonymous15_1.__i__s_1));
    401     return ((struct __anonymous15 )___src__14s__anonymous15_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);
    402434}
    403435static inline void ___constructor__F_P14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, short __i__s_1){
     
    438470}
    439471static 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;
    440473    ((void)((*___dst__P14s__anonymous16_1).__i__i_1=___src__14s__anonymous16_1.__i__i_1));
    441     return ((struct __anonymous16 )___src__14s__anonymous16_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);
    442476}
    443477static inline void ___constructor__F_P14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, int __i__i_1){
     
    462496}
    463497static 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;
    464499    ((void)((*___dst__P14s__anonymous17_1).__i__i_1=___src__14s__anonymous17_1.__i__i_1));
    465     return ((struct __anonymous17 )___src__14s__anonymous17_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);
    466502}
    467503static inline void ___constructor__F_P14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, int __i__i_1){
     
    486522}
    487523static 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;
    488525    ((void)((*___dst__P14s__anonymous18_1).__i__i_1=___src__14s__anonymous18_1.__i__i_1));
    489     return ((struct __anonymous18 )___src__14s__anonymous18_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);
    490528}
    491529static inline void ___constructor__F_P14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, int __i__i_1){
     
    510548}
    511549static 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;
    512551    ((void)((*___dst__P14s__anonymous19_1).__i__i_1=___src__14s__anonymous19_1.__i__i_1));
    513     return ((struct __anonymous19 )___src__14s__anonymous19_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);
    514554}
    515555static inline void ___constructor__F_P14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, int __i__i_1){
     
    534574}
    535575static 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;
    536577    ((void)((*___dst__P14s__anonymous20_1).__i__i_1=___src__14s__anonymous20_1.__i__i_1));
    537     return ((struct __anonymous20 )___src__14s__anonymous20_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);
    538580}
    539581static inline void ___constructor__F_P14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, int __i__i_1){
     
    558600}
    559601static 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;
    560603    ((void)((*___dst__P14s__anonymous21_1).__i__i_1=___src__14s__anonymous21_1.__i__i_1));
    561     return ((struct __anonymous21 )___src__14s__anonymous21_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);
    562606}
    563607static inline void ___constructor__F_P14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, int __i__i_1){
     
    582626}
    583627static 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;
    584629    ((void)((*___dst__P14s__anonymous22_1).__i__i_1=___src__14s__anonymous22_1.__i__i_1));
    585     return ((struct __anonymous22 )___src__14s__anonymous22_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);
    586632}
    587633static inline void ___constructor__F_P14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, int __i__i_1){
     
    606652}
    607653static 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;
    608655    ((void)((*___dst__P14s__anonymous23_1).__i__i_1=___src__14s__anonymous23_1.__i__i_1));
    609     return ((struct __anonymous23 )___src__14s__anonymous23_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);
    610658}
    611659static inline void ___constructor__F_P14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, int __i__i_1){
  • src/tests/.expect/32/extension.txt

    rdbfb35d r3bd1eb4  
    3333}
    3434static 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;
    3536    ((void)((*___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1));
    3637    ((void)((*___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1));
    3738    ((void)((*___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1));
    38     return ((struct S )___src__2sS_1);
     39    ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1));
     40    return ((struct S )___ret__2sS_1);
    3941}
    4042static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __a__i_1){
     
    6668}
    6769static 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;
    6871    ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U )));
    69     return ((union U )___src__2uU_1);
     72    ((void)___constructor__F_P2uU2uU_autogen___1((&___ret__2uU_1), ___src__2uU_1));
     73    return ((union U )___ret__2uU_1);
    7074}
    7175static inline void ___constructor__F_P2uUi_autogen___1(union U *___dst__P2uU_1, int __src__i_1){
  • src/tests/.expect/32/gccExtensions.txt

    rdbfb35d r3bd1eb4  
    5959    }
    6060    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;
    6162        ((void)((*___dst__P2sS_2).__a__i_2=___src__2sS_2.__a__i_2));
    6263        ((void)((*___dst__P2sS_2).__b__i_2=___src__2sS_2.__b__i_2));
    6364        ((void)((*___dst__P2sS_2).__c__i_2=___src__2sS_2.__c__i_2));
    64         return ((struct S )___src__2sS_2);
     65        ((void)___constructor__F_P2sS2sS_autogen___2((&___ret__2sS_2), ___src__2sS_2));
     66        return ((struct S )___ret__2sS_2);
    6567    }
    6668    inline void ___constructor__F_P2sSi_autogen___2(struct S *___dst__P2sS_2, int __a__i_2){
     
    109111    }
    110112    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;
    111114        ((void)((*___dst__P3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2));
    112         return ((struct s2 )___src__3ss2_2);
     115        ((void)___constructor__F_P3ss23ss2_autogen___2((&___ret__3ss2_2), ___src__3ss2_2));
     116        return ((struct s2 )___ret__3ss2_2);
    113117    }
    114118    inline void ___constructor__F_P3ss2i_autogen___2(struct s2 *___dst__P3ss2_2, int __i__i_2){
     
    128132    }
    129133    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;
    130135        ((void)((*___dst__P3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2));
    131         return ((struct s3 )___src__3ss3_2);
     136        ((void)___constructor__F_P3ss33ss3_autogen___2((&___ret__3ss3_2), ___src__3ss3_2));
     137        return ((struct s3 )___ret__3ss3_2);
    132138    }
    133139    inline void ___constructor__F_P3ss3i_autogen___2(struct s3 *___dst__P3ss3_2, int __i__i_2){
     
    149155    }
    150156    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;
    151158        ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2));
    152         return ((struct s4 )___src__3ss4_2);
     159        ((void)___constructor__F_P3ss43ss4_autogen___2((&___ret__3ss4_2), ___src__3ss4_2));
     160        return ((struct s4 )___ret__3ss4_2);
    153161    }
    154162    inline void ___constructor__F_P3ss4i_autogen___2(struct s4 *___dst__P3ss4_2, int __i__i_2){
  • src/tests/.expect/64/KRfunctions.txt

    rdbfb35d r3bd1eb4  
    3131}
    3232static 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;
    3334    ((void)((*___dst__P2sS_1).__i__i_1=___src__2sS_1.__i__i_1));
    34     return ((struct S )___src__2sS_1);
     35    ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1));
     36    return ((struct S )___ret__2sS_1);
    3537}
    3638static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __i__i_1){
  • src/tests/.expect/64/attributes.txt

    rdbfb35d r3bd1eb4  
    2222}
    2323static 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     return ((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);
    2527}
    2628__attribute__ ((unused)) struct Agn1;
     
    3840}
    3941static inline struct Agn2 ___operator_assign__F5sAgn2_P5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__P5sAgn2_1, struct Agn2 ___src__5sAgn2_1){
    40     return ((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);
    4145}
    4246enum __attribute__ ((unused)) __anonymous1 {
     
    99103}
    100104static 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;
    101106    ((void)((*___dst__P4sFdl_1).__f1__i_1=___src__4sFdl_1.__f1__i_1));
    102107    ((void)((*___dst__P4sFdl_1).__f2__i_1=___src__4sFdl_1.__f2__i_1));
     
    108113    ((void)((*___dst__P4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1));
    109114    ((void)((*___dst__P4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1));
    110     return ((struct Fdl )___src__4sFdl_1);
     115    ((void)___constructor__F_P4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), ___src__4sFdl_1));
     116    return ((struct Fdl )___ret__4sFdl_1);
    111117}
    112118static inline void ___constructor__F_P4sFdli_autogen___1(struct Fdl *___dst__P4sFdl_1, int __f1__i_1){
     
    292298    }
    293299    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;
    294301        ((void)((*___dst__P13s__anonymous4_2).__i__i_2=___src__13s__anonymous4_2.__i__i_2));
    295         return ((struct __anonymous4 )___src__13s__anonymous4_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);
    296304    }
    297305    inline void ___constructor__F_P13s__anonymous4i_autogen___2(struct __anonymous4 *___dst__P13s__anonymous4_2, int __i__i_2){
     
    310318    }
    311319    inline enum __anonymous5 ___operator_assign__F13e__anonymous5_P13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__P13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){
    312         return ((enum __anonymous5 )((*___dst__P13e__anonymous5_2)=___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);
    313323    }
    314324    ((void)sizeof(enum __anonymous5 ));
     
    338348}
    339349static inline struct Vad ___operator_assign__F4sVad_P4sVad4sVad_autogen___1(struct Vad *___dst__P4sVad_1, struct Vad ___src__4sVad_1){
    340     return ((struct Vad )___src__4sVad_1);
    341 }
     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}
  • src/tests/.expect/64/declarationSpecifier.txt

    rdbfb35d r3bd1eb4  
    3030}
    3131static 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;
    3233    ((void)((*___dst__P13s__anonymous0_1).__i__i_1=___src__13s__anonymous0_1.__i__i_1));
    33     return ((struct __anonymous0 )___src__13s__anonymous0_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);
    3436}
    3537static inline void ___constructor__F_P13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, int __i__i_1){
     
    5456}
    5557static 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;
    5659    ((void)((*___dst__P13s__anonymous1_1).__i__i_1=___src__13s__anonymous1_1.__i__i_1));
    57     return ((struct __anonymous1 )___src__13s__anonymous1_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);
    5862}
    5963static inline void ___constructor__F_P13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, int __i__i_1){
     
    7882}
    7983static 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;
    8085    ((void)((*___dst__P13s__anonymous2_1).__i__i_1=___src__13s__anonymous2_1.__i__i_1));
    81     return ((struct __anonymous2 )___src__13s__anonymous2_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);
    8288}
    8389static inline void ___constructor__F_P13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, int __i__i_1){
     
    102108}
    103109static 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;
    104111    ((void)((*___dst__P13s__anonymous3_1).__i__i_1=___src__13s__anonymous3_1.__i__i_1));
    105     return ((struct __anonymous3 )___src__13s__anonymous3_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);
    106114}
    107115static inline void ___constructor__F_P13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, int __i__i_1){
     
    126134}
    127135static 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;
    128137    ((void)((*___dst__P13s__anonymous4_1).__i__i_1=___src__13s__anonymous4_1.__i__i_1));
    129     return ((struct __anonymous4 )___src__13s__anonymous4_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);
    130140}
    131141static inline void ___constructor__F_P13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, int __i__i_1){
     
    150160}
    151161static 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;
    152163    ((void)((*___dst__P13s__anonymous5_1).__i__i_1=___src__13s__anonymous5_1.__i__i_1));
    153     return ((struct __anonymous5 )___src__13s__anonymous5_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);
    154166}
    155167static inline void ___constructor__F_P13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, int __i__i_1){
     
    174186}
    175187static 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;
    176189    ((void)((*___dst__P13s__anonymous6_1).__i__i_1=___src__13s__anonymous6_1.__i__i_1));
    177     return ((struct __anonymous6 )___src__13s__anonymous6_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);
    178192}
    179193static inline void ___constructor__F_P13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, int __i__i_1){
     
    198212}
    199213static 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;
    200215    ((void)((*___dst__P13s__anonymous7_1).__i__i_1=___src__13s__anonymous7_1.__i__i_1));
    201     return ((struct __anonymous7 )___src__13s__anonymous7_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);
    202218}
    203219static inline void ___constructor__F_P13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, int __i__i_1){
     
    230246}
    231247static 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;
    232249    ((void)((*___dst__P13s__anonymous8_1).__i__s_1=___src__13s__anonymous8_1.__i__s_1));
    233     return ((struct __anonymous8 )___src__13s__anonymous8_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);
    234252}
    235253static inline void ___constructor__F_P13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, short __i__s_1){
     
    254272}
    255273static 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;
    256275    ((void)((*___dst__P13s__anonymous9_1).__i__s_1=___src__13s__anonymous9_1.__i__s_1));
    257     return ((struct __anonymous9 )___src__13s__anonymous9_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);
    258278}
    259279static inline void ___constructor__F_P13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, short __i__s_1){
     
    278298}
    279299static 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;
    280301    ((void)((*___dst__P14s__anonymous10_1).__i__s_1=___src__14s__anonymous10_1.__i__s_1));
    281     return ((struct __anonymous10 )___src__14s__anonymous10_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);
    282304}
    283305static inline void ___constructor__F_P14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, short __i__s_1){
     
    302324}
    303325static 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;
    304327    ((void)((*___dst__P14s__anonymous11_1).__i__s_1=___src__14s__anonymous11_1.__i__s_1));
    305     return ((struct __anonymous11 )___src__14s__anonymous11_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);
    306330}
    307331static inline void ___constructor__F_P14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, short __i__s_1){
     
    326350}
    327351static 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;
    328353    ((void)((*___dst__P14s__anonymous12_1).__i__s_1=___src__14s__anonymous12_1.__i__s_1));
    329     return ((struct __anonymous12 )___src__14s__anonymous12_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);
    330356}
    331357static inline void ___constructor__F_P14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, short __i__s_1){
     
    350376}
    351377static 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;
    352379    ((void)((*___dst__P14s__anonymous13_1).__i__s_1=___src__14s__anonymous13_1.__i__s_1));
    353     return ((struct __anonymous13 )___src__14s__anonymous13_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);
    354382}
    355383static inline void ___constructor__F_P14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, short __i__s_1){
     
    374402}
    375403static 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;
    376405    ((void)((*___dst__P14s__anonymous14_1).__i__s_1=___src__14s__anonymous14_1.__i__s_1));
    377     return ((struct __anonymous14 )___src__14s__anonymous14_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);
    378408}
    379409static inline void ___constructor__F_P14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, short __i__s_1){
     
    398428}
    399429static 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;
    400431    ((void)((*___dst__P14s__anonymous15_1).__i__s_1=___src__14s__anonymous15_1.__i__s_1));
    401     return ((struct __anonymous15 )___src__14s__anonymous15_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);
    402434}
    403435static inline void ___constructor__F_P14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, short __i__s_1){
     
    438470}
    439471static 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;
    440473    ((void)((*___dst__P14s__anonymous16_1).__i__i_1=___src__14s__anonymous16_1.__i__i_1));
    441     return ((struct __anonymous16 )___src__14s__anonymous16_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);
    442476}
    443477static inline void ___constructor__F_P14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, int __i__i_1){
     
    462496}
    463497static 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;
    464499    ((void)((*___dst__P14s__anonymous17_1).__i__i_1=___src__14s__anonymous17_1.__i__i_1));
    465     return ((struct __anonymous17 )___src__14s__anonymous17_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);
    466502}
    467503static inline void ___constructor__F_P14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, int __i__i_1){
     
    486522}
    487523static 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;
    488525    ((void)((*___dst__P14s__anonymous18_1).__i__i_1=___src__14s__anonymous18_1.__i__i_1));
    489     return ((struct __anonymous18 )___src__14s__anonymous18_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);
    490528}
    491529static inline void ___constructor__F_P14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, int __i__i_1){
     
    510548}
    511549static 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;
    512551    ((void)((*___dst__P14s__anonymous19_1).__i__i_1=___src__14s__anonymous19_1.__i__i_1));
    513     return ((struct __anonymous19 )___src__14s__anonymous19_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);
    514554}
    515555static inline void ___constructor__F_P14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, int __i__i_1){
     
    534574}
    535575static 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;
    536577    ((void)((*___dst__P14s__anonymous20_1).__i__i_1=___src__14s__anonymous20_1.__i__i_1));
    537     return ((struct __anonymous20 )___src__14s__anonymous20_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);
    538580}
    539581static inline void ___constructor__F_P14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, int __i__i_1){
     
    558600}
    559601static 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;
    560603    ((void)((*___dst__P14s__anonymous21_1).__i__i_1=___src__14s__anonymous21_1.__i__i_1));
    561     return ((struct __anonymous21 )___src__14s__anonymous21_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);
    562606}
    563607static inline void ___constructor__F_P14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, int __i__i_1){
     
    582626}
    583627static 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;
    584629    ((void)((*___dst__P14s__anonymous22_1).__i__i_1=___src__14s__anonymous22_1.__i__i_1));
    585     return ((struct __anonymous22 )___src__14s__anonymous22_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);
    586632}
    587633static inline void ___constructor__F_P14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, int __i__i_1){
     
    606652}
    607653static 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;
    608655    ((void)((*___dst__P14s__anonymous23_1).__i__i_1=___src__14s__anonymous23_1.__i__i_1));
    609     return ((struct __anonymous23 )___src__14s__anonymous23_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);
    610658}
    611659static inline void ___constructor__F_P14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, int __i__i_1){
  • src/tests/.expect/64/extension.txt

    rdbfb35d r3bd1eb4  
    3333}
    3434static 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;
    3536    ((void)((*___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1));
    3637    ((void)((*___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1));
    3738    ((void)((*___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1));
    38     return ((struct S )___src__2sS_1);
     39    ((void)___constructor__F_P2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1));
     40    return ((struct S )___ret__2sS_1);
    3941}
    4042static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __a__i_1){
     
    6668}
    6769static 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;
    6871    ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U )));
    69     return ((union U )___src__2uU_1);
     72    ((void)___constructor__F_P2uU2uU_autogen___1((&___ret__2uU_1), ___src__2uU_1));
     73    return ((union U )___ret__2uU_1);
    7074}
    7175static inline void ___constructor__F_P2uUi_autogen___1(union U *___dst__P2uU_1, int __src__i_1){
  • src/tests/.expect/64/gccExtensions.txt

    rdbfb35d r3bd1eb4  
    5959    }
    6060    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;
    6162        ((void)((*___dst__P2sS_2).__a__i_2=___src__2sS_2.__a__i_2));
    6263        ((void)((*___dst__P2sS_2).__b__i_2=___src__2sS_2.__b__i_2));
    6364        ((void)((*___dst__P2sS_2).__c__i_2=___src__2sS_2.__c__i_2));
    64         return ((struct S )___src__2sS_2);
     65        ((void)___constructor__F_P2sS2sS_autogen___2((&___ret__2sS_2), ___src__2sS_2));
     66        return ((struct S )___ret__2sS_2);
    6567    }
    6668    inline void ___constructor__F_P2sSi_autogen___2(struct S *___dst__P2sS_2, int __a__i_2){
     
    109111    }
    110112    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;
    111114        ((void)((*___dst__P3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2));
    112         return ((struct s2 )___src__3ss2_2);
     115        ((void)___constructor__F_P3ss23ss2_autogen___2((&___ret__3ss2_2), ___src__3ss2_2));
     116        return ((struct s2 )___ret__3ss2_2);
    113117    }
    114118    inline void ___constructor__F_P3ss2i_autogen___2(struct s2 *___dst__P3ss2_2, int __i__i_2){
     
    128132    }
    129133    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;
    130135        ((void)((*___dst__P3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2));
    131         return ((struct s3 )___src__3ss3_2);
     136        ((void)___constructor__F_P3ss33ss3_autogen___2((&___ret__3ss3_2), ___src__3ss3_2));
     137        return ((struct s3 )___ret__3ss3_2);
    132138    }
    133139    inline void ___constructor__F_P3ss3i_autogen___2(struct s3 *___dst__P3ss3_2, int __i__i_2){
     
    149155    }
    150156    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;
    151158        ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2));
    152         return ((struct s4 )___src__3ss4_2);
     159        ((void)___constructor__F_P3ss43ss4_autogen___2((&___ret__3ss4_2), ___src__3ss4_2));
     160        return ((struct s4 )___ret__3ss4_2);
    153161    }
    154162    inline void ___constructor__F_P3ss4i_autogen___2(struct s4 *___dst__P3ss4_2, int __i__i_2){
  • src/tests/.expect/concurrent/sched-int-wait.txt

    rdbfb35d r3bd1eb4  
     1Starting
     2Done
  • src/tests/.expect/memberCtors-ERR1.txt

    rdbfb35d r3bd1eb4  
    1 memberCtors.c:62 error: in void ?{}(B *b), field a2 used before being constructed
     1memberCtors.c:71 error: in void ?{}(B *b), field a2 used before being constructed
  • src/tests/.expect/memberCtors.txt

    rdbfb35d r3bd1eb4  
    1616assigning int: 0 0
    1717end construct A
     18copy constructing int: 0
     19copy constructing int: 0
     20begin copy construct A
     21copy construct this->x
     22copy constructing int: 1001
     23assign this->y
     24copy constructing int: 0
     25destructing int: 0
     26destructing int: 0
     27end copy construct A
     28begin ?=? A
     29copy constructing int: 1001
     30destructing int: 1001
     31destructing int: 1001
     32copy constructing int: 0
     33destructing int: 0
     34destructing int: 0
     35copy constructing int: 0
     36destructing int: 0
     37destructing int: 0
     38end ?=? A
     39copy constructing int: 0
     40copy constructing int: 0
     41begin copy construct A
     42copy construct this->x
     43copy constructing int: 1001
     44assign this->y
     45copy constructing int: 0
     46destructing int: 0
     47destructing int: 0
     48end copy construct A
     49destructing int: 0
     50destructing int: 0
     51destructing int: 1001
     52destructing int: 0
     53destructing int: 0
     54destructing int: 1001
    1855construct b->a1
    1956constructing int
     
    3673copy constructing int: 1000
    3774assign this->y
    38 end copy construct A
    39 copy constructing int: 0
    40 copy constructing int: 0
    41 begin copy construct A
    42 copy construct this->x
    43 copy constructing int: 1001
    44 assign this->y
    45 end copy construct A
    46 copy constructing int: 0
    47 copy constructing int: 0
    48 begin copy construct A
    49 copy construct this->x
    50 copy constructing int: 0
    51 assign this->y
     75copy constructing int: 0
     76destructing int: 0
     77destructing int: 0
     78end copy construct A
     79copy constructing int: 0
     80copy constructing int: 0
     81begin copy construct A
     82copy construct this->x
     83copy constructing int: 1001
     84assign this->y
     85copy constructing int: 0
     86destructing int: 0
     87destructing int: 0
     88end copy construct A
     89copy constructing int: 0
     90copy constructing int: 0
     91begin copy construct A
     92copy construct this->x
     93copy constructing int: 0
     94assign this->y
     95copy constructing int: 0
     96destructing int: 0
     97destructing int: 0
    5298end copy construct A
    5399End of main
     
    60106assigning int: 0 0
    61107end construct A
     108copy constructing int: 0
     109copy constructing int: 0
     110begin copy construct A
     111copy construct this->x
     112copy constructing int: 999
     113assign this->y
     114copy constructing int: 0
     115destructing int: 0
     116destructing int: 0
     117end copy construct A
     118begin ?=? A
     119copy constructing int: 999
     120destructing int: 999
     121destructing int: 999
     122copy constructing int: 0
     123destructing int: 0
     124destructing int: 0
     125copy constructing int: 0
     126destructing int: 0
     127destructing int: 0
     128end ?=? A
     129copy constructing int: 0
     130copy constructing int: 0
     131begin copy construct A
     132copy construct this->x
     133copy constructing int: 999
     134assign this->y
     135copy constructing int: 0
     136destructing int: 0
     137destructing int: 0
     138end copy construct A
     139destructing int: 0
     140destructing int: 0
     141destructing int: 999
     142destructing int: 0
     143destructing int: 0
     144destructing int: 999
    62145destructing int: 0
    63146destructing int: 0
     
    80163assigning int: 0 0
    81164end construct A
     165copy constructing int: 0
     166copy constructing int: 0
     167begin copy construct A
     168copy construct this->x
     169copy constructing int: 999
     170assign this->y
     171copy constructing int: 0
     172destructing int: 0
     173destructing int: 0
     174end copy construct A
     175begin ?=? A
     176copy constructing int: 999
     177destructing int: 999
     178destructing int: 999
     179copy constructing int: 0
     180destructing int: 0
     181destructing int: 0
     182copy constructing int: 0
     183destructing int: 0
     184destructing int: 0
     185end ?=? A
     186copy constructing int: 0
     187copy constructing int: 0
     188begin copy construct A
     189copy construct this->x
     190copy constructing int: 999
     191assign this->y
     192copy constructing int: 0
     193destructing int: 0
     194destructing int: 0
     195end copy construct A
     196destructing int: 0
     197destructing int: 0
     198destructing int: 999
     199destructing int: 0
     200destructing int: 0
     201destructing int: 999
    82202destructing int: 0
    83203destructing int: 0
  • src/tests/.expect/rational.txt

    rdbfb35d r3bd1eb4  
    17173/1
    18184/3
    19 conversion
    20 0.75
    21 0.142857142857143
    22 3.14159292035398
    23 3/4
    24 1/7
    25 355/113
    2619decompose
    2720more tests
  • src/tests/Makefile.am

    rdbfb35d r3bd1eb4  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Thu Feb 16 15:27:50 2017
    14 ## Update Count     : 41
     13## Last Modified On : Sun May 14 14:43:48 2017
     14## Update Count     : 42
    1515###############################################################################
    1616
    1717debug=yes
    1818
    19 quick_test=vector_test avl_test operators numericConstants expression enum array typeof cast dtor-early-exit init_once
     19quick_test=vector_test avl_test operators numericConstants expression enum array typeof cast dtor-early-exit init_once attributes
    2020
    2121if BUILD_CONCURRENCY
     
    3030# applies to both programs
    3131EXTRA_FLAGS =
    32 BUILD_FLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS}
     32BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS}
    3333TEST_FLAGS = $(if $(test), 2> .err/${@}.log, )
    3434CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS}
     
    7676
    7777declarationSpecifier: declarationSpecifier.c
    78         ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     78        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    7979
    8080gccExtensions : gccExtensions.c
    81         ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     81        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    8282
    8383extension : extension.c
    84         ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     84        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    8585
    8686attributes : attributes.c
    87         ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     87        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    8888
    8989KRfunctions : KRfunctions.c
    90         ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     90        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     91
     92gmp : gmp.c
     93        ${CC} ${CFLAGS} -lgmp ${<} -o ${@}
    9194
    9295memberCtors-ERR1: memberCtors.c
  • src/tests/Makefile.in

    rdbfb35d r3bd1eb4  
    226226quick_test = vector_test avl_test operators numericConstants \
    227227        expression enum array typeof cast dtor-early-exit init_once \
    228         $(am__append_1)
     228        attributes $(am__append_1)
    229229@BUILD_CONCURRENCY_FALSE@concurrent = no
    230230@BUILD_CONCURRENCY_TRUE@concurrent = yes
     
    234234# applies to both programs
    235235EXTRA_FLAGS =
    236 BUILD_FLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS}
     236BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS}
    237237TEST_FLAGS = $(if $(test), 2> .err/${@}.log, )
    238238fstream_test_SOURCES = fstream_test.c
     
    695695
    696696declarationSpecifier: declarationSpecifier.c
    697         ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     697        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    698698
    699699gccExtensions : gccExtensions.c
    700         ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     700        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    701701
    702702extension : extension.c
    703         ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     703        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    704704
    705705attributes : attributes.c
    706         ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     706        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    707707
    708708KRfunctions : KRfunctions.c
    709         ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     709        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     710
     711gmp : gmp.c
     712        ${CC} ${CFLAGS} -lgmp ${<} -o ${@}
    710713
    711714memberCtors-ERR1: memberCtors.c
  • src/tests/memberCtors.c

    rdbfb35d r3bd1eb4  
    5353} // z never constructed - will be automatically copy constructed
    5454
     55A ?=?(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
    5564struct B {
    5665  A a1, a2, a3;
  • src/tests/rational.c

    rdbfb35d r3bd1eb4  
    1010// Created On       : Mon Mar 28 08:43:12 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May  2 22:11:05 2017
    13 // Update Count     : 41
     12// Last Modified On : Sun May 14 18:10:28 2017
     13// Update Count     : 57
    1414//
    1515
     16#include <rational>
    1617#include <limits>
    17 #include <rational>
     18#include <stdlib>
    1819#include <fstream>
     20
     21// UNNECESSARY, FIX ME
     22void ?{}( int * this ) { *this = 0; }
     23void ?{}( int * this, zero_t ) { *this = 0; }
     24void ?{}( int * this, one_t ) { *this = 1; }
    1925
    2026int main() {
    2127        sout | "constructor" | endl;
    22         Rational a = { 3 }, b = { 4 }, c;
     28        Rational(int) a = { 3 }, b = { 4 }, c;
    2329        sout | a | b | c | endl;
    24         a = (Rational){ 4, 8 };
    25         b = (Rational){ 5, 7 };
     30
     31        a = (Rational(int)){ 4, 8 };
     32        b = (Rational(int)){ 5, 7 };
    2633        sout | a | b | endl;
    27         a = (Rational){ -2, -3 };
    28         b = (Rational){ 3, -2 };
     34        a = (Rational(int)){ -2, -3 };
     35        b = (Rational(int)){ 3, -2 };
    2936        sout | a | b | endl;
    30         a = (Rational){ -2, 3 };
    31         b = (Rational){ 3, 2 };
     37        a = (Rational(int)){ -2, 3 };
     38        b = (Rational(int)){ 3, 2 };
    3239        sout | a | b | endl;
    3340
    3441        sout | "logical" | endl;
    35         a = (Rational){ -2 };
    36         b = (Rational){ -3, 2 };
     42        a = (Rational(int)){ -2 };
     43        b = (Rational(int)){ -3, 2 };
    3744        sout | a | b | endl;
    3845//      sout | a == 1 | endl; // FIX ME
     
    5057        sout | a / b | endl;
    5158
    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;
     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;
    6269
    6370        sout | "decompose" | endl;
    64         RationalImpl n, d;
     71        int n, d;
    6572//      [n, d] = a;
    6673//      sout | a | n | d | endl;
    6774
    6875        sout | "more tests" | endl;
    69         Rational x = { 1, 2 }, y = { 2 };
     76        Rational(int) x = { 1, 2 }, y = { 2 };
    7077        sout | x - y | endl;
    7178        sout | x > y | endl;
     
    7380        sout | y | denominator( y, -2 ) | y | endl;
    7481
    75         Rational z = { 0, 5 };
     82        Rational(int) z = { 0, 5 };
    7683        sout | z | endl;
    7784
    7885        sout | x | numerator( x, 0 ) | x | endl;
    7986
    80         x = (Rational){ 1, MAX } + (Rational){ 1, MAX };
     87        x = (Rational(int)){ 1, MAX } + (Rational(int)){ 1, MAX };
    8188        sout | x | endl;
    82         x = (Rational){ 3, MAX } + (Rational){ 2, MAX };
     89        x = (Rational(int)){ 3, MAX } + (Rational(int)){ 2, MAX };
    8390        sout | x | endl;
    8491
  • src/tests/sched-int-wait.c

    rdbfb35d r3bd1eb4  
    113113        waiter_left = 4;
    114114        processor p;
     115        sout | "Starting" | endl;
    115116        {
    116117                Signaler  e;
     
    122123                }
    123124        }
     125        sout | "Done" | endl;
    124126}
  • src/tests/test.py

    rdbfb35d r3bd1eb4  
    2424        self.name, self.path = name, path
    2525
     26class TestResult:
     27        SUCCESS = 0
     28        FAILURE = 1
     29        TIMEOUT = 124
     30
    2631# parses the Makefile to find the machine type (32-bit / 64-bit)
    2732def getMachineType():
    2833        sh('echo "void ?{}(int*a,int b){}int main(){return 0;}" > .dummy.c')
    2934        ret, out = sh("make .dummy -s", print2stdout=True)
    30        
     35
    3136        if ret != 0:
    3237                print("Failed to identify architecture:")
     
    161166
    162167        # build, skipping to next test on error
    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)
     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
    164172
    165173        # if the make command succeds continue otherwise skip to diff
     
    170178                if fileIsExecutable(test.name) :
    171179                        # run test
    172                         sh("./%s %s > %s 2>&1" % (test.name, stdinput, out_file), dry_run)
     180                        retcode, _ = sh("timeout 60 ./%s %s > %s 2>&1" % (test.name, stdinput, out_file), dry_run)
    173181                else :
    174182                        # simply cat the result into the output
     
    179187                sh("mv %s %s" % (err_file, out_file), dry_run)
    180188
    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        
     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)
    195199        # clean the executable
    196200        sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
     
    205209        name_txt = "%20s  " % t.name
    206210
    207         #run the test instance and collect the result
    208         test_failed, error = run_single_test(t, generate, dry_run, debug)
     211        retcode, error = run_single_test(t, generate, dry_run, debug)
    209212
    210213        # update output based on current action
    211214        if generate :
    212                 failed_txt = "ERROR"
    213                 success_txt = "Done"
    214         else :
    215                 failed_txt = "FAILED"
    216                 success_txt = "PASSED"
     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"
    217222
    218223        #print result with error if needed
    219         text = name_txt + (failed_txt if test_failed else success_txt)
     224        text = name_txt + result_txt
    220225        out = sys.stdout
    221226        if error :
     
    223228                out = sys.stderr
    224229
    225         print(text, file = out);
     230        print(text, file = out)
    226231        sys.stdout.flush()
    227232        sys.stderr.flush()
    228233        signal.signal(signal.SIGINT, signal.SIG_IGN)
    229234
    230         return test_failed
     235        return retcode != TestResult.SUCCESS
    231236
    232237# run the given list of tests with the given parameters
     
    269274if __name__ == "__main__":
    270275        #always run from same folder
    271         chdir() 
    272        
     276        chdir()
     277
    273278        # parse the command line arguments
    274279        options = getOptions()
Note: See TracChangeset for help on using the changeset viewer.