Changes in / [78315272:3f7e12cb]


Ignore:
Files:
70 added
23 deleted
187 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    r78315272 r3f7e12cb  
    5252tools/prettyprinter/pretty
    5353tools/pretty
     54tools/catchsig
     55tools/repeat
    5456
    5557# generated by xfig for user manual
  • configure

    r78315272 r3f7e12cb  
    62816281
    62826282
    6283 ac_config_files="$ac_config_files Makefile src/driver/Makefile src/Makefile src/benchmark/Makefile src/examples/Makefile src/tests/Makefile src/tests/preempt_longrun/Makefile src/prelude/Makefile src/libcfa/Makefile tools/prettyprinter/Makefile"
     6283ac_config_files="$ac_config_files Makefile src/driver/Makefile src/Makefile src/benchmark/Makefile src/examples/Makefile src/tests/Makefile src/tests/preempt_longrun/Makefile src/prelude/Makefile src/libcfa/Makefile tools/Makefile tools/prettyprinter/Makefile"
    62846284
    62856285
     
    70487048    "src/prelude/Makefile") CONFIG_FILES="$CONFIG_FILES src/prelude/Makefile" ;;
    70497049    "src/libcfa/Makefile") CONFIG_FILES="$CONFIG_FILES src/libcfa/Makefile" ;;
     7050    "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
    70507051    "tools/prettyprinter/Makefile") CONFIG_FILES="$CONFIG_FILES tools/prettyprinter/Makefile" ;;
    70517052
  • configure.ac

    r78315272 r3f7e12cb  
    238238        src/prelude/Makefile
    239239        src/libcfa/Makefile
     240        tools/Makefile
    240241        tools/prettyprinter/Makefile
    241242        ])
  • doc/LaTeXmacros/lstlang.sty

    r78315272 r3f7e12cb  
    22%%
    33%% Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    4 %% 
    5 %% lstlang.sty -- 
    6 %% 
     4%%
     5%% lstlang.sty --
     6%%
    77%% Author           : Peter A. Buhr
    88%% Created On       : Sat May 13 16:34:42 2017
     
    110110                __attribute__, auto, _Bool, catch, catchResume, choose, _Complex, __complex, __complex__,
    111111                __const, __const__, disable, dtype, enable, __extension__, fallthrough, fallthru,
    112                 finally, forall, ftype, _Generic, _Imaginary, inline, __label__, lvalue, _Noreturn, one_t, 
    113                 otype, restrict, _Static_assert, throw, throwResume, trait, try, ttype, typeof, __typeof, 
    114                 __typeof__, virtual, waitfor, when, with, zero_t},
     112                finally, forall, ftype, _Generic, _Imaginary, inline, __label__, lvalue, _Noreturn, one_t,
     113                otype, restrict, _Static_assert, throw, throwResume, trait, try, ttype, typeof, __typeof,
     114                __typeof__, virtual, with, zero_t},
    115115        morekeywords=[2]{
    116                 _Atomic, coroutine, is_coroutine, is_monitor, is_thread, monitor, mutex, nomutex,
    117                 resume, suspend, thread, _Thread_local, yield},
     116                _Atomic, coroutine, is_coroutine, is_monitor, is_thread, monitor, mutex, nomutex, or,
     117                resume, suspend, thread, _Thread_local, waitfor, when, yield},
    118118        moredirectives={defined,include_next}%
    119119}
  • doc/proposals/concurrency/.gitignore

    r78315272 r3f7e12cb  
    1616build/*.out
    1717build/*.ps
     18build/*.pstex
     19build/*.pstex_t
    1820build/*.tex
    1921build/*.toc
  • doc/proposals/concurrency/Makefile

    r78315272 r3f7e12cb  
    1313annex/glossary \
    1414text/intro \
     15text/basics \
    1516text/cforall \
    16 text/basics \
    1717text/concurrency \
     18text/internals \
    1819text/parallelism \
     20text/results \
     21text/together \
     22text/future \
    1923}
    2024
     
    2327        ext_monitor \
    2428        int_monitor \
     29        dependency \
    2530}}
    2631
    27 PICTURES = ${addsuffix .pstex, \
    28 }
     32PICTURES = ${addprefix build/, ${addsuffix .pstex, \
     33        system \
     34}}
    2935
    3036PROGRAMS = ${addsuffix .tex, \
     
    6369        build/*.out     \
    6470        build/*.ps      \
     71        build/*.pstex   \
    6572        build/*.pstex_t \
    6673        build/*.tex     \
  • doc/proposals/concurrency/annex/glossary.tex

    r78315272 r3f7e12cb  
    1313}
    1414
    15 \longnewglossaryentry{group-acquire}
    16 {name={bulk acquiring}}
     15\longnewglossaryentry{bulk-acq}
     16{name={bulk-acquiring}}
    1717{
    1818Implicitly acquiring several monitors when entering a monitor.
     19}
     20
     21\longnewglossaryentry{multi-acq}
     22{name={multiple-acquisition}}
     23{
     24Any locking technique which allow any single thread to acquire a lock multiple times.
    1925}
    2026
     
    101107\newacronym{api}{API}{Application Program Interface}
    102108\newacronym{raii}{RAII}{Ressource Acquisition Is Initialization}
     109\newacronym{numa}{NUMA}{Non-Uniform Memory Access}
  • doc/proposals/concurrency/figures/ext_monitor.fig

    r78315272 r3f7e12cb  
    14144 1 -1 0 0 0 10 0.0000 2 105 90 6000 2160 d\001
    1515-6
    16 6 5850 1650 6150 1950
    17 1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 6000 1800 105 105 6000 1800 6105 1905
    18 4 1 -1 0 0 0 10 0.0000 2 105 90 6000 1860 b\001
     166 5100 2100 5400 2400
     171 3 0 1 -1 -1 1 0 4 0.000 1 0.0000 5250 2250 105 105 5250 2250 5355 2250
     184 1 -1 0 0 0 10 0.0000 2 105 120 5250 2295 X\001
    1919-6
    20206 5100 1800 5400 2100
     
    22224 1 -1 0 0 0 10 0.0000 2 105 120 5250 2010 Y\001
    2323-6
    24 6 5100 2100 5400 2400
    25 1 3 0 1 -1 -1 1 0 4 0.000 1 0.0000 5250 2250 105 105 5250 2250 5355 2250
    26 4 1 -1 0 0 0 10 0.0000 2 105 120 5250 2295 X\001
     246 5850 1650 6150 1950
     251 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 6000 1800 105 105 6000 1800 6105 1905
     264 1 -1 0 0 0 10 0.0000 2 105 90 6000 1860 b\001
    2727-6
    28 6 3000 5400 7200 5700
     286 3070 5445 7275 5655
    29291 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 3150 5550 80 80 3150 5550 3230 5630
    30301 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 4500 5550 105 105 4500 5550 4605 5655
     
    32324 0 -1 0 0 0 12 0.0000 2 135 1035 4725 5625 blocked task\001
    33334 0 -1 0 0 0 12 0.0000 2 135 870 3300 5625 active task\001
    34 4 0 -1 0 0 0 12 0.0000 2 180 930 6225 5625 routine ptrs\001
     344 0 -1 0 0 0 12 0.0000 2 135 1050 6225 5625 routine mask\001
    3535-6
    36361 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 3300 3600 105 105 3300 3600 3405 3705
     
    43432 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
    4444         4050 2925 5475 2925 5475 3225 4050 3225 4050 2925
    45 2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
    46          5850 2850 6075 3000
    47452 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 4
    4846         3150 3750 3750 3750 3750 4050 3150 4050
     
    66642 2 1 1 -1 -1 0 0 -1 4.000 0 0 0 0 0 5
    6765         5850 4200 5850 3300 4350 3300 4350 4200 5850 4200
    68 2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
    69          5250 2850 5850 2850 5850 1650
    70 2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 4
    71          3150 3150 3750 3150 3750 2850 5325 2850
    72662 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 1 2
    7367        1 1 1.00 60.00 120.00
    7468        7 1 1.00 60.00 120.00
    7569         5250 3150 5250 2400
     702 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
     71         3150 3150 3750 3150 3750 2850 5850 2850 5850 1650
     722 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
     73         5850 2850 6150 3000
    76742 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
    7775         5100 1800 5400 1800 5400 2400 5100 2400 5100 1800
  • doc/proposals/concurrency/style/cfa-format.tex

    r78315272 r3f7e12cb  
    108108  belowskip=3pt,
    109109  keepspaces=true,
     110  tabsize=4,
    110111  % frame=lines,
    111112  literate=,
     
    133134  belowskip=3pt,
    134135  keepspaces=true,
     136  tabsize=4,
    135137  % frame=lines,
    136138  literate=,
     
    150152  keywordstyle=\bfseries\color{blue},
    151153  keywordstyle=[2]\bfseries\color{Plum},
    152   commentstyle=\itshape\color{OliveGreen},                  % green and italic comments
     154  commentstyle=\sf\itshape\color{OliveGreen},             % green and italic comments
    153155  identifierstyle=\color{identifierCol},
    154156  stringstyle=\sf\color{Mahogany},                                % use sanserif font
     
    158160  belowskip=3pt,
    159161  keepspaces=true,
     162  tabsize=4,
    160163  % frame=lines,
    161164  literate=,
     
    251254}{}
    252255
     256\lstnewenvironment{gocode}[1][]{
     257  \lstset{
     258    language = Golang,
     259    style=defaultStyle,
     260    #1
     261  }
     262}{}
     263
    253264\newcommand{\zero}{\lstinline{zero_t}\xspace}
    254265\newcommand{\one}{\lstinline{one_t}\xspace}
  • doc/proposals/concurrency/text/basics.tex

    r78315272 r3f7e12cb  
    11% ======================================================================
    22% ======================================================================
    3 \chapter{Basics}\label{basics}
     3\chapter{Concurrency Basics}\label{basics}
    44% ======================================================================
    55% ======================================================================
    6 Before any detailed discussion of the concurrency and parallelism in \CFA, it is important to describe the basics of concurrency and how they are expressed in \CFA user code.
     6Before any detailed discussion of the concurrency and parallelism in \CFA, it is important to describe the basics of concurrency and how they are expressed in \CFA user-code.
    77
    88\section{Basics of concurrency}
    9 At its core, concurrency is based on having call-stacks and potentially multiple threads of execution for these stacks. Concurrency without parallelism only requires having multiple call stacks (or contexts) for a single thread of execution, and switching between these call stacks on a regular basis. A minimal concurrency product can be achieved by creating coroutines, which instead of context switching between each other, always ask an oracle where to context switch next. While coroutines do not technically require a stack, stackfull coroutines are the closest abstraction to a practical "naked"" call stack. When writing concurrency in terms of coroutines, the oracle effectively becomes a scheduler and the whole system now follows a cooperative threading-model \cit. The oracle/scheduler can either be a stackless or stackfull entity and correspondingly require one or two context switches to run a different coroutine. In any case, a subset of concurrency related challenges start to appear. For the complete set of concurrency challenges to occur, the only feature missing is preemption. Indeed, concurrency challenges appear with non-determinism. Guaranteeing mutual-exclusion or synchronisation are simply ways of limiting the lack of determinism in a system. A scheduler introduces order of execution uncertainty, while preemption introduces incertainty about where context-switches occur. Now it is important to understand that uncertainty is not necessarily undesireable; uncertainty can often be used by systems to significantly increase performance and is often the basis of giving a user the illusion that tasks are running in parallel. Optimal performance in concurrent applications is often obtained by having as much non-determinism as correctness allows\cit.
     9At its core, concurrency is based on having multiple call-stacks and scheduling among threads of execution executing on these stacks. Concurrency without parallelism only requires having multiple call stacks (or contexts) for a single thread of execution.
     10
     11Execution with a single thread and multiple stacks where the thread is self-scheduling deterministically across the stacks is called coroutining. Execution with a single and multiple stacks but where the thread is scheduled by an oracle (non-deterministic from the thread perspective) across the stacks is called concurrency.
     12
     13Therefore, a minimal concurrency system can be achieved by creating coroutines, which instead of context switching among each other, always ask an oracle where to context switch next. While coroutines can execute on the caller's stack-frame, stackfull coroutines allow full generality and are sufficient as the basis for concurrency. The aforementioned oracle is a scheduler and the whole system now follows a cooperative threading-model \cit. The oracle/scheduler can either be a stackless or stackfull entity and correspondingly require one or two context switches to run a different coroutine. In any case, a subset of concurrency related challenges start to appear. For the complete set of concurrency challenges to occur, the only feature missing is preemption.
     14
     15A scheduler introduces order of execution uncertainty, while preemption introduces uncertainty about where context-switches occur. Mutual-exclusion and synchronisation are ways of limiting non-determinism in a concurrent system. Now it is important to understand that uncertainty is desireable; uncertainty can be used by runtime systems to significantly increase performance and is often the basis of giving a user the illusion that tasks are running in parallel. Optimal performance in concurrent applications is often obtained by having as much non-determinism as correctness allows\cit.
    1016
    1117\section{\protect\CFA 's Thread Building Blocks}
    12 One of the important features that is missing in C is threading. On modern architectures, a lack of threading is becoming less and less forgivable\cite{Sutter05, Sutter05b}, and therefore modern programming languages must have the proper tools to allow users to write performant concurrent and/or parallel programs. As an extension of C, \CFA needs to express these concepts in a way that is as natural as possible to programmers used to imperative languages. And being a system-level language means programmers expect to choose precisely which features they need and which cost they are willing to pay.
     18One of the important features that is missing in C is threading. On modern architectures, a lack of threading is unacceptable\cite{Sutter05, Sutter05b}, and therefore modern programming languages must have the proper tools to allow users to write performant concurrent programs to take advantage of parallelism. As an extension of C, \CFA needs to express these concepts in a way that is as natural as possible to programmers familiar with imperative languages. And being a system-level language means programmers expect to choose precisely which features they need and which cost they are willing to pay.
    1319
    1420\section{Coroutines: A stepping stone}\label{coroutine}
    15 While the main focus of this proposal is concurrency and parallelism, as mentionned above it is important to adress coroutines, which are actually a significant underlying aspect of a concurrency system. Indeed, while having nothing to do with parallelism and arguably little to do with concurrency, coroutines need to deal with context-switchs and other context-management operations. Therefore, this proposal includes coroutines both as an intermediate step for the implementation of threads, and a first class feature of \CFA. Furthermore, many design challenges of threads are at least partially present in designing coroutines, which makes the design effort that much more relevant. The core API of coroutines revolve around two features: independent call stacks and \code{suspend}/\code{resume}.
    16 
    17 Here is an example of a solution to the fibonnaci problem using \CFA coroutines:
    18 \begin{cfacode}
    19         coroutine Fibonacci {
    20               int fn; // used for communication
    21         };
    22 
    23         void ?{}(Fibonacci & this) { // constructor
    24               this.fn = 0;
    25         }
    26 
    27         // main automacically called on first resume
    28         void main(Fibonacci & this) {
    29                 int fn1, fn2;           // retained between resumes
    30                 this.fn = 0;
    31                 fn1 = this.fn;
    32                 suspend(this);          // return to last resume
    33 
    34                 this.fn = 1;
     21While the main focus of this proposal is concurrency and parallelism, it is important to address coroutines, which are actually a significant building block of a concurrency system. Coroutines need to deal with context-switches and other context-management operations. Therefore, this proposal includes coroutines both as an intermediate step for the implementation of threads, and a first class feature of \CFA. Furthermore, many design challenges of threads are at least partially present in designing coroutines, which makes the design effort that much more relevant. The core \acrshort{api} of coroutines revolve around two features: independent call stacks and \code{suspend}/\code{resume}.
     22
     23\begin{figure}
     24\begin{center}
     25\begin{tabular}{c @{\hskip 0.025in}|@{\hskip 0.025in} c @{\hskip 0.025in}|@{\hskip 0.025in} c}
     26\begin{ccode}[tabsize=2]
     27//Using callbacks
     28void fibonacci_func(
     29        int n,
     30        void (*callback)(int)
     31) {
     32        int first = 0;
     33        int second = 1;
     34        int next, i;
     35        for(i = 0; i < n; i++)
     36        {
     37                if(i <= 1)
     38                        next = i;
     39                else {
     40                        next = f1 + f2;
     41                        f1 = f2;
     42                        f2 = next;
     43                }
     44                callback(next);
     45        }
     46}
     47
     48int main() {
     49        void print_fib(int n) {
     50                printf("%d\n", n);
     51        }
     52
     53        fibonacci_func(
     54                10, print_fib
     55        );
     56
     57
     58
     59}
     60\end{ccode}&\begin{ccode}[tabsize=2]
     61//Using output array
     62void fibonacci_array(
     63        int n,
     64        int * array
     65) {
     66        int f1 = 0; int f2 = 1;
     67        int next, i;
     68        for(i = 0; i < n; i++)
     69        {
     70                if(i <= 1)
     71                        next = i;
     72                else {
     73                        next = f1 + f2;
     74                        f1 = f2;
     75                        f2 = next;
     76                }
     77                array[i] = next;
     78        }
     79}
     80
     81
     82int main() {
     83        int a[10];
     84
     85        fibonacci_func(
     86                10, a
     87        );
     88
     89        for(int i=0;i<10;i++){
     90                printf("%d\n", a[i]);
     91        }
     92
     93}
     94\end{ccode}&\begin{ccode}[tabsize=2]
     95//Using external state
     96typedef struct {
     97        int f1, f2;
     98} Iterator_t;
     99
     100int fibonacci_state(
     101        Iterator_t * it
     102) {
     103        int f;
     104        f = it->f1 + it->f2;
     105        it->f2 = it->f1;
     106        it->f1 = max(f,1);
     107        return f;
     108}
     109
     110
     111
     112
     113
     114
     115
     116int main() {
     117        Iterator_t it={0,0};
     118
     119        for(int i=0;i<10;i++){
     120                printf("%d\n",
     121                        fibonacci_state(
     122                                &it
     123                        );
     124                );
     125        }
     126
     127}
     128\end{ccode}
     129\end{tabular}
     130\end{center}
     131\caption{Different implementations of a fibonacci sequence generator in C.}
     132\label{lst:fibonacci-c}
     133\end{figure}
     134
     135A good example of a problem made easier with coroutines is generators, like the fibonacci sequence. This problem comes with the challenge of decoupling how a sequence is generated and how it is used. Figure \ref{lst:fibonacci-c} shows conventional approaches to writing generators in C. All three of these approach suffer from strong coupling. The left and center approaches require that the generator have knowledge of how the sequence is used, while the rightmost approach requires holding internal state between calls on behalf of the generator and makes it much harder to handle corner cases like the Fibonacci seed.
     136
     137Figure \ref{lst:fibonacci-cfa} is an example of a solution to the fibonnaci problem using \CFA coroutines, where the coroutine stack holds sufficient state for the generation. This solution has the advantage of having very strong decoupling between how the sequence is generated and how it is used. Indeed, this version is as easy to use as the \code{fibonacci_state} solution, while the imlpementation is very similar to the \code{fibonacci_func} example.
     138
     139\begin{figure}
     140\begin{cfacode}
     141coroutine Fibonacci {
     142        int fn; //used for communication
     143};
     144
     145void ?{}(Fibonacci & this) { //constructor
     146        this.fn = 0;
     147}
     148
     149//main automacically called on first resume
     150void main(Fibonacci & this) with (this) {
     151        int fn1, fn2;           //retained between resumes
     152        fn  = 0;
     153        fn1 = fn;
     154        suspend(this);          //return to last resume
     155
     156        fn  = 1;
     157        fn2 = fn1;
     158        fn1 = fn;
     159        suspend(this);          //return to last resume
     160
     161        for ( ;; ) {
     162                fn  = fn1 + fn2;
    35163                fn2 = fn1;
    36                 fn1 = this.fn;
    37                 suspend(this);          // return to last resume
    38 
    39                 for ( ;; ) {
    40                         this.fn = fn1 + fn2;
    41                         fn2 = fn1;
    42                         fn1 = this.fn;
    43                         suspend(this);  // return to last resume
     164                fn1 = fn;
     165                suspend(this);  //return to last resume
     166        }
     167}
     168
     169int next(Fibonacci & this) {
     170        resume(this); //transfer to last suspend
     171        return this.fn;
     172}
     173
     174void main() { //regular program main
     175        Fibonacci f1, f2;
     176        for ( int i = 1; i <= 10; i += 1 ) {
     177                sout | next( f1 ) | next( f2 ) | endl;
     178        }
     179}
     180\end{cfacode}
     181\caption{Implementation of fibonacci using coroutines}
     182\label{lst:fibonacci-cfa}
     183\end{figure}
     184
     185Figure \ref{lst:fmt-line} shows the \code{Format} coroutine which rearranges text in order to group characters into blocks of fixed size. The example takes advantage of resuming coroutines in the constructor to simplify the code and highlights the idea that interesting control flow can occur in the constructor.
     186
     187\begin{figure}
     188\begin{cfacode}[tabsize=3]
     189//format characters into blocks of 4 and groups of 5 blocks per line
     190coroutine Format {
     191        char ch;                                                                        //used for communication
     192        int g, b;                                                               //global because used in destructor
     193};
     194
     195void  ?{}(Format & fmt) {
     196        resume( fmt );                                                  //prime (start) coroutine
     197}
     198
     199void ^?{}(Format & fmt) with fmt {
     200        if ( fmt.g != 0 || fmt.b != 0 )
     201        sout | endl;
     202}
     203
     204void main(Format & fmt) with fmt {
     205        for ( ;; ) {                                                    //for as many characters
     206                for(g = 0; g < 5; g++) {                //groups of 5 blocks
     207                        for(b = 0; b < 4; fb++) {       //blocks of 4 characters
     208                                suspend();
     209                                sout | ch;                                      //print character
     210                        }
     211                        sout | "  ";                                    //print block separator
    44212                }
    45         }
    46 
    47         int next(Fibonacci & this) {
    48                 resume(this); // transfer to last suspend
    49                 return this.fn;
    50         }
    51 
    52         void main() { // regular program main
    53                 Fibonacci f1, f2;
    54                 for ( int i = 1; i <= 10; i += 1 ) {
    55                         sout | next( f1 ) | next( f2 ) | endl;
    56                 }
    57         }
    58 \end{cfacode}
     213                sout | endl;                                            //print group separator
     214        }
     215}
     216
     217void prt(Format & fmt, char ch) {
     218        fmt.ch = ch;
     219        resume(fmt);
     220}
     221
     222int main() {
     223        Format fmt;
     224        char ch;
     225        Eof: for ( ;; ) {                                               //read until end of file
     226                sin | ch;                                                       //read one character
     227                if(eof(sin)) break Eof;                 //eof ?
     228                prt(fmt, ch);                                           //push character for formatting
     229        }
     230}
     231\end{cfacode}
     232\caption{Formatting text into lines of 5 blocks of 4 characters.}
     233\label{lst:fmt-line}
     234\end{figure}
    59235
    60236\subsection{Construction}
    61 One important design challenge for coroutines and threads (shown in section \ref{threads}) is that the runtime system needs to run code after the user-constructor runs. In the case of coroutines, this challenge is simpler since there is no non-determinism from preemption or scheduling. However, the underlying challenge remains the same for coroutines and threads.
    62 
    63 The runtime system needs to create the coroutine's stack and more importantly prepare it for the first resumption. The timing of the creation is non-trivial since users both expect to have fully constructed objects once execution enters the coroutine main and to be able to resume the coroutine from the constructor. Like for regular objects, constructors can still leak coroutines before they are ready. There are several solutions to this problem but the chosen options effectively forces the design of the coroutine.
     237One important design challenge for coroutines and threads (shown in section \ref{threads}) is that the runtime system needs to run code after the user-constructor runs to connect the fully constructed object into the system. In the case of coroutines, this challenge is simpler since there is no non-determinism from preemption or scheduling. However, the underlying challenge remains the same for coroutines and threads.
     238
     239The runtime system needs to create the coroutine's stack and more importantly prepare it for the first resumption. The timing of the creation is non-trivial since users both expect to have fully constructed objects once execution enters the coroutine main and to be able to resume the coroutine from the constructor. As regular objects, constructors can leak coroutines before they are ready. There are several solutions to this problem but the chosen options effectively forces the design of the coroutine.
    64240
    65241Furthermore, \CFA faces an extra challenge as polymorphic routines create invisible thunks when casted to non-polymorphic routines and these thunks have function scope. For example, the following code, while looking benign, can run into undefined behaviour because of thunks:
     
    71247
    72248forall(otype T)
    73 void noop(T *) {}
     249void noop(T*) {}
    74250
    75251void bar() {
    76252        int a;
    77         async(noop, &a);
    78 }
    79 \end{cfacode}
     253        async(noop, &a); //start thread running noop with argument a
     254}
     255\end{cfacode}
     256
    80257The generated C code\footnote{Code trimmed down for brevity} creates a local thunk to hold type information:
    81258
     
    95272}
    96273\end{ccode}
    97 The problem in this example is a race condition between the start of the execution of \code{noop} on the other thread and the stack frame of \code{bar} being destroyed. This extra challenge limits which solutions are viable because storing the function pointer for too long only increases the chances that the race will end in undefined behavior; i.e. the stack based thunk being destroyed before it was used. This challenge is an extension of challenges that come with second-class routines. Indeed, GCC nested routines also have the limitation that the routines cannot be passed outside of the scope of the functions these were declared in. The case of coroutines and threads is simply an extension of this problem to multiple call-stacks.
     274The problem in this example is a storage management issue, the function pointer \code{_thunk0} is only valid until the end of the block, which limits the viable solutions because storing the function pointer for too long causes undefined behavior; i.e., the stack-based thunk being destroyed before it can be used. This challenge is an extension of challenges that come with second-class routines. Indeed, GCC nested routines also have the limitation that nested routine cannot be passed outside of the declaration scope. The case of coroutines and threads is simply an extension of this problem to multiple call-stacks.
    98275
    99276\subsection{Alternative: Composition}
    100 One solution to this challenge would be to use composition/containement,
    101 
    102 \begin{cfacode}
    103         struct Fibonacci {
    104               int fn; // used for communication
    105               coroutine c; //composition
    106         };
    107 
    108         void ?{}(Fibonacci & this) {
    109               this.fn = 0;
    110                 (this.c){};
    111         }
    112 \end{cfacode}
    113 There are two downsides to this approach. The first, which is relatively minor, is that the base class needs to be made aware of the main routine pointer, regardless of whether a parameter or a virtual pointer is used, this means the coroutine data must be made larger to store a value that is actually a compile time constant (address of the main routine). The second problem, which is both subtle and significant, is that now users can get the initialisation order of there coroutines wrong. Indeed, every field of a \CFA struct is constructed but in declaration order, unless users explicitly write otherwise. This semantics means that users who forget to initialize a the coroutine may resume the coroutine with an uninitilized object. For coroutines, this is unlikely to be a problem, for threads however, this is a significant problem.
     277One solution to this challenge is to use composition/containement, where coroutine fields are added to manage the coroutine.
     278
     279\begin{cfacode}
     280struct Fibonacci {
     281        int fn; //used for communication
     282        coroutine c; //composition
     283};
     284
     285void FibMain(void *) {
     286        //...
     287}
     288
     289void ?{}(Fibonacci & this) {
     290        this.fn = 0;
     291        //Call constructor to initialize coroutine
     292        (this.c){myMain};
     293}
     294\end{cfacode}
     295The downside of this approach is that users need to correctly construct the coroutine handle before using it. Like any other objects, doing so the users carefully choose construction order to prevent usage of unconstructed objects. However, in the case of coroutines, users must also pass to the coroutine information about the coroutine main, like in the previous example. This opens the door for user errors and requires extra runtime storage to pass at runtime information that can be known statically.
    114296
    115297\subsection{Alternative: Reserved keyword}
     
    117299
    118300\begin{cfacode}
    119         coroutine Fibonacci {
    120               int fn; // used for communication
    121         };
    122 \end{cfacode}
    123 This mean the compiler can solve problems by injecting code where needed. The downside of this approach is that it makes coroutine a special case in the language. Users who would want to extend coroutines or build their own for various reasons can only do so in ways offered by the language. Furthermore, implementing coroutines without language supports also displays the power of \CFA.
    124 While this is ultimately the option used for idiomatic \CFA code, coroutines and threads can both be constructed by users without using the language support. The reserved keywords are only present to improve ease of use for the common cases.
     301coroutine Fibonacci {
     302        int fn; //used for communication
     303};
     304\end{cfacode}
     305The \code{coroutine} keyword means the compiler can find and inject code where needed. The downside of this approach is that it makes coroutine a special case in the language. Users wantint to extend coroutines or build their own for various reasons can only do so in ways offered by the language. Furthermore, implementing coroutines without language supports also displays the power of the programming language used. While this is ultimately the option used for idiomatic \CFA code, coroutines and threads can still be constructed by users without using the language support. The reserved keywords are only present to improve ease of use for the common cases.
    125306
    126307\subsection{Alternative: Lamda Objects}
     
    135316Often, the canonical threading paradigm in languages is based on function pointers, pthread being one of the most well known examples. The main problem of this approach is that the thread usage is limited to a generic handle that must otherwise be wrapped in a custom type. Since the custom type is simple to write in \CFA and solves several issues, added support for routine/lambda based coroutines adds very little.
    136317
    137 A variation of this would be to use an simple function pointer in the same way pthread does for threads :
     318A variation of this would be to use a simple function pointer in the same way pthread does for threads :
    138319\begin{cfacode}
    139320void foo( coroutine_t cid, void * arg ) {
     
    148329}
    149330\end{cfacode}
    150 This semantic is more common for thread interfaces than coroutines but would work equally well. As discussed in section \ref{threads}, this approach is superseeded by static approaches in terms of expressivity.
     331This semantics is more common for thread interfaces than coroutines works equally well. As discussed in section \ref{threads}, this approach is superseeded by static approaches in terms of expressivity.
    151332
    152333\subsection{Alternative: Trait-based coroutines}
     
    159340      coroutine_desc * get_coroutine(T & this);
    160341};
    161 \end{cfacode}
    162 This ensures an object is not a coroutine until \code{resume} (or \code{prime}) is called on the object. Correspondingly, any object that is passed to \code{resume} is a coroutine since it must satisfy the \code{is_coroutine} trait to compile. The advantage of this approach is that users can easily create different types of coroutines, for example, changing the memory foot print of a coroutine is trivial when implementing the \code{get_coroutine} routine. The \CFA keyword \code{coroutine} only has the effect of implementing the getter and forward declarations required for users to only have to implement the main routine.
     342
     343forall( dtype T | is_coroutine(T) ) void suspend(T &);
     344forall( dtype T | is_coroutine(T) ) void resume (T &);
     345\end{cfacode}
     346This ensures an object is not a coroutine until \code{resume} is called on the object. Correspondingly, any object that is passed to \code{resume} is a coroutine since it must satisfy the \code{is_coroutine} trait to compile. The advantage of this approach is that users can easily create different types of coroutines, for example, changing the memory layout of a coroutine is trivial when implementing the \code{get_coroutine} routine. The \CFA keyword \code{coroutine} only has the effect of implementing the getter and forward declarations required for users to only have to implement the main routine.
    163347
    164348\begin{center}
     
    186370\end{center}
    187371
    188 The combination of these two approaches allows users new to concurrency to have a easy and concise method while more advanced users can expose themselves to otherwise hidden pitfalls at the benefit of tighter control on memory layout and initialization.
     372The combination of these two approaches allows users new to coroutinning and concurrency to have an easy and concise specification, while more advanced users have tighter control on memory layout and initialization.
    189373
    190374\section{Thread Interface}\label{threads}
     
    192376
    193377\begin{cfacode}
    194         thread foo {};
     378thread foo {};
    195379\end{cfacode}
    196380
     
    205389\end{cfacode}
    206390
    207 Obviously, for this thread implementation to be usefull it must run some user code. Several other threading interfaces use a function-pointer representation as the interface of threads (for example \Csharp~\cite{Csharp} and Scala~\cite{Scala}). However, this proposal considers that statically tying a \code{main} routine to a thread superseeds this approach. Since the \code{main} routine is already a special routine in \CFA (where the program begins), it is possible naturally extend the semantics using overloading to declare mains for different threads (the normal main being the main of the initial thread). As such the \code{main} routine of a thread can be defined as
    208 \begin{cfacode}
    209         thread foo {};
    210 
    211         void main(foo & this) {
    212                 sout | "Hello World!" | endl;
    213         }
    214 \end{cfacode}
    215 
    216 In this example, threads of type \code{foo} start execution in the \code{void main(foo*)} routine which prints \code{"Hello World!"}. While this proposoal encourages this approach to enforce strongly-typed programming, users may prefer to use the routine based thread semantics for the sake of simplicity. With these semantics it is trivial to write a thread type that takes a function pointer as parameter and executes it on its stack asynchronously
    217 \begin{cfacode}
    218         typedef void (*voidFunc)(void);
    219 
    220         thread FuncRunner {
    221                 voidFunc func;
    222         };
    223 
    224         //ctor
    225         void ?{}(FuncRunner & this, voidFunc inFunc) {
    226                 this.func = inFunc;
    227         }
    228 
    229         //main
    230         void main(FuncRunner & this) {
    231                 this.func();
    232         }
    233 \end{cfacode}
    234 
    235 An advantage of the overloading approach to main is to clearly highlight where and what memory is required to pass parameters and return values to/from a thread.
    236 
    237 Of course for threads to be useful, it must be possible to start and stop threads and wait for them to complete execution. While using an \acrshort{api} such as \code{fork} and \code{join} is relatively common in the literature, such an interface is unnecessary. Indeed, the simplest approach is to use \acrshort{raii} principles and have threads \code{fork} once the constructor has completed and \code{join} before the destructor runs.
     391Obviously, for this thread implementation to be usefull it must run some user code. Several other threading interfaces use a function-pointer representation as the interface of threads (for example \Csharp~\cite{Csharp} and Scala~\cite{Scala}). However, this proposal considers that statically tying a \code{main} routine to a thread superseeds this approach. Since the \code{main} routine is already a special routine in \CFA (where the program begins), it is a natural extension of the semantics using overloading to declare mains for different threads (the normal main being the main of the initial thread). As such the \code{main} routine of a thread can be defined as
     392\begin{cfacode}
     393thread foo {};
     394
     395void main(foo & this) {
     396        sout | "Hello World!" | endl;
     397}
     398\end{cfacode}
     399
     400In this example, threads of type \code{foo} start execution in the \code{void main(foo &)} routine, which prints \code{"Hello World!"}. While this thesis encourages this approach to enforce strongly-typed programming, users may prefer to use the routine-based thread semantics for the sake of simplicity. With the static semantics it is trivial to write a thread type that takes a function pointer as a parameter and executes it on its stack asynchronously.
     401\begin{cfacode}
     402typedef void (*voidFunc)(int);
     403
     404thread FuncRunner {
     405        voidFunc func;
     406        int arg;
     407};
     408
     409void ?{}(FuncRunner & this, voidFunc inFunc, int arg) {
     410        this.func = inFunc;
     411        this.arg  = arg;
     412}
     413
     414void main(FuncRunner & this) {
     415        //thread starts here and runs the function
     416        this.func( this.arg );
     417}
     418\end{cfacode}
     419
     420A consequence of the strongly-typed approach to main is that memory layout of parameters and return values to/from a thread are now explicitly specified in the \acrshort{api}.
     421
     422Of course for threads to be useful, it must be possible to start and stop threads and wait for them to complete execution. While using an \acrshort{api} such as \code{fork} and \code{join} is relatively common in the literature, such an interface is unnecessary. Indeed, the simplest approach is to use \acrshort{raii} principles and have threads \code{fork} after the constructor has completed and \code{join} before the destructor runs.
    238423\begin{cfacode}
    239424thread World;
     
    254439\end{cfacode}
    255440
    256 This semantic has several advantages over explicit semantics typesafety is guaranteed, a thread is always started and stopped exaclty once and users cannot make any progamming errors. Another advantage of this semantic is that it naturally scale to multiple threads meaning basic synchronisation is very simple
     441This semantic has several advantages over explicit semantics: a thread is always started and stopped exaclty once, users cannot make any progamming errors, and it naturally scales to multiple threads meaning basic synchronisation is very simple.
    257442
    258443\begin{cfacode}
     
    276461\end{cfacode}
    277462
    278 However, one of the apparent drawbacks of this system is that threads now always form a lattice, that is they are always destroyed in opposite order of construction because of block structure. However, storage allocation is not limited to blocks; dynamic allocation can create threads that outlive the scope in which the thread is created much like dynamically allocating memory lets objects outlive the scope in which they are created
     463However, one of the drawbacks of this approach is that threads now always form a lattice, that is they are always destroyed in the opposite order of construction because of block structure. This restriction is relaxed by using dynamic allocation, so threads can outlive the scope in which they are created, much like dynamically allocating memory lets objects outlive the scope in which they are created.
    279464
    280465\begin{cfacode}
     
    283468};
    284469
    285 //main
    286470void main(MyThread & this) {
    287471        //...
     
    291475        MyThread * long_lived;
    292476        {
     477                //Start a thread at the beginning of the scope
    293478                MyThread short_lived;
    294                 //Start a thread at the beginning of the scope
    295 
    296                 DoStuff();
    297479
    298480                //create another thread that will outlive the thread in this scope
    299481                long_lived = new MyThread;
    300482
     483                DoStuff();
     484
    301485                //Wait for the thread short_lived to finish
    302486        }
    303487        DoMoreStuff();
    304488
    305         //Now wait for the short_lived to finish
     489        //Now wait for the long_lived to finish
    306490        delete long_lived;
    307491}
  • doc/proposals/concurrency/text/cforall.tex

    r78315272 r3f7e12cb  
    11% ======================================================================
    22% ======================================================================
    3 \chapter{Cforall crash course}
     3\chapter{Cforall Overview}
    44% ======================================================================
    55% ======================================================================
    66
    7 As mentionned in the introduction, the document presents the design for the concurrency features in \CFA. Since it is a new language here is a quick review of the language specifically tailored to the features needed to support concurrency.
     7The following is a quick introduction to the \CFA language, specifically tailored to the features needed to support concurrency.
    88
    9 \CFA is a extension of ISO C and therefore supports much of the same paradigms as C. It is a non-object oriented system level language, meaning it has very most of the major abstractions have either no runtime cost or can be opt-out easily. Like C, the basics of \CFA revolve around structures and routines, which are thin abstractions over assembly. The vast majority of the code produced by a \CFA compiler respects memory-layouts and calling-conventions laid out by C. However, while \CFA is not an object-oriented language according to a strict definition. It does have some notion of objects, most importantly construction and destruction of objects. Most of the following pieces of code can be found as is on the \CFA website : \cite{www-cfa}
     9\CFA is a extension of ISO-C and therefore supports all of the same paradigms as C. It is a non-object oriented system language, meaning most of the major abstractions have either no runtime overhead or can be opt-out easily. Like C, the basics of \CFA revolve around structures and routines, which are thin abstractions over machine code. The vast majority of the code produced by the \CFA translator respects memory-layouts and calling-conventions laid out by C. Interestingly, while \CFA is not an object-oriented language, lacking the concept of a receiver (e.g., this), it does have some notion of objects\footnote{C defines the term objects as : ``region of data storage in the execution environment, the contents of which can represent
     10values''\cite[3.15]{C11}}, most importantly construction and destruction of objects. Most of the following code examples can be found on the \CFA website \cite{www-cfa}
    1011
    1112\section{References}
    1213
    13 Like \CC, \CFA introduces references as an alternative to pointers. In regards to concurrency, the semantics difference between pointers and references aren't particularly relevant but since this document uses mostly references here is a quick overview of the semantics :
     14Like \CC, \CFA introduces rebindable references providing multiple dereferecing as an alternative to pointers. In regards to concurrency, the semantic difference between pointers and references are not particularly relevant, but since this document uses mostly references, here is a quick overview of the semantics:
    1415\begin{cfacode}
    1516int x, *p1 = &x, **p2 = &p1, ***p3 = &p2,
    16 &r1 = x,    &&r2 = r1,   &&&r3 = r2;
    17 ***p3 = 3;                                      // change x
    18 r3 = 3;                                         // change x, ***r3
    19 **p3 = ...;                                     // change p1
    20 &r3 = ...;                                      // change r1, (&*)**r3
    21 *p3 = ...;                                      // change p2
    22 &&r3 = ...;                                     // change r2, (&(&*)*)*r3
    23 &&&r3 = p3;                                     // change r3 to p3, (&(&(&*)*)*)r3
    24 int y, z, & ar[3] = { x, y, z };                // initialize array of references
    25 &ar[1] = &z;                                    // change reference array element
    26 typeof( ar[1] ) p;                              // is int, i.e., the type of referenced object
    27 typeof( &ar[1] ) q;                             // is int &, i.e., the type of reference
    28 sizeof( ar[1] ) == sizeof( int );               // is true, i.e., the size of referenced object
    29 sizeof( &ar[1] ) == sizeof( int *);             // is true, i.e., the size of a reference
     17        &r1 = x,    &&r2 = r1,   &&&r3 = r2;
     18***p3 = 3;                                                      //change x
     19r3    = 3;                                                      //change x, ***r3
     20**p3  = ...;                                            //change p1
     21*p3   = ...;                                            //change p2
     22int y, z, & ar[3] = {x, y, z};          //initialize array of references
     23typeof( ar[1]) p;                                       //is int, i.e., the type of referenced object
     24typeof(&ar[1]) q;                                       //is int &, i.e., the type of reference
     25sizeof( ar[1]) == sizeof(int);          //is true, i.e., the size of referenced object
     26sizeof(&ar[1]) == sizeof(int *);        //is true, i.e., the size of a reference
    3027\end{cfacode}
    31 The important thing to take away from this code snippet is that references offer a handle to an object much like pointers but which is automatically derefferenced when convinient.
     28The important take away from this code example is that references offer a handle to an object, much like pointers, but which is automatically dereferenced for convinience.
    3229
    3330\section{Overloading}
    3431
    35 Another important feature \CFA has in common with \CC is function overloading :
     32Another important feature of \CFA is function overloading as in Java and \CC, where routines with the same name are selected based on the number and type of the arguments. As well, \CFA uses the return type as part of the selection criteria, as in Ada\cite{Ada}. For routines with multiple parameters and returns, the selection is complex.
    3633\begin{cfacode}
    37 // selection based on type and number of parameters
    38 void f( void );                                 // (1)
    39 void f( char );                                 // (2)
    40 void f( int, double );                          // (3)
    41 f();                                            // select (1)
    42 f( 'a' );                                       // select (2)
    43 f( 3, 5.2 );                                    // select (3)
     34//selection based on type and number of parameters
     35void f(void);                   //(1)
     36void f(char);                   //(2)
     37void f(int, double);    //(3)
     38f();                                    //select (1)
     39f('a');                                 //select (2)
     40f(3, 5.2);                              //select (3)
    4441
    45 // selection based on  type and number of returns
    46 char f( int );                                  // (1)
    47 double f( int );                                // (2)
    48 [ int, double ] f( int );                       // (3)
    49 char c = f( 3 );                                // select (1)
    50 double d = f( 4 );                              // select (2)
    51 [ int, double ] t = f( 5 );                     // select (3)
     42//selection based on  type and number of returns
     43char   f(int);                  //(1)
     44double f(int);                  //(2)
     45char   c = f(3);                //select (1)
     46double d = f(4);                //select (2)
    5247\end{cfacode}
    53 This feature is particularly important for concurrency since the runtime system relies on creating different types do represent concurrency objects. Therefore, overloading is necessary to prevent the need for long prefixes and other naming conventions that prevent clashes. As seen in chapter \ref{basics}, the main is an example of routine that benefits from overloading when concurrency in introduced.
     48This feature is particularly important for concurrency since the runtime system relies on creating different types to represent concurrency objects. Therefore, overloading is necessary to prevent the need for long prefixes and other naming conventions that prevent name clashes. As seen in chapter \ref{basics}, routine \code{main} is an example that benefits from overloading.
    5449
    5550\section{Operators}
    56 Overloading also extends to operators. The syntax for denoting operator-overloading is to name a routine with the symbol of the operator and question marks where the arguments of the operation would be, like so :
     51Overloading also extends to operators. The syntax for denoting operator-overloading is to name a routine with the symbol of the operator and question marks where the arguments of the operation occur, e.g.:
    5752\begin{cfacode}
    58 int ++?( int op );                              // unary prefix increment
    59 int ?++( int op );                              // unary postfix increment
    60 int ?+?( int op1, int op2 );                    // binary plus
    61 int ?<=?( int op1, int op2 );                   // binary less than
    62 int ?=?( int & op1, int op2 );                  // binary assignment
    63 int ?+=?( int & op1, int op2 );                 // binary plus-assignment
     53int ++? (int op);                       //unary prefix increment
     54int ?++ (int op);                       //unary postfix increment
     55int ?+? (int op1, int op2);             //binary plus
     56int ?<=?(int op1, int op2);             //binary less than
     57int ?=? (int & op1, int op2);           //binary assignment
     58int ?+=?(int & op1, int op2);           //binary plus-assignment
    6459
    65 struct S { int i, j; };
    66 S ?+?( S op1, S op2 ) {                         // add two structures
    67         return (S){ op1.i + op2.i, op1.j + op2.j };
     60struct S {int i, j;};
     61S ?+?(S op1, S op2) {                           //add two structures
     62        return (S){op1.i + op2.i, op1.j + op2.j};
    6863}
    69 S s1 = { 1, 2 }, s2 = { 2, 3 }, s3;
    70 s3 = s1 + s2;                                   // compute sum: s3 == { 2, 5 }
     64S s1 = {1, 2}, s2 = {2, 3}, s3;
     65s3 = s1 + s2;                                           //compute sum: s3 == {2, 5}
    7166\end{cfacode}
    72 
    73 Since concurrency does not use operator overloading, this feature is more important as an introduction for the syntax of constructors.
     67While concurrency does not use operator overloading directly, this feature is more important as an introduction for the syntax of constructors.
    7468
    7569\section{Constructors/Destructors}
    76 \CFA uses the following syntax for constructors and destructors :
     70Object life-time is often a challenge in concurrency. \CFA uses the approach of giving concurrent meaning to object life-time as a mean of synchronization and/or mutual exclusion. Since \CFA relies heavily on the life time of objects, constructors and destructors are a core feature required for concurrency and parallelism. \CFA uses the following syntax for constructors and destructors :
    7771\begin{cfacode}
    7872struct S {
     
    8074        int * ia;
    8175};
    82 void ?{}( S & s, int asize ) with s {           // constructor operator
    83         size = asize;                           // initialize fields
    84         ia = calloc( size, sizeof( S ) );
     76void ?{}(S & s, int asize) {    //constructor operator
     77        s.size = asize;                         //initialize fields
     78        s.ia = calloc(size, sizeof(S));
    8579}
    86 void ^?{}( S & s ) with s {                     // destructor operator
    87         free( ia );                             // de-initialization fields
     80void ^?{}(S & s) {                              //destructor operator
     81        free(ia);                                       //de-initialization fields
    8882}
    8983int main() {
    90         S x = { 10 }, y = { 100 };              // implict calls: ?{}( x, 10 ), ?{}( y, 100 )
    91         ...                                     // use x and y
    92         ^x{};  ^y{};                            // explicit calls to de-initialize
    93         x{ 20 };  y{ 200 };                     // explicit calls to reinitialize
    94         ...                                     // reuse x and y
    95 }                                               // implict calls: ^?{}( y ), ^?{}( x )
     84        S x = {10}, y = {100};          //implict calls: ?{}(x, 10), ?{}(y, 100)
     85        ...                                                     //use x and y
     86        ^x{};  ^y{};                            //explicit calls to de-initialize
     87        x{20};  y{200};                         //explicit calls to reinitialize
     88        ...                                                     //reuse x and y
     89}                                                               //implict calls: ^?{}(y), ^?{}(x)
    9690\end{cfacode}
    97 The language guarantees that every object and all their fields are constructed. Like \CC construction is automatically done on declaration and destruction done when the declared variables reach the end of its scope.
     91The language guarantees that every object and all their fields are constructed. Like \CC, construction of an object is automatically done on allocation and destruction of the object is done on deallocation. Allocation and deallocation can occur on the stack or on the heap.
     92\begin{cfacode}
     93{
     94        struct S s = {10};      //allocation, call constructor
     95        ...
     96}                                               //deallocation, call destructor
     97struct S * s = new();   //allocation, call constructor
     98...
     99delete(s);                              //deallocation, call destructor
     100\end{cfacode}
     101Note that like \CC, \CFA introduces \code{new} and \code{delete}, which behave like \code{malloc} and \code{free} in addition to constructing and destructing objects, after calling \code{malloc} and before calling \code{free} respectively.
    98102
    99 For more information see \cite{cforall-ug,rob-thesis,www-cfa}.
     103\section{Parametric Polymorphism}
     104Routines in \CFA can also be reused for multiple types. This capability is done using the \code{forall} clause which gives \CFA its name. \code{forall} clauses allow separately compiled routines to support generic usage over multiple types. For example, the following sum function works for any type that supports construction from 0 and addition :
     105\begin{cfacode}
     106//constraint type, 0 and +
     107forall(otype T | { void ?{}(T *, zero_t); T ?+?(T, T); })
     108T sum(T a[ ], size_t size) {
     109        T total = 0;                            //construct T from 0
     110        for(size_t i = 0; i < size; i++)
     111                total = total + a[i];   //select appropriate +
     112        return total;
     113}
     114
     115S sa[5];
     116int i = sum(sa, 5);                             //use S's 0 construction and +
     117\end{cfacode}
     118
     119Since writing constraints on types can become cumbersome for more constrained functions, \CFA also has the concept of traits. Traits are named collection of constraints that can be used both instead and in addition to regular constraints:
     120\begin{cfacode}
     121trait sumable( otype T ) {
     122        void ?{}(T *, zero_t);          //constructor from 0 literal
     123        T ?+?(T, T);                            //assortment of additions
     124        T ?+=?(T *, T);
     125        T ++?(T *);
     126        T ?++(T *);
     127};
     128forall( otype T | sumable(T) )  //use trait
     129T sum(T a[], size_t size);
     130\end{cfacode}
     131
     132\section{with Clause/Statement}
     133Since \CFA lacks the concept of a receiver, certain functions end-up needing to repeat variable names often. To remove this inconvenience, \CFA provides the \code{with} statement, which opens an aggregate scope making its fields directly accessible (like Pascal).
     134\begin{cfacode}
     135struct S { int i, j; };
     136int mem(S & this) with (this)           //with clause
     137        i = 1;                                          //this->i
     138        j = 2;                                          //this->j
     139}
     140int foo() {
     141        struct S1 { ... } s1;
     142        struct S2 { ... } s2;
     143        with (s1)                                       //with statement
     144        {
     145                //access fields of s1
     146                //without qualification
     147                with (s2)                                       //nesting
     148                {
     149                        //access fields of s1 and s2
     150                        //without qualification
     151                }
     152        }
     153        with (s1, s2)                           //scopes open in parallel
     154        {
     155                //access fields of s1 and s2
     156                //without qualification
     157        }
     158}
     159\end{cfacode}
     160
     161For more information on \CFA see \cite{cforall-ug,rob-thesis,www-cfa}.
  • doc/proposals/concurrency/text/concurrency.tex

    r78315272 r3f7e12cb  
    44% ======================================================================
    55% ======================================================================
    6 Several tool can be used to solve concurrency challenges. Since many of these challenges appear with the use of mutable shared-state, some languages and libraries simply disallow mutable shared-state (Erlang~\cite{Erlang}, Haskell~\cite{Haskell}, Akka (Scala)~\cite{Akka}). In these paradigms, interaction among concurrent objects relies on message passing~\cite{Thoth,Harmony,V-Kernel} or other paradigms that closely relate to networking concepts (channels\cit for example). However, in languages that use routine calls as their core abstraction-mechanism, these approaches force a clear distinction between concurrent and non-concurrent paradigms (i.e., message passing versus routine call). This distinction in turn means that, in order to be effective, programmers need to learn two sets of designs patterns. While this distinction can be hidden away in library code, effective use of the librairy still has to take both paradigms into account.
     6Several tool can be used to solve concurrency challenges. Since many of these challenges appear with the use of mutable shared-state, some languages and libraries simply disallow mutable shared-state (Erlang~\cite{Erlang}, Haskell~\cite{Haskell}, Akka (Scala)~\cite{Akka}). In these paradigms, interaction among concurrent objects relies on message passing~\cite{Thoth,Harmony,V-Kernel} or other paradigms closely relate to networking concepts (channels\cite{CSP,Go} for example). However, in languages that use routine calls as their core abstraction-mechanism, these approaches force a clear distinction between concurrent and non-concurrent paradigms (i.e., message passing versus routine call). This distinction in turn means that, in order to be effective, programmers need to learn two sets of designs patterns. While this distinction can be hidden away in library code, effective use of the librairy still has to take both paradigms into account.
    77
    88Approaches based on shared memory are more closely related to non-concurrent paradigms since they often rely on basic constructs like routine calls and shared objects. At the lowest level, concurrent paradigms are implemented as atomic operations and locks. Many such mechanisms have been proposed, including semaphores~\cite{Dijkstra68b} and path expressions~\cite{Campbell74}. However, for productivity reasons it is desireable to have a higher-level construct be the core concurrency paradigm~\cite{HPP:Study}.
    99
    10 An approach that is worth mentionning because it is gaining in popularity is transactionnal memory~\cite{Dice10}[Check citation]. While this approach is even pursued by system languages like \CC\cit, the performance and feature set is currently too restrictive to be the main concurrency paradigm for general purpose language, which is why it was rejected as the core paradigm for concurrency in \CFA.
    11 
    12 One of the most natural, elegant, and efficient mechanisms for synchronization and communication, especially for shared memory systems, is the \emph{monitor}. Monitors were first proposed by Brinch Hansen~\cite{Hansen73} and later described and extended by C.A.R.~Hoare~\cite{Hoare74}. Many programming languages---e.g., Concurrent Pascal~\cite{ConcurrentPascal}, Mesa~\cite{Mesa}, Modula~\cite{Modula-2}, Turing~\cite{Turing:old}, Modula-3~\cite{Modula-3}, NeWS~\cite{NeWS}, Emerald~\cite{Emerald}, \uC~\cite{Buhr92a} and Java~\cite{Java}---provide monitors as explicit language constructs. In addition, operating-system kernels and device drivers have a monitor-like structure, although they often use lower-level primitives such as semaphores or locks to simulate monitors. For these reasons, this project proposes monitors as the core concurrency-construct.
     10An approach that is worth mentioning because it is gaining in popularity is transactionnal memory~\cite{Dice10}[Check citation]. While this approach is even pursued by system languages like \CC\cit, the performance and feature set is currently too restrictive to be the main concurrency paradigm for systems language, which is why it was rejected as the core paradigm for concurrency in \CFA.
     11
     12One of the most natural, elegant, and efficient mechanisms for synchronization and communication, especially for shared-memory systems, is the \emph{monitor}. Monitors were first proposed by Brinch Hansen~\cite{Hansen73} and later described and extended by C.A.R.~Hoare~\cite{Hoare74}. Many programming languages---e.g., Concurrent Pascal~\cite{ConcurrentPascal}, Mesa~\cite{Mesa}, Modula~\cite{Modula-2}, Turing~\cite{Turing:old}, Modula-3~\cite{Modula-3}, NeWS~\cite{NeWS}, Emerald~\cite{Emerald}, \uC~\cite{Buhr92a} and Java~\cite{Java}---provide monitors as explicit language constructs. In addition, operating-system kernels and device drivers have a monitor-like structure, although they often use lower-level primitives such as semaphores or locks to simulate monitors. For these reasons, this project proposes monitors as the core concurrency-construct.
    1313
    1414\section{Basics}
    15 Non-determinism requires concurrent systems to offer support for mutual-exclusion and synchronisation. Mutual-exclusion is the concept that only a fixed number of threads can access a critical section at any given time, where a critical section is a group of instructions on an associated portion of data that requires the restricted access. On the other hand, synchronization enforces relative ordering of execution and synchronization tools numerous mechanisms to establish timing relationships among threads.
     15Non-determinism requires concurrent systems to offer support for mutual-exclusion and synchronisation. Mutual-exclusion is the concept that only a fixed number of threads can access a critical section at any given time, where a critical section is a group of instructions on an associated portion of data that requires the restricted access. On the other hand, synchronization enforces relative ordering of execution and synchronization tools provide numerous mechanisms to establish timing relationships among threads.
    1616
    1717\subsection{Mutual-Exclusion}
    18 As mentionned above, mutual-exclusion is the guarantee that only a fix number of threads can enter a critical section at once. However, many solution exists for mutual exclusion which vary in terms of performance, flexibility and ease of use. Methods range from low-level locks, which are fast and flexible but require significant attention to be correct, to  higher-level mutual-exclusion methods, which sacrifice some performance in order to improve ease of use. Ease of use comes by either guaranteeing some problems cannot occur (e.g., being deadlock free) or by offering a more explicit coupling between data and corresponding critical section. For example, the \CC \code{std::atomic<T>} which offer an easy way to express mutual-exclusion on a restricted set of operations (.e.g: reading/writing large types atomically). Another challenge with low-level locks is composability. Locks are not composable because it takes careful organising for multiple locks to be used while preventing deadlocks. Easing composability is another feature higher-level mutual-exclusion mechanisms often offer.
     18As mentionned above, mutual-exclusion is the guarantee that only a fix number of threads can enter a critical section at once. However, many solutions exist for mutual exclusion, which vary in terms of performance, flexibility and ease of use. Methods range from low-level locks, which are fast and flexible but require significant attention to be correct, to  higher-level mutual-exclusion methods, which sacrifice some performance in order to improve ease of use. Ease of use comes by either guaranteeing some problems cannot occur (e.g., being deadlock free) or by offering a more explicit coupling between data and corresponding critical section. For example, the \CC \code{std::atomic<T>} offers an easy way to express mutual-exclusion on a restricted set of operations (e.g.: reading/writing large types atomically). Another challenge with low-level locks is composability. Locks have restricted composability because it takes careful organising for multiple locks to be used while preventing deadlocks. Easing composability is another feature higher-level mutual-exclusion mechanisms often offer.
    1919
    2020\subsection{Synchronization}
    21 As for mutual-exclusion, low level synchronisation primitive often offer good performance and good flexibility at the cost of ease of use. Again, higher-level mechanism often simplify usage by adding better coupling between synchronization and data, .eg., message passing, or offering simple solution to otherwise involved challenges. An example of this is barging. As mentionned above synchronization can be expressed as guaranteeing that event \textit{X} always happens before \textit{Y}. Most of the time synchronisation happens around a critical section, where threads most acquire said critical section in a certain order. However, it may also be desired to be able to guarantee that event \textit{Z} does not occur between \textit{X} and \textit{Y}. This is called barging, where event \textit{X} tries to effect event \textit{Y} but anoter thread races to grab the critical section and emits \textit{Z} before \textit{Y}. Preventing or detecting barging is an involved challenge with low-level locks, which can be made much easier by higher-level constructs.
     21As for mutual-exclusion, low-level synchronisation primitives often offer good performance and good flexibility at the cost of ease of use. Again, higher-level mechanism often simplify usage by adding better coupling between synchronization and data, e.g.: message passing, or offering simpler solution to otherwise involved challenges. As mentioned above, synchronization can be expressed as guaranteeing that event \textit{X} always happens before \textit{Y}. Most of the time, synchronisation happens within a critical section, where threads must acquire mutual-exclusion in a certain order. However, it may also be desirable to guarantee that event \textit{Z} does not occur between \textit{X} and \textit{Y}. Not satisfying this property called barging. For example, where event \textit{X} tries to effect event \textit{Y} but another thread acquires the critical section and emits \textit{Z} before \textit{Y}. The classic exmaple is the thread that finishes using a ressource and unblocks a thread waiting to use the resource, but the unblocked thread must compete again to acquire the resource. Preventing or detecting barging is an involved challenge with low-level locks, which can be made much easier by higher-level constructs. This challenge is often split into two different methods, barging avoidance and barging prevention. Algorithms that use status flags and other flag variables to detect barging threads are said to be using barging avoidance while algorithms that baton-passing locks between threads instead of releasing the locks are said to be using barging prevention.
    2222
    2323% ======================================================================
     
    2828A monitor is a set of routines that ensure mutual exclusion when accessing shared state. This concept is generally associated with Object-Oriented Languages like Java~\cite{Java} or \uC~\cite{uC++book} but does not strictly require OO semantics. The only requirements is the ability to declare a handle to a shared object and a set of routines that act on it :
    2929\begin{cfacode}
    30         typedef /*some monitor type*/ monitor;
    31         int f(monitor & m);
    32 
    33         int main() {
    34                 monitor m;  //Handle m
    35                 f(m);       //Routine using handle
    36         }
     30typedef /*some monitor type*/ monitor;
     31int f(monitor & m);
     32
     33int main() {
     34        monitor m;  //Handle m
     35        f(m);       //Routine using handle
     36}
    3737\end{cfacode}
    3838
     
    4747
    4848\begin{cfacode}
    49         monitor counter_t { /*...see section $\ref{data}$...*/ };
    50 
    51         void ?{}(counter_t & nomutex this); //constructor
    52         size_t ++?(counter_t & mutex this); //increment
    53 
    54         //need for mutex is platform dependent
    55         void ?{}(size_t * this, counter_t & mutex cnt); //conversion
    56 \end{cfacode}
    57 
    58 Here, the constructor(\code{?\{\}}) uses the \code{nomutex} keyword to signify that it does not acquire the monitor mutual-exclusion when constructing. This semantics is because an object not yet constructed should never be shared and therefore does not require mutual exclusion. The prefix increment operator uses \code{mutex} to protect the incrementing process from race conditions. Finally, there is a conversion operator from \code{counter_t} to \code{size_t}. This conversion may or may not require the \code{mutex} keyword depending on whether or not reading an \code{size_t} is an atomic operation.
    59 
    60 Having both \code{mutex} and \code{nomutex} keywords is redundant based on the meaning of a routine having neither of these keywords. For example, given a routine without qualifiers \code{void foo(counter_t & this)}, then it is reasonable that it should default to the safest option \code{mutex}, whereas assuming \code{nomutex} is unsafe and may cause subtle errors. In fact, \code{nomutex} is the "normal" parameter behaviour, with the \code{nomutex} keyword effectively stating explicitly that "this routine is not special". Another alternative is to make having exactly one of these keywords mandatory, which would provide the same semantics but without the ambiguity of supporting routines neither keyword. Mandatory keywords would also have the added benefit of being self-documented but at the cost of extra typing. While there are several benefits to mandatory keywords, they do bring a few challenges. Mandatory keywords in \CFA would imply that the compiler must know without a doubt wheter or not a parameter is a monitor or not. Since \CFA relies heavily on traits as an abstraction mechanism, the distinction between a type that is a monitor and a type that looks like a monitor can become blurred. For this reason, \CFA only has the \code{mutex} keyword.
    61 
    62 
    63 The next semantic decision is to establish when \code{mutex} may be used as a type qualifier. Consider the following declarations:
    64 \begin{cfacode}
    65 int f1(monitor & mutex m);
    66 int f2(const monitor & mutex m);
    67 int f3(monitor ** mutex m);
    68 int f4(monitor * mutex m []);
    69 int f5(graph(monitor*) & mutex m);
    70 \end{cfacode}
    71 The problem is to indentify which object(s) should be acquired. Furthermore, each object needs to be acquired only once. In the case of simple routines like \code{f1} and \code{f2} it is easy to identify an exhaustive list of objects to acquire on entry. Adding indirections (\code{f3}) still allows the compiler and programmer to indentify which object is acquired. However, adding in arrays (\code{f4}) makes it much harder. Array lengths are not necessarily known in C, and even then making sure objects are only acquired once becomes none-trivial. This can be extended to absurd limits like \code{f5}, which uses a graph of monitors. To keep everyone as sane as possible~\cite{Chicken}, this projects imposes the requirement that a routine may only acquire one monitor per parameter and it must be the type of the parameter with one level of indirection (ignoring potential qualifiers). Also note that while routine \code{f3} can be supported, meaning that monitor \code{**m} is be acquired, passing an array to this routine would be type safe and yet result in undefined behavior because only the first element of the array is acquired. This is specially true for non-copyable objects like monitors, where an array of pointers is simplest way to express a group of monitors. However, this ambiguity is part of the C type-system with respects to arrays. For this reason, \code{mutex} is disallowed in the context where arrays may be passed:
    72 
    73 \begin{cfacode}
    74 int f1(monitor & mutex m);   //Okay : recommanded case
    75 int f2(monitor * mutex m);   //Okay : could be an array but probably not
    76 int f3(monitor mutex m []);  //Not Okay : Array of unkown length
    77 int f4(monitor ** mutex m);  //Not Okay : Could be an array
    78 int f5(monitor * mutex m []); //Not Okay : Array of unkown length
    79 \end{cfacode}
    80 
    81 Unlike object-oriented monitors, where calling a mutex member \emph{implicitly} acquires mutual-exclusion, \CFA uses an explicit mechanism to acquire mutual-exclusion. A consequence of this approach is that it extends naturally to multi-monitor calls.
    82 \begin{cfacode}
    83 int f(MonitorA & mutex a, MonitorB & mutex b);
    84 
    85 MonitorA a;
    86 MonitorB b;
    87 f(a,b);
    88 \end{cfacode}
    89 The capacity to acquire multiple locks before entering a critical section is called \emph{\gls{group-acquire}}. In practice, writing multi-locking routines that do not lead to deadlocks is tricky. Having language support for such a feature is therefore a significant asset for \CFA. In the case presented above, \CFA guarantees that the order of aquisition is consistent across calls to routines using the same monitors as arguments. However, since \CFA monitors use multi-acquisition locks, users can effectively force the acquiring order. For example, notice which routines use \code{mutex}/\code{nomutex} and how this affects aquiring order:
    90 \begin{cfacode}
    91         void foo(A & mutex a, B & mutex b) { //acquire a & b
    92                 ...
    93         }
    94 
    95         void bar(A & mutex a, B & /*nomutex*/ b) { //acquire a
    96                 ... foo(a, b); ... //acquire b
    97         }
    98 
    99         void baz(A & /*nomutex*/ a, B & mutex b) { //acquire b
    100                 ... foo(a, b); ... //acquire a
    101         }
    102 \end{cfacode}
    103 The multi-acquisition monitor lock allows a monitor lock to be acquired by both \code{bar} or \code{baz} and acquired again in \code{foo}. In the calls to \code{bar} and \code{baz} the monitors are acquired in opposite order.
    104 
    105 However, such use leads the lock acquiring order problem. In the example above, the user uses implicit ordering in the case of function \code{foo} but explicit ordering in the case of \code{bar} and \code{baz}. This subtle mistake means that calling these routines concurrently may lead to deadlock and is therefore undefined behavior. As shown on several occasion\cit, solving this problem requires:
    106 \begin{enumerate}
    107         \item Dynamically tracking of the monitor-call order.
    108         \item Implement rollback semantics.
    109 \end{enumerate}
    110 While the first requirement is already a significant constraint on the system, implementing a general rollback semantics in a C-like language is prohibitively complex \cit. In \CFA, users simply need to be carefull when acquiring multiple monitors at the same time.
    111 
    112 Finally, for convenience, monitors support multiple acquiring, that is acquiring a monitor while already holding it does not cause a deadlock. It simply increments an internal counter which is then used to release the monitor after the number of acquires and releases match up. This is particularly usefull when monitor routines use other monitor routines as helpers or for recursions. For example:
    113 \begin{cfacode}
    114 monitor bank {
    115         int money;
    116         log_t usr_log;
    117 };
    118 
    119 void deposit( bank & mutex b, int deposit ) {
    120         b.money += deposit;
    121         b.usr_log | "Adding" | deposit | endl;
    122 }
    123 
    124 void transfer( bank & mutex mybank, bank & mutex yourbank, int me2you) {
    125         deposit( mybank, -me2you );
    126         deposit( yourbank, me2you );
    127 }
    128 \end{cfacode}
    129 
    130 % ======================================================================
    131 % ======================================================================
    132 \subsection{Data semantics} \label{data}
    133 % ======================================================================
    134 % ======================================================================
    135 Once the call semantics are established, the next step is to establish data semantics. Indeed, until now a monitor is used simply as a generic handle but in most cases monitors contain shared data. This data should be intrinsic to the monitor declaration to prevent any accidental use of data without its appropriate protection. For example, here is a complete version of the counter showed in section \ref{call}:
    136 \begin{cfacode}
    137 monitor counter_t {
    138         int value;
    139 };
    140 
    141 void ?{}(counter_t & this) {
    142         this.cnt = 0;
    143 }
    144 
    145 int ?++(counter_t & mutex this) {
    146         return ++this.value;
    147 }
    148 
    149 //need for mutex is platform dependent here
    150 void ?{}(int * this, counter_t & mutex cnt) {
    151         *this = (int)cnt;
    152 }
    153 \end{cfacode}
    154 
     49monitor counter_t { /*...see section $\ref{data}$...*/ };
     50
     51void ?{}(counter_t & nomutex this); //constructor
     52size_t ++?(counter_t & mutex this); //increment
     53
     54//need for mutex is platform dependent
     55void ?{}(size_t * this, counter_t & mutex cnt); //conversion
     56\end{cfacode}
    15557This counter is used as follows:
    15658\begin{center}
     
    16971\end{tabular}
    17072\end{center}
    171 Notice how the counter is used without any explicit synchronisation and yet supports thread-safe semantics for both reading and writting.
    172 
    173 % ======================================================================
    174 % ======================================================================
    175 \subsection{Implementation Details: Interaction with polymorphism}
    176 % ======================================================================
    177 % ======================================================================
    178 Depending on the choice of semantics for when monitor locks are acquired, interaction between monitors and \CFA's concept of polymorphism can be complex to support. However, it is shown that entry-point locking solves most of the issues.
    179 
    180 First of all, interaction between \code{otype} polymorphism and monitors is impossible since monitors do not support copying. Therefore, the main question is how to support \code{dtype} polymorphism. Since a monitor's main purpose is to ensure mutual exclusion when accessing shared data, this implies that mutual exclusion is only required for routines that do in fact access shared data. However, since \code{dtype} polymorphism always handles incomplete types (by definition), no \code{dtype} polymorphic routine can access shared data since the data requires knowledge about the type. Therefore, the only concern when combining \code{dtype} polymorphism and monitors is to protect access to routines.
    181 
    182 Before looking into complex control-flow, it is important to present the difference between the two acquiring options : callsite and entry-point locking, i.e. acquiring the monitors before making a mutex routine call or as the first operation of the mutex routine-call. For example:
     73Notice how the counter is used without any explicit synchronisation and yet supports thread-safe semantics for both reading and writting, which is similar in usage to \CC \code{atomic} template.
     74
     75Here, the constructor(\code{?\{\}}) uses the \code{nomutex} keyword to signify that it does not acquire the monitor mutual-exclusion when constructing. This semantics is because an object not yet con\-structed should never be shared and therefore does not require mutual exclusion. The prefix increment operator uses \code{mutex} to protect the incrementing process from race conditions. Finally, there is a conversion operator from \code{counter_t} to \code{size_t}. This conversion may or may not require the \code{mutex} keyword depending on whether or not reading a \code{size_t} is an atomic operation.
     76
     77For maximum usability, monitors use \gls{multi-acq} semantics, which means a single thread can acquire the same monitor multiple times without deadlock. For example, figure \ref{fig:search} uses recursion and \gls{multi-acq} to print values inside a binary tree.
     78\begin{figure}
     79\label{fig:search}
     80\begin{cfacode}
     81monitor printer { ... };
     82struct tree {
     83        tree * left, right;
     84        char * value;
     85};
     86void print(printer & mutex p, char * v);
     87
     88void print(printer & mutex p, tree * t) {
     89        print(p, t->value);
     90        print(p, t->left );
     91        print(p, t->right);
     92}
     93\end{cfacode}
     94\caption{Recursive printing algorithm using \gls{multi-acq}.}
     95\end{figure}
     96
     97Having both \code{mutex} and \code{nomutex} keywords is redundant based on the meaning of a routine having neither of these keywords. For example, given a routine without qualifiers \code{void foo(counter_t & this)}, then it is reasonable that it should default to the safest option \code{mutex}, whereas assuming \code{nomutex} is unsafe and may cause subtle errors. In fact, \code{nomutex} is the ``normal'' parameter behaviour, with the \code{nomutex} keyword effectively stating explicitly that ``this routine is not special''. Another alternative is making exactly one of these keywords mandatory, which provides the same semantics but without the ambiguity of supporting routines with neither keyword. Mandatory keywords would also have the added benefit of being self-documented but at the cost of extra typing. While there are several benefits to mandatory keywords, they do bring a few challenges. Mandatory keywords in \CFA would imply that the compiler must know without doubt whether or not a parameter is a monitor or not. Since \CFA relies heavily on traits as an abstraction mechanism, the distinction between a type that is a monitor and a type that looks like a monitor can become blurred. For this reason, \CFA only has the \code{mutex} keyword and uses no keyword to mean \code{nomutex}.
     98
     99The next semantic decision is to establish when \code{mutex} may be used as a type qualifier. Consider the following declarations:
     100\begin{cfacode}
     101int f1(monitor & mutex m);
     102int f2(const monitor & mutex m);
     103int f3(monitor ** mutex m);
     104int f4(monitor * mutex m []);
     105int f5(graph(monitor*) & mutex m);
     106\end{cfacode}
     107The problem is to indentify which object(s) should be acquired. Furthermore, each object needs to be acquired only once. In the case of simple routines like \code{f1} and \code{f2} it is easy to identify an exhaustive list of objects to acquire on entry. Adding indirections (\code{f3}) still allows the compiler and programmer to indentify which object is acquired. However, adding in arrays (\code{f4}) makes it much harder. Array lengths are not necessarily known in C, and even then making sure objects are only acquired once becomes none-trivial. This problem can be extended to absurd limits like \code{f5}, which uses a graph of monitors. To make the issue tractable, this project imposes the requirement that a routine may only acquire one monitor per parameter and it must be the type of the parameter with at most one level of indirection (ignoring potential qualifiers). Also note that while routine \code{f3} can be supported, meaning that monitor \code{**m} is be acquired, passing an array to this routine would be type safe and yet result in undefined behavior because only the first element of the array is acquired. However, this ambiguity is part of the C type-system with respects to arrays. For this reason, \code{mutex} is disallowed in the context where arrays may be passed:
     108\begin{cfacode}
     109int f1(monitor & mutex m);   //Okay : recommanded case
     110int f2(monitor * mutex m);   //Okay : could be an array but probably not
     111int f3(monitor mutex m []);  //Not Okay : Array of unkown length
     112int f4(monitor ** mutex m);  //Not Okay : Could be an array
     113int f5(monitor * mutex m []); //Not Okay : Array of unkown length
     114\end{cfacode}
     115Note that not all array functions are actually distinct in the type system. However, even if the code generation could tell the difference, the extra information is still not sufficient to extend meaningfully the monitor call semantic.
     116
     117Unlike object-oriented monitors, where calling a mutex member \emph{implicitly} acquires mutual-exclusion of the receiver object, \CFA uses an explicit mechanism to acquire mutual-exclusion. A consequence of this approach is that it extends naturally to multi-monitor calls.
     118\begin{cfacode}
     119int f(MonitorA & mutex a, MonitorB & mutex b);
     120
     121MonitorA a;
     122MonitorB b;
     123f(a,b);
     124\end{cfacode}
     125While OO monitors could be extended with a mutex qualifier for multiple-monitor calls, no example of this feature could be found. The capacity to acquire multiple locks before entering a critical section is called \emph{\gls{bulk-acq}}. In practice, writing multi-locking routines that do not lead to deadlocks is tricky. Having language support for such a feature is therefore a significant asset for \CFA. In the case presented above, \CFA guarantees that the order of aquisition is consistent across calls to different routines using the same monitors as arguments. This consistent ordering means acquiring multiple monitors in the way is safe from deadlock. However, users can still force the acquiring order. For example, notice which routines use \code{mutex}/\code{nomutex} and how this affects aquiring order:
     126\begin{cfacode}
     127void foo(A & mutex a, B & mutex b) { //acquire a & b
     128        ...
     129}
     130
     131void bar(A & mutex a, B & /*nomutex*/ b) { //acquire a
     132        ... foo(a, b); ... //acquire b
     133}
     134
     135void baz(A & /*nomutex*/ a, B & mutex b) { //acquire b
     136        ... foo(a, b); ... //acquire a
     137}
     138\end{cfacode}
     139The \gls{multi-acq} monitor lock allows a monitor lock to be acquired by both \code{bar} or \code{baz} and acquired again in \code{foo}. In the calls to \code{bar} and \code{baz} the monitors are acquired in opposite order.
     140
     141However, such use leads to the lock acquiring order problem. In the example above, the user uses implicit ordering in the case of function \code{foo} but explicit ordering in the case of \code{bar} and \code{baz}. This subtle mistake means that calling these routines concurrently may lead to deadlock and is therefore undefined behavior. As shown\cit, solving this problem requires:
     142\begin{enumerate}
     143        \item Dynamically tracking of the monitor-call order.
     144        \item Implement rollback semantics.
     145\end{enumerate}
     146While the first requirement is already a significant constraint on the system, implementing a general rollback semantics in a C-like language is prohibitively complex \cit. In \CFA, users simply need to be carefull when acquiring multiple monitors at the same time or only use \gls{bulk-acq} of all the monitors. While \CFA provides only a partial solution, many system provide no solution and the \CFA partial solution handles many useful cases.
     147
     148For example, \gls{multi-acq} and \gls{bulk-acq} can be used together in interesting ways:
     149\begin{cfacode}
     150monitor bank { ... };
     151
     152void deposit( bank & mutex b, int deposit );
     153
     154void transfer( bank & mutex mybank, bank & mutex yourbank, int me2you) {
     155        deposit( mybank, -me2you );
     156        deposit( yourbank, me2you );
     157}
     158\end{cfacode}
     159This example shows a trivial solution to the bank-account transfer-problem\cit. Without \gls{multi-acq} and \gls{bulk-acq}, the solution to this problem is much more involved and requires carefull engineering.
     160
     161\subsection{\code{mutex} statement} \label{mutex-stmt}
     162
     163The call semantics discussed aboved have one software engineering issue, only a named routine can acquire the mutual-exclusion of a set of monitor. \CFA offers the \code{mutex} statement to workaround the need for unnecessary names, avoiding a major software engineering problem\cit. Listing \ref{lst:mutex-stmt} shows an example of the \code{mutex} statement, which introduces a new scope in which the mutual-exclusion of a set of monitor is acquired. Beyond naming, the \code{mutex} statement has no semantic difference from a routine call with \code{mutex} parameters.
     164
     165\begin{figure}
    183166\begin{center}
    184 \setlength\tabcolsep{1.5pt}
    185 \begin{tabular}{|c|c|c|}
    186 Code & \gls{callsite-locking} & \gls{entry-point-locking} \\
    187 \CFA & pseudo-code & pseudo-code \\
     167\begin{tabular}{|c|c|}
     168function call & \code{mutex} statement \\
    188169\hline
    189170\begin{cfacode}[tabsize=3]
    190 void foo(monitor& mutex a){
    191 
    192 
    193 
    194         //Do Work
    195         //...
    196 
    197 }
    198 
    199 void main() {
    200         monitor a;
    201 
    202 
    203 
    204         foo(a);
    205 
    206 }
    207 \end{cfacode} & \begin{pseudo}[tabsize=3]
    208 foo(& a) {
    209 
    210 
    211 
    212         //Do Work
    213         //...
    214 
    215 }
    216 
    217 main() {
    218         monitor a;
    219         //calling routine
    220         //handles concurrency
    221         acquire(a);
    222         foo(a);
    223         release(a);
    224 }
    225 \end{pseudo} & \begin{pseudo}[tabsize=3]
    226 foo(& a) {
    227         //called routine
    228         //handles concurrency
    229         acquire(a);
    230         //Do Work
    231         //...
    232         release(a);
    233 }
    234 
    235 main() {
    236         monitor a;
    237 
    238 
    239 
    240         foo(a);
    241 
    242 }
    243 \end{pseudo}
     171monitor M {};
     172void foo( M & mutex m ) {
     173        //critical section
     174}
     175
     176void bar( M & m ) {
     177        foo( m );
     178}
     179\end{cfacode}&\begin{cfacode}[tabsize=3]
     180monitor M {};
     181void bar( M & m ) {
     182        mutex(m) {
     183                //critical section
     184        }
     185}
     186
     187
     188\end{cfacode}
    244189\end{tabular}
    245190\end{center}
    246 
    247 \Gls{callsite-locking} is inefficient, since any \code{dtype} routine may have to obtain some lock before calling a routine, depending on whether or not the type passed is a monitor. However, with \gls{entry-point-locking} calling a monitor routine becomes exactly the same as calling it from anywhere else.
    248 
    249 Note the \code{mutex} keyword relies on the resolver, which means that in cases where a generic monitor routine is actually desired, writing a mutex routine is possible with the proper trait. This is possible because monitors are designed in terms a trait. For example:
    250 \begin{cfacode}
    251 //Incorrect
    252 //T is not a monitor
    253 forall(dtype T)
    254 void foo(T * mutex t);
    255 
    256 //Correct
    257 //this function only works on monitors
    258 //(any monitor)
    259 forall(dtype T | is_monitor(T))
    260 void bar(T * mutex t));
    261 \end{cfacode}
    262 
    263 
    264 % ======================================================================
    265 % ======================================================================
    266 \section{Internal scheduling} \label{insched}
    267 % ======================================================================
    268 % ======================================================================
    269 In addition to mutual exclusion, the monitors at the core of \CFA's concurrency can also be used to achieve synchronisation. With monitors, this is generally achieved with internal or external scheduling as in\cit. Since internal scheduling of single monitors is mostly a solved problem, this proposal concentraits on extending internal scheduling to multiple monitors at once. Indeed, like the \gls{group-acquire} semantics, internal scheduling extends to multiple monitors at once in a way that is natural to the user but requires additional complexity on the implementation side.
     191\caption{Regular call semantics vs. \code{mutex} statement}
     192\label{lst:mutex-stmt}
     193\end{figure}
     194
     195% ======================================================================
     196% ======================================================================
     197\subsection{Data semantics} \label{data}
     198% ======================================================================
     199% ======================================================================
     200Once the call semantics are established, the next step is to establish data semantics. Indeed, until now a monitor is used simply as a generic handle but in most cases monitors contain shared data. This data should be intrinsic to the monitor declaration to prevent any accidental use of data without its appropriate protection. For example, here is a complete version of the counter showed in section \ref{call}:
     201\begin{cfacode}
     202monitor counter_t {
     203        int value;
     204};
     205
     206void ?{}(counter_t & this) {
     207        this.cnt = 0;
     208}
     209
     210int ?++(counter_t & mutex this) {
     211        return ++this.value;
     212}
     213
     214//need for mutex is platform dependent here
     215void ?{}(int * this, counter_t & mutex cnt) {
     216        *this = (int)cnt;
     217}
     218\end{cfacode}
     219
     220Like threads and coroutines, monitors are defined in terms of traits with some additional language support in the form of the \code{monitor} keyword. The monitor trait is :
     221\begin{cfacode}
     222trait is_monitor(dtype T) {
     223        monitor_desc * get_monitor( T & );
     224        void ^?{}( T & mutex );
     225};
     226\end{cfacode}
     227Note that the destructor of a monitor must be a \code{mutex} routine. This requirement ensures that the destructor has mutual-exclusion. As with any object, any call to a monitor, using \code{mutex} or otherwise, is Undefined Behaviour after the destructor has run.
     228
     229% ======================================================================
     230% ======================================================================
     231\section{Internal scheduling} \label{intsched}
     232% ======================================================================
     233% ======================================================================
     234In addition to mutual exclusion, the monitors at the core of \CFA's concurrency can also be used to achieve synchronisation. With monitors, this capability is generally achieved with internal or external scheduling as in\cit. Since internal scheduling within a single monitor is mostly a solved problem, this thesis concentrates on extending internal scheduling to multiple monitors. Indeed, like the \gls{bulk-acq} semantics, internal scheduling extends to multiple monitors in a way that is natural to the user but requires additional complexity on the implementation side.
    270235
    271236First, here is a simple example of such a technique:
    272237
    273238\begin{cfacode}
    274         monitor A {
    275                 condition e;
    276         }
    277 
    278         void foo(A & mutex a) {
    279                 ...
    280                 // Wait for cooperation from bar()
    281                 wait(a.e);
    282                 ...
    283         }
    284 
    285         void bar(A & mutex a) {
    286                 // Provide cooperation for foo()
    287                 ...
    288                 // Unblock foo at scope exit
    289                 signal(a.e);
    290         }
    291 \end{cfacode}
    292 
    293 There are two details to note here. First, there \code{signal} is a delayed operation, it only unblocks the waiting thread when it reaches the end of the critical section. This is needed to respect mutual-exclusion. Second, in \CFA, \code{condition} have no particular need to be stored inside a monitor, beyond any software engineering reasons. Here routine \code{foo} waits for the \code{signal} from \code{bar} before making further progress, effectively ensuring a basic ordering.
    294 
    295 An important aspect to take into account here is that \CFA does not allow barging, which means that once function \code{bar} releases the monitor, foo is guaranteed to resume immediately after (unless some other thread waited on the same condition). This guarantees offers the benefit of not having to loop arount waits in order to guarantee that a condition is still met. The main reason \CFA offers this guarantee is that users can easily introduce barging if it becomes a necessity but adding barging prevention or barging avoidance is more involved without language support. Supporting barging prevention as well as extending internal scheduling to multiple monitors is the main source of complexity in the design of \CFA concurrency.
     239monitor A {
     240        condition e;
     241}
     242
     243void foo(A & mutex a) {
     244        ...
     245        //Wait for cooperation from bar()
     246        wait(a.e);
     247        ...
     248}
     249
     250void bar(A & mutex a) {
     251        //Provide cooperation for foo()
     252        ...
     253        //Unblock foo
     254        signal(a.e);
     255}
     256\end{cfacode}
     257
     258There are two details to note here. First, the \code{signal} is a delayed operation, it only unblocks the waiting thread when it reaches the end of the critical section. This semantic is needed to respect mutual-exclusion. The alternative is to return immediately after the call to \code{signal}, which is significantly more restrictive. Second, in \CFA, while it is common to store a \code{condition} as a field of the monitor, a \code{condition} variable can be stored/created independently of a monitor. Here routine \code{foo} waits for the \code{signal} from \code{bar} before making further progress, effectively ensuring a basic ordering.
     259
     260An important aspect of the implementation is that \CFA does not allow barging, which means that once function \code{bar} releases the monitor, \code{foo} is guaranteed to resume immediately after (unless some other thread waited on the same condition). This guarantees offers the benefit of not having to loop arount waits in order to guarantee that a condition is still met. The main reason \CFA offers this guarantee is that users can easily introduce barging if it becomes a necessity but adding barging prevention or barging avoidance is more involved without language support. Supporting barging prevention as well as extending internal scheduling to multiple monitors is the main source of complexity in the design of \CFA concurrency.
    296261
    297262% ======================================================================
     
    300265% ======================================================================
    301266% ======================================================================
    302 It is easier to understand the problem of multi-monitor scheduling using a series of pseudo-code. Note that for simplicity in the following snippets of pseudo-code, waiting and signalling is done using an implicit condition variable, like Java built-in monitors.
     267It is easier to understand the problem of multi-monitor scheduling using a series of pseudo-code. Note that for simplicity in the following snippets of pseudo-code, waiting and signalling is done using an implicit condition variable, like Java built-in monitors. Indeed, \code{wait} statements always use the implicit condition as paremeter and explicitly names the monitors (A and B) associated with the condition. Note that in \CFA, condition variables are tied to a set of monitors on first use (called branding) which means that using internal scheduling with distinct sets of monitors requires one condition variable per set of monitors.
    303268
    304269\begin{multicols}{2}
     
    319284\end{pseudo}
    320285\end{multicols}
    321 The example shows the simple case of having two threads (one for each column) and a single monitor A. One thread acquires before waiting (atomically blocking and releasing A) and the other acquires before signalling. There is an important thing to note here, both \code{wait} and \code{signal} must be called with the proper monitor(s) already acquired. This restriction is hidden on the user side in \uC, as it is a logical requirement for barging prevention.
    322 
    323 A direct extension of the previous example is the \gls{group-acquire} version:
     286The example shows the simple case of having two threads (one for each column) and a single monitor A. One thread acquires before waiting (atomically blocking and releasing A) and the other acquires before signalling. It is important to note here that both \code{wait} and \code{signal} must be called with the proper monitor(s) already acquired. This semantic is a logical requirement for barging prevention.
     287
     288A direct extension of the previous example is a \gls{bulk-acq} version:
    324289
    325290\begin{multicols}{2}
     
    338303\end{pseudo}
    339304\end{multicols}
    340 This version uses \gls{group-acquire} (denoted using the \& symbol), but the presence of multiple monitors does not add a particularly new meaning. Synchronization happens between the two threads in exactly the same way and order. The only difference is that mutual exclusion covers more monitors. On the implementation side, handling multiple monitors does add a degree of complexity as the next few examples demonstrate.
    341 
    342 While deadlock issues can occur when nesting monitors, these issues are only a symptom of the fact that locks, and by extension monitors, are not perfectly composable. However, for monitors as for locks, it is possible to write a program using nesting without encountering any problems if nested is done correctly. For example, the next pseudo-code snippet acquires monitors A then B before waiting while only acquiring B when signalling, effectively avoiding the nested monitor problem.
    343 
     305This version uses \gls{bulk-acq} (denoted using the {\sf\&} symbol), but the presence of multiple monitors does not add a particularly new meaning. Synchronization happens between the two threads in exactly the same way and order. The only difference is that mutual exclusion covers more monitors. On the implementation side, handling multiple monitors does add a degree of complexity as the next few examples demonstrate.
     306
     307While deadlock issues can occur when nesting monitors, these issues are only a symptom of the fact that locks, and by extension monitors, are not perfectly composable. For monitors, a well known deadlock problem is the Nested Monitor Problem\cit, which occurs when a \code{wait} is made by a thread that holds more than one monitor. For example, the following pseudo-code runs into the nested-monitor problem :
    344308\begin{multicols}{2}
    345309\begin{pseudo}
     
    354318
    355319\begin{pseudo}
     320acquire A
     321        acquire B
     322                signal B
     323        release B
     324release A
     325\end{pseudo}
     326\end{multicols}
     327
     328The \code{wait} only releases monitor \code{B} so the signalling thread cannot acquire monitor \code{A} to get to the \code{signal}. Attempting release of all acquired monitors at the \code{wait} results in another set of problems such as releasing monitor \code{C}, which has nothing to do with the \code{signal}.
     329
     330However, for monitors as for locks, it is possible to write a program using nesting without encountering any problems if nesting is done correctly. For example, the next pseudo-code snippet acquires monitors {\sf A} then {\sf B} before waiting, while only acquiring {\sf B} when signalling, effectively avoiding the nested monitor problem.
     331
     332\begin{multicols}{2}
     333\begin{pseudo}
     334acquire A
     335        acquire B
     336                wait B
     337        release B
     338release A
     339\end{pseudo}
     340
     341\columnbreak
     342
     343\begin{pseudo}
    356344
    357345acquire B
     
    362350\end{multicols}
    363351
    364 The next example is where \gls{group-acquire} adds a significant layer of complexity to the internal signalling semantics.
    365 
     352% ======================================================================
     353% ======================================================================
     354\subsection{Internal Scheduling - in depth}
     355% ======================================================================
     356% ======================================================================
     357
     358A larger example is presented to show complex issuesfor \gls{bulk-acq} and all the implementation options are analyzed. Listing \ref{lst:int-bulk-pseudo} shows an example where \gls{bulk-acq} adds a significant layer of complexity to the internal signalling semantics, and listing \ref{lst:int-bulk-cfa} shows the corresponding \CFA code which implements the pseudo-code in listing \ref{lst:int-bulk-pseudo}. For the purpose of translating the given pseudo-code into \CFA-code any method of introducing monitor into context, other than a \code{mutex} parameter, is acceptable, e.g., global variables, pointer parameters or using locals with the \code{mutex}-statement.
     359
     360\begin{figure}[!b]
    366361\begin{multicols}{2}
    367362Waiting thread
    368363\begin{pseudo}[numbers=left]
    369364acquire A
    370         // Code Section 1
     365        //Code Section 1
    371366        acquire A & B
    372                 // Code Section 2
     367                //Code Section 2
    373368                wait A & B
    374                 // Code Section 3
     369                //Code Section 3
    375370        release A & B
    376         // Code Section 4
     371        //Code Section 4
    377372release A
    378373\end{pseudo}
     
    383378\begin{pseudo}[numbers=left, firstnumber=10]
    384379acquire A
    385         // Code Section 5
     380        //Code Section 5
    386381        acquire A & B
    387                 // Code Section 6
     382                //Code Section 6
    388383                signal A & B
    389                 // Code Section 7
     384                //Code Section 7
    390385        release A & B
    391         // Code Section 8
     386        //Code Section 8
    392387release A
    393388\end{pseudo}
    394389\end{multicols}
     390\caption{Internal scheduling with \gls{bulk-acq}}
     391\label{lst:int-bulk-pseudo}
     392\end{figure}
     393
     394\begin{figure}[!b]
    395395\begin{center}
    396 Listing 1
     396\begin{cfacode}[xleftmargin=.4\textwidth]
     397monitor A a;
     398monitor B b;
     399condition c;
     400\end{cfacode}
    397401\end{center}
    398 
    399 It is particularly important to pay attention to code sections 8 and 4, which are where the existing semantics of internal scheduling need to be extended for multiple monitors. The root of the problem is that \gls{group-acquire} is used in a context where one of the monitors is already acquired and is why it is important to define the behaviour of the previous pseudo-code. When the signaller thread reaches the location where it should "release A \& B" (line 16), it must actually transfer ownership of monitor B to the waiting thread. This ownership trasnfer is required in order to prevent barging. Since the signalling thread still needs the monitor A, simply waking up the waiting thread is not an option because it would violate mutual exclusion. There are three options:
     402\begin{multicols}{2}
     403Waiting thread
     404\begin{cfacode}
     405mutex(a) {
     406        //Code Section 1
     407        mutex(a, b) {
     408                //Code Section 2
     409                wait(c);
     410                //Code Section 3
     411        }
     412        //Code Section 4
     413}
     414\end{cfacode}
     415
     416\columnbreak
     417
     418Signalling thread
     419\begin{cfacode}
     420mutex(a) {
     421        //Code Section 5
     422        mutex(a, b) {
     423                //Code Section 6
     424                signal(c);
     425                //Code Section 7
     426        }
     427        //Code Section 8
     428}
     429\end{cfacode}
     430\end{multicols}
     431\caption{Equivalent \CFA code for listing \ref{lst:int-bulk-pseudo}}
     432\label{lst:int-bulk-cfa}
     433\end{figure}
     434
     435The complexity begins at code sections 4 and 8, which are where the existing semantics of internal scheduling need to be extended for multiple monitors. The root of the problem is that \gls{bulk-acq} is used in a context where one of the monitors is already acquired and is why it is important to define the behaviour of the previous pseudo-code. When the signaller thread reaches the location where it should ``release \code{A & B}'' (line 16), it must actually transfer ownership of monitor \code{B} to the waiting thread. This ownership trasnfer is required in order to prevent barging. Since the signalling thread still needs monitor \code{A}, simply waking up the waiting thread is not an option because it violates mutual exclusion. There are three options.
    400436
    401437\subsubsection{Delaying signals}
    402 The first more obvious solution to solve the problem of multi-monitor scheduling is to keep ownership of all locks until the last lock is ready to be transferred. It can be argued that that moment is the correct time to transfer ownership when the last lock is no longer needed because this semantics fits most closely to the behaviour of single monitor scheduling. This solution has the main benefit of transferring ownership of groups of monitors, which simplifies the semantics from mutiple objects to a single group of object, effectively making the existing single monitor semantic viable by simply changing monitors to monitor collections.
     438The obvious solution to solve the problem of multi-monitor scheduling is to keep ownership of all locks until the last lock is ready to be transferred. It can be argued that that moment is when the last lock is no longer needed because this semantics fits most closely to the behaviour of single-monitor scheduling. This solution has the main benefit of transferring ownership of groups of monitors, which simplifies the semantics from mutiple objects to a single group of objects, effectively making the existing single-monitor semantic viable by simply changing monitors to monitor groups.
    403439\begin{multicols}{2}
    404440Waiter
     
    424460\end{pseudo}
    425461\end{multicols}
    426 However, this solution can become much more complicated depending on what is executed while secretly holding B (at line 10). Indeed, nothing prevents a user from signalling monitor A on a different condition variable:
    427 \newpage
    428 \begin{multicols}{2}
    429 Thread 1
     462However, this solution can become much more complicated depending on what is executed while secretly holding B (at line 10). Indeed, nothing prevents signalling monitor A on a different condition variable:
     463\begin{figure}
     464\begin{multicols}{3}
     465Thread $\alpha$
    430466\begin{pseudo}[numbers=left, firstnumber=1]
    431467acquire A
     
    436472\end{pseudo}
    437473
    438 Thread 2
    439 \begin{pseudo}[numbers=left, firstnumber=6]
    440 acquire A
    441         wait A
    442 release A
    443 \end{pseudo}
    444 
    445474\columnbreak
    446475
    447 Thread 3
    448 \begin{pseudo}[numbers=left, firstnumber=10]
     476Thread $\gamma$
     477\begin{pseudo}[numbers=left, firstnumber=1]
    449478acquire A
    450479        acquire A & B
    451480                signal A & B
    452481        release A & B
    453         //Secretly keep B here
    454482        signal A
    455483release A
    456 //Wakeup thread 1 or 2?
    457 //Who wakes up the other thread?
    458 \end{pseudo}
     484\end{pseudo}
     485
     486\columnbreak
     487
     488Thread $\beta$
     489\begin{pseudo}[numbers=left, firstnumber=1]
     490acquire A
     491        wait A
     492release A
     493\end{pseudo}
     494
    459495\end{multicols}
     496\caption{Dependency graph}
     497\label{lst:dependency}
     498\end{figure}
    460499
    461500The goal in this solution is to avoid the need to transfer ownership of a subset of the condition monitors. However, this goal is unreacheable in the previous example. Depending on the order of signals (line 12 and 15) two cases can happen.
     
    467506Note that ordering is not determined by a race condition but by whether signalled threads are enqueued in FIFO or FILO order. However, regardless of the answer, users can move line 15 before line 11 and get the reverse effect.
    468507
    469 In both cases, the threads need to be able to distinguish on a per monitor basis which ones need to be released and which ones need to be transferred. Which means monitors cannot be handled as a single homogenous group.
     508In both cases, the threads need to be able to distinguish, on a per monitor basis, which ones need to be released and which ones need to be transferred, which means monitors cannot be handled as a single homogenous group and therefore effectively precludes this approach.
    470509
    471510\subsubsection{Dependency graphs}
    472 In the Listing 1 pseudo-code, there is a solution which statisfies both barging prevention and mutual exclusion. If ownership of both monitors is transferred to the waiter when the signaller releases A and then the waiter transfers back ownership of A when it releases it then the problem is solved. Dynamically finding the correct order is therefore the second possible solution. The problem it encounters is that it effectively boils down to resolving a dependency graph of ownership requirements. Here even the simplest of code snippets requires two transfers and it seems to increase in a manner closer to polynomial. For example, the following code, which is just a direct extension to three monitors, requires at least three ownership transfer and has multiple solutions:
     511In the listing \ref{lst:int-bulk-pseudo} pseudo-code, there is a solution which statisfies both barging prevention and mutual exclusion. If ownership of both monitors is transferred to the waiter when the signaller releases \code{A & B} and then the waiter transfers back ownership of \code{A} when it releases it, then the problem is solved (\code{B} is no longer in use at this point). Dynamically finding the correct order is therefore the second possible solution. The problem it encounters is that it effectively boils down to resolving a dependency graph of ownership requirements. Here even the simplest of code snippets requires two transfers and it seems to increase in a manner closer to polynomial. For example, the following code, which is just a direct extension to three monitors, requires at least three ownership transfer and has multiple solutions:
    473512
    474513\begin{multicols}{2}
     
    495534\end{pseudo}
    496535\end{multicols}
    497 Resolving dependency graph being a complex and expensive endeavour, this solution is not the preffered one.
     536
     537\begin{figure}
     538\begin{center}
     539\input{dependency}
     540\end{center}
     541\caption{Dependency graph of the statements in listing \ref{lst:dependency}}
     542\label{fig:dependency}
     543\end{figure}
     544
     545Listing \ref{lst:dependency} is the three thread example rewritten for dependency graphs. Figure \ref{fig:dependency} shows the corresponding dependency graph that results, where every node is a statement of one of the three threads, and the arrows the dependency of that statement (e.g., $\alpha1$ must happen before $\alpha2$). The extra challenge is that this dependency graph is effectively post-mortem, but the runtime system needs to be able to build and solve these graphs as the dependency unfolds. Resolving dependency graph being a complex and expensive endeavour, this solution is not the preffered one.
    498546
    499547\subsubsection{Partial signalling} \label{partial-sig}
    500 Finally, the solution that is chosen for \CFA is to use partial signalling. Consider the following case:
    501 
    502 \begin{multicols}{2}
    503 \begin{pseudo}[numbers=left]
    504 acquire A
    505         acquire A & B
    506                 wait A & B
    507         release A & B
    508 release A
    509 \end{pseudo}
    510 
    511 \columnbreak
    512 
    513 \begin{pseudo}[numbers=left, firstnumber=6]
    514 acquire A
    515         acquire A & B
    516                 signal A & B
    517         release A & B
    518         // ... More code
    519 release A
    520 \end{pseudo}
    521 \end{multicols}
    522 The partial signalling solution transfers ownership of monitor B at lines 10 but does not wake the waiting thread since it is still using monitor A. Only when it reaches line 11 does it actually wakeup the waiting thread. This solution has the benefit that complexity is encapsulated into only two actions, passing monitors to the next owner when they should be release and conditionnaly waking threads if all conditions are met. Contrary to the other solutions, this solution quickly hits an upper bound on complexity of implementation.
     548Finally, the solution that is chosen for \CFA is to use partial signalling. Again using listing \ref{lst:int-bulk-pseudo}, the partial signalling solution transfers ownership of monitor B at lines 10 but does not wake the waiting thread since it is still using monitor A. Only when it reaches line 11 does it actually wakeup the waiting thread. This solution has the benefit that complexity is encapsulated into only two actions, passing monitors to the next owner when they should be release and conditionally waking threads if all conditions are met. This solution has a much simpler implementation than a dependency graph solving algorithm which is why it was chosen. Furthermore, after being fully implemented, this solution does not appear to have any downsides worth mentionning.
    523549
    524550% ======================================================================
     
    527553% ======================================================================
    528554% ======================================================================
    529 An important note is that, until now, signalling a monitor was a delayed operation. The ownership of the monitor is transferred only when the monitor would have otherwise been released, not at the point of the \code{signal} statement. However, in some cases, it may be more convenient for users to immediately transfer ownership to the thread that is waiting for cooperation, which is achieved using the \code{signal_block} routine\footnote{name to be discussed}.
    530 
    531 For example here is an example highlighting the difference in behaviour:
    532 \begin{center}
     555\begin{figure}
    533556\begin{tabular}{|c|c|}
    534557\code{signal} & \code{signal_block} \\
    535558\hline
    536 \begin{cfacode}
    537 monitor M { int val; };
    538 
    539 void foo(M & mutex m ) {
    540         m.val++;
    541         sout| "Foo:" | m.val |endl;
    542 
    543         wait( c );
    544 
    545         m.val++;
    546         sout| "Foo:" | m.val |endl;
    547 }
    548 
    549 void bar(M & mutex m ) {
    550         m.val++;
    551         sout| "Bar:" | m.val |endl;
    552 
    553         signal( c );
    554 
    555         m.val++;
    556         sout| "Bar:" | m.val |endl;
    557 }
    558 \end{cfacode}&\begin{cfacode}
    559 monitor M { int val; };
    560 
    561 void foo(M & mutex m ) {
    562         m.val++;
    563         sout| "Foo:" | m.val |endl;
    564 
    565         wait( c );
    566 
    567         m.val++;
    568         sout| "Foo:" | m.val |endl;
    569 }
    570 
    571 void bar(M & mutex m ) {
    572         m.val++;
    573         sout| "Bar:" | m.val |endl;
    574 
    575         signal_block( c );
    576 
    577         m.val++;
    578         sout| "Bar:" | m.val |endl;
     559\begin{cfacode}[tabsize=3]
     560monitor DatingService
     561{
     562        //compatibility codes
     563        enum{ CCodes = 20 };
     564
     565        int girlPhoneNo
     566        int boyPhoneNo;
     567};
     568
     569condition girls[CCodes];
     570condition boys [CCodes];
     571condition exchange;
     572
     573int girl(int phoneNo, int ccode)
     574{
     575        //no compatible boy ?
     576        if(empty(boys[ccode]))
     577        {
     578                //wait for boy
     579                wait(girls[ccode]);
     580
     581                //make phone number available
     582                girlPhoneNo = phoneNo;
     583
     584                //wake boy from chair
     585                signal(exchange);
     586        }
     587        else
     588        {
     589                //make phone number available
     590                girlPhoneNo = phoneNo;
     591
     592                //wake boy
     593                signal(boys[ccode]);
     594
     595                //sit in chair
     596                wait(exchange);
     597        }
     598        return boyPhoneNo;
     599}
     600
     601int boy(int phoneNo, int ccode)
     602{
     603        //same as above
     604        //with boy/girl interchanged
     605}
     606\end{cfacode}&\begin{cfacode}[tabsize=3]
     607monitor DatingService
     608{
     609        //compatibility codes
     610        enum{ CCodes = 20 };
     611
     612        int girlPhoneNo;
     613        int boyPhoneNo;
     614};
     615
     616condition girls[CCodes];
     617condition boys [CCodes];
     618//exchange is not needed
     619
     620int girl(int phoneNo, int ccode)
     621{
     622        //no compatible boy ?
     623        if(empty(boys[ccode]))
     624        {
     625                //wait for boy
     626                wait(girls[ccode]);
     627
     628                //make phone number available
     629                girlPhoneNo = phoneNo;
     630
     631                //wake boy from chair
     632                signal(exchange);
     633        }
     634        else
     635        {
     636                //make phone number available
     637                girlPhoneNo = phoneNo;
     638
     639                //wake boy
     640                signal_block(boys[ccode]);
     641
     642                //second handshake unnecessary
     643
     644        }
     645        return boyPhoneNo;
     646}
     647
     648int boy(int phoneNo, int ccode)
     649{
     650        //same as above
     651        //with boy/girl interchanged
    579652}
    580653\end{cfacode}
    581654\end{tabular}
    582 \end{center}
    583 Assuming that \code{val} is initialized at 0, that each routine are called from seperate thread and that \code{foo} is always called first. The previous code would yield the following output:
    584 
     655\caption{Dating service example using \code{signal} and \code{signal_block}. }
     656\label{lst:datingservice}
     657\end{figure}
     658An important note is that, until now, signalling a monitor was a delayed operation. The ownership of the monitor is transferred only when the monitor would have otherwise been released, not at the point of the \code{signal} statement. However, in some cases, it may be more convenient for users to immediately transfer ownership to the thread that is waiting for cooperation, which is achieved using the \code{signal_block} routine\footnote{name to be discussed}.
     659
     660The example in listing \ref{lst:datingservice} highlights the difference in behaviour. As mentioned, \code{signal} only transfers ownership once the current critical section exits, this behaviour requires additional synchronisation when a two-way handshake is needed. To avoid this extraneous synchronisation, the \code{condition} type offers the \code{signal_block} routine, which handles the two-way handshake as shown in the example. This removes the need for a second condition variables and simplifies programming. Like every other monitor semantic, \code{signal_block} uses barging prevention, which means mutual-exclusion is baton-passed both on the frond-end and the back-end of the call to \code{signal_block}, meaning no other thread can acquire the monitor neither before nor after the call.
     661
     662% ======================================================================
     663% ======================================================================
     664\section{External scheduling} \label{extsched}
     665% ======================================================================
     666% ======================================================================
     667An alternative to internal scheduling is external scheduling, e.g., in \uC.
    585668\begin{center}
    586 \begin{tabular}{|c|c|}
    587 \code{signal} & \code{signal_block} \\
     669\begin{tabular}{|c|c|c|}
     670Internal Scheduling & External Scheduling & Go\\
    588671\hline
    589 \begin{pseudo}
    590 Foo: 0
    591 Bar: 1
    592 Bar: 2
    593 Foo: 3
    594 \end{pseudo}&\begin{pseudo}
    595 Foo: 0
    596 Bar: 1
    597 Foo: 2
    598 Bar: 3
    599 \end{pseudo}
    600 \end{tabular}
    601 \end{center}
    602 
    603 As mentionned, \code{signal} only transfers ownership once the current critical section exits, resulting in the second "Bar" line to be printed before the second "Foo" line. On the other hand, \code{signal_block} immediately transfers ownership to \code{bar}, causing an inversion of output. Obviously this means that \code{signal_block} is a blocking call, which will only be resumed once the signalled function exits the critical section.
    604 
    605 % ======================================================================
    606 % ======================================================================
    607 \subsection{Internal scheduling: Implementation} \label{inschedimpl}
    608 % ======================================================================
    609 % ======================================================================
    610 There are several challenges specific to \CFA when implementing internal scheduling. These challenges are direct results of \gls{group-acquire} and loose object definitions. These two constraints are to root cause of most design decisions in the implementation of internal scheduling. Furthermore, to avoid the head-aches of dynamically allocating memory in a concurrent environment, the internal-scheduling design is entirely free of mallocs and other dynamic memory allocation scheme. This is to avoid the chicken and egg problem of having a memory allocator that relies on the threading system and a threading system that relies on the runtime. This extra goal, means that memory management is a constant concern in the design of the system.
    611 
    612 The main memory concern for concurrency is queues. All blocking operations are made by parking threads onto queues. These queues need to be intrinsic\cit to avoid the need memory allocation. This entails that all the fields needed to keep track of all needed information. Since internal scheduling can use an unbound amount of memory (depending on \gls{group-acquire}) statically defining information information in the intrusive fields of threads is insufficient. The only variable sized container that does not require memory allocation is the callstack, which is heavily used in the implementation of internal scheduling. Particularly the GCC extension variable length arrays which is used extensively.
    613 
    614 Since stack allocation is based around scope, the first step of the implementation is to identify the scopes that are available to store the information, and which of these can have a variable length. In the case of external scheduling, the threads and the condition both allow a fixed amount of memory to be stored, while mutex-routines and the actual blocking call allow for an unbound amount (though adding too much to the mutex routine stack size can become expansive faster).
    615 
    616 The following figure is the traditionnal illustration of a monitor :
    617 
    618 \begin{center}
    619 {\resizebox{0.4\textwidth}{!}{\input{monitor}}}
    620 \end{center}
    621 
    622 For \CFA, the previous picture does not have support for blocking multiple monitors on a single condition. To support \gls{group-acquire} two changes to this picture are required. First, it doesn't make sense to tie the condition to a single monitor since blocking two monitors as one would require arbitrarily picking a monitor to hold the condition. Secondly, the object waiting on the conditions and AS-stack cannot simply contain the waiting thread since a single thread can potentially wait on multiple monitors. As mentionned in section \ref{inschedimpl}, the handling in multiple monitors is done by partially passing, which entails that each concerned monitor needs to have a node object. However, for waiting on the condition, since all threads need to wait together, a single object needs to be queued in the condition. Moving out the condition and updating the node types yields :
    623 
    624 \begin{center}
    625 {\resizebox{0.8\textwidth}{!}{\input{int_monitor}}}
    626 \end{center}
    627 
    628 \newpage
    629 
    630 This picture and the proper entry and leave algorithms is the fundamental implementation of internal scheduling.
    631 
    632 \begin{multicols}{2}
    633 Entry
    634 \begin{pseudo}[numbers=left]
    635 if monitor is free
    636         enter
    637 elif I already own the monitor
    638         continue
    639 else
    640         block
    641 increment recursion
    642 
    643 \end{pseudo}
    644 \columnbreak
    645 Exit
    646 \begin{pseudo}[numbers=left, firstnumber=8]
    647 decrement recursion
    648 if recursion == 0
    649         if signal_stack not empty
    650                 set_owner to thread
    651                 if all monitors ready
    652                         wake-up thread
    653 
    654         if entry queue not empty
    655                 wake-up thread
    656 \end{pseudo}
    657 \end{multicols}
    658 
    659 Some important things to notice about the exit routine. The solution discussed in \ref{inschedimpl} can be seen on line 11 of the previous pseudo code. Basically, the solution boils down to having a seperate data structure for the condition queue and the AS-stack, and unconditionally transferring ownership of the monitors but only unblocking the thread when the last monitor has trasnferred ownership. This solution is safe as well as preventing any potential barging.
    660 
    661 % ======================================================================
    662 % ======================================================================
    663 \section{External scheduling} \label{extsched}
    664 % ======================================================================
    665 % ======================================================================
    666 An alternative to internal scheduling is to use external scheduling.
    667 \begin{center}
    668 \begin{tabular}{|c|c|}
    669 Internal Scheduling & External Scheduling \\
    670 \hline
    671 \begin{ucppcode}
     672\begin{ucppcode}[tabsize=3]
    672673_Monitor Semaphore {
    673674        condition c;
     
    675676public:
    676677        void P() {
    677                 if(inUse) wait(c);
     678                if(inUse)
     679                        wait(c);
    678680                inUse = true;
    679681        }
     
    683685        }
    684686}
    685 \end{ucppcode}&\begin{ucppcode}
     687\end{ucppcode}&\begin{ucppcode}[tabsize=3]
    686688_Monitor Semaphore {
    687689
     
    689691public:
    690692        void P() {
    691                 if(inUse) _Accept(V);
     693                if(inUse)
     694                        _Accept(V);
    692695                inUse = true;
    693696        }
     
    697700        }
    698701}
    699 \end{ucppcode}
     702\end{ucppcode}&\begin{gocode}[tabsize=3]
     703type MySem struct {
     704        inUse bool
     705        c     chan bool
     706}
     707
     708// acquire
     709func (s MySem) P() {
     710        if s.inUse {
     711                select {
     712                case <-s.c:
     713                }
     714        }
     715        s.inUse = true
     716}
     717
     718// release
     719func (s MySem) V() {
     720        s.inUse = false
     721
     722        //This actually deadlocks
     723        //when single thread
     724        s.c <- false
     725}
     726\end{gocode}
    700727\end{tabular}
    701728\end{center}
    702 This method is more constrained and explicit, which may help users tone down the undeterministic nature of concurrency. Indeed, as the following examples demonstrates, external scheduling allows users to wait for events from other threads without the concern of unrelated events occuring. External scheduling can generally be done either in terms of control flow (e.g., \uC) or in terms of data (e.g. Go). Of course, both of these paradigms have their own strenghts and weaknesses but for this project control-flow semantics were chosen to stay consistent with the rest of the languages semantics. Two challenges specific to \CFA arise when trying to add external scheduling with loose object definitions and multi-monitor routines. The previous example shows a simple use \code{_Accept} versus \code{wait}/\code{signal} and its advantages. Note that while other languages often use \code{accept} as the core external scheduling keyword, \CFA uses \code{waitfor} to prevent name collisions with existing socket APIs.
    703 
    704 In the case of internal scheduling, the call to \code{wait} only guarantees that \code{V} is the last routine to access the monitor. This entails that the routine \code{V} may have acquired mutual exclusion several times while routine \code{P} was waiting. On the other hand, external scheduling guarantees that while routine \code{P} was waiting, no routine other than \code{V} could acquire the monitor.
     729This method is more constrained and explicit, which helps users tone down the undeterministic nature of concurrency. Indeed, as the following examples demonstrates, external scheduling allows users to wait for events from other threads without the concern of unrelated events occuring. External scheduling can generally be done either in terms of control flow (e.g., \uC with \code{_Accept}) or in terms of data (e.g., Go with channels). Of course, both of these paradigms have their own strenghts and weaknesses but for this project control-flow semantics were chosen to stay consistent with the rest of the languages semantics. Two challenges specific to \CFA arise when trying to add external scheduling with loose object definitions and multi-monitor routines. The previous example shows a simple use \code{_Accept} versus \code{wait}/\code{signal} and its advantages. Note that while other languages often use \code{accept}/\code{select} as the core external scheduling keyword, \CFA uses \code{waitfor} to prevent name collisions with existing socket \acrshort{api}s.
     730
     731For the \code{P} member above using internal scheduling, the call to \code{wait} only guarantees that \code{V} is the last routine to access the monitor, allowing a third routine, say \code{isInUse()}, acquire mutual exclusion several times while routine \code{P} is waiting. On the other hand, external scheduling guarantees that while routine \code{P} is waiting, no routine other than \code{V} can acquire the monitor.
    705732
    706733% ======================================================================
     
    709736% ======================================================================
    710737% ======================================================================
    711 In \uC, monitor declarations include an exhaustive list of monitor operations. Since \CFA is not object oriented it becomes both more difficult to implement but also less clear for the user:
    712 
    713 \begin{cfacode}
    714         monitor A {};
    715 
    716         void f(A & mutex a);
    717         void f(int a, float b);
    718         void g(A & mutex a) {
    719                 waitfor(f); // Less obvious which f() to wait for
    720         }
     738In \uC, monitor declarations include an exhaustive list of monitor operations. Since \CFA is not object oriented, monitors become both more difficult to implement and less clear for a user:
     739
     740\begin{cfacode}
     741monitor A {};
     742
     743void f(A & mutex a);
     744void g(A & mutex a) {
     745        waitfor(f); //Obvious which f() to wait for
     746}
     747
     748void f(A & mutex a, int); //New different F added in scope
     749void h(A & mutex a) {
     750        waitfor(f); //Less obvious which f() to wait for
     751}
    721752\end{cfacode}
    722753
     
    728759        if monitor is free
    729760                enter
    730         elif I already own the monitor
     761        elif already own the monitor
    731762                continue
    732763        elif monitor accepts me
     
    738769\end{center}
    739770
    740 For the fist two conditions, it is easy to implement a check that can evaluate the condition in a few instruction. However, a fast check for \pscode{monitor accepts me} is much harder to implement depending on the constraints put on the monitors. Indeed, monitors are often expressed as an entry queue and some acceptor queue as in the following figure:
     771For the first two conditions, it is easy to implement a check that can evaluate the condition in a few instruction. However, a fast check for \pscode{monitor accepts me} is much harder to implement depending on the constraints put on the monitors. Indeed, monitors are often expressed as an entry queue and some acceptor queue as in the following figure:
    741772
    742773\begin{center}
     
    744775\end{center}
    745776
    746 There are other alternatives to these pictures but in the case of this picture implementing a fast accept check is relatively easy. Indeed simply updating a bitmask when the acceptor queue changes is enough to have a check that executes in a single instruction, even with a fairly large number (e.g. 128) of mutex members. This technique cannot be used in \CFA because it relies on the fact that the monitor type declares all the acceptable routines. For OO languages this does not compromise much since monitors already have an exhaustive list of member routines. However, for \CFA this is not the case; routines can be added to a type anywhere after its declaration. Its important to note that the bitmask approach does not actually require an exhaustive list of routines, but it requires a dense unique ordering of routines with an upper-bound and that ordering must be consistent across translation units.
    747 The alternative would be to have a picture more like this one:
     777There are other alternatives to these pictures, but in the case of this picture, implementing a fast accept check is relatively easy. Restricted to a fixed number of mutex members, N, the accept check reduces to updating a bitmask when the acceptor queue changes, a check that executes in a single instruction even with a fairly large number (e.g., 128) of mutex members. This technique cannot be used in \CFA because it relies on the fact that the monitor type enumerates (declares) all the acceptable routines. For OO languages this does not compromise much since monitors already have an exhaustive list of member routines. However, for \CFA this is not the case; routines can be added to a type anywhere after its declaration. It is important to note that the bitmask approach does not actually require an exhaustive list of routines, but it requires a dense unique ordering of routines with an upper-bound and that ordering must be consistent across translation units.
     778The alternative is to alter the implementeation like this:
    748779
    749780\begin{center}
     
    751782\end{center}
    752783
    753 Not storing the queues inside the monitor means that the storage can vary between routines, allowing for more flexibility and extensions. Storing an array of function-pointers would solve the issue of uniquely identifying acceptable routines. However, the single instruction bitmask compare has been replaced by dereferencing a pointer followed by a linear search. Furthermore, supporting nested external scheduling may now require additionnal searches on calls to waitfor to check if a routine is already queued in.
    754 
    755 At this point we must make a decision between flexibility and performance. Many design decisions in \CFA achieve both flexibility and performance, for example polymorphic routines add significant flexibility but inlining them means the optimizer can easily remove any runtime cost. Here however, the cost of flexibility cannot be trivially removed. In the end, the most flexible approach has been chosen since it allows users to write programs that would otherwise be prohibitively hard to write. This is based on the assumption that writing fast but inflexible locks is closer to a solved problems than writing locks that are as flexible as external scheduling in \CFA.
    756 
    757 Another aspect to consider is what happens if multiple overloads of the same routine are used. For the time being it is assumed that multiple overloads of the same routine are considered as distinct routines. However, this could easily be extended in the future.
     784Generating a mask dynamically means that the storage for the mask information can vary between calls to \code{waitfor}, allowing for more flexibility and extensions. Storing an array of accepted function-pointers replaces the single instruction bitmask compare with dereferencing a pointer followed by a linear search. Furthermore, supporting nested external scheduling (e.g., listing \ref{lst:nest-ext}) may now require additionnal searches on calls to \code{waitfor} statement to check if a routine is already queued in.
     785
     786\begin{figure}
     787\begin{cfacode}
     788monitor M {};
     789void foo( M & mutex a ) {}
     790void bar( M & mutex b ) {
     791        //Nested in the waitfor(bar, c) call
     792        waitfor(foo, b);
     793}
     794void baz( M & mutex c ) {
     795        waitfor(bar, c);
     796}
     797
     798\end{cfacode}
     799\caption{Example of nested external scheduling}
     800\label{lst:nest-ext}
     801\end{figure}
     802
     803Note that in the second picture, tasks need to always keep track of which routine they are attempting to acquire the monitor and the routine mask needs to have both a function pointer and a set of monitors, as will be discussed in the next section. These details where omitted from the picture for the sake of simplifying the representation.
     804
     805At this point, a decision must be made between flexibility and performance. Many design decisions in \CFA achieve both flexibility and performance, for example polymorphic routines add significant flexibility but inlining them means the optimizer can easily remove any runtime cost. Here however, the cost of flexibility cannot be trivially removed. In the end, the most flexible approach has been chosen since it allows users to write programs that would otherwise be prohibitively hard to write. This decision is based on the assumption that writing fast but inflexible locks is closer to a solved problems than writing locks that are as flexible as external scheduling in \CFA.
    758806
    759807% ======================================================================
     
    763811% ======================================================================
    764812
    765 External scheduling, like internal scheduling, becomes orders of magnitude more complex when we start introducing multi-monitor syntax. Even in the simplest possible case some new semantics need to be established:
    766 \begin{cfacode}
    767         mutex struct A {};
    768 
    769         mutex struct B {};
    770 
    771         void g(A & mutex a, B & mutex b) {
    772                 waitfor(f); //ambiguous, which monitor
    773         }
     813External scheduling, like internal scheduling, becomes significantly more complex when introducing multi-monitor syntax. Even in the simplest possible case, some new semantics need to be established:
     814\begin{cfacode}
     815monitor M {};
     816
     817void f(M & mutex a);
     818
     819void g(M & mutex b, M & mutex c) {
     820        waitfor(f); //two monitors M => unkown which to pass to f(M & mutex)
     821}
    774822\end{cfacode}
    775823
     
    777825
    778826\begin{cfacode}
    779         mutex struct A {};
    780 
    781         mutex struct B {};
    782 
    783         void g(A & mutex a, B & mutex b) {
    784                 waitfor( f, b );
    785         }
    786 \end{cfacode}
    787 
    788 This is unambiguous. Both locks will be acquired and kept, when routine \code{f} is called the lock for monitor \code{b} will be temporarily transferred from \code{g} to \code{f} (while \code{g} still holds lock \code{a}). This behavior can be extended to multi-monitor waitfor statment as follows.
    789 
    790 \begin{cfacode}
    791         mutex struct A {};
    792 
    793         mutex struct B {};
    794 
    795         void g(A & mutex a, B & mutex b) {
    796                 waitfor( f, a, b);
    797         }
    798 \end{cfacode}
    799 
    800 Note that the set of monitors passed to the \code{waitfor} statement must be entirely contained in the set of monitor already acquired in the routine. \code{waitfor} used in any other context is Undefined Behaviour.
    801 
    802 An important behavior to note is that what happens when set of monitors only match partially :
    803 
    804 \begin{cfacode}
    805         mutex struct A {};
    806 
    807         mutex struct B {};
    808 
    809         void g(A & mutex a, B & mutex b) {
    810                 waitfor(f, a, b);
    811         }
    812 
    813         A a1, a2;
    814         B b;
    815 
    816         void foo() {
    817                 g(a1, b);
    818         }
    819 
    820         void bar() {
    821                 f(a2, b);
    822         }
    823 \end{cfacode}
    824 
    825 While the equivalent can happen when using internal scheduling, the fact that conditions are branded on first use means that users have to use two different condition variables. In both cases, partially matching monitor sets will not wake-up the waiting thread. It is also important to note that in the case of external scheduling, as for routine calls, the order of parameters is important; \code{waitfor(f,a,b)} and \code{waitfor(f,b,a)} are to distinct waiting condition.
    826 
    827 % ======================================================================
    828 % ======================================================================
    829 \subsection{Implementation Details: External scheduling queues}
    830 % ======================================================================
    831 % ======================================================================
    832 To support multi-monitor external scheduling means that some kind of entry-queues must be used that is aware of both monitors. However, acceptable routines must be aware of the entry queues which means they must be stored inside at least one of the monitors that will be acquired. This in turn adds the requirement a systematic algorithm of disambiguating which queue is relavant regardless of user ordering. The proposed algorithm is to fall back on monitors lock ordering and specify that the monitor that is acquired first is the lock with the relevant entry queue. This assumes that the lock acquiring order is static for the lifetime of all concerned objects but that is a reasonable constraint. This algorithm choice has two consequences, the entry queue of the highest priority monitor is no longer a true FIFO queue and the queue of the lowest priority monitor is both required and probably unused. The queue can no longer be a FIFO queue because instead of simply containing the waiting threads in order arrival, they also contain the second mutex. Therefore, another thread with the same highest priority monitor but a different lowest priority monitor may arrive first but enter the critical section after a thread with the correct pairing. Secondly, since it may not be known at compile time which monitor will be the lowest priority monitor, every monitor needs to have the correct queues even though it is probable that half the multi-monitor queues will go unused for the entire duration of the program.
    833 
    834 % ======================================================================
    835 % ======================================================================
    836 \section{Other concurrency tools}
    837 % ======================================================================
    838 % ======================================================================
    839 % \TODO
     827monitor M {};
     828
     829void f(M & mutex a);
     830
     831void g(M & mutex a, M & mutex b) {
     832        waitfor( f, b );
     833}
     834\end{cfacode}
     835
     836This syntax is unambiguous. Both locks are acquired and kept by \code{g}. When routine \code{f} is called, the lock for monitor \code{b} is temporarily transferred from \code{g} to \code{f} (while \code{g} still holds lock \code{a}). This behavior can be extended to multi-monitor \code{waitfor} statement as follows.
     837
     838\begin{cfacode}
     839monitor M {};
     840
     841void f(M & mutex a, M & mutex b);
     842
     843void g(M & mutex a, M & mutex b) {
     844        waitfor( f, a, b);
     845}
     846\end{cfacode}
     847
     848Note that the set of monitors passed to the \code{waitfor} statement must be entirely contained in the set of monitors already acquired in the routine. \code{waitfor} used in any other context is Undefined Behaviour.
     849
     850An important behavior to note is when a set of monitors only match partially :
     851
     852\begin{cfacode}
     853mutex struct A {};
     854
     855mutex struct B {};
     856
     857void g(A & mutex a, B & mutex b) {
     858        waitfor(f, a, b);
     859}
     860
     861A a1, a2;
     862B b;
     863
     864void foo() {
     865        g(a1, b); //block on accept
     866}
     867
     868void bar() {
     869        f(a2, b); //fufill cooperation
     870}
     871\end{cfacode}
     872
     873While the equivalent can happen when using internal scheduling, the fact that conditions are specific to a set of monitors means that users have to use two different condition variables. In both cases, partially matching monitor sets does not wake-up the waiting thread. It is also important to note that in the case of external scheduling, as for routine calls, the order of parameters is irrelevant; \code{waitfor(f,a,b)} and \code{waitfor(f,b,a)} are indistinguishable waiting condition.
     874
     875% ======================================================================
     876% ======================================================================
     877\subsection{\code{waitfor} semantics}
     878% ======================================================================
     879% ======================================================================
     880
     881Syntactically, the \code{waitfor} statement takes a function identifier and a set of monitors. While the set of monitors can be any list of expression, the function name is more restricted because the compiler validates at compile time the validity of the function type and the parameters used with the \code{waitfor} statement. It checks that the set of monitor passed in matches the requirements for a function call. Listing \ref{lst:waitfor} shows various usage of the waitfor statement and which are acceptable. The choice of the function type is made ignoring any non-\code{mutex} parameter. One limitation of the current implementation is that it does not handle overloading.
     882\begin{figure}
     883\begin{cfacode}
     884monitor A{};
     885monitor B{};
     886
     887void f1( A & mutex );
     888void f2( A & mutex, B & mutex );
     889void f3( A & mutex, int );
     890void f4( A & mutex, int );
     891void f4( A & mutex, double );
     892
     893void foo( A & mutex a1, A & mutex a2, B & mutex b1, B & b2 ) {
     894        A * ap = & a1;
     895        void (*fp)( A & mutex ) = f1;
     896
     897        waitfor(f1, a1);     //Correct : 1 monitor case
     898        waitfor(f2, a1, b1); //Correct : 2 monitor case
     899        waitfor(f3, a1);     //Correct : non-mutex arguments are ignored
     900        waitfor(f1, *ap);    //Correct : expression as argument
     901
     902        waitfor(f1, a1, b1); //Incorrect : Too many mutex arguments
     903        waitfor(f2, a1);     //Incorrect : Too few mutex arguments
     904        waitfor(f2, a1, a2); //Incorrect : Mutex arguments don't match
     905        waitfor(f1, 1);      //Incorrect : 1 not a mutex argument
     906        waitfor(f9, a1);     //Incorrect : f9 function does not exist
     907        waitfor(*fp, a1 );   //Incorrect : fp not an identifier
     908        waitfor(f4, a1);     //Incorrect : f4 ambiguous
     909
     910        waitfor(f2, a1, b2); //Undefined Behaviour : b2 may not acquired
     911}
     912\end{cfacode}
     913\caption{Various correct and incorrect uses of the waitfor statement}
     914\label{lst:waitfor}
     915\end{figure}
     916
     917Finally, for added flexibility, \CFA supports constructing complex \code{waitfor} mask using the \code{or}, \code{timeout} and \code{else}. Indeed, multiple \code{waitfor} can be chained together using \code{or}; this chain forms a single statement that uses baton-pass to any one function that fits one of the function+monitor set passed in. To eanble users to tell which accepted function is accepted, \code{waitfor}s are followed by a statement (including the null statement \code{;}) or a compound statement. When multiple \code{waitfor} are chained together, only the statement corresponding to the accepted function is executed. A \code{waitfor} chain can also be followed by a \code{timeout}, to signify an upper bound on the wait, or an \code{else}, to signify that the call should be non-blocking, that is only check of a matching function call already arrived and return immediately otherwise. Any and all of these clauses can be preceded by a \code{when} condition to dynamically construct the mask based on some current state. Listing \ref{lst:waitfor2}, demonstrates several complex masks and some incorrect ones.
     918
     919\begin{figure}
     920\begin{cfacode}
     921monitor A{};
     922
     923void f1( A & mutex );
     924void f2( A & mutex );
     925
     926void foo( A & mutex a, bool b, int t ) {
     927        //Correct : blocking case
     928        waitfor(f1, a);
     929
     930        //Correct : block with statement
     931        waitfor(f1, a) {
     932                sout | "f1" | endl;
     933        }
     934
     935        //Correct : block waiting for f1 or f2
     936        waitfor(f1, a) {
     937                sout | "f1" | endl;
     938        } or waitfor(f2, a) {
     939                sout | "f2" | endl;
     940        }
     941
     942        //Correct : non-blocking case
     943        waitfor(f1, a); or else;
     944
     945        //Correct : non-blocking case
     946        waitfor(f1, a) {
     947                sout | "blocked" | endl;
     948        } or else {
     949                sout | "didn't block" | endl;
     950        }
     951
     952        //Correct : block at most 10 seconds
     953        waitfor(f1, a) {
     954                sout | "blocked" | endl;
     955        } or timeout( 10`s) {
     956                sout | "didn't block" | endl;
     957        }
     958
     959        //Correct : block only if b == true
     960        //if b == false, don't even make the call
     961        when(b) waitfor(f1, a);
     962
     963        //Correct : block only if b == true
     964        //if b == false, make non-blocking call
     965        waitfor(f1, a); or when(!b) else;
     966
     967        //Correct : block only of t > 1
     968        waitfor(f1, a); or when(t > 1) timeout(t); or else;
     969
     970        //Incorrect : timeout clause is dead code
     971        waitfor(f1, a); or timeout(t); or else;
     972
     973        //Incorrect : order must be
     974        //waitfor [or waitfor... [or timeout] [or else]]
     975        timeout(t); or waitfor(f1, a); or else;
     976}
     977\end{cfacode}
     978\caption{Various correct and incorrect uses of the or, else, and timeout clause around a waitfor statement}
     979\label{lst:waitfor2}
     980\end{figure}
     981
     982% ======================================================================
     983% ======================================================================
     984\subsection{Waiting for the destructor}
     985% ======================================================================
     986% ======================================================================
     987An interesting use for the \code{waitfor} statement is destructor semantics. Indeed, the \code{waitfor} statement can accept any \code{mutex} routine, which includes the destructor (see section \ref{data}). However, with the semantics discussed until now, waiting for the destructor does not make any sense since using an object after its destructor is called is undefined behaviour. The simplest approach is to disallow \code{waitfor} on a destructor. However, a more expressive approach is to flip execution ordering when waiting for the destructor, meaning that waiting for the destructor allows the destructor to run after the current \code{mutex} routine, similarly to how a condition is signalled.
     988\begin{figure}
     989\begin{cfacode}
     990monitor Executer {};
     991struct  Action;
     992
     993void ^?{}   (Executer & mutex this);
     994void execute(Executer & mutex this, const Action & );
     995void run    (Executer & mutex this) {
     996        while(true) {
     997                   waitfor(execute, this);
     998                or waitfor(^?{}   , this) {
     999                        break;
     1000                }
     1001        }
     1002}
     1003\end{cfacode}
     1004\caption{Example of an executor which executes action in series until the destructor is called.}
     1005\label{lst:dtor-order}
     1006\end{figure}
     1007For example, listing \ref{lst:dtor-order} shows an example of an executor with an infinite loop, which waits for the destructor to break out of this loop. Switching the semantic meaning introduces an idiomatic way to terminate a task and/or wait for its termination via destruction.
  • doc/proposals/concurrency/text/intro.tex

    r78315272 r3f7e12cb  
    33% ======================================================================
    44
    5 This proposal provides a minimal concurrency API that is simple, efficient and can be reused to build higher-level features. The simplest possible concurrency system is a thread and a lock but this low-level approach is hard to master. An easier approach for users is to support higher-level constructs as the basis of the concurrency, in \CFA. Indeed, for highly productive parallel programming, high-level approaches are much more popular~\cite{HPP:Study}. Examples are task based, message passing and implicit threading. Therefore a high-level approach is adapted in \CFA
     5This thesis provides a minimal concurrency \acrshort{api} that is simple, efficient and can be reused to build higher-level features. The simplest possible concurrency system is a thread and a lock but this low-level approach is hard to master. An easier approach for users is to support higher-level constructs as the basis of concurrency. Indeed, for highly productive concurrent programming, high-level approaches are much more popular~\cite{HPP:Study}. Examples are task based, message passing and implicit threading. The high-level approach and its minimal \acrshort{api} are tested in a dialect of C, call \CFA. Furthermore, the proposed \acrshort{api} doubles as an early definition of the \CFA language and library. This thesis also comes with an implementation of the concurrency library for \CFA as well as all the required language features added to the source-to-source translator.
    66
    7 There are actually two problems that need to be solved in the design of concurrency for a programming language: which concurrency and which parallelism tools are available to the users. While these two concepts are often combined, they are in fact distinct concepts that require different tools~\cite{Buhr05a}. Concurrency tools need to handle mutual exclusion and synchronization, while parallelism tools are about performance, cost and resource utilization.
     7There are actually two problems that need to be solved in the design of concurrency for a programming language: which concurrency and which parallelism tools are available to the programmer. While these two concepts are often combined, they are in fact distinct, requiring different tools~\cite{Buhr05a}. Concurrency tools need to handle mutual exclusion and synchronization, while parallelism tools are about performance, cost and resource utilization.
  • doc/proposals/concurrency/text/parallelism.tex

    r78315272 r3f7e12cb  
    1111\section{Paradigm}
    1212\subsection{User-level threads}
    13 A direct improvement on the \gls{kthread} approach is to use \glspl{uthread}. These threads offer most of the same features that the operating system already provide but can be used on a much larger scale. This approach is the most powerfull solution as it allows all the features of multi-threading, while removing several of the more expensives costs of using kernel threads. The down side is that almost none of the low-level threading problems are hidden, users still have to think about data races, deadlocks and synchronization issues. These issues can be somewhat alleviated by a concurrency toolkit with strong garantees but the parallelism toolkit offers very little to reduce complexity in itself.
     13A direct improvement on the \gls{kthread} approach is to use \glspl{uthread}. These threads offer most of the same features that the operating system already provide but can be used on a much larger scale. This approach is the most powerfull solution as it allows all the features of multi-threading, while removing several of the more expensive costs of kernel threads. The down side is that almost none of the low-level threading problems are hidden; users still have to think about data races, deadlocks and synchronization issues. These issues can be somewhat alleviated by a concurrency toolkit with strong garantees but the parallelism toolkit offers very little to reduce complexity in itself.
    1414
    1515Examples of languages that support \glspl{uthread} are Erlang~\cite{Erlang} and \uC~\cite{uC++book}.
    1616
    1717\subsection{Fibers : user-level threads without preemption}
    18 A popular varient of \glspl{uthread} is what is often reffered to as \glspl{fiber}. However, \glspl{fiber} do not present meaningful semantical differences with \glspl{uthread}. Advocates of \glspl{fiber} list their high performance and ease of implementation as majors strenghts of \glspl{fiber} but the performance difference between \glspl{uthread} and \glspl{fiber} is controversial and the ease of implementation, while true, is a weak argument in the context of language design. Therefore this proposal largely ignore fibers.
     18A popular varient of \glspl{uthread} is what is often refered to as \glspl{fiber}. However, \glspl{fiber} do not present meaningful semantical differences with \glspl{uthread}. The significant difference between \glspl{uthread} and \glspl{fiber} is the lack of \gls{preemption} in the later one. Advocates of \glspl{fiber} list their high performance and ease of implementation as majors strenghts of \glspl{fiber} but the performance difference between \glspl{uthread} and \glspl{fiber} is controversial, and the ease of implementation, while true, is a weak argument in the context of language design. Therefore this proposal largely ignores fibers.
    1919
    2020An example of a language that uses fibers is Go~\cite{Go}
    2121
    2222\subsection{Jobs and thread pools}
    23 The approach on the opposite end of the spectrum is to base parallelism on \glspl{pool}. Indeed, \glspl{pool} offer limited flexibility but at the benefit of a simpler user interface. In \gls{pool} based systems, users express parallelism as units of work and a dependency graph (either explicit or implicit) that tie them together. This approach means users need not worry about concurrency but significantly limits the interaction that can occur among jobs. Indeed, any \gls{job} that blocks also blocks the underlying worker, which effectively means the CPU utilization, and therefore throughput, suffers noticeably. It can be argued that a solution to this problem is to use more workers than available cores. However, unless the number of jobs and the number of workers are comparable, having a significant amount of blocked jobs always results in idles cores.
     23An approach on the opposite end of the spectrum is to base parallelism on \glspl{pool}. Indeed, \glspl{pool} offer limited flexibility but at the benefit of a simpler user interface. In \gls{pool} based systems, users express parallelism as units of work, called jobs, and a dependency graph (either explicit or implicit) that tie them together. This approach means users need not worry about concurrency but significantly limit the interaction that can occur among jobs. Indeed, any \gls{job} that blocks also blocks the underlying worker, which effectively means the CPU utilization, and therefore throughput, suffers noticeably. It can be argued that a solution to this problem is to use more workers than available cores. However, unless the number of jobs and the number of workers are comparable, having a significant amount of blocked jobs always results in idles cores.
    2424
    2525The gold standard of this implementation is Intel's TBB library~\cite{TBB}.
    2626
    2727\subsection{Paradigm performance}
    28 While the choice between the three paradigms listed above may have significant performance implication, it is difficult to pindown the performance implications of chosing a model at the language level. Indeed, in many situations one of these paradigms may show better performance but it all strongly depends on the workload. Having a large amount of mostly independent units of work to execute almost guarantess that the \gls{pool} based system has the best performance thanks to the lower memory overhead. However, interactions between jobs can easily exacerbate contention. User-level threads allow fine-grain context switching, which results in better resource utilisation, but context switches will be more expansive and the extra control means users need to tweak more variables to get the desired performance. Furthermore, if the units of uninterrupted work are large enough the paradigm choice is largely amorticised by the actual work done.
     28While the choice between the three paradigms listed above may have significant performance implication, it is difficult to pindown the performance implications of chosing a model at the language level. Indeed, in many situations one of these paradigms may show better performance but it all strongly depends on the workload. Having a large amount of mostly independent units of work to execute almost guarantess that the \gls{pool} based system has the best performance thanks to the lower memory overhead (i.e., no thread stack per job). However, interactions among jobs can easily exacerbate contention. User-level threads allow fine-grain context switching, which results in better resource utilisation, but a context switch is more expensive and the extra control means users need to tweak more variables to get the desired performance. Finally, if the units of uninterrupted work are large enough the paradigm choice is largely amortised by the actual work done.
    2929
    30 \newpage
    31 \TODO
    32 \subsection{The \protect\CFA\ Kernel : Processors, Clusters and Threads}\label{kernel}
     30\section{The \protect\CFA\ Kernel : Processors, Clusters and Threads}\label{kernel}
    3331
     32\Glspl{cfacluster} have not been fully implmented in the context of this thesis, currently \CFA only supports one \gls{cfacluster}, the initial one. The objective of \gls{cfacluster} is to group \gls{kthread} with identical settings together. \Glspl{uthread} can be scheduled on a \glspl{kthread} of a given \gls{cfacluster}, allowing organization between \glspl{kthread} and \glspl{uthread}. It is important that \glspl{kthread} belonging to a same \glspl{cfacluster} have homogenous settings, otherwise migrating a \gls{uthread} from one \gls{kthread} to the other can cause issues.
     33
     34\subsection{Future Work: Machine setup}\label{machine}
     35While this was not done in the context of this thesis, another important aspect of clusters is affinity. While many common desktop and laptop PCs have homogeneous CPUs, other devices often have more heteregenous setups. For example, system using \acrshort{numa} configurations may benefit from users being able to tie clusters and/or kernel threads to certains CPU cores. OS support for CPU affinity is now common \cit, which means it is both possible and desirable for \CFA to offer an abstraction mechanism for portable CPU affinity.
    3436
    3537\subsection{Paradigms}\label{cfaparadigms}
    36 Given these building blocks we can then reproduce the all three of the popular paradigms. Indeed, we get \glspl{uthread} as the default paradigm in \CFA. However, disabling \glspl{preemption} on the \gls{cfacluster} means \glspl{cfathread} effectively become \glspl{fiber}. Since several \glspl{cfacluster} with different scheduling policy can coexist in the same application, this allows \glspl{fiber} and \glspl{uthread} to coexist in the runtime of an application.
    37 
    38 % \subsection{High-level options}\label{tasks}
    39 %
    40 % \subsubsection{Thread interface}
    41 % constructors destructors
    42 %       initializer lists
    43 % monitors
    44 %
    45 % \subsubsection{Futures}
    46 %
    47 % \subsubsection{Implicit threading}
    48 % Finally, simpler applications can benefit greatly from having implicit parallelism. That is, parallelism that does not rely on the user to write concurrency. This type of parallelism can be achieved both at the language level and at the system level.
    49 %
    50 % \begin{center}
    51 % \begin{tabular}[t]{|c|c|c|}
    52 % Sequential & System Parallel & Language Parallel \\
    53 % \begin{lstlisting}
    54 % void big_sum(int* a, int* b,
    55 %                int* out,
    56 %                size_t length)
    57 % {
    58 %       for(int i = 0; i < length; ++i ) {
    59 %               out[i] = a[i] + b[i];
    60 %       }
    61 % }
    62 %
    63 %
    64 %
    65 %
    66 %
    67 % int* a[10000];
    68 % int* b[10000];
    69 % int* c[10000];
    70 % //... fill in a and b ...
    71 % big_sum(a, b, c, 10000);
    72 % \end{lstlisting} &\begin{lstlisting}
    73 % void big_sum(int* a, int* b,
    74 %                int* out,
    75 %                size_t length)
    76 % {
    77 %       range ar(a, a + length);
    78 %       range br(b, b + length);
    79 %       range or(out, out + length);
    80 %       parfor( ai, bi, oi,
    81 %       [](int* ai, int* bi, int* oi) {
    82 %               oi = ai + bi;
    83 %       });
    84 % }
    85 %
    86 % int* a[10000];
    87 % int* b[10000];
    88 % int* c[10000];
    89 % //... fill in a and b ...
    90 % big_sum(a, b, c, 10000);
    91 % \end{lstlisting}&\begin{lstlisting}
    92 % void big_sum(int* a, int* b,
    93 %                int* out,
    94 %                size_t length)
    95 % {
    96 %       for (ai, bi, oi) in (a, b, out) {
    97 %               oi = ai + bi;
    98 %       }
    99 % }
    100 %
    101 %
    102 %
    103 %
    104 %
    105 % int* a[10000];
    106 % int* b[10000];
    107 % int* c[10000];
    108 % //... fill in a and b ...
    109 % big_sum(a, b, c, 10000);
    110 % \end{lstlisting}
    111 % \end{tabular}
    112 % \end{center}
    113 %
    114 % \subsection{Machine setup}\label{machine}
    115 % Threads are all good and well but wee still some OS support to fully utilize available hardware.
    116 %
    117 % \textbf{\large{Work in progress...}} Do wee need something beyond specifying the number of kernel threads?
     38Given these building blocks, it is possible to reproduce all three of the popular paradigms. Indeed, \glspl{uthread} is the default paradigm in \CFA. However, disabling \gls{preemption} on the \gls{cfacluster} means \glspl{cfathread} effectively become \glspl{fiber}. Since several \glspl{cfacluster} with different scheduling policy can coexist in the same application, this allows \glspl{fiber} and \glspl{uthread} to coexist in the runtime of an application. Finally, it is possible to build executors for thread pools from \glspl{uthread} or \glspl{fiber}.
  • doc/proposals/concurrency/thesis.tex

    r78315272 r3f7e12cb  
    11% requires tex packages: texlive-base texlive-latex-base tex-common texlive-humanities texlive-latex-extra texlive-fonts-recommended
    22
    3 % inline code ©...© (copyright symbol) emacs: C-q M-)
    4 % red highlighting ®...® (registered trademark symbol) emacs: C-q M-.
    5 % blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_
    6 % green highlighting ¢...¢ (cent symbol) emacs: C-q M-"
    7 % LaTex escape §...§ (section symbol) emacs: C-q M-'
    8 % keyword escape ¶...¶ (pilcrow symbol) emacs: C-q M-^
     3% inline code �...� (copyright symbol) emacs: C-q M-)
     4% red highlighting �...� (registered trademark symbol) emacs: C-q M-.
     5% blue highlighting �...� (sharp s symbol) emacs: C-q M-_
     6% green highlighting �...� (cent symbol) emacs: C-q M-"
     7% LaTex escape �...� (section symbol) emacs: C-q M-'
     8% keyword escape �...� (pilcrow symbol) emacs: C-q M-^
    99% math escape $...$ (dollar symbol)
    1010
     
    2727\usepackage{multicol}
    2828\usepackage[acronym]{glossaries}
    29 \usepackage{varioref}   
     29\usepackage{varioref}
    3030\usepackage{listings}                                           % format program code
    3131\usepackage[flushmargin]{footmisc}                              % support label/reference in footnote
     
    3535\usepackage[pagewise]{lineno}
    3636\usepackage{fancyhdr}
     37\usepackage{float}
    3738\renewcommand{\linenumberfont}{\scriptsize\sffamily}
     39\usepackage{siunitx}
     40\sisetup{ binary-units=true }
    3841\input{style}                                                   % bespoke macros used in the document
    3942\usepackage[dvips,plainpages=false,pdfpagelabels,pdfpagemode=UseNone,colorlinks=true,pagebackref=true,linkcolor=blue,citecolor=blue,urlcolor=blue,pagebackref=true,breaklinks=true]{hyperref}
     
    7073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    7174
    72 \setcounter{secnumdepth}{3}                           % number subsubsections
    73 \setcounter{tocdepth}{3}                              % subsubsections in table of contents
     75\setcounter{secnumdepth}{2}                           % number subsubsections
     76\setcounter{tocdepth}{2}                              % subsubsections in table of contents
    7477% \linenumbers                                          % comment out to turn off line numbering
    7578\makeindex
     
    103106\input{parallelism}
    104107
    105 \chapter{Putting it all together}
     108\input{internals}
     109
     110\input{together}
     111
     112\input{results}
     113
     114\input{future}
    106115
    107116\chapter{Conclusion}
    108 
    109 \chapter{Future work}
    110 Concurrency and parallelism is still a very active field that strongly benefits from hardware advances. As such certain features that aren't necessarily mature enough in their current state could become relevant in the lifetime of \CFA.
    111 \subsection{Transactions}
    112117
    113118\section*{Acknowledgements}
  • doc/proposals/concurrency/version

    r78315272 r3f7e12cb  
    1 0.9.180
     10.11.47
  • src/CodeGen/CodeGenerator.cc

    r78315272 r3f7e12cb  
    287287        void CodeGenerator::postvisit( TypeDecl * typeDecl ) {
    288288                assertf( ! genC, "TypeDecls should not reach code generation." );
    289                 output << typeDecl->genTypeString() << " " << typeDecl->get_name();
    290                 if ( typeDecl->get_kind() != TypeDecl::Any && typeDecl->get_sized() ) {
    291                         output << " | sized(" << typeDecl->get_name() << ")";
    292                 }
    293                 if ( ! typeDecl->get_assertions().empty() ) {
     289                output << typeDecl->genTypeString() << " " << typeDecl->name;
     290                if ( typeDecl->sized ) {
     291                        output << " | sized(" << typeDecl->name << ")";
     292                }
     293                if ( ! typeDecl->assertions.empty() ) {
    294294                        output << " | { ";
    295                         genCommaList( typeDecl->get_assertions().begin(), typeDecl->get_assertions().end() );
     295                        for ( DeclarationWithType * assert :  typeDecl->assertions ) {
     296                                assert->accept( *visitor );
     297                                output << "; ";
     298                        }
    296299                        output << " }";
    297300                }
     
    443446        void CodeGenerator::postvisit( UntypedExpr * untypedExpr ) {
    444447                extension( untypedExpr );
    445                 if ( NameExpr * nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) {
     448                if ( NameExpr * nameExpr = dynamic_cast< NameExpr* >( untypedExpr->function ) ) {
    446449                        OperatorInfo opInfo;
    447                         if ( operatorLookup( nameExpr->get_name(), opInfo ) ) {
    448                                 std::list< Expression* >::iterator arg = untypedExpr->get_args().begin();
     450                        if ( operatorLookup( nameExpr->name, opInfo ) ) {
     451                                std::list< Expression* >::iterator arg = untypedExpr->args.begin();
    449452                                switch ( opInfo.type ) {
    450453                                  case OT_INDEX:
    451                                         assert( untypedExpr->get_args().size() == 2 );
     454                                        assert( untypedExpr->args.size() == 2 );
    452455                                        (*arg++)->accept( *visitor );
    453456                                        output << "[";
     
    461464                                  case OT_CTOR:
    462465                                  case OT_DTOR:
    463                                         if ( untypedExpr->get_args().size() == 1 ) {
     466                                        if ( untypedExpr->args.size() == 1 ) {
    464467                                                // the expression fed into a single parameter constructor or destructor may contain side
    465468                                                // effects, so must still output this expression
     
    480483                                                (*arg++)->accept( *visitor );
    481484                                                output << opInfo.symbol << "{ ";
    482                                                 genCommaList( arg, untypedExpr->get_args().end() );
     485                                                genCommaList( arg, untypedExpr->args.end() );
    483486                                                output << "}) /* " << opInfo.inputName << " */";
    484487                                        } // if
     
    488491                                  case OT_PREFIXASSIGN:
    489492                                  case OT_LABELADDRESS:
    490                                         assert( untypedExpr->get_args().size() == 1 );
     493                                        assert( untypedExpr->args.size() == 1 );
    491494                                        output << "(";
    492495                                        output << opInfo.symbol;
     
    497500                                  case OT_POSTFIX:
    498501                                  case OT_POSTFIXASSIGN:
    499                                         assert( untypedExpr->get_args().size() == 1 );
     502                                        assert( untypedExpr->args.size() == 1 );
    500503                                        (*arg)->accept( *visitor );
    501504                                        output << opInfo.symbol;
     
    504507                                  case OT_INFIX:
    505508                                  case OT_INFIXASSIGN:
    506                                         assert( untypedExpr->get_args().size() == 2 );
     509                                        assert( untypedExpr->args.size() == 2 );
    507510                                        output << "(";
    508511                                        (*arg++)->accept( *visitor );
     
    517520                                } // switch
    518521                        } else {
    519                                 if ( nameExpr->get_name() == "..." ) { // case V1 ... V2 or case V1~V2
    520                                         assert( untypedExpr->get_args().size() == 2 );
    521                                         (*untypedExpr->get_args().begin())->accept( *visitor );
    522                                         output << " ... ";
    523                                         (*--untypedExpr->get_args().end())->accept( *visitor );
    524                                 } else {                                                                // builtin routines
    525                                         nameExpr->accept( *visitor );
    526                                         output << "(";
    527                                         genCommaList( untypedExpr->get_args().begin(), untypedExpr->get_args().end() );
    528                                         output << ")";
    529                                 } // if
     522                                // builtin routines
     523                                nameExpr->accept( *visitor );
     524                                output << "(";
     525                                genCommaList( untypedExpr->args.begin(), untypedExpr->args.end() );
     526                                output << ")";
    530527                        } // if
    531528                } else {
    532                         untypedExpr->get_function()->accept( *visitor );
     529                        untypedExpr->function->accept( *visitor );
    533530                        output << "(";
    534                         genCommaList( untypedExpr->get_args().begin(), untypedExpr->get_args().end() );
     531                        genCommaList( untypedExpr->args.begin(), untypedExpr->args.end() );
    535532                        output << ")";
    536533                } // if
     
    538535
    539536        void CodeGenerator::postvisit( RangeExpr * rangeExpr ) {
    540                 rangeExpr->get_low()->accept( *visitor );
     537                rangeExpr->low->accept( *visitor );
    541538                output << " ... ";
    542                 rangeExpr->get_high()->accept( *visitor );
     539                rangeExpr->high->accept( *visitor );
    543540        }
    544541
     
    546543                extension( nameExpr );
    547544                OperatorInfo opInfo;
    548                 if ( operatorLookup( nameExpr->get_name(), opInfo ) ) {
    549                         assert( opInfo.type == OT_CONSTANT );
    550                         output << opInfo.symbol;
     545                if ( operatorLookup( nameExpr->name, opInfo ) ) {
     546                        if ( opInfo.type == OT_CONSTANT ) {
     547                                output << opInfo.symbol;
     548                        } else {
     549                                output << opInfo.outputName;
     550                        }
    551551                } else {
    552552                        output << nameExpr->get_name();
     
    885885
    886886        void CodeGenerator::postvisit( CaseStmt * caseStmt ) {
     887                updateLocation( caseStmt );
     888                output << indent;
    887889                if ( caseStmt->isDefault()) {
    888890                        output << "default";
     
    947949                output << ";";
    948950        }
     951        void CodeGenerator::postvisit( CatchStmt * stmt ) {
     952                assertf( ! genC, "Catch statements should not reach code generation." );
     953
     954                output << ((stmt->get_kind() == CatchStmt::Terminate) ?
     955                "catch" : "catchResume");
     956                output << "( ";
     957                stmt->decl->accept( *visitor );
     958                output << " ) ";
     959
     960                if( stmt->cond ) {
     961                        output << "if/when(?) (";
     962                        stmt->cond->accept( *visitor );
     963                        output << ") ";
     964                }
     965                stmt->body->accept( *visitor );
     966        }
     967
     968        void CodeGenerator::postvisit( WaitForStmt * stmt ) {
     969                assertf( ! genC, "Waitfor statements should not reach code generation." );
     970
     971                bool first = true;
     972                for( auto & clause : stmt->clauses ) {
     973                        if(first) { output << "or "; first = false; }
     974                        if( clause.condition ) {
     975                                output << "when(";
     976                                stmt->timeout.condition->accept( *visitor );
     977                                output << ") ";
     978                        }
     979                        output << "waitfor(";
     980                        clause.target.function->accept( *visitor );
     981                        for( Expression * expr : clause.target.arguments ) {
     982                                output << ",";
     983                                expr->accept( *visitor );
     984                        }
     985                        output << ") ";
     986                        clause.statement->accept( *visitor );
     987                }
     988
     989                if( stmt->timeout.statement ) {
     990                        output << "or ";
     991                        if( stmt->timeout.condition ) {
     992                                output << "when(";
     993                                stmt->timeout.condition->accept( *visitor );
     994                                output << ") ";
     995                        }
     996                        output << "timeout(";
     997                        stmt->timeout.time->accept( *visitor );
     998                        output << ") ";
     999                        stmt->timeout.statement->accept( *visitor );
     1000                }
     1001
     1002                if( stmt->orelse.statement ) {
     1003                        output << "or ";
     1004                        if( stmt->orelse.condition ) {
     1005                                output << "when(";
     1006                                stmt->orelse.condition->accept( *visitor );
     1007                                output << ")";
     1008                        }
     1009                        output << "else ";
     1010                        stmt->orelse.statement->accept( *visitor );
     1011                }
     1012        }
     1013
    9491014
    9501015        void CodeGenerator::postvisit( WhileStmt * whileStmt ) {
     
    10251090        }
    10261091} // namespace CodeGen
     1092
     1093
     1094unsigned Indenter::tabsize = 2;
     1095
     1096std::ostream & operator<<( std::ostream & out, const BaseSyntaxNode * node ) {
     1097        if ( node ) {
     1098                node->print( out );
     1099        } else {
     1100                out << "nullptr";
     1101        }
     1102        return out;
     1103}
    10271104
    10281105// Local Variables: //
  • src/CodeGen/CodeGenerator.h

    r78315272 r3f7e12cb  
    100100                void postvisit( ReturnStmt * );
    101101                void postvisit( ThrowStmt * );
     102                void postvisit( CatchStmt * );
     103                void postvisit( WaitForStmt * );
    102104                void postvisit( WhileStmt * );
    103105                void postvisit( ForStmt * );
  • src/CodeGen/FixNames.cc

    r78315272 r3f7e12cb  
    6666                );
    6767
    68                 mainDecl->get_functionType()->get_parameters().push_back(
     68                main_type->get_parameters().push_back(
    6969                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    7070                );
    7171
    72                 mainDecl->get_functionType()->get_parameters().push_back(
     72                main_type->get_parameters().push_back(
    7373                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0,
    7474                        new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ),
  • src/CodeGen/GenType.cc

    r78315272 r3f7e12cb  
    210210
    211211        std::string GenType::handleGeneric( ReferenceToType * refType ) {
    212                 if ( ! refType->get_parameters().empty() ) {
     212                if ( ! refType->parameters.empty() ) {
    213213                        std::ostringstream os;
    214214                        PassVisitor<CodeGenerator> cg( os, pretty, genC, lineMarks );
    215215                        os << "(";
    216                         cg.pass.genCommaList( refType->get_parameters().begin(), refType->get_parameters().end() );
     216                        cg.pass.genCommaList( refType->parameters.begin(), refType->parameters.end() );
    217217                        os << ") ";
    218218                        return os.str();
  • src/Common/Indenter.h

    r78315272 r3f7e12cb  
    1818
    1919struct Indenter {
    20         Indenter( unsigned int amt = 2 ) : amt( amt ) {}
    21         unsigned int amt = 2;  // amount 1 level increases indent by (i.e. how much to increase by in operator++)
    22         unsigned int indent = 0;
     20        static unsigned tabsize;
     21
     22        Indenter( unsigned int amt = tabsize, unsigned int indent = 0 ) : amt( amt ), indent( indent ) {}
     23        unsigned int amt;  // amount 1 level increases indent by (i.e. how much to increase by in operator++)
     24        unsigned int indent;
    2325
    2426        Indenter & operator+=(int nlevels) { indent += amt*nlevels; return *this; }
     
    3032};
    3133
    32 inline std::ostream & operator<<( std::ostream & out, Indenter & indent ) {
     34inline std::ostream & operator<<( std::ostream & out, const Indenter & indent ) {
    3335        return out << std::string(indent.indent, ' ');
    3436}
  • src/Common/PassVisitor.h

    r78315272 r3f7e12cb  
    44
    55#include <stack>
     6
     7#include "Common/utility.h"
    68
    79#include "SynTree/Mutator.h"
     
    1012#include "SymTab/Indexer.h"
    1113
     14#include "SynTree/Attribute.h"
    1215#include "SynTree/Initializer.h"
    1316#include "SynTree/Statement.h"
     
    5356        pass_type pass;
    5457
    55         virtual void visit( ObjectDecl *objectDecl ) override final;
    56         virtual void visit( FunctionDecl *functionDecl ) override final;
    57         virtual void visit( StructDecl *aggregateDecl ) override final;
    58         virtual void visit( UnionDecl *aggregateDecl ) override final;
    59         virtual void visit( EnumDecl *aggregateDecl ) override final;
    60         virtual void visit( TraitDecl *aggregateDecl ) override final;
    61         virtual void visit( TypeDecl *typeDecl ) override final;
    62         virtual void visit( TypedefDecl *typeDecl ) override final;
    63         virtual void visit( AsmDecl *asmDecl ) override final;
    64 
    65         virtual void visit( CompoundStmt *compoundStmt ) override final;
    66         virtual void visit( ExprStmt *exprStmt ) override final;
    67         virtual void visit( AsmStmt *asmStmt ) override final;
    68         virtual void visit( IfStmt *ifStmt ) override final;
    69         virtual void visit( WhileStmt *whileStmt ) override final;
    70         virtual void visit( ForStmt *forStmt ) override final;
    71         virtual void visit( SwitchStmt *switchStmt ) override final;
    72         virtual void visit( CaseStmt *caseStmt ) override final;
    73         virtual void visit( BranchStmt *branchStmt ) override final;
    74         virtual void visit( ReturnStmt *returnStmt ) override final;
    75         virtual void visit( ThrowStmt *throwStmt ) override final;
    76         virtual void visit( TryStmt *tryStmt ) override final;
    77         virtual void visit( CatchStmt *catchStmt ) override final;
    78         virtual void visit( FinallyStmt *finallyStmt ) override final;
    79         virtual void visit( WaitForStmt *waitforStmt ) override final;
    80         virtual void visit( NullStmt *nullStmt ) override final;
    81         virtual void visit( DeclStmt *declStmt ) override final;
    82         virtual void visit( ImplicitCtorDtorStmt *impCtorDtorStmt ) override final;
    83 
    84         virtual void visit( ApplicationExpr *applicationExpr ) override final;
    85         virtual void visit( UntypedExpr *untypedExpr ) override final;
    86         virtual void visit( NameExpr *nameExpr ) override final;
    87         virtual void visit( CastExpr *castExpr ) override final;
    88         virtual void visit( VirtualCastExpr *castExpr ) override final;
    89         virtual void visit( AddressExpr *addressExpr ) override final;
    90         virtual void visit( LabelAddressExpr *labAddressExpr ) override final;
    91         virtual void visit( UntypedMemberExpr *memberExpr ) override final;
    92         virtual void visit( MemberExpr *memberExpr ) override final;
    93         virtual void visit( VariableExpr *variableExpr ) override final;
    94         virtual void visit( ConstantExpr *constantExpr ) override final;
    95         virtual void visit( SizeofExpr *sizeofExpr ) override final;
    96         virtual void visit( AlignofExpr *alignofExpr ) override final;
    97         virtual void visit( UntypedOffsetofExpr *offsetofExpr ) override final;
    98         virtual void visit( OffsetofExpr *offsetofExpr ) override final;
    99         virtual void visit( OffsetPackExpr *offsetPackExpr ) override final;
    100         virtual void visit( AttrExpr *attrExpr ) override final;
    101         virtual void visit( LogicalExpr *logicalExpr ) override final;
    102         virtual void visit( ConditionalExpr *conditionalExpr ) override final;
    103         virtual void visit( CommaExpr *commaExpr ) override final;
    104         virtual void visit( TypeExpr *typeExpr ) override final;
    105         virtual void visit( AsmExpr *asmExpr ) override final;
    106         virtual void visit( ImplicitCopyCtorExpr *impCpCtorExpr ) override final;
    107         virtual void visit( ConstructorExpr * ctorExpr ) override final;
    108         virtual void visit( CompoundLiteralExpr *compLitExpr ) override final;
    109         virtual void visit( RangeExpr *rangeExpr ) override final;
    110         virtual void visit( UntypedTupleExpr *tupleExpr ) override final;
    111         virtual void visit( TupleExpr *tupleExpr ) override final;
    112         virtual void visit( TupleIndexExpr *tupleExpr ) override final;
    113         virtual void visit( TupleAssignExpr *assignExpr ) override final;
    114         virtual void visit( StmtExpr * stmtExpr ) override final;
    115         virtual void visit( UniqueExpr * uniqueExpr ) override final;
    116 
    117         virtual void visit( VoidType *basicType ) override final;
    118         virtual void visit( BasicType *basicType ) override final;
    119         virtual void visit( PointerType *pointerType ) override final;
    120         virtual void visit( ArrayType *arrayType ) override final;
    121         virtual void visit( ReferenceType *referenceType ) override final;
    122         virtual void visit( FunctionType *functionType ) override final;
    123         virtual void visit( StructInstType *aggregateUseType ) override final;
    124         virtual void visit( UnionInstType *aggregateUseType ) override final;
    125         virtual void visit( EnumInstType *aggregateUseType ) override final;
    126         virtual void visit( TraitInstType *aggregateUseType ) override final;
    127         virtual void visit( TypeInstType *aggregateUseType ) override final;
    128         virtual void visit( TupleType *tupleType ) override final;
    129         virtual void visit( TypeofType *typeofType ) override final;
    130         virtual void visit( AttrType *attrType ) override final;
    131         virtual void visit( VarArgsType *varArgsType ) override final;
    132         virtual void visit( ZeroType *zeroType ) override final;
    133         virtual void visit( OneType *oneType ) override final;
    134 
    135         virtual void visit( Designation *designation ) override final;
    136         virtual void visit( SingleInit *singleInit ) override final;
    137         virtual void visit( ListInit *listInit ) override final;
    138         virtual void visit( ConstructorInit *ctorInit ) override final;
    139 
    140         virtual void visit( Subrange *subrange ) override final;
    141 
    142         virtual void visit( Constant *constant ) override final;
    143 
    144         virtual DeclarationWithType* mutate( ObjectDecl *objectDecl ) override final;
    145         virtual DeclarationWithType* mutate( FunctionDecl *functionDecl ) override final;
    146         virtual Declaration* mutate( StructDecl *aggregateDecl ) override final;
    147         virtual Declaration* mutate( UnionDecl *aggregateDecl ) override final;
    148         virtual Declaration* mutate( EnumDecl *aggregateDecl ) override final;
    149         virtual Declaration* mutate( TraitDecl *aggregateDecl ) override final;
    150         virtual Declaration* mutate( TypeDecl *typeDecl ) override final;
    151         virtual Declaration* mutate( TypedefDecl *typeDecl ) override final;
    152         virtual AsmDecl* mutate( AsmDecl *asmDecl ) override final;
    153 
    154         virtual CompoundStmt* mutate( CompoundStmt *compoundStmt ) override final;
    155         virtual Statement* mutate( ExprStmt *exprStmt ) override final;
    156         virtual Statement* mutate( AsmStmt *asmStmt ) override final;
    157         virtual Statement* mutate( IfStmt *ifStmt ) override final;
    158         virtual Statement* mutate( WhileStmt *whileStmt ) override final;
    159         virtual Statement* mutate( ForStmt *forStmt ) override final;
    160         virtual Statement* mutate( SwitchStmt *switchStmt ) override final;
    161         virtual Statement* mutate( CaseStmt *caseStmt ) override final;
    162         virtual Statement* mutate( BranchStmt *branchStmt ) override final;
    163         virtual Statement* mutate( ReturnStmt *returnStmt ) override final;
    164         virtual Statement* mutate( ThrowStmt *throwStmt ) override final;
    165         virtual Statement* mutate( TryStmt *tryStmt ) override final;
    166         virtual Statement* mutate( CatchStmt *catchStmt ) override final;
    167         virtual Statement* mutate( FinallyStmt *finallyStmt ) override final;
    168         virtual Statement* mutate( WaitForStmt *waitforStmt ) override final;
    169         virtual NullStmt* mutate( NullStmt *nullStmt ) override final;
    170         virtual Statement* mutate( DeclStmt *declStmt ) override final;
    171         virtual Statement* mutate( ImplicitCtorDtorStmt *impCtorDtorStmt ) override final;
    172 
    173         virtual Expression* mutate( ApplicationExpr *applicationExpr ) override final;
    174         virtual Expression* mutate( UntypedExpr *untypedExpr ) override final;
    175         virtual Expression* mutate( NameExpr *nameExpr ) override final;
    176         virtual Expression* mutate( AddressExpr *castExpr ) override final;
    177         virtual Expression* mutate( LabelAddressExpr *labAddressExpr ) override final;
    178         virtual Expression* mutate( CastExpr *castExpr ) override final;
    179         virtual Expression* mutate( VirtualCastExpr *castExpr ) override final;
    180         virtual Expression* mutate( UntypedMemberExpr *memberExpr ) override final;
    181         virtual Expression* mutate( MemberExpr *memberExpr ) override final;
    182         virtual Expression* mutate( VariableExpr *variableExpr ) override final;
    183         virtual Expression* mutate( ConstantExpr *constantExpr ) override final;
    184         virtual Expression* mutate( SizeofExpr *sizeofExpr ) override final;
    185         virtual Expression* mutate( AlignofExpr *alignofExpr ) override final;
    186         virtual Expression* mutate( UntypedOffsetofExpr *offsetofExpr ) override final;
    187         virtual Expression* mutate( OffsetofExpr *offsetofExpr ) override final;
    188         virtual Expression* mutate( OffsetPackExpr *offsetPackExpr ) override final;
    189         virtual Expression* mutate( AttrExpr *attrExpr ) override final;
    190         virtual Expression* mutate( LogicalExpr *logicalExpr ) override final;
    191         virtual Expression* mutate( ConditionalExpr *conditionalExpr ) override final;
    192         virtual Expression* mutate( CommaExpr *commaExpr ) override final;
    193         virtual Expression* mutate( TypeExpr *typeExpr ) override final;
    194         virtual Expression* mutate( AsmExpr *asmExpr ) override final;
    195         virtual Expression* mutate( ImplicitCopyCtorExpr *impCpCtorExpr ) override final;
    196         virtual Expression* mutate( ConstructorExpr *ctorExpr ) override final;
    197         virtual Expression* mutate( CompoundLiteralExpr *compLitExpr ) override final;
    198         virtual Expression* mutate( RangeExpr *rangeExpr ) override final;
    199         virtual Expression* mutate( UntypedTupleExpr *tupleExpr ) override final;
    200         virtual Expression* mutate( TupleExpr *tupleExpr ) override final;
    201         virtual Expression* mutate( TupleIndexExpr *tupleExpr ) override final;
    202         virtual Expression* mutate( TupleAssignExpr *assignExpr ) override final;
    203         virtual Expression* mutate( StmtExpr * stmtExpr ) override final;
    204         virtual Expression* mutate( UniqueExpr * uniqueExpr ) override final;
    205 
    206         virtual Type* mutate( VoidType *basicType ) override final;
    207         virtual Type* mutate( BasicType *basicType ) override final;
    208         virtual Type* mutate( PointerType *pointerType ) override final;
    209         virtual Type* mutate( ArrayType *arrayType ) override final;
    210         virtual Type* mutate( ReferenceType *referenceType ) override final;
    211         virtual Type* mutate( FunctionType *functionType ) override final;
    212         virtual Type* mutate( StructInstType *aggregateUseType ) override final;
    213         virtual Type* mutate( UnionInstType *aggregateUseType ) override final;
    214         virtual Type* mutate( EnumInstType *aggregateUseType ) override final;
    215         virtual Type* mutate( TraitInstType *aggregateUseType ) override final;
    216         virtual Type* mutate( TypeInstType *aggregateUseType ) override final;
    217         virtual Type* mutate( TupleType *tupleType ) override final;
    218         virtual Type* mutate( TypeofType *typeofType ) override final;
    219         virtual Type* mutate( AttrType *attrType ) override final;
    220         virtual Type* mutate( VarArgsType *varArgsType ) override final;
    221         virtual Type* mutate( ZeroType *zeroType ) override final;
    222         virtual Type* mutate( OneType *oneType ) override final;
    223 
    224         virtual Designation* mutate( Designation *designation ) override final;
    225         virtual Initializer* mutate( SingleInit *singleInit ) override final;
    226         virtual Initializer* mutate( ListInit *listInit ) override final;
    227         virtual Initializer* mutate( ConstructorInit *ctorInit ) override final;
    228 
    229         virtual Subrange *mutate( Subrange *subrange ) override final;
    230 
    231         virtual Constant *mutate( Constant *constant ) override final;
     58        virtual void visit( ObjectDecl * objectDecl ) override final;
     59        virtual void visit( FunctionDecl * functionDecl ) override final;
     60        virtual void visit( StructDecl * aggregateDecl ) override final;
     61        virtual void visit( UnionDecl * aggregateDecl ) override final;
     62        virtual void visit( EnumDecl * aggregateDecl ) override final;
     63        virtual void visit( TraitDecl * aggregateDecl ) override final;
     64        virtual void visit( TypeDecl * typeDecl ) override final;
     65        virtual void visit( TypedefDecl * typeDecl ) override final;
     66        virtual void visit( AsmDecl * asmDecl ) override final;
     67
     68        virtual void visit( CompoundStmt * compoundStmt ) override final;
     69        virtual void visit( ExprStmt * exprStmt ) override final;
     70        virtual void visit( AsmStmt * asmStmt ) override final;
     71        virtual void visit( IfStmt * ifStmt ) override final;
     72        virtual void visit( WhileStmt * whileStmt ) override final;
     73        virtual void visit( ForStmt * forStmt ) override final;
     74        virtual void visit( SwitchStmt * switchStmt ) override final;
     75        virtual void visit( CaseStmt * caseStmt ) override final;
     76        virtual void visit( BranchStmt * branchStmt ) override final;
     77        virtual void visit( ReturnStmt * returnStmt ) override final;
     78        virtual void visit( ThrowStmt * throwStmt ) override final;
     79        virtual void visit( TryStmt * tryStmt ) override final;
     80        virtual void visit( CatchStmt * catchStmt ) override final;
     81        virtual void visit( FinallyStmt * finallyStmt ) override final;
     82        virtual void visit( WaitForStmt * waitforStmt ) override final;
     83        virtual void visit( NullStmt * nullStmt ) override final;
     84        virtual void visit( DeclStmt * declStmt ) override final;
     85        virtual void visit( ImplicitCtorDtorStmt * impCtorDtorStmt ) override final;
     86
     87        virtual void visit( ApplicationExpr * applicationExpr ) override final;
     88        virtual void visit( UntypedExpr * untypedExpr ) override final;
     89        virtual void visit( NameExpr * nameExpr ) override final;
     90        virtual void visit( CastExpr * castExpr ) override final;
     91        virtual void visit( VirtualCastExpr * castExpr ) override final;
     92        virtual void visit( AddressExpr * addressExpr ) override final;
     93        virtual void visit( LabelAddressExpr * labAddressExpr ) override final;
     94        virtual void visit( UntypedMemberExpr * memberExpr ) override final;
     95        virtual void visit( MemberExpr * memberExpr ) override final;
     96        virtual void visit( VariableExpr * variableExpr ) override final;
     97        virtual void visit( ConstantExpr * constantExpr ) override final;
     98        virtual void visit( SizeofExpr * sizeofExpr ) override final;
     99        virtual void visit( AlignofExpr * alignofExpr ) override final;
     100        virtual void visit( UntypedOffsetofExpr * offsetofExpr ) override final;
     101        virtual void visit( OffsetofExpr * offsetofExpr ) override final;
     102        virtual void visit( OffsetPackExpr * offsetPackExpr ) override final;
     103        virtual void visit( AttrExpr * attrExpr ) override final;
     104        virtual void visit( LogicalExpr * logicalExpr ) override final;
     105        virtual void visit( ConditionalExpr * conditionalExpr ) override final;
     106        virtual void visit( CommaExpr * commaExpr ) override final;
     107        virtual void visit( TypeExpr * typeExpr ) override final;
     108        virtual void visit( AsmExpr * asmExpr ) override final;
     109        virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr ) override final;
     110        virtual void visit( ConstructorExpr *  ctorExpr ) override final;
     111        virtual void visit( CompoundLiteralExpr * compLitExpr ) override final;
     112        virtual void visit( RangeExpr * rangeExpr ) override final;
     113        virtual void visit( UntypedTupleExpr * tupleExpr ) override final;
     114        virtual void visit( TupleExpr * tupleExpr ) override final;
     115        virtual void visit( TupleIndexExpr * tupleExpr ) override final;
     116        virtual void visit( TupleAssignExpr * assignExpr ) override final;
     117        virtual void visit( StmtExpr *  stmtExpr ) override final;
     118        virtual void visit( UniqueExpr *  uniqueExpr ) override final;
     119
     120        virtual void visit( VoidType * basicType ) override final;
     121        virtual void visit( BasicType * basicType ) override final;
     122        virtual void visit( PointerType * pointerType ) override final;
     123        virtual void visit( ArrayType * arrayType ) override final;
     124        virtual void visit( ReferenceType * referenceType ) override final;
     125        virtual void visit( FunctionType * functionType ) override final;
     126        virtual void visit( StructInstType * aggregateUseType ) override final;
     127        virtual void visit( UnionInstType * aggregateUseType ) override final;
     128        virtual void visit( EnumInstType * aggregateUseType ) override final;
     129        virtual void visit( TraitInstType * aggregateUseType ) override final;
     130        virtual void visit( TypeInstType * aggregateUseType ) override final;
     131        virtual void visit( TupleType * tupleType ) override final;
     132        virtual void visit( TypeofType * typeofType ) override final;
     133        virtual void visit( AttrType * attrType ) override final;
     134        virtual void visit( VarArgsType * varArgsType ) override final;
     135        virtual void visit( ZeroType * zeroType ) override final;
     136        virtual void visit( OneType * oneType ) override final;
     137
     138        virtual void visit( Designation * designation ) override final;
     139        virtual void visit( SingleInit * singleInit ) override final;
     140        virtual void visit( ListInit * listInit ) override final;
     141        virtual void visit( ConstructorInit * ctorInit ) override final;
     142
     143        virtual void visit( Subrange * subrange ) override final;
     144
     145        virtual void visit( Constant * constant ) override final;
     146
     147        virtual void visit( Attribute * attribute ) override final;
     148
     149        virtual DeclarationWithType * mutate( ObjectDecl * objectDecl ) override final;
     150        virtual DeclarationWithType * mutate( FunctionDecl * functionDecl ) override final;
     151        virtual Declaration * mutate( StructDecl * aggregateDecl ) override final;
     152        virtual Declaration * mutate( UnionDecl * aggregateDecl ) override final;
     153        virtual Declaration * mutate( EnumDecl * aggregateDecl ) override final;
     154        virtual Declaration * mutate( TraitDecl * aggregateDecl ) override final;
     155        virtual Declaration * mutate( TypeDecl * typeDecl ) override final;
     156        virtual Declaration * mutate( TypedefDecl * typeDecl ) override final;
     157        virtual AsmDecl * mutate( AsmDecl * asmDecl ) override final;
     158
     159        virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override final;
     160        virtual Statement * mutate( ExprStmt * exprStmt ) override final;
     161        virtual Statement * mutate( AsmStmt * asmStmt ) override final;
     162        virtual Statement * mutate( IfStmt * ifStmt ) override final;
     163        virtual Statement * mutate( WhileStmt * whileStmt ) override final;
     164        virtual Statement * mutate( ForStmt * forStmt ) override final;
     165        virtual Statement * mutate( SwitchStmt * switchStmt ) override final;
     166        virtual Statement * mutate( CaseStmt * caseStmt ) override final;
     167        virtual Statement * mutate( BranchStmt * branchStmt ) override final;
     168        virtual Statement * mutate( ReturnStmt * returnStmt ) override final;
     169        virtual Statement * mutate( ThrowStmt * throwStmt ) override final;
     170        virtual Statement * mutate( TryStmt * tryStmt ) override final;
     171        virtual Statement * mutate( CatchStmt * catchStmt ) override final;
     172        virtual Statement * mutate( FinallyStmt * finallyStmt ) override final;
     173        virtual Statement * mutate( WaitForStmt * waitforStmt ) override final;
     174        virtual NullStmt * mutate( NullStmt * nullStmt ) override final;
     175        virtual Statement * mutate( DeclStmt * declStmt ) override final;
     176        virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt ) override final;
     177
     178        virtual Expression * mutate( ApplicationExpr * applicationExpr ) override final;
     179        virtual Expression * mutate( UntypedExpr * untypedExpr ) override final;
     180        virtual Expression * mutate( NameExpr * nameExpr ) override final;
     181        virtual Expression * mutate( AddressExpr * castExpr ) override final;
     182        virtual Expression * mutate( LabelAddressExpr * labAddressExpr ) override final;
     183        virtual Expression * mutate( CastExpr * castExpr ) override final;
     184        virtual Expression * mutate( VirtualCastExpr * castExpr ) override final;
     185        virtual Expression * mutate( UntypedMemberExpr * memberExpr ) override final;
     186        virtual Expression * mutate( MemberExpr * memberExpr ) override final;
     187        virtual Expression * mutate( VariableExpr * variableExpr ) override final;
     188        virtual Expression * mutate( ConstantExpr * constantExpr ) override final;
     189        virtual Expression * mutate( SizeofExpr * sizeofExpr ) override final;
     190        virtual Expression * mutate( AlignofExpr * alignofExpr ) override final;
     191        virtual Expression * mutate( UntypedOffsetofExpr * offsetofExpr ) override final;
     192        virtual Expression * mutate( OffsetofExpr * offsetofExpr ) override final;
     193        virtual Expression * mutate( OffsetPackExpr * offsetPackExpr ) override final;
     194        virtual Expression * mutate( AttrExpr * attrExpr ) override final;
     195        virtual Expression * mutate( LogicalExpr * logicalExpr ) override final;
     196        virtual Expression * mutate( ConditionalExpr * conditionalExpr ) override final;
     197        virtual Expression * mutate( CommaExpr * commaExpr ) override final;
     198        virtual Expression * mutate( TypeExpr * typeExpr ) override final;
     199        virtual Expression * mutate( AsmExpr * asmExpr ) override final;
     200        virtual Expression * mutate( ImplicitCopyCtorExpr * impCpCtorExpr ) override final;
     201        virtual Expression * mutate( ConstructorExpr * ctorExpr ) override final;
     202        virtual Expression * mutate( CompoundLiteralExpr * compLitExpr ) override final;
     203        virtual Expression * mutate( RangeExpr * rangeExpr ) override final;
     204        virtual Expression * mutate( UntypedTupleExpr * tupleExpr ) override final;
     205        virtual Expression * mutate( TupleExpr * tupleExpr ) override final;
     206        virtual Expression * mutate( TupleIndexExpr * tupleExpr ) override final;
     207        virtual Expression * mutate( TupleAssignExpr * assignExpr ) override final;
     208        virtual Expression * mutate( StmtExpr *  stmtExpr ) override final;
     209        virtual Expression * mutate( UniqueExpr *  uniqueExpr ) override final;
     210
     211        virtual Type * mutate( VoidType * basicType ) override final;
     212        virtual Type * mutate( BasicType * basicType ) override final;
     213        virtual Type * mutate( PointerType * pointerType ) override final;
     214        virtual Type * mutate( ArrayType * arrayType ) override final;
     215        virtual Type * mutate( ReferenceType * referenceType ) override final;
     216        virtual Type * mutate( FunctionType * functionType ) override final;
     217        virtual Type * mutate( StructInstType * aggregateUseType ) override final;
     218        virtual Type * mutate( UnionInstType * aggregateUseType ) override final;
     219        virtual Type * mutate( EnumInstType * aggregateUseType ) override final;
     220        virtual Type * mutate( TraitInstType * aggregateUseType ) override final;
     221        virtual Type * mutate( TypeInstType * aggregateUseType ) override final;
     222        virtual Type * mutate( TupleType * tupleType ) override final;
     223        virtual Type * mutate( TypeofType * typeofType ) override final;
     224        virtual Type * mutate( AttrType * attrType ) override final;
     225        virtual Type * mutate( VarArgsType * varArgsType ) override final;
     226        virtual Type * mutate( ZeroType * zeroType ) override final;
     227        virtual Type * mutate( OneType * oneType ) override final;
     228
     229        virtual Designation * mutate( Designation * designation ) override final;
     230        virtual Initializer * mutate( SingleInit * singleInit ) override final;
     231        virtual Initializer * mutate( ListInit * listInit ) override final;
     232        virtual Initializer * mutate( ConstructorInit * ctorInit ) override final;
     233
     234        virtual Subrange * mutate( Subrange * subrange ) override final;
     235
     236        virtual Constant * mutate( Constant * constant ) override final;
     237
     238        virtual Attribute * mutate( Attribute * attribute ) override final;
     239
     240        virtual TypeSubstitution * mutate( TypeSubstitution * sub ) final;
    232241
    233242private:
    234243        template<typename pass_t> friend void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_t >& visitor );
    235244        template<typename pass_t> friend void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_t >& visitor );
     245        template< typename TreeType, typename pass_t > friend void maybeAccept_impl( TreeType * tree, PassVisitor< pass_t > & visitor );
     246        template< typename TreeType, typename pass_t > friend void maybeMutate_impl( TreeType *& tree, PassVisitor< pass_t > & mutator );
     247        template< typename Container, typename pass_t > friend void maybeAccept_impl( Container & container, PassVisitor< pass_t > & visitor );
     248        template< typename Container, typename pass_t > friend void maybeMutate_impl( Container & container, PassVisitor< pass_t > & mutator );
    236249
    237250        template<typename node_type> void call_previsit ( node_type * node ) { previsit_impl ( pass, node, 0 ); }
     
    268281        std::list< Declaration* > *     get_afterDecls () { return declsToAddAfter_impl ( pass, 0); }
    269282
    270         void set_visit_children( bool& ref ) { bool_ref * ptr = visit_children_impl(pass, 0); if(ptr) ptr->set( ref ); }
     283        bool       get_visit_children    () { bool_ref * ptr = visit_children_impl(pass, 0); return ptr ? *ptr : true; }
     284        bool_ref * get_visit_children_ptr() { return visit_children_impl(pass, 0); }
    271285
    272286        void indexerScopeEnter  ()                             { indexer_impl_enterScope  ( pass, 0       ); }
  • src/Common/PassVisitor.impl.h

    r78315272 r3f7e12cb  
    22// IWYU pragma: private, include "PassVisitor.h"
    33
    4 #define VISIT_START( node )                     \
    5         __attribute__((unused))                   \
     4#define VISIT_START( node )                                     \
     5        __attribute__((unused))                                   \
     6        ChildrenGuard children_guard( get_visit_children_ptr() ); \
     7        __attribute__((unused))                                   \
    68        guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
    7         bool visit_children = true;               \
    8         set_visit_children( visit_children );   \
    9         call_previsit( node );                    \
    10         if( visit_children ) {                    \
     9        call_previsit( node );                                    \
    1110
    1211#define VISIT_END( node )                       \
    13         }                                         \
    1412        call_postvisit( node );                   \
    1513
    16 #define MUTATE_START( node )                    \
    17         __attribute__((unused))                   \
     14#define MUTATE_START( node )                                    \
     15        __attribute__((unused))                                   \
     16        ChildrenGuard children_guard( get_visit_children_ptr() ); \
     17        __attribute__((unused))                                   \
    1818        guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
    19         bool visit_children = true;               \
    20         set_visit_children( visit_children );   \
    21         call_premutate( node );                   \
    22         if( visit_children ) {                    \
     19        call_premutate( node );                                   \
    2320
    2421#define MUTATE_END( type, node )                \
    25         }                                         \
    2622        return call_postmutate< type * >( node ); \
    2723
    2824
    29 #define VISIT_BODY( node )        \
    30         VISIT_START( node );        \
    31         Visitor::visit( node );     \
    32         VISIT_END( node );          \
    33 
    34 
    35 #define MUTATE_BODY( type, node ) \
    36         MUTATE_START( node );       \
    37         Mutator::mutate( node );    \
    38         MUTATE_END( type, node );   \
     25#define VISIT_BODY( node )          \
     26        VISIT_START( node );          \
     27        if( children_guard ) {        \
     28                Visitor::visit( node ); \
     29        }                             \
     30        VISIT_END( node );            \
     31
     32
     33#define MUTATE_BODY( type, node )    \
     34        MUTATE_START( node );          \
     35        if( children_guard ) {         \
     36                Mutator::mutate( node ); \
     37        }                              \
     38        MUTATE_END( type, node );      \
    3939
    4040
     
    6363template< typename pass_type >
    6464static inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) {
    65 
    6665        DeclList_t* beforeDecls = visitor.get_beforeDecls();
    6766        DeclList_t* afterDecls  = visitor.get_afterDecls();
     
    7675                try {
    7776                        // run visitor on declaration
    78                         maybeAccept( *i, visitor );
     77                        maybeAccept_impl( *i, visitor );
    7978                } catch( SemanticError &e ) {
    8079                        e.set_location( (*i)->location );
     
    9291template< typename pass_type >
    9392static inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {
    94 
    9593        DeclList_t* beforeDecls = mutator.get_beforeDecls();
    9694        DeclList_t* afterDecls  = mutator.get_afterDecls();
     
    104102                try {
    105103                        // run mutator on declaration
    106                         *i = maybeMutate( *i, mutator );
     104                        maybeMutate_impl( *i, mutator );
    107105                } catch( SemanticError &e ) {
    108106                        e.set_location( (*i)->location );
     
    118116}
    119117
    120 template< typename Container, typename VisitorType >
    121 inline void maybeAccept( Container &container, VisitorType &visitor ) {
     118template< typename TreeType, typename pass_type >
     119inline void maybeAccept_impl( TreeType * tree, PassVisitor< pass_type > & visitor ) {
     120        if ( ! visitor.get_visit_children() ) return;
     121        if ( tree ) {
     122                tree->accept( visitor );
     123        }
     124}
     125
     126template< typename Container, typename pass_type >
     127inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) {
     128        if ( ! visitor.get_visit_children() ) return;
    122129        SemanticError errors;
    123130        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
     
    136143}
    137144
    138 template< typename Container, typename MutatorType >
    139 inline void maybeMutateRef( Container &container, MutatorType &mutator ) {
     145template< typename TreeType, typename pass_type >
     146inline void maybeMutate_impl( TreeType *& tree, PassVisitor< pass_type > & mutator ) {
     147        if ( ! mutator.get_visit_children() ) return;
     148
     149        if ( tree ) {
     150                tree = strict_dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) );
     151        }
     152}
     153
     154template< typename Container, typename pass_type >
     155inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) {
     156        if ( ! mutator.get_visit_children() ) return;
    140157        SemanticError errors;
    141158        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    142159                try {
    143160                        if ( *i ) {
    144 ///                 *i = (*i)->acceptMutator( mutator );
    145161                                *i = dynamic_cast< typename Container::value_type >( (*i)->acceptMutator( mutator ) );
    146162                                assert( *i );
     
    159175template< typename func_t >
    160176void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
     177        if ( ! get_visit_children() ) return;
    161178        SemanticError errors;
    162179
     
    199216void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {
    200217        handleStatementList( statements, [this]( Statement * stmt) {
    201                 stmt->accept( *this );
     218                maybeAccept_impl( stmt, *this );
    202219        });
    203220}
     
    206223void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) {
    207224        handleStatementList( statements, [this]( Statement *& stmt) {
    208                 stmt = stmt->acceptMutator( *this );
     225                maybeMutate_impl( stmt, *this );
    209226        });
    210227}
     
    214231template< typename func_t >
    215232Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) {
     233        if ( ! get_visit_children() ) return stmt;
     234
    216235        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
    217236        ValueGuardPtr< TypeSubstitution * >  oldEnv        ( get_env_ptr    () );
     
    244263Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
    245264        return handleStatement( stmt, [this]( Statement * stmt ) {
    246                 maybeAccept( stmt, *this );
     265                maybeAccept_impl( stmt, *this );
    247266                return stmt;
    248267        });
     
    252271Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) {
    253272        return handleStatement( stmt, [this]( Statement * stmt ) {
    254                 return maybeMutate( stmt, *this );
     273                maybeMutate_impl( stmt, *this );
     274                return stmt;
    255275        });
    256276}
     
    259279template< typename func_t >
    260280Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) {
     281        if ( ! get_visit_children() ) return expr;
    261282        if( !expr ) return nullptr;
    262283
     
    266287        }
    267288
    268         // should env be cloned (or moved) onto the result of the mutate?
     289        // should env be moved onto the result of the mutate?
    269290        return func( expr );
    270291}
     
    273294Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) {
    274295        return handleExpression(expr, [this]( Expression * expr ) {
    275                 expr->accept( *this );
     296                maybeAccept_impl( expr, *this );
    276297                return expr;
    277298        });
     
    281302Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) {
    282303        return handleExpression(expr, [this]( Expression * expr ) {
    283                 return expr->acceptMutator( *this );
     304                maybeMutate_impl( expr, *this );
     305                return expr;
    284306        });
     307}
     308
     309template< typename TreeType, typename VisitorType >
     310inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) {
     311        if ( ! visitor.get_visit_children() ) return;
     312        auto guard = makeFuncGuard(
     313                [&visitor]() { visitor.indexerScopeEnter(); },
     314                [&visitor]() { visitor.indexerScopeLeave(); }
     315        );
     316        maybeAccept_impl( tree, visitor );
     317}
     318
     319template< typename TreeType, typename MutatorType >
     320inline void indexerScopedMutate( TreeType *& tree, MutatorType & mutator ) {
     321        if ( ! mutator.get_visit_children() ) return;
     322        auto guard = makeFuncGuard(
     323                [&mutator]() { mutator.indexerScopeEnter(); },
     324                [&mutator]() { mutator.indexerScopeLeave(); }
     325        );
     326        maybeMutate_impl( tree, mutator );
    285327}
    286328
     
    319361
    320362        indexerScopedAccept( node->type         , *this );
    321         maybeAccept        ( node->init         , *this );
    322         maybeAccept        ( node->bitfieldWidth, *this );
     363        maybeAccept_impl   ( node->init         , *this );
     364        maybeAccept_impl   ( node->bitfieldWidth, *this );
     365        maybeAccept_impl   ( node->attributes   , *this );
    323366
    324367        if ( node->name != "" ) {
     
    334377
    335378        indexerScopedMutate( node->type         , *this );
    336         maybeMutateRef     ( node->init         , *this );
    337         maybeMutateRef     ( node->bitfieldWidth, *this );
     379        maybeMutate_impl   ( node->init         , *this );
     380        maybeMutate_impl   ( node->bitfieldWidth, *this );
     381        maybeMutate_impl   ( node->attributes   , *this );
    338382
    339383        if ( node->name != "" ) {
     
    356400        {
    357401                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    358                 maybeAccept( node->type, *this );
    359                 maybeAccept( node->statements, *this );
     402                maybeAccept_impl( node->type, *this );
     403                maybeAccept_impl( node->statements, *this );
     404                maybeAccept_impl( node->attributes, *this );
    360405        }
    361406
     
    373418        {
    374419                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    375                 maybeMutateRef( node->type, *this );
    376                 maybeMutateRef( node->statements, *this );
     420                maybeMutate_impl( node->type, *this );
     421                maybeMutate_impl( node->statements, *this );
     422                maybeMutate_impl( node->attributes, *this );
    377423        }
    378424
     
    392438        {
    393439                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    394                 maybeAccept( node->parameters, *this );
    395                 maybeAccept( node->members   , *this );
     440                maybeAccept_impl( node->parameters, *this );
     441                maybeAccept_impl( node->members   , *this );
    396442        }
    397443
     
    412458        {
    413459                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    414                 maybeMutateRef( node->parameters, *this );
    415                 maybeMutateRef( node->members   , *this );
     460                maybeMutate_impl( node->parameters, *this );
     461                maybeMutate_impl( node->members   , *this );
    416462        }
    417463
     
    433479        {
    434480                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    435                 maybeAccept( node->parameters, *this );
    436                 maybeAccept( node->members   , *this );
     481                maybeAccept_impl( node->parameters, *this );
     482                maybeAccept_impl( node->members   , *this );
    437483        }
    438484
     
    451497        {
    452498                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    453                 maybeMutateRef( node->parameters, *this );
    454                 maybeMutateRef( node->members   , *this );
     499                maybeMutate_impl( node->parameters, *this );
     500                maybeMutate_impl( node->members   , *this );
    455501        }
    456502
     
    469515
    470516        // unlike structs, traits, and unions, enums inject their members into the global scope
    471         maybeAccept( node->parameters, *this );
    472         maybeAccept( node->members   , *this );
     517        maybeAccept_impl( node->parameters, *this );
     518        maybeAccept_impl( node->members   , *this );
    473519
    474520        VISIT_END( node );
     
    482528
    483529        // unlike structs, traits, and unions, enums inject their members into the global scope
    484         maybeMutateRef( node->parameters, *this );
    485         maybeMutateRef( node->members   , *this );
     530        maybeMutate_impl( node->parameters, *this );
     531        maybeMutate_impl( node->members   , *this );
    486532
    487533        MUTATE_END( Declaration, node );
     
    496542        {
    497543                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    498                 maybeAccept( node->parameters, *this );
    499                 maybeAccept( node->members   , *this );
     544                maybeAccept_impl( node->parameters, *this );
     545                maybeAccept_impl( node->members   , *this );
    500546        }
    501547
     
    511557        {
    512558                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    513                 maybeMutateRef( node->parameters, *this );
    514                 maybeMutateRef( node->members   , *this );
     559                maybeMutate_impl( node->parameters, *this );
     560                maybeMutate_impl( node->members   , *this );
    515561        }
    516562
     
    528574        {
    529575                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    530                 maybeAccept( node->parameters, *this );
    531                 maybeAccept( node->base      , *this );
     576                maybeAccept_impl( node->parameters, *this );
     577                maybeAccept_impl( node->base      , *this );
    532578        }
    533579
     
    537583        indexerAddType( node );
    538584
    539         maybeAccept( node->assertions, *this );
     585        maybeAccept_impl( node->assertions, *this );
    540586
    541587        indexerScopedAccept( node->init, *this );
     
    550596        {
    551597                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    552                 maybeMutateRef( node->parameters, *this );
    553                 maybeMutateRef( node->base      , *this );
     598                maybeMutate_impl( node->parameters, *this );
     599                maybeMutate_impl( node->base      , *this );
    554600        }
    555601
     
    559605        indexerAddType( node );
    560606
    561         maybeMutateRef( node->assertions, *this );
     607        maybeMutate_impl( node->assertions, *this );
    562608
    563609        indexerScopedMutate( node->init, *this );
     
    574620        {
    575621                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    576                 maybeAccept( node->parameters, *this );
    577                 maybeAccept( node->base      , *this );
     622                maybeAccept_impl( node->parameters, *this );
     623                maybeAccept_impl( node->base      , *this );
    578624        }
    579625
    580626        indexerAddType( node );
    581627
    582         maybeAccept( node->assertions, *this );
     628        maybeAccept_impl( node->assertions, *this );
    583629
    584630        VISIT_END( node );
     
    591637        {
    592638                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    593                 maybeMutateRef     ( node->parameters, *this );
    594                 maybeMutateRef( node->base      , *this );
     639                maybeMutate_impl( node->parameters, *this );
     640                maybeMutate_impl( node->base      , *this );
    595641        }
    596642
    597643        indexerAddType( node );
    598644
    599         maybeMutateRef( node->assertions, *this );
     645        maybeMutate_impl( node->assertions, *this );
    600646
    601647        MUTATE_END( Declaration, node );
     
    608654        VISIT_START( node );
    609655
    610         maybeAccept( node->stmt, *this );
     656        maybeAccept_impl( node->stmt, *this );
    611657
    612658        VISIT_END( node );
     
    617663        MUTATE_START( node );
    618664
    619         maybeMutateRef( node->stmt, *this );
     665        maybeMutate_impl( node->stmt, *this );
    620666
    621667        MUTATE_END( AsmDecl, node );
     
    686732                // if statements introduce a level of scope (for the initialization)
    687733                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    688                 acceptAll( node->get_initialization(), *this );
    689                 visitExpression( node->condition );
     734                maybeAccept_impl( node->get_initialization(), *this );
     735                visitExpression ( node->condition );
    690736                node->thenPart = visitStatement( node->thenPart );
    691737                node->elsePart = visitStatement( node->elsePart );
     
    700746                // if statements introduce a level of scope (for the initialization)
    701747                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    702                 maybeMutateRef( node->get_initialization(), *this );
     748                maybeMutate_impl( node->get_initialization(), *this );
    703749                node->condition = mutateExpression( node->condition );
    704750                node->thenPart  = mutateStatement ( node->thenPart  );
     
    738784                // for statements introduce a level of scope (for the initialization)
    739785                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    740                 maybeAccept( node->initialization, *this );
     786                maybeAccept_impl( node->initialization, *this );
    741787                visitExpression( node->condition );
    742788                visitExpression( node->increment );
     
    752798                // for statements introduce a level of scope (for the initialization)
    753799                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    754                 maybeMutateRef( node->initialization, *this );
     800                maybeMutate_impl( node->initialization, *this );
    755801                node->condition = mutateExpression( node->condition );
    756802                node->increment = mutateExpression( node->increment );
     
    855901        VISIT_START( node );
    856902
    857         maybeAccept( node->block       , *this );
    858         maybeAccept( node->handlers    , *this );
    859         maybeAccept( node->finallyBlock, *this );
     903        maybeAccept_impl( node->block       , *this );
     904        maybeAccept_impl( node->handlers    , *this );
     905        maybeAccept_impl( node->finallyBlock, *this );
    860906
    861907        VISIT_END( node );
     
    866912        MUTATE_START( node );
    867913
    868         maybeMutateRef( node->block       , *this );
    869         maybeMutateRef( node->handlers    , *this );
    870         maybeMutateRef( node->finallyBlock, *this );
     914        maybeMutate_impl( node->block       , *this );
     915        maybeMutate_impl( node->handlers    , *this );
     916        maybeMutate_impl( node->finallyBlock, *this );
    871917
    872918        MUTATE_END( Statement, node );
     
    881927                // catch statements introduce a level of scope (for the caught exception)
    882928                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    883                 maybeAccept( node->decl, *this );
     929                maybeAccept_impl( node->decl, *this );
    884930                node->cond = visitExpression( node->cond );
    885931                node->body = visitStatement ( node->body );
     
    894940                // catch statements introduce a level of scope (for the caught exception)
    895941                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    896                 maybeMutateRef( node->decl, *this );
     942                maybeMutate_impl( node->decl, *this );
    897943                node->cond = mutateExpression( node->cond );
    898944                node->body = mutateStatement ( node->body );
     
    9681014
    9691015        indexerScopedAccept( node->result  , *this );
    970         maybeAccept        ( node->function, *this );
    971         maybeAccept        ( node->args    , *this );
     1016        maybeAccept_impl        ( node->function, *this );
     1017        maybeAccept_impl        ( node->args    , *this );
    9721018
    9731019        VISIT_END( node );
     
    9801026        indexerScopedMutate( node->env     , *this );
    9811027        indexerScopedMutate( node->result  , *this );
    982         maybeMutateRef     ( node->function, *this );
    983         maybeMutateRef     ( node->args    , *this );
     1028        maybeMutate_impl   ( node->function, *this );
     1029        maybeMutate_impl   ( node->args    , *this );
    9841030
    9851031        MUTATE_END( Expression, node );
     
    9921038        VISIT_START( node );
    9931039
    994         // maybeAccept( node->get_env(), *this );
     1040        // maybeAccept_impl( node->get_env(), *this );
    9951041        indexerScopedAccept( node->result, *this );
    9961042
     
    10441090
    10451091        indexerScopedAccept( node->result, *this );
    1046         maybeAccept        ( node->arg   , *this );
     1092        maybeAccept_impl        ( node->arg   , *this );
    10471093
    10481094        VISIT_END( node );
     
    10551101        indexerScopedMutate( node->env   , *this );
    10561102        indexerScopedMutate( node->result, *this );
    1057         maybeMutateRef     ( node->arg   , *this );
     1103        maybeMutate_impl   ( node->arg   , *this );
    10581104
    10591105        MUTATE_END( Expression, node );
     
    10671113
    10681114        indexerScopedAccept( node->result, *this );
    1069         maybeAccept( node->arg, *this );
     1115        maybeAccept_impl( node->arg, *this );
    10701116
    10711117        VISIT_END( node );
     
    10781124        indexerScopedMutate( node->env   , *this );
    10791125        indexerScopedMutate( node->result, *this );
    1080         maybeMutateRef     ( node->arg   , *this );
     1126        maybeMutate_impl   ( node->arg   , *this );
    10811127
    10821128        MUTATE_END( Expression, node );
     
    10901136
    10911137        indexerScopedAccept( node->result, *this );
    1092         maybeAccept        ( node->arg   , *this );
     1138        maybeAccept_impl   ( node->arg   , *this );
    10931139
    10941140        VISIT_END( node );
     
    11011147        indexerScopedMutate( node->env   , *this );
    11021148        indexerScopedMutate( node->result, *this );
    1103         maybeMutateRef     ( node->arg   , *this );
     1149        maybeMutate_impl   ( node->arg   , *this );
    11041150
    11051151        MUTATE_END( Expression, node );
     
    11341180
    11351181        indexerScopedAccept( node->result   , *this );
    1136         maybeAccept        ( node->aggregate, *this );
    1137         maybeAccept        ( node->member   , *this );
     1182        maybeAccept_impl   ( node->aggregate, *this );
     1183        maybeAccept_impl   ( node->member   , *this );
    11381184
    11391185        VISIT_END( node );
     
    11461192        indexerScopedMutate( node->env      , *this );
    11471193        indexerScopedMutate( node->result   , *this );
    1148         maybeMutateRef     ( node->aggregate, *this );
    1149         maybeMutateRef     ( node->member   , *this );
     1194        maybeMutate_impl   ( node->aggregate, *this );
     1195        maybeMutate_impl   ( node->member   , *this );
    11501196
    11511197        MUTATE_END( Expression, node );
     
    11591205
    11601206        indexerScopedAccept( node->result   , *this );
    1161         maybeAccept        ( node->aggregate, *this );
     1207        maybeAccept_impl   ( node->aggregate, *this );
    11621208
    11631209        VISIT_END( node );
     
    11701216        indexerScopedMutate( node->env      , *this );
    11711217        indexerScopedMutate( node->result   , *this );
    1172         maybeMutateRef     ( node->aggregate, *this );
     1218        maybeMutate_impl   ( node->aggregate, *this );
    11731219
    11741220        MUTATE_END( Expression, node );
     
    12031249
    12041250        indexerScopedAccept( node->result   , *this );
    1205         maybeAccept        ( &node->constant, *this );
     1251        maybeAccept_impl   ( &node->constant, *this );
    12061252
    12071253        VISIT_END( node );
     
    12141260        indexerScopedMutate( node->env   , *this );
    12151261        indexerScopedMutate( node->result, *this );
    1216         node->constant = *maybeMutate( &node->constant, *this );
     1262        Constant * ptr = &node->constant;
     1263        maybeMutate_impl( ptr, *this );
     1264        node->constant = *ptr;
    12171265
    12181266        MUTATE_END( Expression, node );
     
    12271275        indexerScopedAccept( node->result, *this );
    12281276        if ( node->get_isType() ) {
    1229                 maybeAccept( node->type, *this );
     1277                maybeAccept_impl( node->type, *this );
    12301278        } else {
    1231                 maybeAccept( node->expr, *this );
     1279                maybeAccept_impl( node->expr, *this );
    12321280        }
    12331281
     
    12421290        indexerScopedMutate( node->result, *this );
    12431291        if ( node->get_isType() ) {
    1244                 maybeMutateRef( node->type, *this );
     1292                maybeMutate_impl( node->type, *this );
    12451293        } else {
    1246                 maybeMutateRef( node->expr, *this );
     1294                maybeMutate_impl( node->expr, *this );
    12471295        }
    12481296
     
    12581306        indexerScopedAccept( node->result, *this );
    12591307        if ( node->get_isType() ) {
    1260                 maybeAccept( node->type, *this );
     1308                maybeAccept_impl( node->type, *this );
    12611309        } else {
    1262                 maybeAccept( node->expr, *this );
     1310                maybeAccept_impl( node->expr, *this );
    12631311        }
    12641312
     
    12731321        indexerScopedMutate( node->result, *this );
    12741322        if ( node->get_isType() ) {
    1275                 maybeMutateRef( node->type, *this );
     1323                maybeMutate_impl( node->type, *this );
    12761324        } else {
    1277                 maybeMutateRef( node->expr, *this );
     1325                maybeMutate_impl( node->expr, *this );
    12781326        }
    12791327
     
    12881336
    12891337        indexerScopedAccept( node->result, *this );
    1290         maybeAccept        ( node->type  , *this );
     1338        maybeAccept_impl   ( node->type  , *this );
    12911339
    12921340        VISIT_END( node );
     
    12991347        indexerScopedMutate( node->env   , *this );
    13001348        indexerScopedMutate( node->result, *this );
    1301         maybeMutateRef     ( node->type  , *this );
     1349        maybeMutate_impl   ( node->type  , *this );
    13021350
    13031351        MUTATE_END( Expression, node );
     
    13111359
    13121360        indexerScopedAccept( node->result, *this );
    1313         maybeAccept        ( node->type  , *this );
    1314         maybeAccept        ( node->member, *this );
     1361        maybeAccept_impl   ( node->type  , *this );
     1362        maybeAccept_impl   ( node->member, *this );
    13151363
    13161364        VISIT_END( node );
     
    13231371        indexerScopedMutate( node->env   , *this );
    13241372        indexerScopedMutate( node->result, *this );
    1325         maybeMutateRef     ( node->type  , *this );
    1326         maybeMutateRef     ( node->member, *this );
     1373        maybeMutate_impl   ( node->type  , *this );
     1374        maybeMutate_impl   ( node->member, *this );
    13271375
    13281376        MUTATE_END( Expression, node );
     
    13361384
    13371385        indexerScopedAccept( node->result, *this );
    1338         maybeAccept        ( node->type  , *this );
     1386        maybeAccept_impl   ( node->type  , *this );
    13391387
    13401388        VISIT_END( node );
     
    13471395        indexerScopedMutate( node->env   , *this );
    13481396        indexerScopedMutate( node->result, *this );
    1349         maybeMutateRef     ( node->type  , *this );
     1397        maybeMutate_impl   ( node->type  , *this );
    13501398
    13511399        MUTATE_END( Expression, node );
     
    13601408        indexerScopedAccept( node->result, *this );
    13611409        if ( node->get_isType() ) {
    1362                 maybeAccept( node->type, *this );
     1410                maybeAccept_impl( node->type, *this );
    13631411        } else {
    1364                 maybeAccept( node->expr, *this );
     1412                maybeAccept_impl( node->expr, *this );
    13651413        }
    13661414
     
    13751423        indexerScopedMutate( node->result, *this );
    13761424        if ( node->get_isType() ) {
    1377                 maybeMutateRef( node->type, *this );
     1425                maybeMutate_impl( node->type, *this );
    13781426        } else {
    1379                 maybeMutateRef( node->expr, *this );
     1427                maybeMutate_impl( node->expr, *this );
    13801428        }
    13811429
     
    13901438
    13911439        indexerScopedAccept( node->result, *this );
    1392         maybeAccept        ( node->arg1  , *this );
    1393         maybeAccept        ( node->arg2  , *this );
     1440        maybeAccept_impl   ( node->arg1  , *this );
     1441        maybeAccept_impl   ( node->arg2  , *this );
    13941442
    13951443        VISIT_END( node );
     
    14021450        indexerScopedMutate( node->env   , *this );
    14031451        indexerScopedMutate( node->result, *this );
    1404         maybeMutateRef     ( node->arg1  , *this );
    1405         maybeMutateRef     ( node->arg2  , *this );
     1452        maybeMutate_impl   ( node->arg1  , *this );
     1453        maybeMutate_impl   ( node->arg2  , *this );
    14061454
    14071455        MUTATE_END( Expression, node );
     
    14151463
    14161464        indexerScopedAccept( node->result, *this );
    1417         maybeAccept        ( node->arg1  , *this );
    1418         maybeAccept        ( node->arg2  , *this );
    1419         maybeAccept        ( node->arg3  , *this );
     1465        maybeAccept_impl        ( node->arg1  , *this );
     1466        maybeAccept_impl        ( node->arg2  , *this );
     1467        maybeAccept_impl        ( node->arg3  , *this );
    14201468
    14211469        VISIT_END( node );
     
    14281476        indexerScopedMutate( node->env   , *this );
    14291477        indexerScopedMutate( node->result, *this );
    1430         maybeMutateRef     ( node->arg1  , *this );
    1431         maybeMutateRef     ( node->arg2  , *this );
    1432         maybeMutateRef     ( node->arg3  , *this );
     1478        maybeMutate_impl   ( node->arg1  , *this );
     1479        maybeMutate_impl   ( node->arg2  , *this );
     1480        maybeMutate_impl   ( node->arg3  , *this );
    14331481
    14341482        MUTATE_END( Expression, node );
     
    14421490
    14431491        indexerScopedAccept( node->result, *this );
    1444         maybeAccept        ( node->arg1  , *this );
    1445         maybeAccept        ( node->arg2  , *this );
     1492        maybeAccept_impl   ( node->arg1  , *this );
     1493        maybeAccept_impl   ( node->arg2  , *this );
    14461494
    14471495        VISIT_END( node );
     
    14541502        indexerScopedMutate( node->env   , *this );
    14551503        indexerScopedMutate( node->result, *this );
    1456         maybeMutateRef     ( node->arg1  , *this );
    1457         maybeMutateRef     ( node->arg2  , *this );
     1504        maybeMutate_impl   ( node->arg1  , *this );
     1505        maybeMutate_impl   ( node->arg2  , *this );
    14581506
    14591507        MUTATE_END( Expression, node );
     
    14671515
    14681516        indexerScopedAccept( node->result, *this );
    1469         maybeAccept        ( node->type, *this );
     1517        maybeAccept_impl   ( node->type, *this );
    14701518
    14711519        VISIT_END( node );
     
    14781526        indexerScopedMutate( node->env   , *this );
    14791527        indexerScopedMutate( node->result, *this );
    1480         maybeMutateRef     ( node->type  , *this );
     1528        maybeMutate_impl   ( node->type  , *this );
    14811529
    14821530        MUTATE_END( Expression, node );
     
    14901538
    14911539        indexerScopedAccept( node->result    , *this );
    1492         maybeAccept        ( node->inout     , *this );
    1493         maybeAccept        ( node->constraint, *this );
    1494         maybeAccept        ( node->operand   , *this );
     1540        maybeAccept_impl   ( node->inout     , *this );
     1541        maybeAccept_impl   ( node->constraint, *this );
     1542        maybeAccept_impl   ( node->operand   , *this );
    14951543
    14961544        VISIT_END( node );
     
    15031551        indexerScopedMutate( node->env       , *this );
    15041552        indexerScopedMutate( node->result    , *this );
    1505         maybeMutateRef     ( node->inout     , *this );
    1506         maybeMutateRef     ( node->constraint, *this );
    1507         maybeMutateRef     ( node->operand   , *this );
     1553        maybeMutate_impl   ( node->inout     , *this );
     1554        maybeMutate_impl   ( node->constraint, *this );
     1555        maybeMutate_impl   ( node->operand   , *this );
    15081556
    15091557        MUTATE_END( Expression, node );
     
    15171565
    15181566        indexerScopedAccept( node->result     , *this );
    1519         maybeAccept        ( node->callExpr   , *this );
    1520         maybeAccept        ( node->tempDecls  , *this );
    1521         maybeAccept        ( node->returnDecls, *this );
    1522         maybeAccept        ( node->dtors      , *this );
     1567        maybeAccept_impl   ( node->callExpr   , *this );
     1568        maybeAccept_impl   ( node->tempDecls  , *this );
     1569        maybeAccept_impl   ( node->returnDecls, *this );
     1570        maybeAccept_impl   ( node->dtors      , *this );
    15231571
    15241572        VISIT_END( node );
     
    15311579        indexerScopedMutate( node->env        , *this );
    15321580        indexerScopedMutate( node->result     , *this );
    1533         maybeMutateRef     ( node->callExpr   , *this );
    1534         maybeMutateRef     ( node->tempDecls  , *this );
    1535         maybeMutateRef     ( node->returnDecls, *this );
    1536         maybeMutateRef     ( node->dtors      , *this );
     1581        maybeMutate_impl   ( node->callExpr   , *this );
     1582        maybeMutate_impl   ( node->tempDecls  , *this );
     1583        maybeMutate_impl   ( node->returnDecls, *this );
     1584        maybeMutate_impl   ( node->dtors      , *this );
    15371585
    15381586        MUTATE_END( Expression, node );
     
    15461594
    15471595        indexerScopedAccept( node->result  , *this );
    1548         maybeAccept        ( node->callExpr, *this );
     1596        maybeAccept_impl   ( node->callExpr, *this );
    15491597
    15501598        VISIT_END( node );
     
    15571605        indexerScopedMutate( node->env     , *this );
    15581606        indexerScopedMutate( node->result  , *this );
    1559         maybeMutateRef     ( node->callExpr, *this );
     1607        maybeMutate_impl   ( node->callExpr, *this );
    15601608
    15611609        MUTATE_END( Expression, node );
     
    15691617
    15701618        indexerScopedAccept( node->result     , *this );
    1571         maybeAccept        ( node->initializer, *this );
     1619        maybeAccept_impl   ( node->initializer, *this );
    15721620
    15731621        VISIT_END( node );
     
    15801628        indexerScopedMutate( node->env        , *this );
    15811629        indexerScopedMutate( node->result     , *this );
    1582         maybeMutateRef     ( node->initializer, *this );
     1630        maybeMutate_impl     ( node->initializer, *this );
    15831631
    15841632        MUTATE_END( Expression, node );
     
    15921640
    15931641        indexerScopedAccept( node->result, *this );
    1594         maybeAccept        ( node->low   , *this );
    1595         maybeAccept        ( node->high  , *this );
     1642        maybeAccept_impl   ( node->low   , *this );
     1643        maybeAccept_impl   ( node->high  , *this );
    15961644
    15971645        VISIT_END( node );
     
    16041652        indexerScopedMutate( node->env   , *this );
    16051653        indexerScopedMutate( node->result, *this );
    1606         maybeMutateRef     ( node->low   , *this );
    1607         maybeMutateRef     ( node->high  , *this );
     1654        maybeMutate_impl   ( node->low   , *this );
     1655        maybeMutate_impl   ( node->high  , *this );
    16081656
    16091657        MUTATE_END( Expression, node );
     
    16171665
    16181666        indexerScopedAccept( node->result, *this );
    1619         maybeAccept        ( node->exprs , *this );
     1667        maybeAccept_impl   ( node->exprs , *this );
    16201668
    16211669        VISIT_END( node );
     
    16281676        indexerScopedMutate( node->env   , *this );
    16291677        indexerScopedMutate( node->result, *this );
    1630         maybeMutateRef     ( node->exprs , *this );
     1678        maybeMutate_impl   ( node->exprs , *this );
    16311679
    16321680        MUTATE_END( Expression, node );
     
    16401688
    16411689        indexerScopedAccept( node->result, *this );
    1642         maybeAccept          ( node->exprs , *this );
     1690        maybeAccept_impl   ( node->exprs , *this );
    16431691
    16441692        VISIT_END( node );
     
    16511699        indexerScopedMutate( node->env   , *this );
    16521700        indexerScopedMutate( node->result, *this );
    1653         maybeMutateRef     ( node->exprs , *this );
     1701        maybeMutate_impl   ( node->exprs , *this );
    16541702
    16551703        MUTATE_END( Expression, node );
     
    16631711
    16641712        indexerScopedAccept( node->result, *this );
    1665         maybeAccept        ( node->tuple , *this );
     1713        maybeAccept_impl   ( node->tuple , *this );
    16661714
    16671715        VISIT_END( node );
     
    16741722        indexerScopedMutate( node->env   , *this );
    16751723        indexerScopedMutate( node->result, *this );
    1676         maybeMutateRef     ( node->tuple , *this );
     1724        maybeMutate_impl   ( node->tuple , *this );
    16771725
    16781726        MUTATE_END( Expression, node );
     
    16861734
    16871735        indexerScopedAccept( node->result  , *this );
    1688         maybeAccept        ( node->stmtExpr, *this );
     1736        maybeAccept_impl   ( node->stmtExpr, *this );
    16891737
    16901738        VISIT_END( node );
     
    16971745        indexerScopedMutate( node->env     , *this );
    16981746        indexerScopedMutate( node->result  , *this );
    1699         maybeMutateRef     ( node->stmtExpr, *this );
     1747        maybeMutate_impl   ( node->stmtExpr, *this );
    17001748
    17011749        MUTATE_END( Expression, node );
     
    17141762
    17151763        indexerScopedAccept( node->result     , *this );
    1716         maybeAccept        ( node->statements , *this );
    1717         maybeAccept        ( node->returnDecls, *this );
    1718         maybeAccept        ( node->dtors      , *this );
     1764        maybeAccept_impl   ( node->statements , *this );
     1765        maybeAccept_impl   ( node->returnDecls, *this );
     1766        maybeAccept_impl   ( node->dtors      , *this );
    17191767
    17201768        VISIT_END( node );
     
    17311779
    17321780        indexerScopedMutate( node->result     , *this );
    1733         maybeMutateRef     ( node->statements , *this );
    1734         maybeMutateRef     ( node->returnDecls, *this );
    1735         maybeMutateRef     ( node->dtors      , *this );
     1781        maybeMutate_impl   ( node->statements , *this );
     1782        maybeMutate_impl   ( node->returnDecls, *this );
     1783        maybeMutate_impl   ( node->dtors      , *this );
    17361784
    17371785        MUTATE_END( Expression, node );
     
    17451793
    17461794        indexerScopedAccept( node->result, *this );
    1747         maybeAccept        ( node->expr  , *this );
     1795        maybeAccept_impl   ( node->expr  , *this );
    17481796
    17491797        VISIT_END( node );
     
    17561804        indexerScopedMutate( node->env   , *this );
    17571805        indexerScopedMutate( node->result, *this );
    1758         maybeMutateRef     ( node->expr  , *this );
     1806        maybeMutate_impl   ( node->expr  , *this );
    17591807
    17601808        MUTATE_END( Expression, node );
     
    18011849        {
    18021850                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1803                 maybeAccept( node->forall    , *this );
    1804                 maybeAccept( node->parameters, *this );
     1851                maybeAccept_impl( node->forall    , *this );
     1852                maybeAccept_impl( node->parameters, *this );
    18051853        }
    18061854
     
    18161864        {
    18171865                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1818                 maybeMutateRef( node->forall    , *this );
    1819                 maybeMutateRef( node->parameters, *this );
     1866                maybeMutate_impl( node->forall    , *this );
     1867                maybeMutate_impl( node->parameters, *this );
    18201868        }
    18211869
     
    18331881        {
    18341882                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1835                 maybeAccept( node->forall    , *this );
    1836                 maybeAccept( node->parameters, *this );
     1883                maybeAccept_impl( node->forall    , *this );
     1884                maybeAccept_impl( node->parameters, *this );
    18371885        }
    18381886
     
    18481896        {
    18491897                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1850                 maybeMutateRef( node->forall    , *this );
    1851                 maybeMutateRef( node->parameters, *this );
     1898                maybeMutate_impl( node->forall    , *this );
     1899                maybeMutate_impl( node->parameters, *this );
    18521900        }
    18531901
     
    18731921        VISIT_START( node );
    18741922
    1875         maybeAccept( node->forall    , *this );
    1876         maybeAccept( node->parameters, *this );
     1923        maybeAccept_impl( node->forall    , *this );
     1924        maybeAccept_impl( node->parameters, *this );
    18771925
    18781926        VISIT_END( node );
     
    18831931        MUTATE_START( node );
    18841932
    1885         maybeMutateRef( node->forall    , *this );
    1886         maybeMutateRef( node->parameters, *this );
     1933        maybeMutate_impl( node->forall    , *this );
     1934        maybeMutate_impl( node->parameters, *this );
    18871935
    18881936        MUTATE_END( Type, node );
     
    19301978        VISIT_START( node );
    19311979
    1932         maybeAccept( node->get_designators(), *this );
     1980        maybeAccept_impl( node->get_designators(), *this );
    19331981
    19341982        VISIT_END( node );
     
    19391987        MUTATE_START( node );
    19401988
    1941         maybeMutateRef( node->get_designators(), *this );
     1989        maybeMutate_impl( node->get_designators(), *this );
    19421990
    19431991        MUTATE_END( Designation, node );
     
    19812029template< typename pass_type >
    19822030void PassVisitor< pass_type >::visit( Constant * node ) {
     2031        VISIT_BODY( node );
     2032}
     2033
     2034template< typename pass_type >
     2035void PassVisitor< pass_type >::visit( Attribute * node ) {
    19832036        VISIT_BODY( node );
    19842037}
     
    20692122        MUTATE_BODY( Constant, node );
    20702123}
     2124
     2125template< typename pass_type >
     2126Attribute * PassVisitor< pass_type >::mutate( Attribute * node  )  {
     2127        MUTATE_BODY( Attribute, node );
     2128}
     2129
     2130template< typename pass_type >
     2131TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) {
     2132        MUTATE_START( node );
     2133
     2134        for ( auto & p : node->typeEnv ) {
     2135                indexerScopedMutate( p.second, *this );
     2136        }
     2137        for ( auto & p : node->varEnv ) {
     2138                indexerScopedMutate( p.second, *this );
     2139        }
     2140
     2141        MUTATE_END( TypeSubstitution, node );
     2142}
  • src/Common/PassVisitor.proto.h

    r78315272 r3f7e12cb  
    4646        ~bool_ref() = default;
    4747
    48         operator bool() { return *m_ref; }
     48        operator bool() { return m_ref ? *m_ref : true; }
    4949        bool operator=( bool val ) { return *m_ref = val; }
    5050
    5151private:
    5252
    53         template<typename pass>
    54         friend class PassVisitor;
    55 
    56         void set( bool & val ) { m_ref = &val; };
    57 
    58         bool * m_ref;
     53        friend class ChildrenGuard;
     54
     55        bool * set( bool & val ) {
     56                bool * prev = m_ref;
     57                m_ref = &val;
     58                return prev;
     59        }
     60
     61        bool * m_ref = nullptr;
    5962};
    6063
    61 template< typename TreeType, typename VisitorType >
    62 inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) {
    63         auto guard = makeFuncGuard(
    64                 [&visitor]() { visitor.indexerScopeEnter(); },
    65                 [&visitor]() { visitor.indexerScopeLeave(); }
    66         );
    67         maybeAccept( tree, visitor );
    68 }
    69 
    70 template< typename TreeType, typename MutatorType >
    71 inline void indexerScopedMutate( TreeType *& tree, MutatorType & mutator ) {
    72         auto guard = makeFuncGuard(
    73                 [&mutator]() { mutator.indexerScopeEnter(); },
    74                 [&mutator]() { mutator.indexerScopeLeave(); }
    75         );
    76         tree = maybeMutate( tree, mutator );
    77 }
    78 
    79 template< typename TreeType, typename MutatorType >
    80 inline void maybeMutateRef( TreeType *& tree, MutatorType & mutator ) {
    81         tree = maybeMutate( tree, mutator );
    82 }
     64class ChildrenGuard {
     65public:
     66
     67        ChildrenGuard( bool_ref * ref )
     68                : m_val ( true )
     69                , m_prev( ref ? ref->set( m_val ) : nullptr )
     70                , m_ref ( ref )
     71        {}
     72
     73        ~ChildrenGuard() {
     74                if( m_ref ) {
     75                        m_ref->set( *m_prev );
     76                }
     77        }
     78
     79        operator bool() { return m_val; }
     80
     81private:
     82        bool       m_val;
     83        bool     * m_prev;
     84        bool_ref * m_ref;
     85};
    8386
    8487//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  • src/Common/utility.h

    r78315272 r3f7e12cb  
    1818#include <cctype>
    1919#include <algorithm>
     20#include <functional>
    2021#include <iostream>
    2122#include <iterator>
     
    2728
    2829#include <cassert>
     30
     31#include "Common/Indenter.h"
    2932
    3033template< typename T >
     
    7578
    7679template< typename Container >
    77 void printAll( const Container &container, std::ostream &os, int indent = 0 ) {
     80void printAll( const Container &container, std::ostream &os, Indenter indent = {} ) {
    7881        for ( typename Container::const_iterator i = container.begin(); i != container.end(); ++i ) {
    7982                if ( *i ) {
    80                         os << std::string( indent,  ' ' );
    81                         (*i)->print( os, indent + 2 );
     83                        os << indent;
     84                        (*i)->print( os, indent );
    8285                        // need an endl after each element because it's not easy to know when each individual item should end
    8386                        os << std::endl;
     
    351354template< typename T1, typename T2 >
    352355struct group_iterate_t {
     356private:
     357        std::tuple<T1, T2> args;
     358public:
    353359        group_iterate_t( bool skipBoundsCheck, const T1 & v1, const T2 & v2 ) : args(v1, v2) {
    354360                assertf(skipBoundsCheck || v1.size() == v2.size(), "group iteration requires containers of the same size: <%zd, %zd>.", v1.size(), v2.size());
    355361        };
    356362
     363        typedef std::tuple<decltype(*std::get<0>(args).begin()), decltype(*std::get<1>(args).begin())> value_type;
     364        typedef decltype(std::get<0>(args).begin()) T1Iter;
     365        typedef decltype(std::get<1>(args).begin()) T2Iter;
     366
    357367        struct iterator {
    358                 typedef typename std::remove_reference<T1>::type T1val;
    359                 typedef typename std::remove_reference<T2>::type T2val;
    360                 typedef std::tuple<typename T1val::value_type &, typename T2val::value_type &> value_type;
    361                 typedef typename T1val::iterator T1Iter;
    362                 typedef typename T2val::iterator T2Iter;
    363368                typedef std::tuple<T1Iter, T2Iter> IterTuple;
    364369                IterTuple it;
     
    370375                value_type operator*() const { return std::tie( *std::get<0>(it), *std::get<1>(it) ); }
    371376        };
     377
    372378        iterator begin() { return iterator( std::get<0>(args).begin(), std::get<1>(args).begin() ); }
    373379        iterator end() { return iterator( std::get<0>(args).end(), std::get<1>(args).end() ); }
    374 
    375 private:
    376         std::tuple<T1, T2> args;
    377380};
    378381
  • src/Concurrency/Keywords.cc

    r78315272 r3f7e12cb  
    196196                std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* );
    197197                void validate( DeclarationWithType * );
     198                void addDtorStatments( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &);
    198199                void addStatments( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &);
    199200
     
    206207                StructDecl* monitor_decl = nullptr;
    207208                StructDecl* guard_decl = nullptr;
     209                StructDecl* dtor_guard_decl = nullptr;
    208210
    209211                static std::unique_ptr< Type > generic_func;
     
    229231
    230232                void postvisit( FunctionDecl * decl );
     233                void previsit ( StructDecl   * decl );
    231234
    232235                void addStartStatement( FunctionDecl * decl, DeclarationWithType * param );
     
    236239                        acceptAll( translationUnit, impl );
    237240                }
     241
     242          private :
     243                bool thread_ctor_seen = false;
     244                StructDecl * thread_decl = nullptr;
    238245        };
    239246
     
    403410                if( mutexArgs.empty() ) return;
    404411
     412                if( CodeGen::isConstructor(decl->name) ) throw SemanticError( "constructors cannot have mutex parameters", decl );
     413
     414                bool isDtor = CodeGen::isDestructor( decl->name );
     415
     416                if( isDtor && mutexArgs.size() != 1 ) throw SemanticError( "destructors can only have 1 mutex argument", decl );
     417
    405418                for(auto arg : mutexArgs) {
    406419                        validate( arg );
     
    412425                if( !monitor_decl ) throw SemanticError( "mutex keyword requires monitors to be in scope, add #include <monitor>", decl );
    413426                if( !guard_decl ) throw SemanticError( "mutex keyword requires monitors to be in scope, add #include <monitor>", decl );
    414 
    415                 addStatments( decl, body, mutexArgs );
     427                if( !dtor_guard_decl ) throw SemanticError( "mutex keyword requires monitors to be in scope, add #include <monitor>", decl );
     428
     429                if( isDtor ) {
     430                        addDtorStatments( decl, body, mutexArgs );
     431                }
     432                else {
     433                        addStatments( decl, body, mutexArgs );
     434                }
    416435        }
    417436
     
    425444                        assert( !guard_decl );
    426445                        guard_decl = decl;
     446                }
     447                else if( decl->name == "monitor_dtor_guard_t" ) {
     448                        assert( !dtor_guard_decl );
     449                        dtor_guard_decl = decl;
    427450                }
    428451        }
     
    457480                //Make sure that typed isn't mutex
    458481                if( base->get_mutex() ) throw SemanticError( "mutex keyword may only appear once per argument ", arg );
     482        }
     483
     484        void MutexKeyword::addDtorStatments( FunctionDecl* func, CompoundStmt * body, const std::list<DeclarationWithType * > & args ) {
     485                Type * arg_type = args.front()->get_type()->clone();
     486                arg_type->set_mutex( false );
     487
     488                ObjectDecl * monitors = new ObjectDecl(
     489                        "__monitor",
     490                        noStorage,
     491                        LinkageSpec::Cforall,
     492                        nullptr,
     493                        new PointerType(
     494                                noQualifiers,
     495                                new StructInstType(
     496                                        noQualifiers,
     497                                        monitor_decl
     498                                )
     499                        ),
     500                        new SingleInit( new UntypedExpr(
     501                                new NameExpr( "get_monitor" ),
     502                                {  new CastExpr( new VariableExpr( args.front() ), arg_type ) }
     503                        ))
     504                );
     505
     506                assert(generic_func);
     507
     508                //in reverse order :
     509                // monitor_guard_t __guard = { __monitors, #, func };
     510                body->push_front(
     511                        new DeclStmt( noLabels, new ObjectDecl(
     512                                "__guard",
     513                                noStorage,
     514                                LinkageSpec::Cforall,
     515                                nullptr,
     516                                new StructInstType(
     517                                        noQualifiers,
     518                                        dtor_guard_decl
     519                                ),
     520                                new ListInit(
     521                                        {
     522                                                new SingleInit( new AddressExpr( new VariableExpr( monitors ) ) ),
     523                                                new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone() ) )
     524                                        },
     525                                        noDesignators,
     526                                        true
     527                                )
     528                        ))
     529                );
     530
     531                //monitor_desc * __monitors[] = { get_monitor(a), get_monitor(b) };
     532                body->push_front( new DeclStmt( noLabels, monitors) );
    459533        }
    460534
     
    523597        // General entry routine
    524598        //=============================================================================================
     599        void ThreadStarter::previsit( StructDecl * decl ) {
     600                if( decl->name == "thread_desc" && decl->body ) {
     601                        assert( !thread_decl );
     602                        thread_decl = decl;
     603                }
     604        }
     605
    525606        void ThreadStarter::postvisit(FunctionDecl * decl) {
    526607                if( ! CodeGen::isConstructor(decl->name) ) return;
    527608
     609                Type * typeof_this = InitTweak::getTypeofThis(decl->type);
     610                StructInstType * ctored_type = dynamic_cast< StructInstType * >( typeof_this );
     611                if( ctored_type && ctored_type->baseStruct == thread_decl ) {
     612                        thread_ctor_seen = true;
     613                }
     614
    528615                DeclarationWithType * param = decl->get_functionType()->get_parameters().front();
    529616                auto type  = dynamic_cast< StructInstType * >( InitTweak::getPointerBase( param->get_type() ) );
    530                 // if( type ) std::cerr << "FRED2" << std::endl;
    531617                if( type && type->get_baseStruct()->is_thread() ) {
     618                        if( !thread_decl || !thread_ctor_seen ) {
     619                                throw SemanticError("thread keyword requires threads to be in scope, add #include <thread>");
     620                        }
     621
    532622                        addStartStatement( decl, param );
    533623                }
  • src/Concurrency/Waitfor.cc

    r78315272 r3f7e12cb  
    2727#include "InitTweak/InitTweak.h"   // for getPointerBase
    2828#include "Parser/LinkageSpec.h"    // for Cforall
    29 #include "SymTab/AddVisit.h"       // for acceptAndAdd
     29#include "ResolvExpr/Resolver.h"   // for findVoidExpression
    3030#include "SynTree/Constant.h"      // for Constant
    3131#include "SynTree/Declaration.h"   // for StructDecl, FunctionDecl, ObjectDecl
     
    112112        //=============================================================================================
    113113
    114         class GenerateWaitForPass final : public WithStmtsToAdd {
     114        class GenerateWaitForPass final : public WithIndexer {
    115115          public:
    116116
     
    126126
    127127                ObjectDecl * declare( unsigned long count, CompoundStmt * stmt );
     128                ObjectDecl * declareFlag( CompoundStmt * stmt );
     129                Statement  * makeSetter( ObjectDecl * flag );
    128130                ObjectDecl * declMon( WaitForStmt::Clause & clause, CompoundStmt * stmt );
    129                 void         init( ObjectDecl * acceptables, int index, WaitForStmt::Clause & clause, CompoundStmt * stmt );
    130                 Expression * init_timeout( Expression *& time, Expression *& time_cond, bool has_else, Expression *& else_cond, CompoundStmt * stmt );
    131                 Expression * call();
    132                 void choose();
     131                void         init( ObjectDecl * acceptables, int index, WaitForStmt::Clause & clause, Statement * settter, CompoundStmt * stmt );
     132                Expression * init_timeout( Expression *& time, Expression *& time_cond, bool has_else, Expression *& else_cond, Statement * settter, CompoundStmt * stmt );
     133                Expression * call(size_t count, ObjectDecl * acceptables, Expression * timeout, CompoundStmt * stmt);
     134                void         choose( WaitForStmt * waitfor, Expression  * result, CompoundStmt * stmt );
    133135
    134136                static void implement( std::list< Declaration * > & translationUnit ) {
     
    140142          private:
    141143                FunctionDecl        * decl_waitfor    = nullptr;
     144                StructDecl          * decl_mask       = nullptr;
    142145                StructDecl          * decl_acceptable = nullptr;
    143146                StructDecl          * decl_monitor    = nullptr;
    144                 DeclarationWithType * decl_m_func     = nullptr;
    145                 DeclarationWithType * decl_m_count    = nullptr;
    146                 DeclarationWithType * decl_m_monitors = nullptr;
    147                 DeclarationWithType * decl_m_isdtor   = nullptr;
    148147
    149148                static std::unique_ptr< Type > generic_func;
    150149
     150                UniqueName namer_acc = "__acceptables_"s;
     151                UniqueName namer_idx = "__index_"s;
     152                UniqueName namer_flg = "__do_run_"s;
     153                UniqueName namer_msk = "__mask_"s;
    151154                UniqueName namer_mon = "__monitors_"s;
    152                 UniqueName namer_acc = "__acceptables_"s;
    153155                UniqueName namer_tim = "__timeout_"s;
    154156        };
     
    167169        namespace {
    168170                Expression * makeOpIndex( DeclarationWithType * array, unsigned long index ) {
    169                         return new ApplicationExpr(
     171                        return new UntypedExpr(
    170172                                new NameExpr( "?[?]" ),
    171173                                {
     
    177179
    178180                Expression * makeOpAssign( Expression * lhs, Expression * rhs ) {
    179                         return new ApplicationExpr(
     181                        return new UntypedExpr(
    180182                                        new NameExpr( "?=?" ),
    181183                                        { lhs, rhs }
     
    183185                }
    184186
    185                 Expression * makeOpMember( Expression * sue, DeclarationWithType * mem ) {
    186                         return new MemberExpr( mem, sue );
    187                 }
    188 
    189                 Statement * makeAccStatement( DeclarationWithType * object, unsigned long index, DeclarationWithType * member, Expression * value ) {
    190                         return new ExprStmt(
    191                                 noLabels,
    192                                 makeOpAssign(
    193                                         makeOpMember(
    194                                                 makeOpIndex(
    195                                                         object,
    196                                                         index
    197                                                 ),
    198                                                 member
     187                Expression * makeOpMember( Expression * sue, const std::string & mem ) {
     188                        return new UntypedMemberExpr( new NameExpr( mem ), sue );
     189                }
     190
     191                Statement * makeAccStatement( DeclarationWithType * object, unsigned long index, const std::string & member, Expression * value, const SymTab::Indexer & indexer ) {
     192                        Expression * expr = makeOpAssign(
     193                                makeOpMember(
     194                                        makeOpIndex(
     195                                                object,
     196                                                index
    199197                                        ),
    200                                         value
    201                                 )
     198                                        member
     199                                ),
     200                                value
    202201                        );
     202
     203                        ResolvExpr::findVoidExpression( expr, indexer );
     204
     205                        return new ExprStmt( noLabels, expr );
    203206                }
    204207
     
    208211                        return new ConstantExpr( Constant::from_bool( ifnull ) );
    209212                }
     213
     214                VariableExpr * extractVariable( Expression * func ) {
     215                        if( VariableExpr * var = dynamic_cast< VariableExpr * >( func ) ) {
     216                                return var;
     217                        }
     218
     219                        CastExpr * cast = strict_dynamic_cast< CastExpr * >( func );
     220                        return strict_dynamic_cast< VariableExpr * >( cast->arg );
     221                }
     222
     223                Expression * detectIsDtor( Expression * func ) {
     224                        VariableExpr * typed_func = extractVariable( func );
     225                        bool is_dtor = InitTweak::isDestructor( typed_func->var );
     226                        return new ConstantExpr( Constant::from_bool( is_dtor ) );
     227                }
    210228        };
    211229
     
    216234
    217235        void GenerateWaitForPass::premutate( FunctionDecl * decl) {
    218                 if( decl->name != "__accept_internal" ) return;
     236                if( decl->name != "__waitfor_internal" ) return;
    219237
    220238                decl_waitfor = decl;
     
    227245                        assert( !decl_acceptable );
    228246                        decl_acceptable = decl;
    229                         for( Declaration * field : decl_acceptable->members ) {
    230                                      if( field->name == "func"    ) decl_m_func     = strict_dynamic_cast< DeclarationWithType * >( field );
    231                                 else if( field->name == "count"   ) decl_m_count    = strict_dynamic_cast< DeclarationWithType * >( field );
    232                                 else if( field->name == "monitor" ) decl_m_monitors = strict_dynamic_cast< DeclarationWithType * >( field );
    233                                 else if( field->name == "is_dtor" ) decl_m_isdtor   = strict_dynamic_cast< DeclarationWithType * >( field );
    234                         }
    235 
     247                }
     248                else if( decl->name == "__waitfor_mask_t" ) {
     249                        assert( !decl_mask );
     250                        decl_mask = decl;
    236251                }
    237252                else if( decl->name == "monitor_desc" ) {
     
    242257
    243258        Statement * GenerateWaitForPass::postmutate( WaitForStmt * waitfor ) {
    244                 return waitfor;
    245 
    246                 if( !decl_monitor || !decl_acceptable ) throw SemanticError( "waitfor keyword requires monitors to be in scope, add #include <monitor>", waitfor );
     259                if( !decl_monitor || !decl_acceptable || !decl_mask ) throw SemanticError( "waitfor keyword requires monitors to be in scope, add #include <monitor>", waitfor );
    247260
    248261                CompoundStmt * stmt = new CompoundStmt( noLabels );
    249262
    250263                ObjectDecl * acceptables = declare( waitfor->clauses.size(), stmt );
     264                ObjectDecl * flag        = declareFlag( stmt );
     265                Statement  * setter      = makeSetter( flag );
    251266
    252267                int index = 0;
    253268                for( auto & clause : waitfor->clauses ) {
    254                         init( acceptables, index, clause, stmt );
     269                        init( acceptables, index, clause, setter, stmt );
    255270
    256271                        index++;
     
    262277                        waitfor->orelse .statement,
    263278                        waitfor->orelse .condition,
     279                        setter,
    264280                        stmt
    265281                );
    266282
    267                 // Expression * result  = call( acceptables, timeout, orelse, stmt );
    268 
    269                 // choose( waitfor, result );
     283                CompoundStmt * compound = new CompoundStmt( noLabels );
     284                stmt->push_back( new IfStmt(
     285                        noLabels,
     286                        safeCond( new VariableExpr( flag ) ),
     287                        compound,
     288                        nullptr
     289                ));
     290
     291                Expression * result = call( waitfor->clauses.size(), acceptables, timeout, compound );
     292
     293                choose( waitfor, result, compound );
    270294
    271295                return stmt;
     
    274298        ObjectDecl * GenerateWaitForPass::declare( unsigned long count, CompoundStmt * stmt )
    275299        {
    276                 ObjectDecl * acceptables = new ObjectDecl(
     300                ObjectDecl * acceptables = ObjectDecl::newObject(
    277301                        namer_acc.newName(),
    278                         noStorage,
    279                         LinkageSpec::Cforall,
    280                         nullptr,
    281302                        new ArrayType(
    282303                                noQualifiers,
     
    294315                stmt->push_back( new DeclStmt( noLabels, acceptables) );
    295316
     317                Expression * set = new UntypedExpr(
     318                        new NameExpr( "__builtin_memset" ),
     319                        {
     320                                new VariableExpr( acceptables ),
     321                                new ConstantExpr( Constant::from_int( 0 ) ),
     322                                new SizeofExpr( new VariableExpr( acceptables ) )
     323                        }
     324                );
     325
     326                ResolvExpr::findVoidExpression( set, indexer );
     327
     328                stmt->push_back( new ExprStmt( noLabels, set ) );
     329
    296330                return acceptables;
    297331        }
    298332
     333        ObjectDecl * GenerateWaitForPass::declareFlag( CompoundStmt * stmt ) {
     334                ObjectDecl * flag = ObjectDecl::newObject(
     335                        namer_flg.newName(),
     336                        new BasicType(
     337                                noQualifiers,
     338                                BasicType::Bool
     339                        ),
     340                        new SingleInit( new ConstantExpr( Constant::from_ulong( 0 ) ) )
     341                );
     342
     343                stmt->push_back( new DeclStmt( noLabels, flag) );
     344
     345                return flag;
     346        }
     347
     348        Statement * GenerateWaitForPass::makeSetter( ObjectDecl * flag ) {
     349                Expression * expr = new UntypedExpr(
     350                        new NameExpr( "?=?" ),
     351                        {
     352                                new VariableExpr( flag ),
     353                                new ConstantExpr( Constant::from_ulong( 1 ) )
     354                        }
     355                );
     356
     357                ResolvExpr::findVoidExpression( expr, indexer );
     358
     359                return new ExprStmt( noLabels, expr );
     360        }
     361
    299362        ObjectDecl * GenerateWaitForPass::declMon( WaitForStmt::Clause & clause, CompoundStmt * stmt ) {
    300363
    301                 ObjectDecl * mon = new ObjectDecl(
     364                ObjectDecl * mon = ObjectDecl::newObject(
    302365                        namer_mon.newName(),
    303                         noStorage,
    304                         LinkageSpec::Cforall,
    305                         nullptr,
    306366                        new ArrayType(
    307367                                noQualifiers,
    308                                 new StructInstType(
     368                                new PointerType(
    309369                                        noQualifiers,
    310                                         decl_monitor
     370                                        new StructInstType(
     371                                                noQualifiers,
     372                                                decl_monitor
     373                                        )
    311374                                ),
    312375                                new ConstantExpr( Constant::from_ulong( clause.target.arguments.size() ) ),
     
    316379                        new ListInit(
    317380                                map_range < std::list<Initializer*> > ( clause.target.arguments, [this](Expression * expr ){
    318                                         return new SingleInit( expr );
     381                                        Expression * init = new CastExpr(
     382                                                new UntypedExpr(
     383                                                        new NameExpr( "get_monitor" ),
     384                                                        { expr }
     385                                                ),
     386                                                new PointerType(
     387                                                        noQualifiers,
     388                                                        new StructInstType(
     389                                                                noQualifiers,
     390                                                                decl_monitor
     391                                                        )
     392                                                )
     393                                        );
     394
     395                                        ResolvExpr::findSingleExpression( init, indexer );
     396                                        return new SingleInit( init );
    319397                                })
    320398                        )
     
    326404        }
    327405
    328         void GenerateWaitForPass::init( ObjectDecl * acceptables, int index, WaitForStmt::Clause & clause, CompoundStmt * stmt ) {
     406        void GenerateWaitForPass::init( ObjectDecl * acceptables, int index, WaitForStmt::Clause & clause, Statement * setter, CompoundStmt * stmt ) {
    329407
    330408                ObjectDecl * monitors = declMon( clause, stmt );
    331409
    332                 CompoundStmt * compound = new CompoundStmt( noLabels );
    333                 compound->push_back( makeAccStatement( acceptables, index, decl_m_func    , clause.target.function ) );
    334                 compound->push_back( makeAccStatement( acceptables, index, decl_m_count   , new ConstantExpr( Constant::from_ulong( clause.target.arguments.size() ) ) ) );
    335                 compound->push_back( makeAccStatement( acceptables, index, decl_m_monitors, new VariableExpr( monitors ) ) );
    336                 compound->push_back( makeAccStatement( acceptables, index, decl_m_isdtor  , new ConstantExpr( Constant::from_bool( true ) ) ) );
     410                Type * fptr_t = new PointerType( noQualifiers, new FunctionType( noQualifiers, true ) );
    337411
    338412                stmt->push_back( new IfStmt(
    339413                        noLabels,
    340414                        safeCond( clause.condition ),
    341                         compound,
     415                        new CompoundStmt({
     416                                makeAccStatement( acceptables, index, "is_dtor", detectIsDtor( clause.target.function )                                    , indexer ),
     417                                makeAccStatement( acceptables, index, "func"   , new CastExpr( clause.target.function, fptr_t )                            , indexer ),
     418                                makeAccStatement( acceptables, index, "list"   , new VariableExpr( monitors )                                              , indexer ),
     419                                makeAccStatement( acceptables, index, "size"   , new ConstantExpr( Constant::from_ulong( clause.target.arguments.size() ) ), indexer ),
     420                                setter->clone()
     421                        }),
    342422                        nullptr
    343423                ));
     
    353433                bool has_else,
    354434                Expression *& else_cond,
     435                Statement * setter,
    355436                CompoundStmt * stmt
    356437        ) {
    357                 ObjectDecl * timeout = new ObjectDecl(
     438                ObjectDecl * timeout = ObjectDecl::newObject(
    358439                        namer_tim.newName(),
    359                         noStorage,
    360                         LinkageSpec::Cforall,
    361                         nullptr,
    362440                        new BasicType(
    363441                                noQualifiers,
     
    374452                        stmt->push_back( new IfStmt(
    375453                                noLabels,
    376                                 safeCond( else_cond ),
    377                                 new ExprStmt(
    378                                         noLabels,
    379                                         makeOpAssign(
    380                                                 new VariableExpr( timeout ),
    381                                                 time
    382                                         )
    383                                 ),
     454                                safeCond( time_cond ),
     455                                new CompoundStmt({
     456                                        new ExprStmt(
     457                                                noLabels,
     458                                                makeOpAssign(
     459                                                        new VariableExpr( timeout ),
     460                                                        time
     461                                                )
     462                                        ),
     463                                        setter->clone()
     464                                }),
    384465                                nullptr
    385466                        ));
     
    392473                                noLabels,
    393474                                safeCond( else_cond ),
    394                                 new ExprStmt(
    395                                         noLabels,
    396                                         makeOpAssign(
    397                                                 new VariableExpr( timeout ),
    398                                                 new ConstantExpr( Constant::from_ulong( 0 ) )
    399                                         )
    400                                 ),
     475                                new CompoundStmt({
     476                                        new ExprStmt(
     477                                                noLabels,
     478                                                makeOpAssign(
     479                                                        new VariableExpr( timeout ),
     480                                                        new ConstantExpr( Constant::from_ulong( 0 ) )
     481                                                )
     482                                        ),
     483                                        setter->clone()
     484                                }),
    401485                                nullptr
    402486                        ));
     
    405489                }
    406490
     491                delete setter;
     492
    407493                return new VariableExpr( timeout );
     494        }
     495
     496        Expression * GenerateWaitForPass::call(
     497                size_t count,
     498                ObjectDecl * acceptables,
     499                Expression * timeout,
     500                CompoundStmt * stmt
     501        ) {
     502                ObjectDecl * index = ObjectDecl::newObject(
     503                        namer_idx.newName(),
     504                        new BasicType(
     505                                noQualifiers,
     506                                BasicType::ShortSignedInt
     507                        ),
     508                        new SingleInit(
     509                                new ConstantExpr( Constant::from_int( -1 ) )
     510                        )
     511                );
     512
     513                stmt->push_back( new DeclStmt( noLabels, index ) );
     514
     515                ObjectDecl * mask = ObjectDecl::newObject(
     516                        namer_msk.newName(),
     517                        new StructInstType(
     518                                noQualifiers,
     519                                decl_mask
     520                        ),
     521                        new ListInit({
     522                                new SingleInit( new AddressExpr( new VariableExpr( index ) ) ),
     523                                new SingleInit( new VariableExpr( acceptables ) ),
     524                                new SingleInit( new ConstantExpr( Constant::from_ulong( count ) ) )
     525                        })
     526                );
     527
     528                stmt->push_back( new DeclStmt( noLabels, mask ) );
     529
     530                stmt->push_back( new ExprStmt(
     531                        noLabels,
     532                        new ApplicationExpr(
     533                                VariableExpr::functionPointer( decl_waitfor ),
     534                                {
     535                                        new CastExpr(
     536                                                new VariableExpr( mask ),
     537                                                new ReferenceType(
     538                                                        noQualifiers,
     539                                                        new StructInstType(
     540                                                                noQualifiers,
     541                                                                decl_mask
     542                                                        )
     543                                                )
     544                                        ),
     545                                        timeout
     546                                }
     547                        )
     548                ));
     549
     550                return new VariableExpr( index );
     551        }
     552
     553        void GenerateWaitForPass::choose(
     554                WaitForStmt * waitfor,
     555                Expression  * result,
     556                CompoundStmt * stmt
     557        ) {
     558                SwitchStmt * swtch = new SwitchStmt(
     559                        noLabels,
     560                        result,
     561                        std::list<Statement *>()
     562                );
     563
     564                unsigned long i = 0;
     565                for( auto & clause : waitfor->clauses ) {
     566                        swtch->statements.push_back(
     567                                new CaseStmt(
     568                                        noLabels,
     569                                        new ConstantExpr( Constant::from_ulong( i++ ) ),
     570                                        {
     571                                                clause.statement,
     572                                                new BranchStmt(
     573                                                        noLabels,
     574                                                        "",
     575                                                        BranchStmt::Break
     576                                                )
     577                                        }
     578                                )
     579                        );
     580                }
     581
     582                if(waitfor->timeout.statement) {
     583                        swtch->statements.push_back(
     584                                new CaseStmt(
     585                                        noLabels,
     586                                        new ConstantExpr( Constant::from_int( -2 ) ),
     587                                        {
     588                                                waitfor->timeout.statement,
     589                                                new BranchStmt(
     590                                                        noLabels,
     591                                                        "",
     592                                                        BranchStmt::Break
     593                                                )
     594                                        }
     595                                )
     596                        );
     597                }
     598
     599                if(waitfor->orelse.statement) {
     600                        swtch->statements.push_back(
     601                                new CaseStmt(
     602                                        noLabels,
     603                                        new ConstantExpr( Constant::from_int( -1 ) ),
     604                                        {
     605                                                waitfor->orelse.statement,
     606                                                new BranchStmt(
     607                                                        noLabels,
     608                                                        "",
     609                                                        BranchStmt::Break
     610                                                )
     611                                        }
     612                                )
     613                        );
     614                }
     615
     616                stmt->push_back( swtch );
    408617        }
    409618};
  • src/GenPoly/Box.cc

    r78315272 r3f7e12cb  
    3232#include "Common/UniqueName.h"           // for UniqueName
    3333#include "Common/utility.h"              // for toString
    34 #include "DeclMutator.h"                 // for DeclMutator
    3534#include "FindFunction.h"                // for findFunction, findAndReplace...
    3635#include "GenPoly/ErasableScopedMap.h"   // for ErasableScopedMap<>::const_i...
     
    3938#include "Lvalue.h"                      // for generalizedLvalue
    4039#include "Parser/LinkageSpec.h"          // for C, Spec, Cforall, Intrinsic
    41 #include "PolyMutator.h"                 // for PolyMutator
    4240#include "ResolvExpr/TypeEnvironment.h"  // for EqvClass
    4341#include "ResolvExpr/typeops.h"          // for typesCompatible
     
    6260                FunctionType *makeAdapterType( FunctionType *adaptee, const TyVarMap &tyVars );
    6361
     62                class BoxPass {
     63                protected:
     64                        BoxPass() : scopeTyVars( TypeDecl::Data{} ) {}
     65                        TyVarMap scopeTyVars;
     66                };
     67
    6468                /// Adds layout-generation functions to polymorphic types
    65                 class LayoutFunctionBuilder final : public DeclMutator {
    66                         unsigned int functionNesting;  // current level of nested functions
     69                class LayoutFunctionBuilder final : public WithDeclsToAdd, public WithVisitorRef<LayoutFunctionBuilder>, public WithShortCircuiting {
     70                        unsigned int functionNesting = 0;  // current level of nested functions
    6771                public:
    68                         LayoutFunctionBuilder() : functionNesting( 0 ) {}
    69 
    70                         using DeclMutator::mutate;
    71                         virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override;
    72                         virtual Declaration *mutate( StructDecl *structDecl ) override;
    73                         virtual Declaration *mutate( UnionDecl *unionDecl ) override;
     72                        void previsit( FunctionDecl *functionDecl );
     73                        void previsit( StructDecl *structDecl );
     74                        void previsit( UnionDecl *unionDecl );
    7475                };
    7576
    7677                /// Replaces polymorphic return types with out-parameters, replaces calls to polymorphic functions with adapter calls as needed, and adds appropriate type variables to the function call
    77                 class Pass1 final : public PolyMutator {
     78                class Pass1 final : public BoxPass, public WithTypeSubstitution, public WithStmtsToAdd, public WithGuards, public WithVisitorRef<Pass1>, public WithShortCircuiting {
    7879                  public:
    7980                        Pass1();
    8081
    81                         using PolyMutator::mutate;
    82                         virtual Expression *mutate( ApplicationExpr *appExpr ) override;
    83                         virtual Expression *mutate( AddressExpr *addrExpr ) override;
    84                         virtual Expression *mutate( UntypedExpr *expr ) override;
    85                         virtual DeclarationWithType* mutate( FunctionDecl *functionDecl ) override;
    86                         virtual TypeDecl *mutate( TypeDecl *typeDecl ) override;
    87                         virtual Expression *mutate( CommaExpr *commaExpr ) override;
    88                         virtual Expression *mutate( ConditionalExpr *condExpr ) override;
    89                         virtual Statement * mutate( ReturnStmt *returnStmt ) override;
    90                         virtual Type *mutate( PointerType *pointerType ) override;
    91                         virtual Type * mutate( FunctionType *functionType ) override;
    92 
    93                         virtual void doBeginScope() override;
    94                         virtual void doEndScope() override;
     82                        void premutate( FunctionDecl * functionDecl );
     83                        void premutate( TypeDecl * typeDecl );
     84                        void premutate( CommaExpr * commaExpr );
     85                        Expression * postmutate( ApplicationExpr * appExpr );
     86                        Expression * postmutate( UntypedExpr *expr );
     87                        void premutate( AddressExpr * addrExpr );
     88                        Expression * postmutate( AddressExpr * addrExpr );
     89                        void premutate( ReturnStmt * returnStmt );
     90                        void premutate( PointerType * pointerType );
     91                        void premutate( FunctionType * functionType );
     92
     93                        void beginScope();
     94                        void endScope();
    9595                  private:
    9696                        /// Pass the extra type parameters from polymorphic generic arguments or return types into a function application
     
    129129                /// * Moves polymorphic returns in function types to pointer-type parameters
    130130                /// * adds type size and assertion parameters to parameter lists
    131                 class Pass2 final : public PolyMutator {
    132                   public:
    133                         template< typename DeclClass >
    134                         DeclClass *handleDecl( DeclClass *decl );
    135                         template< typename AggDecl >
    136                         AggDecl * handleAggDecl( AggDecl * aggDecl );
    137 
    138                         typedef PolyMutator Parent;
    139                         using Parent::mutate;
    140                         virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override;
    141                         virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override;
    142                         virtual StructDecl *mutate( StructDecl *structDecl ) override;
    143                         virtual UnionDecl *mutate( UnionDecl *unionDecl ) override;
    144                         virtual TraitDecl *mutate( TraitDecl *unionDecl ) override;
    145                         virtual TypeDecl *mutate( TypeDecl *typeDecl ) override;
    146                         virtual TypedefDecl *mutate( TypedefDecl *typedefDecl ) override;
    147                         virtual Type *mutate( PointerType *pointerType ) override;
    148                         virtual Type *mutate( FunctionType *funcType ) override;
     131                struct Pass2 final : public BoxPass, public WithGuards {
     132                        void handleAggDecl();
     133
     134                        DeclarationWithType * postmutate( FunctionDecl *functionDecl );
     135                        void premutate( StructDecl *structDecl );
     136                        void premutate( UnionDecl *unionDecl );
     137                        void premutate( TraitDecl *unionDecl );
     138                        void premutate( TypeDecl *typeDecl );
     139                        void premutate( PointerType *pointerType );
     140                        void premutate( FunctionType *funcType );
    149141
    150142                  private:
     
    158150                /// * Calculates polymorphic offsetof expressions from offset array
    159151                /// * Inserts dynamic calculation of polymorphic type layouts where needed
    160                 class PolyGenericCalculator final : public WithGuards, public WithVisitorRef<PolyGenericCalculator>, public WithStmtsToAdd, public WithDeclsToAdd, public WithTypeSubstitution {
     152                class PolyGenericCalculator final : public BoxPass, public WithGuards, public WithVisitorRef<PolyGenericCalculator>, public WithStmtsToAdd, public WithDeclsToAdd, public WithTypeSubstitution {
    161153                public:
    162154                        PolyGenericCalculator();
     
    197189                        ScopedSet< std::string > knownOffsets;          ///< Set of non-generic types for which the offset array exists in the current scope, indexed by offsetofName
    198190                        UniqueName bufNamer;                           ///< Namer for VLA buffers
    199                         TyVarMap scopeTyVars;
    200191                };
    201192
    202193                /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, sizeof expressions of polymorphic types with the proper variable, and strips fields from generic struct declarations.
    203                 class Pass3 final : public PolyMutator {
    204                   public:
     194                struct Pass3 final : public BoxPass, public WithGuards {
    205195                        template< typename DeclClass >
    206                         DeclClass *handleDecl( DeclClass *decl, Type *type );
    207 
    208                         using PolyMutator::mutate;
    209                         virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override;
    210                         virtual Declaration *mutate( StructDecl *structDecl ) override;
    211                         virtual Declaration *mutate( UnionDecl *unionDecl ) override;
    212                         virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override;
    213                         virtual TypedefDecl *mutate( TypedefDecl *objectDecl ) override;
    214                         virtual TypeDecl *mutate( TypeDecl *objectDecl ) override;
    215                         virtual Type *mutate( PointerType *pointerType ) override;
    216                         virtual Type *mutate( FunctionType *funcType ) override;
    217                   private:
     196                        void handleDecl( DeclClass * decl, Type * type );
     197
     198                        void premutate( ObjectDecl * objectDecl );
     199                        void premutate( FunctionDecl * functionDecl );
     200                        void premutate( TypedefDecl * typedefDecl );
     201                        void premutate( StructDecl * structDecl );
     202                        void premutate( UnionDecl * unionDecl );
     203                        void premutate( TypeDecl * typeDecl );
     204                        void premutate( PointerType * pointerType );
     205                        void premutate( FunctionType * funcType );
    218206                };
    219207        } // anonymous namespace
     
    247235
    248236        void box( std::list< Declaration *>& translationUnit ) {
    249                 LayoutFunctionBuilder layoutBuilder;
    250                 Pass1 pass1;
    251                 Pass2 pass2;
     237                PassVisitor<LayoutFunctionBuilder> layoutBuilder;
     238                PassVisitor<Pass1> pass1;
     239                PassVisitor<Pass2> pass2;
    252240                PassVisitor<PolyGenericCalculator> polyCalculator;
    253                 Pass3 pass3;
    254 
    255                 layoutBuilder.mutateDeclarationList( translationUnit );
    256                 mutateTranslationUnit/*All*/( translationUnit, pass1 );
    257                 mutateTranslationUnit/*All*/( translationUnit, pass2 );
     241                PassVisitor<Pass3> pass3;
     242
     243                acceptAll( translationUnit, layoutBuilder );
     244                mutateAll( translationUnit, pass1 );
     245                mutateAll( translationUnit, pass2 );
    258246                mutateAll( translationUnit, polyCalculator );
    259                 mutateTranslationUnit/*All*/( translationUnit, pass3 );
     247                mutateAll( translationUnit, pass3 );
    260248        }
    261249
    262250        ////////////////////////////////// LayoutFunctionBuilder ////////////////////////////////////////////
    263251
    264         DeclarationWithType *LayoutFunctionBuilder::mutate( FunctionDecl *functionDecl ) {
    265                 functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) );
     252        void LayoutFunctionBuilder::previsit( FunctionDecl *functionDecl ) {
     253                visit_children = false;
     254                maybeAccept( functionDecl->get_functionType(), *visitor );
    266255                ++functionNesting;
    267                 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
     256                maybeAccept( functionDecl->get_statements(), *visitor );
    268257                --functionNesting;
    269                 return functionDecl;
    270258        }
    271259
     
    356344        }
    357345
    358         Declaration *LayoutFunctionBuilder::mutate( StructDecl *structDecl ) {
     346        void LayoutFunctionBuilder::previsit( StructDecl *structDecl ) {
    359347                // do not generate layout function for "empty" tag structs
    360                 if ( structDecl->get_members().empty() ) return structDecl;
     348                visit_children = false;
     349                if ( structDecl->get_members().empty() ) return;
    361350
    362351                // get parameters that can change layout, exiting early if none
    363352                std::list< TypeDecl* > otypeParams = takeOtypeOnly( structDecl->get_parameters() );
    364                 if ( otypeParams.empty() ) return structDecl;
     353                if ( otypeParams.empty() ) return;
    365354
    366355                // build layout function signature
     
    413402                addStmt( layoutDecl->get_statements(), makeAlignTo( derefVar( sizeParam ), derefVar( alignParam ) ) );
    414403
    415                 addDeclarationAfter( layoutDecl );
    416                 return structDecl;
     404                declsToAddAfter.push_back( layoutDecl );
    417405        }
    418406
    419         Declaration *LayoutFunctionBuilder::mutate( UnionDecl *unionDecl ) {
     407        void LayoutFunctionBuilder::previsit( UnionDecl *unionDecl ) {
    420408                // do not generate layout function for "empty" tag unions
    421                 if ( unionDecl->get_members().empty() ) return unionDecl;
     409                visit_children = false;
     410                if ( unionDecl->get_members().empty() ) return;
    422411
    423412                // get parameters that can change layout, exiting early if none
    424413                std::list< TypeDecl* > otypeParams = takeOtypeOnly( unionDecl->get_parameters() );
    425                 if ( otypeParams.empty() ) return unionDecl;
     414                if ( otypeParams.empty() ) return;
    426415
    427416                // build layout function signature
     
    456445                addStmt( layoutDecl->get_statements(), makeAlignTo( derefVar( sizeParam ), derefVar( alignParam ) ) );
    457446
    458                 addDeclarationAfter( layoutDecl );
    459                 return unionDecl;
     447                declsToAddAfter.push_back( layoutDecl );
    460448        }
    461449
     
    501489                Pass1::Pass1() : tempNamer( "_temp" ) {}
    502490
    503                 DeclarationWithType *Pass1::mutate( FunctionDecl *functionDecl ) {
     491                void Pass1::premutate( FunctionDecl *functionDecl ) {
    504492                        if ( functionDecl->get_statements() ) {         // empty routine body ?
    505493                                // std::cerr << "mutating function: " << functionDecl->get_mangleName() << std::endl;
    506                                 doBeginScope();
    507                                 scopeTyVars.beginScope();
    508 
    509                                 DeclarationWithType *oldRetval = retval;
     494                                GuardScope( scopeTyVars );
     495                                GuardValue( retval );
    510496
    511497                                // process polymorphic return value
    512498                                retval = nullptr;
    513                                 if ( isDynRet( functionDecl->get_functionType() ) && functionDecl->get_linkage() != LinkageSpec::C ) {
    514                                         retval = functionDecl->get_functionType()->get_returnVals().front();
     499                                FunctionType *functionType = functionDecl->type;
     500                                if ( isDynRet( functionType ) && functionDecl->linkage != LinkageSpec::C ) {
     501                                        retval = functionType->returnVals.front();
    515502
    516503                                        // give names to unnamed return values
    517                                         if ( retval->get_name() == "" ) {
    518                                                 retval->set_name( "_retparm" );
    519                                                 retval->set_linkage( LinkageSpec::C );
     504                                        if ( retval->name == "" ) {
     505                                                retval->name = "_retparm";
     506                                                retval->linkage = LinkageSpec::C;
    520507                                        } // if
    521508                                } // if
    522509
    523                                 FunctionType *functionType = functionDecl->get_functionType();
    524                                 makeTyVarMap( functionDecl->get_functionType(), scopeTyVars );
    525 
    526                                 std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
     510                                makeTyVarMap( functionType, scopeTyVars );
     511
     512                                std::list< DeclarationWithType *> &paramList = functionType->parameters;
    527513                                std::list< FunctionType *> functions;
    528                                 for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    529                                         for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
     514                                for ( Type::ForallList::iterator tyVar = functionType->forall.begin(); tyVar != functionType->forall.end(); ++tyVar ) {
     515                                        for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->assertions.begin(); assert != (*tyVar)->assertions.end(); ++assert ) {
    530516                                                findFunction( (*assert)->get_type(), functions, scopeTyVars, needsAdapter );
    531517                                        } // for
     
    542528                                        } // if
    543529                                } // for
    544 
    545                                 functionDecl->set_statements( functionDecl->get_statements()->acceptMutator( *this ) );
    546 
    547                                 scopeTyVars.endScope();
    548                                 retval = oldRetval;
    549                                 doEndScope();
    550530                                // std::cerr << "end function: " << functionDecl->get_mangleName() << std::endl;
    551531                        } // if
    552                         return functionDecl;
    553                 }
    554 
    555                 TypeDecl *Pass1::mutate( TypeDecl *typeDecl ) {
     532                }
     533
     534                void Pass1::premutate( TypeDecl *typeDecl ) {
    556535                        addToTyVarMap( typeDecl, scopeTyVars );
    557                         return dynamic_cast<TypeDecl*>( Mutator::mutate( typeDecl ) );
    558                 }
    559 
    560                 Expression *Pass1::mutate( CommaExpr *commaExpr ) {
     536                }
     537
     538                void Pass1::premutate( CommaExpr *commaExpr ) {
    561539                        // Attempting to find application expressions that were mutated by the copy constructor passes
    562540                        // to use an explicit return variable, so that the variable can be reused as a parameter to the
     
    574552                                }
    575553                        }
    576 
    577                         commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) );
    578                         commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) );
    579                         return commaExpr;
    580                 }
    581 
    582                 Expression *Pass1::mutate( ConditionalExpr *condExpr ) {
    583                         condExpr->set_arg1( maybeMutate( condExpr->get_arg1(), *this ) );
    584                         condExpr->set_arg2( maybeMutate( condExpr->get_arg2(), *this ) );
    585                         condExpr->set_arg3( maybeMutate( condExpr->get_arg3(), *this ) );
    586                         return condExpr;
    587 
    588554                }
    589555
     
    634600
    635601                        // add size/align for generic types to parameter list
    636                         if ( ! appExpr->get_function()->has_result() ) return;
     602                        if ( ! appExpr->get_function()->result ) return;
    637603                        FunctionType *funcType = getFunctionType( appExpr->get_function()->get_result() );
    638604                        assert( funcType );
     
    659625                ObjectDecl *Pass1::makeTemporary( Type *type ) {
    660626                        ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, type, 0 );
    661                         stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
     627                        stmtsToAddBefore.push_back( new DeclStmt( noLabels, newObj ) );
    662628                        return newObj;
    663629                }
     
    748714
    749715                void Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars ) {
    750                         assertf( arg->has_result(), "arg does not have result: %s", toString( arg ).c_str() );
    751                         if ( isPolyType( param, exprTyVars ) ) {
    752                                 Type * newType = arg->get_result()->clone();
     716                        assertf( arg->result, "arg does not have result: %s", toString( arg ).c_str() );
     717                        if ( ! needsBoxing( param, arg->result, exprTyVars, env ) ) return;
     718
     719                        if ( arg->result->get_lvalue() ) {
     720                                // argument expression may be CFA lvalue, but not C lvalue -- apply generalizedLvalue transformations.
     721                                // if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( arg ) ) {
     722                                //      if ( dynamic_cast<ArrayType *>( varExpr->var->get_type() ) ){
     723                                //              // temporary hack - don't box arrays, because &arr is not the same as &arr[0]
     724                                //              return;
     725                                //      }
     726                                // }
     727                                arg =  generalizedLvalue( new AddressExpr( arg ) );
     728                                if ( ! ResolvExpr::typesCompatible( param, arg->get_result(), SymTab::Indexer() ) ) {
     729                                        // silence warnings by casting boxed parameters when the actual type does not match up with the formal type.
     730                                        arg = new CastExpr( arg, param->clone() );
     731                                }
     732                        } else {
     733                                // use type computed in unification to declare boxed variables
     734                                Type * newType = param->clone();
    753735                                if ( env ) env->apply( newType );
    754                                 std::unique_ptr<Type> manager( newType );
    755                                 if ( isPolyType( newType ) ) {
    756                                         // if the argument's type is polymorphic, we don't need to box again!
    757                                         return;
    758                                 } else if ( arg->get_result()->get_lvalue() ) {
    759                                         // argument expression may be CFA lvalue, but not C lvalue -- apply generalizedLvalue transformations.
    760                                         // if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( arg ) ) {
    761                                         //      if ( dynamic_cast<ArrayType *>( varExpr->var->get_type() ) ){
    762                                         //              // temporary hack - don't box arrays, because &arr is not the same as &arr[0]
    763                                         //              return;
    764                                         //      }
    765                                         // }
    766                                         arg =  generalizedLvalue( new AddressExpr( arg ) );
    767                                         if ( ! ResolvExpr::typesCompatible( param, arg->get_result(), SymTab::Indexer() ) ) {
    768                                                 // silence warnings by casting boxed parameters when the actual type does not match up with the formal type.
    769                                                 arg = new CastExpr( arg, param->clone() );
    770                                         }
    771                                 } else {
    772                                         // use type computed in unification to declare boxed variables
    773                                         Type * newType = param->clone();
    774                                         if ( env ) env->apply( newType );
    775                                         ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, newType, 0 );
    776                                         newObj->get_type()->get_qualifiers() = Type::Qualifiers(); // TODO: is this right???
    777                                         stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
    778                                         UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) ); // TODO: why doesn't this just use initialization syntax?
    779                                         assign->get_args().push_back( new VariableExpr( newObj ) );
    780                                         assign->get_args().push_back( arg );
    781                                         stmtsToAdd.push_back( new ExprStmt( noLabels, assign ) );
    782                                         arg = new AddressExpr( new VariableExpr( newObj ) );
    783                                 } // if
     736                                ObjectDecl *newObj = ObjectDecl::newObject( tempNamer.newName(), newType, nullptr );
     737                                newObj->get_type()->get_qualifiers() = Type::Qualifiers(); // TODO: is this right???
     738                                stmtsToAddBefore.push_back( new DeclStmt( noLabels, newObj ) );
     739                                UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) ); // TODO: why doesn't this just use initialization syntax?
     740                                assign->get_args().push_back( new VariableExpr( newObj ) );
     741                                assign->get_args().push_back( arg );
     742                                stmtsToAddBefore.push_back( new ExprStmt( noLabels, assign ) );
     743                                arg = new AddressExpr( new VariableExpr( newObj ) );
    784744                        } // if
     745                }
     746
     747                // find instances of polymorphic type parameters
     748                struct PolyFinder {
     749                        const TyVarMap * tyVars = nullptr;
     750                        bool found = false;
     751
     752                        void previsit( TypeInstType * t ) {
     753                                if ( isPolyType( t, *tyVars ) ) {
     754                                        found = true;
     755                                }
     756                        }
     757                };
     758
     759                // true if there is an instance of a polymorphic type parameter in t
     760                bool hasPolymorphism( Type * t, const TyVarMap &tyVars ) {
     761                        PassVisitor<PolyFinder> finder;
     762                        finder.pass.tyVars = &tyVars;
     763                        maybeAccept( t, finder );
     764                        return finder.pass.found;
    785765                }
    786766
     
    789769                /// this gets rid of warnings from gcc.
    790770                void addCast( Expression *&actual, Type *formal, const TyVarMap &tyVars ) {
    791                         if ( getFunctionType( formal ) ) {
     771                        // type contains polymorphism, but isn't exactly a polytype, in which case it
     772                        // has some real actual type (e.g. unsigned int) and casting to void * is wrong
     773                        if ( hasPolymorphism( formal, tyVars ) && ! isPolyType( formal, tyVars ) ) {
    792774                                Type * newType = formal->clone();
    793775                                newType = ScrubTyVars::scrub( newType, tyVars );
     
    797779
    798780                void Pass1::boxParams( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ) {
    799                         for ( std::list< DeclarationWithType *>::const_iterator param = function->get_parameters().begin(); param != function->get_parameters().end(); ++param, ++arg ) {
    800                                 assertf( arg != appExpr->get_args().end(), "boxParams: missing argument for param %s to %s in %s", toString( *param ).c_str(), toString( function ).c_str(), toString( appExpr ).c_str() );
     781                        for ( std::list< DeclarationWithType *>::const_iterator param = function->get_parameters().begin(); param != function->parameters.end(); ++param, ++arg ) {
     782                                assertf( arg != appExpr->args.end(), "boxParams: missing argument for param %s to %s in %s", toString( *param ).c_str(), toString( function ).c_str(), toString( appExpr ).c_str() );
    801783                                addCast( *arg, (*param)->get_type(), exprTyVars );
    802784                                boxParam( (*param)->get_type(), *arg, exprTyVars );
     
    807789                        std::list< Expression *>::iterator cur = arg;
    808790                        for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    809                                 for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
     791                                for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->assertions.begin(); assert != (*tyVar)->assertions.end(); ++assert ) {
    810792                                        InferredParams::const_iterator inferParam = appExpr->get_inferParams().find( (*assert)->get_uniqueId() );
    811                                         if ( inferParam == appExpr->get_inferParams().end() ) {
    812                                                 std::cerr << "looking for assertion: " << (*assert) << std::endl << appExpr << std::endl;
    813                                         }
    814                                         assertf( inferParam != appExpr->get_inferParams().end(), "NOTE: Explicit casts of polymorphic functions to compatible monomorphic functions are currently unsupported" );
     793                                        assertf( inferParam != appExpr->get_inferParams().end(), "addInferredParams missing inferred parameter: %s in: %s", toString( *assert ).c_str(), toString( appExpr ).c_str() );
    815794                                        Expression *newExpr = inferParam->second.expr->clone();
    816795                                        addCast( newExpr, (*assert)->get_type(), tyVars );
     
    822801
    823802                void makeRetParm( FunctionType *funcType ) {
    824                         DeclarationWithType *retParm = funcType->get_returnVals().front();
     803                        DeclarationWithType *retParm = funcType->returnVals.front();
    825804
    826805                        // make a new parameter that is a pointer to the type of the old return value
     
    835814                        // actually make the adapter type
    836815                        FunctionType *adapter = adaptee->clone();
    837 //                      if ( ! adapter->get_returnVals().empty() && isPolyType( adapter->get_returnVals().front()->get_type(), tyVars ) ) {
    838816                        if ( isDynRet( adapter, tyVars ) ) {
    839817                                makeRetParm( adapter );
     
    961939                                                std::pair< AdapterIter, bool > answer = adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, newAdapter ) );
    962940                                                adapter = answer.first;
    963                                                 stmtsToAdd.push_back( new DeclStmt( noLabels, newAdapter ) );
     941                                                stmtsToAddBefore.push_back( new DeclStmt( noLabels, newAdapter ) );
    964942                                        } // if
    965943                                        assert( adapter != adapters.end() );
     
    999977                                if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) {
    1000978                                        if ( varExpr->get_var()->get_name() == "?[?]" ) {
    1001                                                 assert( appExpr->has_result() );
     979                                                assert( appExpr->result );
    1002980                                                assert( appExpr->get_args().size() == 2 );
    1003981                                                Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
     
    10331011                                                } // if
    10341012                                        } else if ( varExpr->get_var()->get_name() == "*?" ) {
    1035                                                 assert( appExpr->has_result() );
     1013                                                assert( appExpr->result );
    10361014                                                assert( ! appExpr->get_args().empty() );
    10371015                                                if ( isPolyType( appExpr->get_result(), scopeTyVars, env ) ) {
     
    10501028                                                } // if
    10511029                                        } else if ( varExpr->get_var()->get_name() == "?++" || varExpr->get_var()->get_name() == "?--" ) {
    1052                                                 assert( appExpr->has_result() );
     1030                                                assert( appExpr->result );
    10531031                                                assert( appExpr->get_args().size() == 1 );
    10541032                                                if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) {
     
    10701048                                                } // if
    10711049                                        } else if ( varExpr->get_var()->get_name() == "++?" || varExpr->get_var()->get_name() == "--?" ) {
    1072                                                 assert( appExpr->has_result() );
     1050                                                assert( appExpr->result );
    10731051                                                assert( appExpr->get_args().size() == 1 );
    10741052                                                if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) {
     
    10761054                                                } // if
    10771055                                        } else if ( varExpr->get_var()->get_name() == "?+?" || varExpr->get_var()->get_name() == "?-?" ) {
    1078                                                 assert( appExpr->has_result() );
     1056                                                assert( appExpr->result );
    10791057                                                assert( appExpr->get_args().size() == 2 );
    10801058                                                Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
     
    11021080                                                } // if
    11031081                                        } else if ( varExpr->get_var()->get_name() == "?+=?" || varExpr->get_var()->get_name() == "?-=?" ) {
    1104                                                 assert( appExpr->has_result() );
     1082                                                assert( appExpr->result );
    11051083                                                assert( appExpr->get_args().size() == 2 );
    11061084                                                Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env );
     
    11181096                }
    11191097
    1120                 Expression *Pass1::mutate( ApplicationExpr *appExpr ) {
     1098                Expression *Pass1::postmutate( ApplicationExpr *appExpr ) {
    11211099                        // std::cerr << "mutate appExpr: " << InitTweak::getFunctionName( appExpr ) << std::endl;
    11221100                        // for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
     
    11241102                        // }
    11251103                        // std::cerr << "\n";
    1126                         appExpr->get_function()->acceptMutator( *this );
    1127                         mutateAll( appExpr->get_args(), *this );
    1128 
    1129                         assert( appExpr->get_function()->has_result() );
    1130                         FunctionType * function = getFunctionType( appExpr->get_function()->get_result() );
    1131                         assertf( function, "ApplicationExpr has non-function type: %s", toString( appExpr->get_function()->get_result() ).c_str() );
     1104
     1105                        assert( appExpr->function->result );
     1106                        FunctionType * function = getFunctionType( appExpr->function->result );
     1107                        assertf( function, "ApplicationExpr has non-function type: %s", toString( appExpr->function->result ).c_str() );
    11321108
    11331109                        if ( Expression *newExpr = handleIntrinsics( appExpr ) ) {
     
    11821158                }
    11831159
    1184                 Expression *Pass1::mutate( UntypedExpr *expr ) {
    1185                         if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
    1186                                 if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
     1160                Expression * Pass1::postmutate( UntypedExpr *expr ) {
     1161                        if ( expr->result && isPolyType( expr->result, scopeTyVars, env ) ) {
     1162                                if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->function ) ) {
    11871163                                        if ( name->get_name() == "*?" ) {
    1188                                                 Expression *ret = expr->get_args().front();
    1189                                                 expr->get_args().clear();
     1164                                                Expression *ret = expr->args.front();
     1165                                                expr->args.clear();
    11901166                                                delete expr;
    1191                                                 return ret->acceptMutator( *this );
     1167                                                return ret;
    11921168                                        } // if
    11931169                                } // if
    11941170                        } // if
    1195                         return PolyMutator::mutate( expr );
    1196                 }
    1197 
    1198                 Expression *Pass1::mutate( AddressExpr *addrExpr ) {
    1199                         assert( addrExpr->get_arg()->has_result() && ! addrExpr->get_arg()->get_result()->isVoid() );
     1171                        return expr;
     1172                }
     1173
     1174                void Pass1::premutate( AddressExpr * ) { visit_children = false; }
     1175                Expression * Pass1::postmutate( AddressExpr * addrExpr ) {
     1176                        assert( addrExpr->get_arg()->result && ! addrExpr->get_arg()->get_result()->isVoid() );
    12001177
    12011178                        bool needs = false;
    12021179                        if ( UntypedExpr *expr = dynamic_cast< UntypedExpr *>( addrExpr->get_arg() ) ) {
    1203                                 if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
     1180                                if ( expr->result && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
    12041181                                        if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
    12051182                                                if ( name->get_name() == "*?" ) {
    12061183                                                        if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr->get_args().front() ) ) {
    1207                                                                 assert( appExpr->get_function()->has_result() );
     1184                                                                assert( appExpr->get_function()->result );
    12081185                                                                FunctionType *function = getFunctionType( appExpr->get_function()->get_result() );
    12091186                                                                assert( function );
     
    12161193                        // isPolyType check needs to happen before mutating addrExpr arg, so pull it forward
    12171194                        // out of the if condition.
    1218                         addrExpr->set_arg( mutateExpression( addrExpr->get_arg() ) );
     1195                        addrExpr->arg = addrExpr->get_arg()->acceptMutator( *visitor );
    12191196                        // ... but must happen after mutate, since argument might change (e.g. intrinsic *?, ?[?]) - re-evaluate above comment
    12201197                        bool polytype = isPolyType( addrExpr->get_arg()->get_result(), scopeTyVars, env );
     
    12311208                }
    12321209
    1233                 Statement * Pass1::mutate( ReturnStmt *returnStmt ) {
    1234                         if ( retval && returnStmt->get_expr() ) {
    1235                                 assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() );
    1236                                 delete returnStmt->get_expr();
    1237                                 returnStmt->set_expr( 0 );
    1238                         } else {
    1239                                 returnStmt->set_expr( mutateExpression( returnStmt->get_expr() ) );
     1210                void Pass1::premutate( ReturnStmt *returnStmt ) {
     1211                        if ( retval && returnStmt->expr ) {
     1212                                assert( returnStmt->expr->result && ! returnStmt->expr->result->isVoid() );
     1213                                delete returnStmt->expr;
     1214                                returnStmt->expr = nullptr;
    12401215                        } // if
    1241                         return returnStmt;
    1242                 }
    1243 
    1244                 Type * Pass1::mutate( PointerType *pointerType ) {
    1245                         scopeTyVars.beginScope();
     1216                }
     1217
     1218                void Pass1::premutate( PointerType *pointerType ) {
     1219                        GuardScope( scopeTyVars );
    12461220                        makeTyVarMap( pointerType, scopeTyVars );
    1247 
    1248                         Type *ret = Mutator::mutate( pointerType );
    1249 
    1250                         scopeTyVars.endScope();
    1251                         return ret;
    1252                 }
    1253 
    1254                 Type * Pass1::mutate( FunctionType *functionType ) {
    1255                         scopeTyVars.beginScope();
     1221                }
     1222
     1223                void Pass1::premutate( FunctionType *functionType ) {
     1224                        GuardScope( scopeTyVars );
    12561225                        makeTyVarMap( functionType, scopeTyVars );
    1257 
    1258                         Type *ret = Mutator::mutate( functionType );
    1259 
    1260                         scopeTyVars.endScope();
    1261                         return ret;
    1262                 }
    1263 
    1264                 void Pass1::doBeginScope() {
     1226                }
     1227
     1228                void Pass1::beginScope() {
    12651229                        adapters.beginScope();
    12661230                }
    12671231
    1268                 void Pass1::doEndScope() {
     1232                void Pass1::endScope() {
    12691233                        adapters.endScope();
    12701234                }
     
    12931257                }
    12941258
    1295                 template< typename DeclClass >
    1296                 DeclClass * Pass2::handleDecl( DeclClass *decl ) {
    1297                         DeclClass *ret = static_cast< DeclClass *>( Parent::mutate( decl ) );
    1298 
    1299                         return ret;
    1300                 }
    1301 
    1302                 DeclarationWithType * Pass2::mutate( FunctionDecl *functionDecl ) {
    1303                         functionDecl = strict_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) );
     1259                DeclarationWithType * Pass2::postmutate( FunctionDecl *functionDecl ) {
    13041260                        FunctionType * ftype = functionDecl->get_functionType();
    13051261                        if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) {
     
    13251281                }
    13261282
    1327                 ObjectDecl * Pass2::mutate( ObjectDecl *objectDecl ) {
    1328                         return handleDecl( objectDecl );
    1329                 }
    1330 
    1331                 template< typename AggDecl >
    1332                 AggDecl * Pass2::handleAggDecl( AggDecl * aggDecl ) {
     1283                void Pass2::premutate( StructDecl * ) {
    13331284                        // prevent tyVars from leaking into containing scope
    1334                         scopeTyVars.beginScope();
    1335                         Parent::mutate( aggDecl );
    1336                         scopeTyVars.endScope();
    1337                         return aggDecl;
    1338                 }
    1339 
    1340                 StructDecl * Pass2::mutate( StructDecl *aggDecl ) {
    1341                         return handleAggDecl( aggDecl );
    1342                 }
    1343 
    1344                 UnionDecl * Pass2::mutate( UnionDecl *aggDecl ) {
    1345                         return handleAggDecl( aggDecl );
    1346                 }
    1347 
    1348                 TraitDecl * Pass2::mutate( TraitDecl *aggDecl ) {
    1349                         return handleAggDecl( aggDecl );
    1350                 }
    1351 
    1352                 TypeDecl * Pass2::mutate( TypeDecl *typeDecl ) {
     1285                        GuardScope( scopeTyVars );
     1286                }
     1287
     1288                void Pass2::premutate( UnionDecl * ) {
     1289                        // prevent tyVars from leaking into containing scope
     1290                        GuardScope( scopeTyVars );
     1291                }
     1292
     1293                void Pass2::premutate( TraitDecl * ) {
     1294                        // prevent tyVars from leaking into containing scope
     1295                        GuardScope( scopeTyVars );
     1296                }
     1297
     1298                void Pass2::premutate( TypeDecl *typeDecl ) {
    13531299                        addToTyVarMap( typeDecl, scopeTyVars );
    1354                         if ( typeDecl->get_base() ) {
    1355                                 return handleDecl( typeDecl );
    1356                         } else {
    1357                                 return dynamic_cast<TypeDecl*>( Parent::mutate( typeDecl ) );
    1358                         }
    1359                 }
    1360 
    1361                 TypedefDecl * Pass2::mutate( TypedefDecl *typedefDecl ) {
    1362                         return handleDecl( typedefDecl );
    1363                 }
    1364 
    1365                 Type * Pass2::mutate( PointerType *pointerType ) {
    1366                         scopeTyVars.beginScope();
     1300                }
     1301
     1302                void Pass2::premutate( PointerType *pointerType ) {
     1303                        GuardScope( scopeTyVars );
    13671304                        makeTyVarMap( pointerType, scopeTyVars );
    1368 
    1369                         Type *ret = Parent::mutate( pointerType );
    1370 
    1371                         scopeTyVars.endScope();
    1372                         return ret;
    1373                 }
    1374 
    1375                 Type *Pass2::mutate( FunctionType *funcType ) {
    1376                         scopeTyVars.beginScope();
    1377 
     1305                }
     1306
     1307                void Pass2::premutate( FunctionType *funcType ) {
     1308                        GuardScope( scopeTyVars );
    13781309                        makeTyVarMap( funcType, scopeTyVars );
    13791310
     
    14141345                                // move all assertions into parameter list
    14151346                                for ( std::list< DeclarationWithType *>::iterator assert = (*tyParm)->get_assertions().begin(); assert != (*tyParm)->get_assertions().end(); ++assert ) {
    1416 //      *assert = (*assert)->acceptMutator( *this );
    14171347                                        // assertion parameters may not be used in body, pass along with unused attribute.
    14181348                                        (*assert)->get_attributes().push_back( new Attribute( "unused" ) );
     
    14501380                                                }
    14511381                                        }
    1452 
    14531382                                        seenTypes.insert( typeName );
    14541383                                }
     
    14581387                        funcType->get_parameters().splice( last, inferredParams );
    14591388                        addAdapters( funcType );
    1460                         mutateAll( funcType->get_returnVals(), *this );
    1461                         mutateAll( funcType->get_parameters(), *this );
    1462 
    1463                         scopeTyVars.endScope();
    1464                         return funcType;
    14651389                }
    14661390
     
    14681392
    14691393                PolyGenericCalculator::PolyGenericCalculator()
    1470                         : knownLayouts(), knownOffsets(), bufNamer( "_buf" ), scopeTyVars( TypeDecl::Data{} ) {}
     1394                        : knownLayouts(), knownOffsets(), bufNamer( "_buf" ) {}
    14711395
    14721396                void PolyGenericCalculator::beginTypeScope( Type *ty ) {
     
    18291753
    18301754                template< typename DeclClass >
    1831                 DeclClass * Pass3::handleDecl( DeclClass *decl, Type *type ) {
    1832                         scopeTyVars.beginScope();
     1755                void Pass3::handleDecl( DeclClass * decl, Type * type ) {
     1756                        GuardScope( scopeTyVars );
    18331757                        makeTyVarMap( type, scopeTyVars );
    1834 
    1835                         DeclClass *ret = static_cast< DeclClass *>( Mutator::mutate( decl ) );
    1836                         // ScrubTyVars::scrub( decl, scopeTyVars );
    18371758                        ScrubTyVars::scrubAll( decl );
    1838 
    1839                         scopeTyVars.endScope();
    1840                         return ret;
    1841                 }
    1842 
    1843                 ObjectDecl * Pass3::mutate( ObjectDecl *objectDecl ) {
    1844                         return handleDecl( objectDecl, objectDecl->get_type() );
    1845                 }
    1846 
    1847                 DeclarationWithType * Pass3::mutate( FunctionDecl *functionDecl ) {
    1848                         return handleDecl( functionDecl, functionDecl->get_functionType() );
    1849                 }
    1850 
    1851                 TypedefDecl * Pass3::mutate( TypedefDecl *typedefDecl ) {
    1852                         return handleDecl( typedefDecl, typedefDecl->get_base() );
     1759                }
     1760
     1761                void Pass3::premutate( ObjectDecl * objectDecl ) {
     1762                        handleDecl( objectDecl, objectDecl->type );
     1763                }
     1764
     1765                void Pass3::premutate( FunctionDecl * functionDecl ) {
     1766                        handleDecl( functionDecl, functionDecl->type );
     1767                }
     1768
     1769                void Pass3::premutate( TypedefDecl * typedefDecl ) {
     1770                        handleDecl( typedefDecl, typedefDecl->base );
    18531771                }
    18541772
    18551773                /// Strips the members from a generic aggregate
    1856                 void stripGenericMembers(AggregateDecl* decl) {
    1857                         if ( ! decl->get_parameters().empty() ) decl->get_members().clear();
    1858                 }
    1859 
    1860                 Declaration *Pass3::mutate( StructDecl *structDecl ) {
     1774                void stripGenericMembers(AggregateDecl * decl) {
     1775                        if ( ! decl->parameters.empty() ) decl->members.clear();
     1776                }
     1777
     1778                void Pass3::premutate( StructDecl * structDecl ) {
    18611779                        stripGenericMembers( structDecl );
    1862                         return structDecl;
    1863                 }
    1864 
    1865                 Declaration *Pass3::mutate( UnionDecl *unionDecl ) {
     1780                }
     1781
     1782                void Pass3::premutate( UnionDecl * unionDecl ) {
    18661783                        stripGenericMembers( unionDecl );
    1867                         return unionDecl;
    1868                 }
    1869 
    1870                 TypeDecl * Pass3::mutate( TypeDecl *typeDecl ) {
    1871 //   Initializer *init = 0;
    1872 //   std::list< Expression *> designators;
    1873 //   addToTyVarMap( typeDecl, scopeTyVars );
    1874 //   if ( typeDecl->get_base() ) {
    1875 //     init = new SimpleInit( new SizeofExpr( handleDecl( typeDecl, typeDecl->get_base() ) ), designators );
    1876 //   }
    1877 //   return new ObjectDecl( typeDecl->get_name(), Declaration::Extern, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ), init );
    1878 
     1784                }
     1785
     1786                void Pass3::premutate( TypeDecl * typeDecl ) {
    18791787                        addToTyVarMap( typeDecl, scopeTyVars );
    1880                         return dynamic_cast<TypeDecl*>( Mutator::mutate( typeDecl ) );
    1881                 }
    1882 
    1883                 Type * Pass3::mutate( PointerType *pointerType ) {
    1884                         scopeTyVars.beginScope();
     1788                }
     1789
     1790                void Pass3::premutate( PointerType * pointerType ) {
     1791                        GuardScope( scopeTyVars );
    18851792                        makeTyVarMap( pointerType, scopeTyVars );
    1886 
    1887                         Type *ret = Mutator::mutate( pointerType );
    1888 
    1889                         scopeTyVars.endScope();
    1890                         return ret;
    1891                 }
    1892 
    1893                 Type * Pass3::mutate( FunctionType *functionType ) {
    1894                         scopeTyVars.beginScope();
     1793                }
     1794
     1795                void Pass3::premutate( FunctionType * functionType ) {
     1796                        GuardScope( scopeTyVars );
    18951797                        makeTyVarMap( functionType, scopeTyVars );
    1896 
    1897                         Type *ret = Mutator::mutate( functionType );
    1898 
    1899                         scopeTyVars.endScope();
    1900                         return ret;
    19011798                }
    19021799        } // anonymous namespace
  • src/GenPoly/FindFunction.cc

    r78315272 r3f7e12cb  
    1818#include <utility>                      // for pair
    1919
     20#include "Common/PassVisitor.h"         // for PassVisitor
    2021#include "Common/SemanticError.h"       // for SemanticError
    2122#include "GenPoly/ErasableScopedMap.h"  // for ErasableScopedMap<>::iterator
     
    2728
    2829namespace GenPoly {
    29         class FindFunction : public Mutator {
     30        class FindFunction : public WithGuards, public WithVisitorRef<FindFunction>, public WithShortCircuiting {
    3031          public:
    3132                FindFunction( std::list< FunctionType* > &functions, const TyVarMap &tyVars, bool replaceMode, FindFunctionPredicate predicate );
    3233
    33                 virtual Type *mutate( FunctionType *functionType );
    34                 virtual Type *mutate( PointerType *pointerType );
     34                void premutate( FunctionType * functionType );
     35                Type * postmutate( FunctionType * functionType );
     36                void premutate( PointerType * pointerType );
    3537          private:
    3638                void handleForall( const Type::ForallList &forall );
     
    4345
    4446        void findFunction( Type *type, std::list< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate ) {
    45                 FindFunction finder( functions, tyVars, false, predicate );
     47                PassVisitor<FindFunction> finder( functions, tyVars, false, predicate );
    4648                type->acceptMutator( finder );
    4749        }
    4850
    4951        void findAndReplaceFunction( Type *&type, std::list< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate ) {
    50                 FindFunction finder( functions, tyVars, true, predicate );
     52                PassVisitor<FindFunction> finder( functions, tyVars, true, predicate );
    5153                type = type->acceptMutator( finder );
    5254        }
     
    5759
    5860        void FindFunction::handleForall( const Type::ForallList &forall ) {
    59                 for ( Type::ForallList::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
    60                         TyVarMap::iterator var = tyVars.find( (*i)->get_name() );
     61                for ( const Declaration * td : forall ) {
     62                        TyVarMap::iterator var = tyVars.find( td->name );
    6163                        if ( var != tyVars.end() ) {
    6264                                tyVars.erase( var->first );
     
    6567        }
    6668
    67         Type * FindFunction::mutate( FunctionType *functionType ) {
    68                 tyVars.beginScope();
     69        void FindFunction::premutate( FunctionType * functionType ) {
     70                visit_children = false;
     71                GuardScope( tyVars );
    6972                handleForall( functionType->get_forall() );
    70                 mutateAll( functionType->get_returnVals(), *this );
     73                mutateAll( functionType->get_returnVals(), *visitor );
     74        }
     75
     76        Type * FindFunction::postmutate( FunctionType * functionType ) {
    7177                Type *ret = functionType;
    7278                if ( predicate( functionType, tyVars ) ) {
     
    7783                        } // if
    7884                } // if
    79                 tyVars.endScope();
    8085                return ret;
    8186        }
    8287
    83         Type * FindFunction::mutate( PointerType *pointerType ) {
    84                 tyVars.beginScope();
     88        void FindFunction::premutate( PointerType * pointerType ) {
     89                GuardScope( tyVars );
    8590                handleForall( pointerType->get_forall() );
    86                 Type *ret = Mutator::mutate( pointerType );
    87                 tyVars.endScope();
    88                 return ret;
    8991        }
    9092} // namespace GenPoly
  • src/GenPoly/GenPoly.cc

    r78315272 r3f7e12cb  
    432432        }
    433433
     434        bool needsBoxing( Type * param, Type * arg, const TyVarMap &exprTyVars, TypeSubstitution * env ) {
     435                // is parameter is not polymorphic, don't need to box
     436                if ( ! isPolyType( param, exprTyVars ) ) return false;
     437                Type * newType = arg->clone();
     438                if ( env ) env->apply( newType );
     439                std::unique_ptr<Type> manager( newType );
     440                // if the argument's type is polymorphic, we don't need to box again!
     441                return ! isPolyType( newType );
     442        }
     443
     444        bool needsBoxing( Type * param, Type * arg, ApplicationExpr * appExpr, TypeSubstitution * env ) {
     445                FunctionType * function = getFunctionType( appExpr->function->result );
     446                assertf( function, "ApplicationExpr has non-function type: %s", toString( appExpr->function->result ).c_str() );
     447                TyVarMap exprTyVars( TypeDecl::Data{} );
     448                makeTyVarMap( function, exprTyVars );
     449                return needsBoxing( param, arg, exprTyVars, env );
     450        }
     451
    434452        void addToTyVarMap( TypeDecl * tyVar, TyVarMap &tyVarMap ) {
    435453                // xxx - should this actually be insert?
  • src/GenPoly/GenPoly.h

    r78315272 r3f7e12cb  
    8080        bool typesPolyCompatible( Type *aty, Type *bty );
    8181
     82        /// true if arg requires boxing given exprTyVars
     83        bool needsBoxing( Type * param, Type * arg, const TyVarMap &exprTyVars, TypeSubstitution * env );
     84
     85        /// true if arg requires boxing in the call to appExpr
     86        bool needsBoxing( Type * param, Type * arg, ApplicationExpr * appExpr, TypeSubstitution * env );
     87
    8288        /// Adds the type variable `tyVar` to `tyVarMap`
    8389        void addToTyVarMap( TypeDecl * tyVar, TyVarMap &tyVarMap );
  • src/GenPoly/InstantiateGeneric.cc

    r78315272 r3f7e12cb  
    238238                                        assertf( false, "Ttype parameters are not currently allowed as parameters to generic types." );
    239239                                        break;
    240                                 case TypeDecl::Any:
    241                                         assertf( false, "otype parameters handled by baseParam->isComplete()." );
     240                                default:
     241                                        assertf( false, "Unhandled type parameter kind" );
    242242                                        break;
    243243                        }
     
    278278                substituteMembers( base->get_members(), baseParams, typeSubs );
    279279
    280                 deleteAll( baseParams );
     280                // xxx - can't delete type parameters because they may have assertions that are used
     281                // deleteAll( baseParams );
    281282                baseParams.clear();
    282283
  • src/GenPoly/ScrubTyVars.cc

    r78315272 r3f7e12cb  
    4040                if ( tyVar != tyVars->end() ) {
    4141                        switch ( tyVar->second.kind ) {
    42                           case TypeDecl::Any:
    4342                          case TypeDecl::Dtype:
    4443                          case TypeDecl::Ttype:
  • src/GenPoly/Specialize.cc

    r78315272 r3f7e12cb  
    2222#include <utility>                       // for pair
    2323
     24#include "Common/PassVisitor.h"
    2425#include "Common/SemanticError.h"        // for SemanticError
    2526#include "Common/UniqueName.h"           // for UniqueName
     
    2829#include "InitTweak/InitTweak.h"         // for isIntrinsicCallExpr
    2930#include "Parser/LinkageSpec.h"          // for C
    30 #include "PolyMutator.h"                 // for PolyMutator
    3131#include "ResolvExpr/FindOpenVars.h"     // for findOpenVars
    3232#include "ResolvExpr/TypeEnvironment.h"  // for OpenVarSet, AssertionSet
     
    4343
    4444namespace GenPoly {
    45         class Specialize final : public PolyMutator {
    46           public:
    47                 using PolyMutator::mutate;
    48                 virtual Expression * mutate( ApplicationExpr *applicationExpr ) override;
    49                 virtual Expression * mutate( AddressExpr *castExpr ) override;
    50                 virtual Expression * mutate( CastExpr *castExpr ) override;
    51                 // virtual Expression * mutate( LogicalExpr *logicalExpr );
    52                 // virtual Expression * mutate( ConditionalExpr *conditionalExpr );
    53                 // virtual Expression * mutate( CommaExpr *commaExpr );
     45        struct Specialize final : public WithTypeSubstitution, public WithStmtsToAdd, public WithVisitorRef<Specialize> {
     46                Expression * postmutate( ApplicationExpr *applicationExpr );
     47                Expression * postmutate( CastExpr *castExpr );
    5448
    5549                void handleExplicitParams( ApplicationExpr *appExpr );
    5650                Expression * createThunkFunction( FunctionType *funType, Expression *actual, InferredParams *inferParams );
    57                 Expression * doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams = nullptr );
     51                Expression * doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams );
    5852
    5953                std::string paramPrefix = "_p";
     
    7266                                if ( ! boundType ) continue;
    7367                                if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( boundType ) ) {
     68                                        // bound to another type variable
    7469                                        if ( closedVars.find( typeInst->get_name() ) == closedVars.end() ) {
     70                                                // bound to a closed variable => must specialize
    7571                                                return true;
    7672                                        } // if
    7773                                } else {
     74                                        // variable is bound to a concrete type => must specialize
    7875                                        return true;
    7976                                } // if
    8077                        } // for
     78                        // none of the type variables are bound
    8179                        return false;
    8280                } else {
     81                        // no env
    8382                        return false;
    8483                } // if
     
    136135                        if ( functionParameterSize( fftype ) != functionParameterSize( aftype ) ) return false;
    137136                        // tuple-parameter sizes are the same, but actual parameter sizes differ - must tuple specialize
    138                         if ( fftype->get_parameters().size() != aftype->get_parameters().size() ) return true;
     137                        if ( fftype->parameters.size() != aftype->parameters.size() ) return true;
    139138                        // total parameter size can be the same, while individual parameters can have different structure
    140                         for ( auto params : group_iterate( fftype->get_parameters(), aftype->get_parameters() ) ) {
     139                        for ( auto params : group_iterate( fftype->parameters, aftype->parameters ) ) {
    141140                                DeclarationWithType * formal = std::get<0>(params);
    142141                                DeclarationWithType * actual = std::get<1>(params);
     
    152151
    153152        Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) {
    154                 assertf( actual->has_result(), "attempting to specialize an untyped expression" );
     153                assertf( actual->result, "attempting to specialize an untyped expression" );
    155154                if ( needsSpecialization( formalType, actual->get_result(), env ) ) {
    156155                        if ( FunctionType *funType = getFunctionType( formalType ) ) {
    157                                 ApplicationExpr *appExpr;
    158                                 VariableExpr *varExpr;
    159                                 if ( ( appExpr = dynamic_cast<ApplicationExpr*>( actual ) ) ) {
     156                                if ( ApplicationExpr * appExpr = dynamic_cast<ApplicationExpr*>( actual ) ) {
    160157                                        return createThunkFunction( funType, appExpr->get_function(), inferParams );
    161                                 } else if ( ( varExpr = dynamic_cast<VariableExpr*>( actual ) ) ) {
     158                                } else if ( VariableExpr * varExpr = dynamic_cast<VariableExpr*>( actual ) ) {
    162159                                        return createThunkFunction( funType, varExpr, inferParams );
    163160                                } else {
     
    204201        }
    205202
    206         struct EnvTrimmer : public Visitor {
     203        struct EnvTrimmer {
    207204                TypeSubstitution * env, * newEnv;
    208205                EnvTrimmer( TypeSubstitution * env, TypeSubstitution * newEnv ) : env( env ), newEnv( newEnv ){}
    209                 virtual void visit( TypeDecl * tyDecl ) {
     206                void previsit( TypeDecl * tyDecl ) {
    210207                        // transfer known bindings for seen type variables
    211                         if ( Type * t = env->lookup( tyDecl->get_name() ) ) {
    212                                 newEnv->add( tyDecl->get_name(), t );
     208                        if ( Type * t = env->lookup( tyDecl->name ) ) {
     209                                newEnv->add( tyDecl->name, t );
    213210                        }
    214211                }
     
    219216                if ( env ) {
    220217                        TypeSubstitution * newEnv = new TypeSubstitution();
    221                         EnvTrimmer trimmer( env, newEnv );
     218                        PassVisitor<EnvTrimmer> trimmer( env, newEnv );
    222219                        expr->accept( trimmer );
    223220                        return newEnv;
     
    277274                std::string oldParamPrefix = paramPrefix;
    278275                paramPrefix += "p";
    279                 // save stmtsToAdd in oldStmts
     276                // save stmtsToAddBefore in oldStmts
    280277                std::list< Statement* > oldStmts;
    281                 oldStmts.splice( oldStmts.end(), stmtsToAdd );
    282                 mutate( appExpr );
     278                oldStmts.splice( oldStmts.end(), stmtsToAddBefore );
     279                appExpr->acceptMutator( *visitor );
    283280                paramPrefix = oldParamPrefix;
    284281                // write any statements added for recursive specializations into the thunk body
    285                 thunkFunc->get_statements()->get_kids().splice( thunkFunc->get_statements()->get_kids().end(), stmtsToAdd );
    286                 // restore oldStmts into stmtsToAdd
    287                 stmtsToAdd.splice( stmtsToAdd.end(), oldStmts );
     282                thunkFunc->statements->kids.splice( thunkFunc->statements->kids.end(), stmtsToAddBefore );
     283                // restore oldStmts into stmtsToAddBefore
     284                stmtsToAddBefore.splice( stmtsToAddBefore.end(), oldStmts );
    288285
    289286                // add return (or valueless expression) to the thunk
    290287                Statement *appStmt;
    291                 if ( funType->get_returnVals().empty() ) {
     288                if ( funType->returnVals.empty() ) {
    292289                        appStmt = new ExprStmt( noLabels, appExpr );
    293290                } else {
    294291                        appStmt = new ReturnStmt( noLabels, appExpr );
    295292                } // if
    296                 thunkFunc->get_statements()->get_kids().push_back( appStmt );
     293                thunkFunc->statements->kids.push_back( appStmt );
    297294
    298295                // add thunk definition to queue of statements to add
    299                 stmtsToAdd.push_back( new DeclStmt( noLabels, thunkFunc ) );
     296                stmtsToAddBefore.push_back( new DeclStmt( noLabels, thunkFunc ) );
    300297                // return address of thunk function as replacement expression
    301298                return new AddressExpr( new VariableExpr( thunkFunc ) );
     
    304301        void Specialize::handleExplicitParams( ApplicationExpr *appExpr ) {
    305302                // create thunks for the explicit parameters
    306                 assert( appExpr->get_function()->has_result() );
    307                 FunctionType *function = getFunctionType( appExpr->get_function()->get_result() );
     303                assert( appExpr->function->result );
     304                FunctionType *function = getFunctionType( appExpr->function->result );
    308305                assert( function );
    309306                std::list< DeclarationWithType* >::iterator formal;
    310307                std::list< Expression* >::iterator actual;
    311308                for ( formal = function->get_parameters().begin(), actual = appExpr->get_args().begin(); formal != function->get_parameters().end() && actual != appExpr->get_args().end(); ++formal, ++actual ) {
    312                         *actual = doSpecialization( (*formal )->get_type(), *actual, &appExpr->get_inferParams() );
    313                 }
    314         }
    315 
    316         Expression * Specialize::mutate( ApplicationExpr *appExpr ) {
    317                 appExpr->get_function()->acceptMutator( *this );
    318                 mutateAll( appExpr->get_args(), *this );
    319 
     309                        *actual = doSpecialization( (*formal)->get_type(), *actual, &appExpr->get_inferParams() );
     310                }
     311        }
     312
     313        Expression * Specialize::postmutate( ApplicationExpr *appExpr ) {
    320314                if ( ! InitTweak::isIntrinsicCallExpr( appExpr ) ) {
    321315                        // create thunks for the inferred parameters
     
    331325        }
    332326
    333         Expression * Specialize::mutate( AddressExpr *addrExpr ) {
    334                 addrExpr->get_arg()->acceptMutator( *this );
    335                 assert( addrExpr->has_result() );
    336                 addrExpr->set_arg( doSpecialization( addrExpr->get_result(), addrExpr->get_arg() ) );
    337                 return addrExpr;
    338         }
    339 
    340         Expression * Specialize::mutate( CastExpr *castExpr ) {
    341                 castExpr->get_arg()->acceptMutator( *this );
    342                 if ( castExpr->get_result()->isVoid() ) {
     327        Expression * Specialize::postmutate( CastExpr *castExpr ) {
     328                if ( castExpr->result->isVoid() ) {
    343329                        // can't specialize if we don't have a return value
    344330                        return castExpr;
    345331                }
    346                 Expression *specialized = doSpecialization( castExpr->get_result(), castExpr->get_arg() );
    347                 if ( specialized != castExpr->get_arg() ) {
     332                Expression *specialized = doSpecialization( castExpr->result, castExpr->arg, &castExpr->inferParams );
     333                if ( specialized != castExpr->arg ) {
    348334                        // assume here that the specialization incorporates the cast
    349335                        return specialized;
     
    353339        }
    354340
    355         // Removing these for now. Richard put these in for some reason, but it's not clear why.
    356         // In particular, copy constructors produce a comma expression, and with this code the parts
    357         // of that comma expression are not specialized, which causes problems.
    358 
    359         // Expression * Specialize::mutate( LogicalExpr *logicalExpr ) {
    360         //      return logicalExpr;
    361         // }
    362 
    363         // Expression * Specialize::mutate( ConditionalExpr *condExpr ) {
    364         //      return condExpr;
    365         // }
    366 
    367         // Expression * Specialize::mutate( CommaExpr *commaExpr ) {
    368         //      return commaExpr;
    369         // }
    370 
    371341        void convertSpecializations( std::list< Declaration* >& translationUnit ) {
    372                 Specialize spec;
     342                PassVisitor<Specialize> spec;
    373343                mutateAll( translationUnit, spec );
    374344        }
  • src/GenPoly/module.mk

    r78315272 r3f7e12cb  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk -- 
     8## module.mk --
    99##
    1010## Author           : Richard C. Bilson
     
    1717SRC += GenPoly/Box.cc \
    1818       GenPoly/GenPoly.cc \
    19        GenPoly/PolyMutator.cc \
    2019       GenPoly/ScrubTyVars.cc \
    2120       GenPoly/Lvalue.cc \
    2221       GenPoly/Specialize.cc \
    23        GenPoly/CopyParams.cc \
    2422       GenPoly/FindFunction.cc \
    25        GenPoly/DeclMutator.cc \
    2623       GenPoly/InstantiateGeneric.cc
  • src/InitTweak/FixInit.cc

    r78315272 r3f7e12cb  
    3636#include "FixGlobalInit.h"             // for fixGlobalInit
    3737#include "GenInit.h"                   // for genCtorDtor
    38 #include "GenPoly/DeclMutator.h"       // for DeclMutator
    3938#include "GenPoly/GenPoly.h"           // for getFunctionType
    40 #include "GenPoly/PolyMutator.h"       // for PolyMutator
    4139#include "InitTweak.h"                 // for getFunctionName, getCallArg
    4240#include "Parser/LinkageSpec.h"        // for C, Spec, Cforall, isBuiltin
     
    4644#include "SymTab/Indexer.h"            // for Indexer
    4745#include "SymTab/Mangler.h"            // for Mangler
    48 #include "SynTree/AddStmtVisitor.h"    // for AddStmtVisitor
    4946#include "SynTree/Attribute.h"         // for Attribute
    5047#include "SynTree/Constant.h"          // for Constant
     
    5855#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution, operator<<
    5956#include "SynTree/Visitor.h"           // for acceptAll, maybeAccept
    60 #include "Tuples/Tuples.h"             // for isTtype
    6157
    6258bool ctordtorp = false; // print all debug
     
    9793                        /// true if type does not need to be copy constructed to ensure correctness
    9894                        bool skipCopyConstruct( Type * type );
    99                         void copyConstructArg( Expression *& arg, ImplicitCopyCtorExpr * impCpCtorExpr );
     95                        void copyConstructArg( Expression *& arg, ImplicitCopyCtorExpr * impCpCtorExpr, Type * formal );
    10096                        void destructRet( ObjectDecl * ret, ImplicitCopyCtorExpr * impCpCtorExpr );
    10197
     
    187183                };
    188184
    189                 class FixCopyCtors final : public GenPoly::PolyMutator {
     185                class FixCopyCtors final : public WithStmtsToAdd, public WithShortCircuiting, public WithVisitorRef<FixCopyCtors> {
    190186                  public:
    191187                        FixCopyCtors( UnqCount & unqCount ) : unqCount( unqCount ){}
     
    194190                        static void fixCopyCtors( std::list< Declaration * > &translationUnit, UnqCount & unqCount );
    195191
    196                         typedef GenPoly::PolyMutator Parent;
    197                         using Parent::mutate;
    198                         virtual Expression * mutate( ImplicitCopyCtorExpr * impCpCtorExpr ) override;
    199                         virtual Expression * mutate( UniqueExpr * unqExpr ) override;
    200                         virtual Expression * mutate( StmtExpr * stmtExpr ) override;
     192                        Expression * postmutate( ImplicitCopyCtorExpr * impCpCtorExpr );
     193                        void premutate( StmtExpr * stmtExpr );
     194                        void premutate( UniqueExpr * unqExpr );
    201195
    202196                        UnqCount & unqCount;
     
    220214                        void emit( CodeLocation, const Params &... params );
    221215
    222                         FunctionDecl * function = 0;
     216                        FunctionDecl * function = nullptr;
    223217                        std::set< DeclarationWithType * > unhandled;
    224218                        std::map< DeclarationWithType *, CodeLocation > usedUninit;
    225                         ObjectDecl * thisParam = 0;
     219                        ObjectDecl * thisParam = nullptr;
    226220                        bool isCtor = false; // true if current function is a constructor
    227                         StructDecl * structDecl = 0;
     221                        StructDecl * structDecl = nullptr;
    228222                };
    229223
     
    243237                };
    244238
    245                 class FixCtorExprs final : public GenPoly::DeclMutator {
    246                   public:
     239                struct FixCtorExprs final : public WithDeclsToAdd, public WithIndexer {
    247240                        /// expands ConstructorExpr nodes into comma expressions, using a temporary for the first argument
    248241                        static void fix( std::list< Declaration * > & translationUnit );
    249242
    250                         using GenPoly::DeclMutator::mutate;
    251                         virtual Expression * mutate( ConstructorExpr * ctorExpr ) override;
     243                        Expression * postmutate( ConstructorExpr * ctorExpr );
    252244                };
    253245        } // namespace
     
    268260
    269261                GenStructMemberCalls::generate( translationUnit );
     262
    270263                // xxx - ctor expansion currently has to be after FixCopyCtors, because there is currently a
    271264                // hack in the way untyped assignments are generated, where the first argument cannot have
     
    297290                        for ( std::list< Declaration * >::iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) {
    298291                                try {
    299                                         *i = maybeMutate( *i, fixer );
     292                                        maybeMutate( *i, fixer );
    300293                                        translationUnit.splice( i, fixer.pass.staticDtorDecls );
    301294                                } catch( SemanticError &e ) {
     
    316309
    317310                void FixCopyCtors::fixCopyCtors( std::list< Declaration * > & translationUnit, UnqCount & unqCount ) {
    318                         FixCopyCtors fixer( unqCount );
     311                        PassVisitor<FixCopyCtors> fixer( unqCount );
    319312                        mutateAll( translationUnit, fixer );
    320313                }
     
    326319
    327320                void FixCtorExprs::fix( std::list< Declaration * > & translationUnit ) {
    328                         FixCtorExprs fixer;
    329                         fixer.mutateDeclarationList( translationUnit );
     321                        PassVisitor<FixCtorExprs> fixer;
     322                        mutateAll( translationUnit, fixer );
    330323                }
    331324
    332325                Expression * InsertImplicitCalls::postmutate( ApplicationExpr * appExpr ) {
    333                         assert( appExpr );
    334 
    335326                        if ( VariableExpr * function = dynamic_cast< VariableExpr * > ( appExpr->get_function() ) ) {
    336                                 if ( LinkageSpec::isBuiltin( function->get_var()->get_linkage() ) ) {
     327                                if ( function->var->linkage.is_builtin ) {
    337328                                        // optimization: don't need to copy construct in order to call intrinsic functions
    338329                                        return appExpr;
    339330                                } else if ( DeclarationWithType * funcDecl = dynamic_cast< DeclarationWithType * > ( function->get_var() ) ) {
    340331                                        FunctionType * ftype = dynamic_cast< FunctionType * >( GenPoly::getFunctionType( funcDecl->get_type() ) );
    341                                         assert( ftype );
    342                                         if ( CodeGen::isConstructor( funcDecl->get_name() ) && ftype->get_parameters().size() == 2 ) {
    343                                                 Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
    344                                                 Type * t2 = ftype->get_parameters().back()->get_type();
     332                                        assertf( ftype, "Function call without function type: %s", toString( funcDecl ).c_str() );
     333                                        if ( CodeGen::isConstructor( funcDecl->get_name() ) && ftype->parameters.size() == 2 ) {
     334                                                Type * t1 = getPointerBase( ftype->parameters.front()->get_type() );
     335                                                Type * t2 = ftype->parameters.back()->get_type();
    345336                                                assert( t1 );
    346337
     
    368359                }
    369360
    370                 bool ResolveCopyCtors::skipCopyConstruct( Type * type ) {
    371                         return dynamic_cast< VarArgsType * >( type ) || dynamic_cast< ReferenceType * >( type ) || GenPoly::getFunctionType( type ) || Tuples::isTtype( type );
    372                 }
     361                bool ResolveCopyCtors::skipCopyConstruct( Type * type ) { return ! isConstructable( type ); }
    373362
    374363                Expression * ResolveCopyCtors::makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg ) {
     
    377366                        ImplicitCtorDtorStmt * stmt = genCtorDtor( fname, var, cpArg );
    378367                        ExprStmt * exprStmt = strict_dynamic_cast< ExprStmt * >( stmt->get_callStmt() );
    379                         Expression * untyped = exprStmt->get_expr();
     368                        Expression * resolved = exprStmt->expr;
     369                        exprStmt->expr = nullptr; // take ownership of expr
    380370
    381371                        // resolve copy constructor
    382372                        // should only be one alternative for copy ctor and dtor expressions, since all arguments are fixed
    383373                        // (VariableExpr and already resolved expression)
    384                         CP_CTOR_PRINT( std::cerr << "ResolvingCtorDtor " << untyped << std::endl; )
    385                         Expression * resolved = ResolvExpr::findVoidExpression( untyped, indexer );
     374                        CP_CTOR_PRINT( std::cerr << "ResolvingCtorDtor " << resolved << std::endl; )
     375                        ResolvExpr::findVoidExpression( resolved, indexer );
    386376                        assert( resolved );
    387377                        if ( resolved->get_env() ) {
     
    391381                                resolved->set_env( nullptr );
    392382                        } // if
    393 
    394383                        delete stmt;
    395384                        return resolved;
    396385                }
    397386
    398                 void ResolveCopyCtors::copyConstructArg( Expression *& arg, ImplicitCopyCtorExpr * impCpCtorExpr ) {
     387                void ResolveCopyCtors::copyConstructArg( Expression *& arg, ImplicitCopyCtorExpr * impCpCtorExpr, Type * formal ) {
    399388                        static UniqueName tempNamer("_tmp_cp");
    400389                        assert( env );
    401390                        CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *env << std::endl; )
    402                         assert( arg->has_result() );
    403                         Type * result = arg->get_result();
     391                        assert( arg->result );
     392                        Type * result = arg->result;
    404393                        if ( skipCopyConstruct( result ) ) return; // skip certain non-copyable types
    405394
    406                         // type may involve type variables, so apply type substitution to get temporary variable's actual type
     395                        // type may involve type variables, so apply type substitution to get temporary variable's actual type.
     396                        // Use applyFree so that types bound in function pointers are not substituted, e.g. in forall(dtype T) void (*)(T).
    407397                        result = result->clone();
    408                         env->apply( result );
    409                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0 );
     398                        env->applyFree( result );
     399                        ObjectDecl * tmp = ObjectDecl::newObject( "__tmp", result, nullptr );
    410400                        tmp->get_type()->set_const( false );
    411401
     
    417407                                // if the chosen constructor is intrinsic, the copy is unnecessary, so
    418408                                // don't create the temporary and don't call the copy constructor
    419                                 VariableExpr * function = dynamic_cast< VariableExpr * >( appExpr->get_function() );
    420                                 assert( function );
    421                                 if ( function->get_var()->get_linkage() == LinkageSpec::Intrinsic ) return;
    422                         }
     409                                VariableExpr * function = strict_dynamic_cast< VariableExpr * >( appExpr->function );
     410                                if ( function->var->linkage == LinkageSpec::Intrinsic ) {
     411                                        // arguments that need to be boxed need a temporary regardless of whether the copy constructor is intrinsic,
     412                                        // so that the object isn't changed inside of the polymorphic function
     413                                        if ( ! GenPoly::needsBoxing( formal, result, impCpCtorExpr->callExpr, env ) ) return;
     414                                }
     415                        }
     416
     417                        // set a unique name for the temporary once it's certain the call is necessary
     418                        tmp->name = tempNamer.newName();
    423419
    424420                        // replace argument to function call with temporary
    425421                        arg = new CommaExpr( cpCtor, new VariableExpr( tmp ) );
    426                         impCpCtorExpr->get_tempDecls().push_back( tmp );
    427                         impCpCtorExpr->get_dtors().push_front( makeCtorDtor( "^?{}", tmp ) );
     422                        impCpCtorExpr->tempDecls.push_back( tmp );
     423                        impCpCtorExpr->dtors.push_front( makeCtorDtor( "^?{}", tmp ) );
    428424                }
    429425
     
    435431                        CP_CTOR_PRINT( std::cerr << "ResolveCopyCtors: " << impCpCtorExpr << std::endl; )
    436432
    437                         ApplicationExpr * appExpr = impCpCtorExpr->get_callExpr();
     433                        ApplicationExpr * appExpr = impCpCtorExpr->callExpr;
    438434
    439435                        // take each argument and attempt to copy construct it.
    440                         for ( Expression * & arg : appExpr->get_args() ) {
    441                                 copyConstructArg( arg, impCpCtorExpr );
     436                        FunctionType * ftype = GenPoly::getFunctionType( appExpr->function->result );
     437                        assert( ftype );
     438                        auto & params = ftype->parameters;
     439                        auto iter = params.begin();
     440                        for ( Expression * & arg : appExpr->args ) {
     441                                Type * formal = nullptr;
     442                                if ( iter != params.end() ) {
     443                                        DeclarationWithType * param = *iter++;
     444                                        formal = param->get_type();
     445                                }
     446
     447                                copyConstructArg( arg, impCpCtorExpr, formal );
    442448                        } // for
    443449
     
    445451                        // initialized with the return value and is destructed later
    446452                        // xxx - handle named return values?
    447                         Type * result = appExpr->get_result();
     453                        Type * result = appExpr->result;
    448454                        if ( ! result->isVoid() ) {
    449455                                static UniqueName retNamer("_tmp_cp_ret");
    450456                                result = result->clone();
    451457                                env->apply( result );
    452                                 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0 );
    453                                 ret->get_type()->set_const( false );
    454                                 impCpCtorExpr->get_returnDecls().push_back( ret );
     458                                ObjectDecl * ret = ObjectDecl::newObject( retNamer.newName(), result, nullptr );
     459                                ret->type->set_const( false );
     460                                impCpCtorExpr->returnDecls.push_back( ret );
    455461                                CP_CTOR_PRINT( std::cerr << "makeCtorDtor for a return" << std::endl; )
    456462                                if ( ! dynamic_cast< ReferenceType * >( result ) ) {
    457                                         // destructing lvalue returns is bad because it can cause multiple destructor calls to the same object - the returned object is not a temporary
     463                                        // destructing reference returns is bad because it can cause multiple destructor calls to the same object - the returned object is not a temporary
    458464                                        destructRet( ret, impCpCtorExpr );
    459465                                }
     
    472478                                result = result->clone();
    473479                                env->apply( result );
    474                                 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0 );
     480                                ObjectDecl * ret = ObjectDecl::newObject( retNamer.newName(), result, nullptr );
    475481                                ret->get_type()->set_const( false );
    476482                                stmtExpr->get_returnDecls().push_front( ret );
     
    493499                                visit_children = false;
    494500                        }
     501                }
     502
     503                // to prevent warnings (‘_unq0’ may be used uninitialized in this function),
     504                // insert an appropriate zero initializer for UniqueExpr temporaries.
     505                Initializer * makeInit( Type * t ) {
     506                        if ( StructInstType * inst = dynamic_cast< StructInstType * >( t ) ) {
     507                                // initizer for empty struct must be empty
     508                                if ( inst->baseStruct->members.empty() ) return new ListInit({});
     509                        } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( t ) ) {
     510                                // initizer for empty union must be empty
     511                                if ( inst->baseUnion->members.empty() ) return new ListInit({});
     512                        }
     513
     514                        return new ListInit( { new SingleInit( new ConstantExpr( Constant::from_int( 0 ) ) ) } );
    495515                }
    496516
     
    509529                        } else {
    510530                                // expr isn't a call expr, so create a new temporary variable to use to hold the value of the unique expression
    511                                 unqExpr->set_object( new ObjectDecl( toString("_unq", unqExpr->get_id()), Type::StorageClasses(), LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );
     531                                unqExpr->set_object( ObjectDecl::newObject( toString("_unq", unqExpr->get_id()), unqExpr->get_result()->clone(), makeInit( unqExpr->get_result() ) ) );
    512532                                unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) );
    513533                        }
     
    515535                }
    516536
    517                 Expression * FixCopyCtors::mutate( ImplicitCopyCtorExpr * impCpCtorExpr ) {
     537                Expression * FixCopyCtors::postmutate( ImplicitCopyCtorExpr * impCpCtorExpr ) {
    518538                        CP_CTOR_PRINT( std::cerr << "FixCopyCtors: " << impCpCtorExpr << std::endl; )
    519539
    520                         impCpCtorExpr = strict_dynamic_cast< ImplicitCopyCtorExpr * >( Parent::mutate( impCpCtorExpr ) );
    521540                        std::list< ObjectDecl * > & tempDecls = impCpCtorExpr->get_tempDecls();
    522541                        std::list< ObjectDecl * > & returnDecls = impCpCtorExpr->get_returnDecls();
     
    525544                        // add all temporary declarations and their constructors
    526545                        for ( ObjectDecl * obj : tempDecls ) {
    527                                 stmtsToAdd.push_back( new DeclStmt( noLabels, obj ) );
     546                                stmtsToAddBefore.push_back( new DeclStmt( noLabels, obj ) );
    528547                        } // for
    529548                        for ( ObjectDecl * obj : returnDecls ) {
    530                                 stmtsToAdd.push_back( new DeclStmt( noLabels, obj ) );
     549                                stmtsToAddBefore.push_back( new DeclStmt( noLabels, obj ) );
    531550                        } // for
    532551
     
    536555                        } // for
    537556
    538                         // xxx - update to work with multiple return values
    539557                        ObjectDecl * returnDecl = returnDecls.empty() ? nullptr : returnDecls.front();
    540558                        Expression * callExpr = impCpCtorExpr->get_callExpr();
     
    561579                                Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) );
    562580                                // move env from callExpr to retExpr
    563                                 retExpr->set_env( callExpr->get_env() );
    564                                 callExpr->set_env( nullptr );
     581                                std::swap( retExpr->env, callExpr->env );
    565582                                return retExpr;
    566583                        } else {
     
    569586                }
    570587
    571                 Expression * FixCopyCtors::mutate( StmtExpr * stmtExpr ) {
     588                void FixCopyCtors::premutate( StmtExpr * stmtExpr ) {
    572589                        // function call temporaries should be placed at statement-level, rather than nested inside of a new statement expression,
    573590                        // since temporaries can be shared across sub-expressions, e.g.
    574591                        //   [A, A] f();
    575592                        //   g([A] x, [A] y);
    576                         //   f(g());
     593                        //   g(f());
    577594                        // f is executed once, so the return temporary is shared across the tuple constructors for x and y.
     595                        // Explicitly mutating children instead of mutating the inner compound statment forces the temporaries to be added
     596                        // to the outer context, rather than inside of the statement expression.
     597                        visit_children = false;
    578598                        std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids();
    579599                        for ( Statement *& stmt : stmts ) {
    580                                 stmt = stmt->acceptMutator( *this );
     600                                stmt = stmt->acceptMutator( *visitor );
    581601                        } // for
    582                         // stmtExpr = strict_dynamic_cast< StmtExpr * >( Parent::mutate( stmtExpr ) );
    583602                        assert( stmtExpr->get_result() );
    584603                        Type * result = stmtExpr->get_result();
    585604                        if ( ! result->isVoid() ) {
    586605                                for ( ObjectDecl * obj : stmtExpr->get_returnDecls() ) {
    587                                         stmtsToAdd.push_back( new DeclStmt( noLabels, obj ) );
     606                                        stmtsToAddBefore.push_back( new DeclStmt( noLabels, obj ) );
    588607                                } // for
    589608                                // add destructors after current statement
     
    592611                                } // for
    593612                                // must have a non-empty body, otherwise it wouldn't have a result
    594                                 CompoundStmt * body = stmtExpr->get_statements();
    595                                 assert( ! body->get_kids().empty() );
     613                                assert( ! stmts.empty() );
    596614                                assert( ! stmtExpr->get_returnDecls().empty() );
    597                                 body->get_kids().push_back( new ExprStmt( noLabels, new VariableExpr( stmtExpr->get_returnDecls().front() ) ) );
     615                                stmts.push_back( new ExprStmt( noLabels, new VariableExpr( stmtExpr->get_returnDecls().front() ) ) );
    598616                                stmtExpr->get_returnDecls().clear();
    599617                                stmtExpr->get_dtors().clear();
     
    601619                        assert( stmtExpr->get_returnDecls().empty() );
    602620                        assert( stmtExpr->get_dtors().empty() );
    603                         return stmtExpr;
    604                 }
    605 
    606                 Expression * FixCopyCtors::mutate( UniqueExpr * unqExpr ) {
     621                }
     622
     623                void FixCopyCtors::premutate( UniqueExpr * unqExpr ) {
     624                        visit_children = false;
    607625                        unqCount[ unqExpr->get_id() ]--;
    608626                        static std::unordered_map< int, std::list< Statement * > > dtors;
    609627                        static std::unordered_map< int, UniqueExpr * > unqMap;
    610                         static std::unordered_set< int > addDeref;
    611628                        // has to be done to clean up ImplicitCopyCtorExpr nodes, even when this node was skipped in previous passes
    612629                        if ( unqMap.count( unqExpr->get_id() ) ) {
     
    619636                                        stmtsToAddAfter.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );
    620637                                }
    621                                 if ( addDeref.count( unqExpr->get_id() ) ) {
    622                                         // other UniqueExpr was dereferenced because it was an lvalue return, so this one should be too
    623                                         return UntypedExpr::createDeref( unqExpr );
    624                                 }
    625                                 return unqExpr;
    626                         }
    627                         FixCopyCtors fixer( unqCount );
     638                                return;
     639                        }
     640                        PassVisitor<FixCopyCtors> fixer( unqCount );
    628641                        unqExpr->set_expr( unqExpr->get_expr()->acceptMutator( fixer ) ); // stmtexprs contained should not be separately fixed, so this must occur after the lookup
    629                         stmtsToAdd.splice( stmtsToAdd.end(), fixer.stmtsToAdd );
     642                        stmtsToAddBefore.splice( stmtsToAddBefore.end(), fixer.pass.stmtsToAddBefore );
    630643                        unqMap[unqExpr->get_id()] = unqExpr;
    631644                        if ( unqCount[ unqExpr->get_id() ] == 0 ) {  // insert destructor after the last use of the unique expression
    632645                                stmtsToAddAfter.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );
    633646                        } else { // remember dtors for last instance of unique expr
    634                                 dtors[ unqExpr->get_id() ] = fixer.stmtsToAddAfter;
    635                         }
    636                         if ( UntypedExpr * deref = dynamic_cast< UntypedExpr * >( unqExpr->get_expr() ) ) {
    637                                 // unique expression is now a dereference, because the inner expression is an lvalue returning function call.
    638                                 // Normalize the expression by dereferencing the unique expression, rather than the inner expression
    639                                 // (i.e. move the dereference out a level)
    640                                 assert( getFunctionName( deref ) == "*?" );
    641                                 unqExpr->set_expr( getCallArg( deref, 0 ) );
    642                                 getCallArg( deref, 0 ) = unqExpr;
    643                                 addDeref.insert( unqExpr->get_id() );
    644                                 return deref;
    645                         }
    646                         return unqExpr;
    647                 }
    648 
    649                 DeclarationWithType *FixInit::postmutate( ObjectDecl *objDecl ) {
     647                                dtors[ unqExpr->get_id() ] = fixer.pass.stmtsToAddAfter;
     648                        }
     649                        return;
     650                }
     651
     652                DeclarationWithType * FixInit::postmutate( ObjectDecl *objDecl ) {
    650653                        // since this removes the init field from objDecl, it must occur after children are mutated (i.e. postmutate)
    651654                        if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) {
     
    745748                                        } else {
    746749                                                ImplicitCtorDtorStmt * implicit = strict_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor );
    747                                                 ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->get_callStmt() );
     750                                                ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->callStmt );
    748751                                                ApplicationExpr * ctorCall = nullptr;
    749                                                 if ( ctorStmt && (ctorCall = isIntrinsicCallExpr( ctorStmt->get_expr() )) && ctorCall->get_args().size() == 2 ) {
     752                                                if ( ctorStmt && (ctorCall = isIntrinsicCallExpr( ctorStmt->expr )) && ctorCall->get_args().size() == 2 ) {
    750753                                                        // clean up intrinsic copy constructor calls by making them into SingleInits
    751                                                         objDecl->set_init( new SingleInit( ctorCall->get_args().back() ) );
    752                                                         ctorCall->get_args().pop_back();
     754                                                        Expression * ctorArg = ctorCall->args.back();
     755                                                        std::swap( ctorArg->env, ctorCall->env );
     756                                                        objDecl->init = new SingleInit( ctorArg );
     757
     758                                                        ctorCall->args.pop_back();
    753759                                                } else {
    754760                                                        stmtsToAddAfter.push_back( ctor );
    755                                                         objDecl->set_init( nullptr );
    756                                                         ctorInit->set_ctor( nullptr );
     761                                                        objDecl->init = nullptr;
     762                                                        ctorInit->ctor = nullptr;
    757763                                                }
    758764                                        } // if
    759                                 } else if ( Initializer * init = ctorInit->get_init() ) {
    760                                         objDecl->set_init( init );
    761                                         ctorInit->set_init( nullptr );
     765                                } else if ( Initializer * init = ctorInit->init ) {
     766                                        objDecl->init = init;
     767                                        ctorInit->init = nullptr;
    762768                                } else {
    763769                                        // no constructor and no initializer, which is okay
    764                                         objDecl->set_init( nullptr );
     770                                        objDecl->init = nullptr;
    765771                                } // if
    766772                                delete ctorInit;
     
    819825                                        assert( ! ctorInit->get_ctor() || ! ctorInit->get_init() );
    820826                                        Statement * dtor = ctorInit->get_dtor();
     827                                        // don't need to call intrinsic dtor, because it does nothing, but
     828                                        // non-intrinsic dtors must be called
    821829                                        if ( dtor && ! isIntrinsicSingleArgCallStmt( dtor ) ) {
    822                                                 // don't need to call intrinsic dtor, because it does nothing, but
    823                                                 // non-intrinsic dtors must be called
     830                                                // set dtor location to the object's location for error messages
     831                                                ctorInit->dtor->location = objDecl->location;
    824832                                                reverseDeclOrder.front().push_front( objDecl );
    825833                                        } // if
     
    832840                        GuardValue( labelVars );
    833841                        labelVars.clear();
     842                        // LabelFinder does not recurse into FunctionDecl, so need to visit
     843                        // its children manually.
    834844                        maybeAccept( funcDecl->type, finder );
    835845                        maybeAccept( funcDecl->statements, finder );
     
    933943                }
    934944
     945                void addIds( SymTab::Indexer & indexer, const std::list< DeclarationWithType * > & decls ) {
     946                        for ( auto d : decls ) {
     947                                indexer.addId( d );
     948                        }
     949                }
     950
     951                void addTypes( SymTab::Indexer & indexer, const std::list< TypeDecl * > & tds ) {
     952                        for ( auto td : tds ) {
     953                                indexer.addType( td );
     954                                addIds( indexer, td->assertions );
     955                        }
     956                }
     957
    935958                void GenStructMemberCalls::previsit( FunctionDecl * funcDecl ) {
    936                         GuardValue( funcDecl );
     959                        GuardValue( function );
    937960                        GuardValue( unhandled );
    938961                        GuardValue( usedUninit );
     
    967990                }
    968991
    969                 void addIds( SymTab::Indexer & indexer, const std::list< DeclarationWithType * > & decls ) {
    970                         for ( auto d : decls ) {
    971                                 indexer.addId( d );
    972                         }
    973                 }
    974 
    975                 void addTypes( SymTab::Indexer & indexer, const std::list< TypeDecl * > & tds ) {
    976                         for ( auto td : tds ) {
    977                                 indexer.addType( td );
    978                                 addIds( indexer, td->assertions );
    979                         }
    980                 }
    981 
    982992                void GenStructMemberCalls::postvisit( FunctionDecl * funcDecl ) {
    983993                        // remove the unhandled objects from usedUninit, because a call is inserted
     
    10121022                                        // skip non-DWT members
    10131023                                        if ( ! field ) continue;
     1024                                        // skip non-constructable members
     1025                                        if ( ! tryConstruct( field ) ) continue;
    10141026                                        // skip handled members
    10151027                                        if ( ! unhandled.count( field ) ) continue;
     
    11301142                }
    11311143
    1132                 DeclarationWithType * MutatingResolver::mutate( ObjectDecl *objectDecl ) {
     1144                DeclarationWithType * MutatingResolver::mutate( ObjectDecl * objectDecl ) {
    11331145                        // add object to the indexer assumes that there will be no name collisions
    11341146                        // in generated code. If this changes, add mutate methods for entities with
     
    11381150                }
    11391151
    1140                 Expression* MutatingResolver::mutate( UntypedExpr *untypedExpr ) {
    1141                         return strict_dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untypedExpr, indexer ) );
    1142                 }
    1143 
    1144                 Expression * FixCtorExprs::mutate( ConstructorExpr * ctorExpr ) {
     1152                Expression * MutatingResolver::mutate( UntypedExpr * untypedExpr ) {
     1153                        Expression * newExpr = untypedExpr;
     1154                        ResolvExpr::findVoidExpression( newExpr, indexer );
     1155                        return newExpr;
     1156                }
     1157
     1158                Expression * FixCtorExprs::postmutate( ConstructorExpr * ctorExpr ) {
    11451159                        static UniqueName tempNamer( "_tmp_ctor_expr" );
    11461160                        // xxx - is the size check necessary?
    1147                         assert( ctorExpr->has_result() && ctorExpr->get_result()->size() == 1 );
     1161                        assert( ctorExpr->result && ctorExpr->get_result()->size() == 1 );
    11481162
    11491163                        // xxx - ideally we would reuse the temporary generated from the copy constructor passes from within firstArg if it exists and not generate a temporary if it's unnecessary.
    1150                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );
    1151                         addDeclaration( tmp );
     1164                        ObjectDecl * tmp = ObjectDecl::newObject( tempNamer.newName(), ctorExpr->get_result()->clone(), nullptr );
     1165                        declsToAddBefore.push_back( tmp );
    11521166
    11531167                        // xxx - this can be TupleAssignExpr now. Need to properly handle this case.
     
    11581172                        delete ctorExpr;
    11591173
     1174                        // build assignment and replace constructor's first argument with new temporary
    11601175                        Expression *& firstArg = callExpr->get_args().front();
    1161 
    1162                         // xxx - hack in 'fake' assignment operator until resolver can easily be called in this pass. Once the resolver can be used in PassVisitor, this hack goes away.
    1163 
    1164                         // generate the type of assignment operator using the type of tmp minus any reference types
    1165                         Type * type = tmp->get_type()->stripReferences();
    1166                         FunctionType * ftype = SymTab::genAssignType( type );
    1167 
    1168                         // generate fake assignment decl and call it using &tmp and &firstArg
    1169                         // since tmp is guaranteed to be a reference and we want to assign pointers
    1170                         FunctionDecl * assignDecl = new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Intrinsic, ftype, nullptr );
    1171                         ApplicationExpr * assign = new ApplicationExpr( VariableExpr::functionPointer( assignDecl ) );
    1172                         assign->get_args().push_back( new AddressExpr( new VariableExpr( tmp ) ) );
    1173                         Expression * addrArg = new AddressExpr( firstArg );
    1174                         // if firstArg has type T&&, then &firstArg has type T*&.
    1175                         // Cast away the reference to a value type so that the argument
    1176                         // matches the assignment's parameter types
    1177                         if ( dynamic_cast<ReferenceType *>( addrArg->get_result() ) ) {
    1178                                 addrArg = new CastExpr( addrArg, addrArg->get_result()->stripReferences()->clone() );
    1179                         }
    1180                         assign->get_args().push_back( addrArg );
     1176                        Expression * assign = new UntypedExpr( new NameExpr( "?=?" ), { new AddressExpr( new VariableExpr( tmp ) ), new AddressExpr( firstArg ) } );
    11811177                        firstArg = new VariableExpr( tmp );
     1178
     1179                        // resolve assignment and dispose of new env
     1180                        ResolvExpr::findVoidExpression( assign, indexer );
     1181                        delete assign->env;
     1182                        assign->env = nullptr;
    11821183
    11831184                        // for constructor expr:
  • src/InitTweak/GenInit.cc

    r78315272 r3f7e12cb  
    2626#include "Common/UniqueName.h"     // for UniqueName
    2727#include "Common/utility.h"        // for ValueGuard, maybeClone
    28 #include "GenPoly/DeclMutator.h"   // for DeclMutator
    2928#include "GenPoly/GenPoly.h"       // for getFunctionType, isPolyType
    3029#include "GenPoly/ScopedSet.h"     // for ScopedSet, ScopedSet<>::const_iter...
     
    6261        };
    6362
    64         struct CtorDtor : public WithGuards, public WithShortCircuiting  {
     63        struct CtorDtor : public WithGuards, public WithShortCircuiting, public WithVisitorRef<CtorDtor>  {
    6564                /// create constructor and destructor statements for object declarations.
    6665                /// the actual call statements will be added in after the resolver has run
     
    7574                // that need to be constructed or destructed
    7675                void previsit( StructDecl *aggregateDecl );
    77                 void previsit( __attribute__((unused)) UnionDecl    * aggregateDecl ) { visit_children = false; }
    78                 void previsit( __attribute__((unused)) EnumDecl     * aggregateDecl ) { visit_children = false; }
    79                 void previsit( __attribute__((unused)) TraitDecl    * aggregateDecl ) { visit_children = false; }
    80                 void previsit( __attribute__((unused)) TypeDecl     * typeDecl )      { visit_children = false; }
    81                 void previsit( __attribute__((unused)) TypedefDecl  * typeDecl )      { visit_children = false; }
    82                 void previsit( __attribute__((unused)) FunctionType * funcType )      { visit_children = false; }
     76                void previsit( AggregateDecl * ) { visit_children = false; }
     77                void previsit( NamedTypeDecl * ) { visit_children = false; }
     78                void previsit( FunctionType * ) { visit_children = false; }
    8379
    8480                void previsit( CompoundStmt * compoundStmt );
     
    8985                // should not have a ConstructorInit generated.
    9086
    91                 bool isManaged( ObjectDecl * objDecl ) const ; // determine if object is managed
    92                 bool isManaged( Type * type ) const; // determine if type is managed
    93                 void handleDWT( DeclarationWithType * dwt ); // add type to managed if ctor/dtor
    94                 GenPoly::ScopedSet< std::string > managedTypes;
     87                ManagedTypes managedTypes;
    9588                bool inFunction = false;
    9689        };
    9790
    98         class HoistArrayDimension final : public GenPoly::DeclMutator {
    99           public:
    100                 typedef GenPoly::DeclMutator Parent;
    101 
     91        struct HoistArrayDimension final : public WithDeclsToAdd, public WithShortCircuiting, public WithGuards {
    10292                /// hoist dimension from array types in object declaration so that it uses a single
    10393                /// const variable of type size_t, so that side effecting array dimensions are only
     
    10595                static void hoistArrayDimension( std::list< Declaration * > & translationUnit );
    10696
    107           private:
    108                 using Parent::mutate;
    109 
    110                 virtual DeclarationWithType * mutate( ObjectDecl * objectDecl ) override;
    111                 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override;
     97                void premutate( ObjectDecl * objectDecl );
     98                DeclarationWithType * postmutate( ObjectDecl * objectDecl );
     99                void premutate( FunctionDecl *functionDecl );
    112100                // should not traverse into any of these declarations to find objects
    113101                // that need to be constructed or destructed
    114                 virtual Declaration* mutate( StructDecl *aggregateDecl ) override { return aggregateDecl; }
    115                 virtual Declaration* mutate( UnionDecl *aggregateDecl ) override { return aggregateDecl; }
    116                 virtual Declaration* mutate( EnumDecl *aggregateDecl ) override { return aggregateDecl; }
    117                 virtual Declaration* mutate( TraitDecl *aggregateDecl ) override { return aggregateDecl; }
    118                 virtual TypeDecl* mutate( TypeDecl *typeDecl ) override { return typeDecl; }
    119                 virtual Declaration* mutate( TypedefDecl *typeDecl ) override { return typeDecl; }
    120 
    121                 virtual Type* mutate( FunctionType *funcType ) override { return funcType; }
     102                void premutate( AggregateDecl * ) { visit_children = false; }
     103                void premutate( NamedTypeDecl * ) { visit_children = false; }
     104                void premutate( FunctionType * ) { visit_children = false; }
    122105
    123106                void hoist( Type * type );
     
    128111
    129112        void genInit( std::list< Declaration * > & translationUnit ) {
    130                 ReturnFixer::makeReturnTemp( translationUnit );
     113                fixReturnStatements( translationUnit );
    131114                HoistArrayDimension::hoistArrayDimension( translationUnit );
    132115                CtorDtor::generateCtorDtor( translationUnit );
    133116        }
    134117
    135         void ReturnFixer::makeReturnTemp( std::list< Declaration * > & translationUnit ) {
     118        void fixReturnStatements( std::list< Declaration * > & translationUnit ) {
    136119                PassVisitor<ReturnFixer> fixer;
    137120                mutateAll( translationUnit, fixer );
     
    143126                // hands off if the function returns a reference - we don't want to allocate a temporary if a variable's address
    144127                // is being returned
    145                 if ( returnStmt->get_expr() && returnVals.size() == 1 && ! dynamic_cast< ReferenceType * >( returnVals.front()->get_type() ) ) {
     128                if ( returnStmt->expr && returnVals.size() == 1 && isConstructable( returnVals.front()->get_type() ) ) {
    146129                        // explicitly construct the return value using the return expression and the retVal object
    147                         assertf( returnVals.front()->get_name() != "", "Function %s has unnamed return value\n", funcName.c_str() );
    148 
    149                         stmtsToAddBefore.push_back( genCtorDtor( "?{}", dynamic_cast< ObjectDecl *>( returnVals.front() ), returnStmt->get_expr() ) );
     130                        assertf( returnVals.front()->name != "", "Function %s has unnamed return value\n", funcName.c_str() );
     131
     132                        ObjectDecl * retVal = strict_dynamic_cast< ObjectDecl * >( returnVals.front() );
     133                        if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( returnStmt->expr ) ) {
     134                                // return statement has already been mutated - don't need to do it again
     135                                if ( varExpr->var == retVal ) return;
     136                        }
     137                        stmtsToAddBefore.push_back( genCtorDtor( "?{}", retVal, returnStmt->get_expr() ) );
    150138
    151139                        // return the retVal object
    152                         returnStmt->set_expr( new VariableExpr( returnVals.front() ) );
     140                        returnStmt->expr = new VariableExpr( returnVals.front() );
    153141                } // if
    154142        }
     
    158146                GuardValue( funcName );
    159147
    160                 ftype = functionDecl->get_functionType();
    161                 funcName = functionDecl->get_name();
     148                ftype = functionDecl->type;
     149                funcName = functionDecl->name;
    162150        }
    163151
     
    165153        // which would be incorrect if it is a side-effecting computation.
    166154        void HoistArrayDimension::hoistArrayDimension( std::list< Declaration * > & translationUnit ) {
    167                 HoistArrayDimension hoister;
    168                 hoister.mutateDeclarationList( translationUnit );
    169         }
    170 
    171         DeclarationWithType * HoistArrayDimension::mutate( ObjectDecl * objectDecl ) {
     155                PassVisitor<HoistArrayDimension> hoister;
     156                mutateAll( translationUnit, hoister );
     157        }
     158
     159        void HoistArrayDimension::premutate( ObjectDecl * objectDecl ) {
     160                GuardValue( storageClasses );
    172161                storageClasses = objectDecl->get_storageClasses();
    173                 DeclarationWithType * temp = Parent::mutate( objectDecl );
     162        }
     163
     164        DeclarationWithType * HoistArrayDimension::postmutate( ObjectDecl * objectDecl ) {
    174165                hoist( objectDecl->get_type() );
    175                 return temp;
     166                return objectDecl;
    176167        }
    177168
     
    194185
    195186                        arrayType->set_dimension( new VariableExpr( arrayDimension ) );
    196                         addDeclaration( arrayDimension );
     187                        declsToAddBefore.push_back( arrayDimension );
    197188
    198189                        hoist( arrayType->get_base() );
     
    201192        }
    202193
    203         DeclarationWithType * HoistArrayDimension::mutate( FunctionDecl *functionDecl ) {
    204                 ValueGuard< bool > oldInFunc( inFunction );
    205                 inFunction = true;
    206                 DeclarationWithType * decl = Parent::mutate( functionDecl );
    207                 return decl;
     194        void HoistArrayDimension::premutate( FunctionDecl * ) {
     195                GuardValue( inFunction );
    208196        }
    209197
     
    213201        }
    214202
    215         bool CtorDtor::isManaged( Type * type ) const {
    216                 // at least for now, references are never constructed
     203        bool ManagedTypes::isManaged( Type * type ) const {
     204                // references are never constructed
    217205                if ( dynamic_cast< ReferenceType * >( type ) ) return false;
    218206                // need to clear and reset qualifiers when determining if a type is managed
     
    221209                if ( TupleType * tupleType = dynamic_cast< TupleType * > ( type ) ) {
    222210                        // tuple is also managed if any of its components are managed
    223                         if ( std::any_of( tupleType->get_types().begin(), tupleType->get_types().end(), [&](Type * type) { return isManaged( type ); }) ) {
     211                        if ( std::any_of( tupleType->types.begin(), tupleType->types.end(), [&](Type * type) { return isManaged( type ); }) ) {
    224212                                return true;
    225213                        }
    226214                }
    227215                // a type is managed if it appears in the map of known managed types, or if it contains any polymorphism (is a type variable or generic type containing a type variable)
    228                 return managedTypes.find( SymTab::Mangler::mangle( type ) ) != managedTypes.end() || GenPoly::isPolyType( type );
    229         }
    230 
    231         bool CtorDtor::isManaged( ObjectDecl * objDecl ) const {
     216                return managedTypes.find( SymTab::Mangler::mangleConcrete( type ) ) != managedTypes.end() || GenPoly::isPolyType( type );
     217        }
     218
     219        bool ManagedTypes::isManaged( ObjectDecl * objDecl ) const {
    232220                Type * type = objDecl->get_type();
    233221                while ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
     
    237225        }
    238226
    239         void CtorDtor::handleDWT( DeclarationWithType * dwt ) {
     227        void ManagedTypes::handleDWT( DeclarationWithType * dwt ) {
    240228                // if this function is a user-defined constructor or destructor, mark down the type as "managed"
    241229                if ( ! LinkageSpec::isOverridable( dwt->get_linkage() ) && CodeGen::isCtorDtor( dwt->get_name() ) ) {
     
    244232                        Type * type = InitTweak::getPointerBase( params.front()->get_type() );
    245233                        assert( type );
    246                         managedTypes.insert( SymTab::Mangler::mangle( type ) );
    247                 }
    248         }
     234                        managedTypes.insert( SymTab::Mangler::mangleConcrete( type ) );
     235                }
     236        }
     237
     238        void ManagedTypes::handleStruct( StructDecl * aggregateDecl ) {
     239                // don't construct members, but need to take note if there is a managed member,
     240                // because that means that this type is also managed
     241                for ( Declaration * member : aggregateDecl->get_members() ) {
     242                        if ( ObjectDecl * field = dynamic_cast< ObjectDecl * >( member ) ) {
     243                                if ( isManaged( field ) ) {
     244                                        // generic parameters should not play a role in determining whether a generic type is constructed - construct all generic types, so that
     245                                        // polymorphic constructors make generic types managed types
     246                                        StructInstType inst( Type::Qualifiers(), aggregateDecl );
     247                                        managedTypes.insert( SymTab::Mangler::mangleConcrete( &inst ) );
     248                                        break;
     249                                }
     250                        }
     251                }
     252        }
     253
     254        void ManagedTypes::beginScope() { managedTypes.beginScope(); }
     255        void ManagedTypes::endScope() { managedTypes.endScope(); }
    249256
    250257        ImplicitCtorDtorStmt * genCtorDtor( const std::string & fname, ObjectDecl * objDecl, Expression * arg ) {
     
    291298
    292299        void CtorDtor::previsit( ObjectDecl * objDecl ) {
    293                 handleDWT( objDecl );
     300                managedTypes.handleDWT( objDecl );
    294301                // hands off if @=, extern, builtin, etc.
    295302                // even if unmanaged, try to construct global or static if initializer is not constexpr, since this is not legal C
    296                 if ( tryConstruct( objDecl ) && ( isManaged( objDecl ) || ((! inFunction || objDecl->get_storageClasses().is_static ) && ! isConstExpr( objDecl->get_init() ) ) ) ) {
     303                if ( tryConstruct( objDecl ) && ( managedTypes.isManaged( objDecl ) || ((! inFunction || objDecl->get_storageClasses().is_static ) && ! isConstExpr( objDecl->get_init() ) ) ) ) {
    297304                        // constructed objects cannot be designated
    298305                        if ( isDesignated( objDecl->get_init() ) ) throw SemanticError( "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n", objDecl );
     
    305312
    306313        void CtorDtor::previsit( FunctionDecl *functionDecl ) {
     314                visit_children = false;  // do not try and construct parameters or forall parameters
    307315                GuardValue( inFunction );
    308316                inFunction = true;
    309317
    310                 handleDWT( functionDecl );
     318                managedTypes.handleDWT( functionDecl );
    311319
    312320                GuardScope( managedTypes );
     
    314322                for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) {
    315323                        for ( DeclarationWithType *& assertion : tyDecl->get_assertions() ) {
    316                                 handleDWT( assertion );
     324                                managedTypes.handleDWT( assertion );
    317325                        }
    318326                }
    319327
    320                 PassVisitor<CtorDtor> newCtorDtor;
    321                 newCtorDtor.pass = *this;
    322                 maybeAccept( functionDecl->get_statements(), newCtorDtor );
    323                 visit_children = false;  // do not try and construct parameters or forall parameters - must happen after maybeAccept
     328                maybeAccept( functionDecl->get_statements(), *visitor );
    324329        }
    325330
     
    327332                visit_children = false; // do not try to construct and destruct aggregate members
    328333
    329                 // don't construct members, but need to take note if there is a managed member,
    330                 // because that means that this type is also managed
    331                 for ( Declaration * member : aggregateDecl->get_members() ) {
    332                         if ( ObjectDecl * field = dynamic_cast< ObjectDecl * >( member ) ) {
    333                                 if ( isManaged( field ) ) {
    334                                         StructInstType inst( Type::Qualifiers(), aggregateDecl );
    335                                         managedTypes.insert( SymTab::Mangler::mangle( &inst ) );
    336                                         break;
    337                                 }
    338                         }
    339                 }
    340         }
    341 
    342         void CtorDtor::previsit( __attribute__((unused)) CompoundStmt * compoundStmt ) {
     334                managedTypes.handleStruct( aggregateDecl );
     335        }
     336
     337        void CtorDtor::previsit( CompoundStmt * ) {
    343338                GuardScope( managedTypes );
    344339        }
  • src/InitTweak/GenInit.h

    r78315272 r3f7e12cb  
    1616#pragma once
    1717
    18 #include <list>               // for list
    19 #include <string>             // for string
     18#include <list>                // for list
     19#include <string>              // for string
    2020
    21 #include "SynTree/SynTree.h"  // for Visitor Nodes
     21#include "SynTree/SynTree.h"   // for Visitor Nodes
     22
     23#include "GenPoly/ScopedSet.h" // for ScopedSet
    2224
    2325namespace InitTweak {
     
    2527        void genInit( std::list< Declaration * > & translationUnit );
    2628
    27   /// generates a single ctor/dtor statement using objDecl as the 'this' parameter and arg as the optional argument
    28   ImplicitCtorDtorStmt * genCtorDtor( const std::string & fname, ObjectDecl * objDecl, Expression * arg = nullptr );
     29        /// Converts return statements into copy constructor calls on the hidden return variable
     30        void fixReturnStatements( std::list< Declaration * > & translationUnit );
     31
     32        /// generates a single ctor/dtor statement using objDecl as the 'this' parameter and arg as the optional argument
     33        ImplicitCtorDtorStmt * genCtorDtor( const std::string & fname, ObjectDecl * objDecl, Expression * arg = nullptr );
    2934
    3035        /// creates an appropriate ConstructorInit node which contains a constructor, destructor, and C-initializer
    3136        ConstructorInit * genCtorInit( ObjectDecl * objDecl );
     37
     38        class ManagedTypes {
     39        public:
     40                bool isManaged( ObjectDecl * objDecl ) const ; // determine if object is managed
     41                bool isManaged( Type * type ) const; // determine if type is managed
     42
     43                void handleDWT( DeclarationWithType * dwt ); // add type to managed if ctor/dtor
     44                void handleStruct( StructDecl * aggregateDecl ); // add type to managed if child is managed
     45
     46                void beginScope();
     47                void endScope();
     48        private:
     49                GenPoly::ScopedSet< std::string > managedTypes;
     50        };
    3251} // namespace
    3352
  • src/InitTweak/InitTweak.cc

    r78315272 r3f7e12cb  
    1 #include <stddef.h>                // for NULL
    21#include <algorithm>               // for find, all_of
    32#include <cassert>                 // for assertf, assert, strict_dynamic_cast
     
    2322#include "SynTree/Type.h"          // for FunctionType, ArrayType, PointerType
    2423#include "SynTree/Visitor.h"       // for Visitor, maybeAccept
     24#include "Tuples/Tuples.h"         // for Tuples::isTtype
    2525
    2626class UntypedValofExpr;
     
    170170        }
    171171
     172        bool InitExpander::addReference() {
     173                bool added = false;
     174                for ( Expression *& expr : cur ) {
     175                        expr = new AddressExpr( expr );
     176                        added = true;
     177                }
     178                return added;
     179        }
     180
    172181        namespace {
    173182                /// given index i, dimension d, initializer init, and callExpr f, generates
     
    184193                        callExpr->get_args().splice( callExpr->get_args().end(), args );
    185194
    186                         *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), NULL );
     195                        *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), nullptr );
    187196
    188197                        UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) );
     
    250259        // To accomplish this, generate switch statement, consuming all of expander's elements
    251260        Statement * InitImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) {
    252                 if ( ! init ) return NULL;
     261                if ( ! init ) return nullptr;
    253262                CompoundStmt * block = new CompoundStmt( noLabels );
    254263                build( dst, indices.begin(), indices.end(), init, back_inserter( block->get_kids() ) );
    255264                if ( block->get_kids().empty() ) {
    256265                        delete block;
    257                         return NULL;
     266                        return nullptr;
    258267                } else {
    259                         init = NULL; // init was consumed in creating the list init
     268                        init = nullptr; // init was consumed in creating the list init
    260269                        return block;
    261270                }
    262271        }
    263272
    264         Statement * ExprImpl::buildListInit( __attribute((unused)) UntypedExpr * dst, __attribute((unused)) std::list< Expression * > & indices ) {
    265                 return NULL;
     273        Statement * ExprImpl::buildListInit( UntypedExpr *, std::list< Expression * > & ) {
     274                return nullptr;
    266275        }
    267276
     
    270279        }
    271280
    272         bool tryConstruct( ObjectDecl * objDecl ) {
     281        Type * getTypeofThis( FunctionType * ftype ) {
     282                assertf( ftype, "getTypeofThis: nullptr ftype" );
     283                ObjectDecl * thisParam = getParamThis( ftype );
     284                ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( thisParam->type );
     285                return refType->base;
     286        }
     287
     288        ObjectDecl * getParamThis( FunctionType * ftype ) {
     289                assertf( ftype, "getParamThis: nullptr ftype" );
     290                auto & params = ftype->parameters;
     291                assertf( ! params.empty(), "getParamThis: ftype with 0 parameters: %s", toString( ftype ).c_str() );
     292                return strict_dynamic_cast< ObjectDecl * >( params.front() );
     293        }
     294
     295        bool tryConstruct( DeclarationWithType * dwt ) {
     296                ObjectDecl * objDecl = dynamic_cast< ObjectDecl * >( dwt );
     297                if ( ! objDecl ) return false;
    273298                return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) &&
    274                         (objDecl->get_init() == NULL ||
    275                                 ( objDecl->get_init() != NULL && objDecl->get_init()->get_maybeConstructed() ))
    276                         && ! objDecl->get_storageClasses().is_extern;
     299                        (objDecl->get_init() == nullptr ||
     300                                ( objDecl->get_init() != nullptr && objDecl->get_init()->get_maybeConstructed() ))
     301                        && ! objDecl->get_storageClasses().is_extern
     302                        && isConstructable( objDecl->type );
     303        }
     304
     305        bool isConstructable( Type * type ) {
     306                return ! dynamic_cast< VarArgsType * >( type ) && ! dynamic_cast< ReferenceType * >( type ) && ! dynamic_cast< FunctionType * >( type ) && ! Tuples::isTtype( type );
    277307        }
    278308
     
    314344                collectCtorDtorCalls( stmt, matches );
    315345                assert( matches.size() <= 1 );
    316                 return matches.size() == 1 ? matches.front() : NULL;
     346                return matches.size() == 1 ? matches.front() : nullptr;
    317347        }
    318348
     
    332362                        assert( expr );
    333363                        if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( expr ) ) {
    334                                 return varExpr->get_var();
     364                                return varExpr->var;
    335365                        } else if ( MemberExpr * memberExpr = dynamic_cast< MemberExpr * >( expr ) ) {
    336                                 return memberExpr->get_member();
     366                                return memberExpr->member;
    337367                        } else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
    338                                 return getCalledFunction( castExpr->get_arg() );
     368                                return getCalledFunction( castExpr->arg );
    339369                        } else if ( UntypedExpr * untypedExpr = dynamic_cast< UntypedExpr * >( expr ) ) {
    340370                                return handleDerefCalledFunction( untypedExpr );
     
    342372                                return handleDerefCalledFunction( appExpr );
    343373                        } else if ( AddressExpr * addrExpr = dynamic_cast< AddressExpr * >( expr ) ) {
    344                                 return getCalledFunction( addrExpr->get_arg() );
     374                                return getCalledFunction( addrExpr->arg );
     375                        } else if ( CommaExpr * commaExpr = dynamic_cast< CommaExpr * >( expr ) ) {
     376                                return getCalledFunction( commaExpr->arg2 );
    345377                        }
    346378                        return nullptr;
     
    359391        ApplicationExpr * isIntrinsicCallExpr( Expression * expr ) {
    360392                ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr );
    361                 if ( ! appExpr ) return NULL;
     393                if ( ! appExpr ) return nullptr;
    362394                DeclarationWithType * function = getCalledFunction( appExpr->get_function() );
    363395                assertf( function, "getCalledFunction returned nullptr: %s", toString( appExpr->get_function() ).c_str() );
    364396                // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor
    365397                // will call all member dtors, and some members may have a user defined dtor.
    366                 return function->get_linkage() == LinkageSpec::Intrinsic ? appExpr : NULL;
     398                return function->get_linkage() == LinkageSpec::Intrinsic ? appExpr : nullptr;
    367399        }
    368400
     
    482514                        return refType->get_base();
    483515                } else {
    484                         return NULL;
     516                        return nullptr;
    485517                }
    486518        }
     
    488520        Type * isPointerType( Type * type ) {
    489521                if ( getPointerBase( type ) ) return type;
    490                 else return NULL;
     522                else return nullptr;
    491523        }
    492524
     
    557589        FunctionDecl * isCopyFunction( Declaration * decl, const std::string & fname ) {
    558590                FunctionDecl * function = dynamic_cast< FunctionDecl * >( decl );
    559                 if ( ! function ) return 0;
    560                 if ( function->get_name() != fname ) return 0;
    561                 FunctionType * ftype = function->get_functionType();
    562                 if ( ftype->get_parameters().size() != 2 ) return 0;
     591                if ( ! function ) return nullptr;
     592                if ( function->name != fname ) return nullptr;
     593                FunctionType * ftype = function->type;
     594                if ( ftype->parameters.size() != 2 ) return nullptr;
    563595
    564596                Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
    565                 Type * t2 = ftype->get_parameters().back()->get_type();
     597                Type * t2 = ftype->parameters.back()->get_type();
    566598                assert( t1 );
    567599
     
    583615        }
    584616        FunctionDecl * isDefaultConstructor( Declaration * decl ) {
    585                 if ( isConstructor( decl->get_name() ) ) {
     617                if ( isConstructor( decl->name ) ) {
    586618                        if ( FunctionDecl * func = dynamic_cast< FunctionDecl * >( decl ) ) {
    587                                 if ( func->get_functionType()->get_parameters().size() == 1 ) {
     619                                if ( func->type->parameters.size() == 1 ) {
    588620                                        return func;
    589621                                }
  • src/InitTweak/InitTweak.h

    r78315272 r3f7e12cb  
    3030        FunctionDecl * isCopyFunction( Declaration * decl, const std::string & fname );
    3131
     32        /// returns the base type of the first parameter to a constructor/destructor/assignment function
     33        Type * getTypeofThis( FunctionType * ftype );
     34
     35        /// returns the first parameter of a constructor/destructor/assignment function
     36        ObjectDecl * getParamThis( FunctionType * ftype );
     37
    3238        /// transform Initializer into an argument list that can be passed to a call expression
    3339        std::list< Expression * > makeInitList( Initializer * init );
    3440
    35         /// True if the resolver should try to construct objDecl
    36         bool tryConstruct( ObjectDecl * objDecl );
     41        /// True if the resolver should try to construct dwt
     42        bool tryConstruct( DeclarationWithType * dwt );
     43
     44        /// True if the type can have a user-defined constructor
     45        bool isConstructable( Type * t );
    3746
    3847        /// True if the Initializer contains designations
     
    96105                void addArrayIndex( Expression * index, Expression * dimension );
    97106                void clearArrayIndices();
     107                bool addReference();
    98108
    99109                class ExpanderImpl;
  • src/MakeLibCfa.cc

    r78315272 r3f7e12cb  
    119119                        newDecls.push_back( funcDecl );
    120120
     121                        Statement * stmt = nullptr;
    121122                        switch ( opInfo.type ) {
    122123                          case CodeGen::OT_INDEX:
     
    128129                          case CodeGen::OT_POSTFIXASSIGN:
    129130                          case CodeGen::OT_INFIXASSIGN:
     131                                        // return the recursive call
     132                                        stmt = new ReturnStmt( noLabels, newExpr );
     133                                        break;
    130134                          case CodeGen::OT_CTOR:
    131135                          case CodeGen::OT_DTOR:
    132                                 // return the recursive call
    133                                         funcDecl->get_statements()->get_kids().push_back( new ReturnStmt( std::list< Label >(), newExpr ) );
     136                                        // execute the recursive call
     137                                        stmt = new ExprStmt( noLabels, newExpr );
    134138                                        break;
    135139                          case CodeGen::OT_CONSTANT:
     
    138142                                assert( false );
    139143                        } // switch
     144                        funcDecl->get_statements()->push_back( stmt );
    140145                }
    141146        } // namespace
  • src/Makefile.in

    r78315272 r3f7e12cb  
    172172        GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \
    173173        GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \
    174         GenPoly/driver_cfa_cpp-PolyMutator.$(OBJEXT) \
    175174        GenPoly/driver_cfa_cpp-ScrubTyVars.$(OBJEXT) \
    176175        GenPoly/driver_cfa_cpp-Lvalue.$(OBJEXT) \
    177176        GenPoly/driver_cfa_cpp-Specialize.$(OBJEXT) \
    178         GenPoly/driver_cfa_cpp-CopyParams.$(OBJEXT) \
    179177        GenPoly/driver_cfa_cpp-FindFunction.$(OBJEXT) \
    180         GenPoly/driver_cfa_cpp-DeclMutator.$(OBJEXT) \
    181178        GenPoly/driver_cfa_cpp-InstantiateGeneric.$(OBJEXT) \
    182179        InitTweak/driver_cfa_cpp-GenInit.$(OBJEXT) \
     
    253250        SynTree/driver_cfa_cpp-Visitor.$(OBJEXT) \
    254251        SynTree/driver_cfa_cpp-Mutator.$(OBJEXT) \
    255         SynTree/driver_cfa_cpp-AddStmtVisitor.$(OBJEXT) \
    256252        SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT) \
    257253        SynTree/driver_cfa_cpp-Attribute.$(OBJEXT) \
     
    497493        ControlStruct/ForExprMutator.cc \
    498494        ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \
    499         GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \
    500         GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \
    501         GenPoly/CopyParams.cc GenPoly/FindFunction.cc \
    502         GenPoly/DeclMutator.cc GenPoly/InstantiateGeneric.cc \
    503         InitTweak/GenInit.cc InitTweak/FixInit.cc \
    504         InitTweak/FixGlobalInit.cc InitTweak/InitTweak.cc \
    505         Parser/parser.yy Parser/lex.ll Parser/TypedefTable.cc \
    506         Parser/ParseNode.cc Parser/DeclarationNode.cc \
    507         Parser/ExpressionNode.cc Parser/StatementNode.cc \
    508         Parser/InitializerNode.cc Parser/TypeData.cc \
    509         Parser/LinkageSpec.cc Parser/parserutility.cc \
    510         ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \
    511         ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \
    512         ResolvExpr/CommonType.cc ResolvExpr/ConversionCost.cc \
    513         ResolvExpr/CastCost.cc ResolvExpr/PtrsCastable.cc \
    514         ResolvExpr/AdjustExprType.cc ResolvExpr/AlternativePrinter.cc \
    515         ResolvExpr/Resolver.cc ResolvExpr/ResolveTypeof.cc \
    516         ResolvExpr/RenameVars.cc ResolvExpr/FindOpenVars.cc \
    517         ResolvExpr/PolyCost.cc ResolvExpr/Occurs.cc \
    518         ResolvExpr/TypeEnvironment.cc ResolvExpr/CurrentObject.cc \
    519         SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \
    520         SymTab/FixFunction.cc SymTab/ImplementationType.cc \
    521         SymTab/TypeEquality.cc SymTab/Autogen.cc SynTree/Type.cc \
    522         SynTree/VoidType.cc SynTree/BasicType.cc \
    523         SynTree/PointerType.cc SynTree/ArrayType.cc \
    524         SynTree/ReferenceType.cc SynTree/FunctionType.cc \
    525         SynTree/ReferenceToType.cc SynTree/TupleType.cc \
    526         SynTree/TypeofType.cc SynTree/AttrType.cc \
     495        GenPoly/GenPoly.cc GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc \
     496        GenPoly/Specialize.cc GenPoly/FindFunction.cc \
     497        GenPoly/InstantiateGeneric.cc InitTweak/GenInit.cc \
     498        InitTweak/FixInit.cc InitTweak/FixGlobalInit.cc \
     499        InitTweak/InitTweak.cc Parser/parser.yy Parser/lex.ll \
     500        Parser/TypedefTable.cc Parser/ParseNode.cc \
     501        Parser/DeclarationNode.cc Parser/ExpressionNode.cc \
     502        Parser/StatementNode.cc Parser/InitializerNode.cc \
     503        Parser/TypeData.cc Parser/LinkageSpec.cc \
     504        Parser/parserutility.cc ResolvExpr/AlternativeFinder.cc \
     505        ResolvExpr/Alternative.cc ResolvExpr/Unify.cc \
     506        ResolvExpr/PtrsAssignable.cc ResolvExpr/CommonType.cc \
     507        ResolvExpr/ConversionCost.cc ResolvExpr/CastCost.cc \
     508        ResolvExpr/PtrsCastable.cc ResolvExpr/AdjustExprType.cc \
     509        ResolvExpr/AlternativePrinter.cc ResolvExpr/Resolver.cc \
     510        ResolvExpr/ResolveTypeof.cc ResolvExpr/RenameVars.cc \
     511        ResolvExpr/FindOpenVars.cc ResolvExpr/PolyCost.cc \
     512        ResolvExpr/Occurs.cc ResolvExpr/TypeEnvironment.cc \
     513        ResolvExpr/CurrentObject.cc SymTab/Indexer.cc \
     514        SymTab/Mangler.cc SymTab/Validate.cc SymTab/FixFunction.cc \
     515        SymTab/ImplementationType.cc SymTab/TypeEquality.cc \
     516        SymTab/Autogen.cc SynTree/Type.cc SynTree/VoidType.cc \
     517        SynTree/BasicType.cc SynTree/PointerType.cc \
     518        SynTree/ArrayType.cc SynTree/ReferenceType.cc \
     519        SynTree/FunctionType.cc SynTree/ReferenceToType.cc \
     520        SynTree/TupleType.cc SynTree/TypeofType.cc SynTree/AttrType.cc \
    527521        SynTree/VarArgsType.cc SynTree/ZeroOneType.cc \
    528522        SynTree/Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \
     
    535529        SynTree/NamedTypeDecl.cc SynTree/TypeDecl.cc \
    536530        SynTree/Initializer.cc SynTree/Visitor.cc SynTree/Mutator.cc \
    537         SynTree/AddStmtVisitor.cc SynTree/TypeSubstitution.cc \
    538         SynTree/Attribute.cc SynTree/VarExprReplacer.cc \
    539         Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \
    540         Tuples/Explode.cc Virtual/ExpandCasts.cc
     531        SynTree/TypeSubstitution.cc SynTree/Attribute.cc \
     532        SynTree/VarExprReplacer.cc Tuples/TupleAssignment.cc \
     533        Tuples/TupleExpansion.cc Tuples/Explode.cc \
     534        Virtual/ExpandCasts.cc
    541535MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \
    542536        ${cfa_cpplib_PROGRAMS}}
     
    717711GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT): GenPoly/$(am__dirstamp) \
    718712        GenPoly/$(DEPDIR)/$(am__dirstamp)
    719 GenPoly/driver_cfa_cpp-PolyMutator.$(OBJEXT): GenPoly/$(am__dirstamp) \
    720         GenPoly/$(DEPDIR)/$(am__dirstamp)
    721713GenPoly/driver_cfa_cpp-ScrubTyVars.$(OBJEXT): GenPoly/$(am__dirstamp) \
    722714        GenPoly/$(DEPDIR)/$(am__dirstamp)
     
    725717GenPoly/driver_cfa_cpp-Specialize.$(OBJEXT): GenPoly/$(am__dirstamp) \
    726718        GenPoly/$(DEPDIR)/$(am__dirstamp)
    727 GenPoly/driver_cfa_cpp-CopyParams.$(OBJEXT): GenPoly/$(am__dirstamp) \
    728         GenPoly/$(DEPDIR)/$(am__dirstamp)
    729719GenPoly/driver_cfa_cpp-FindFunction.$(OBJEXT):  \
    730720        GenPoly/$(am__dirstamp) GenPoly/$(DEPDIR)/$(am__dirstamp)
    731 GenPoly/driver_cfa_cpp-DeclMutator.$(OBJEXT): GenPoly/$(am__dirstamp) \
    732         GenPoly/$(DEPDIR)/$(am__dirstamp)
    733721GenPoly/driver_cfa_cpp-InstantiateGeneric.$(OBJEXT):  \
    734722        GenPoly/$(am__dirstamp) GenPoly/$(DEPDIR)/$(am__dirstamp)
     
    929917SynTree/driver_cfa_cpp-Mutator.$(OBJEXT): SynTree/$(am__dirstamp) \
    930918        SynTree/$(DEPDIR)/$(am__dirstamp)
    931 SynTree/driver_cfa_cpp-AddStmtVisitor.$(OBJEXT):  \
    932         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    933919SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT):  \
    934920        SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
     
    1007993@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Po@am__quote@
    1008994@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Po@am__quote@
    1009 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-CopyParams.Po@am__quote@
    1010 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-DeclMutator.Po@am__quote@
    1011995@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-FindFunction.Po@am__quote@
    1012996@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-GenPoly.Po@am__quote@
    1013997@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-InstantiateGeneric.Po@am__quote@
    1014998@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-Lvalue.Po@am__quote@
    1015 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-PolyMutator.Po@am__quote@
    1016999@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Po@am__quote@
    10171000@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-Specialize.Po@am__quote@
     
    10561039@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TypeEquality.Po@am__quote@
    10571040@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po@am__quote@
    1058 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-AddStmtVisitor.Po@am__quote@
    10591041@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-AddressExpr.Po@am__quote@
    10601042@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-AggregateDecl.Po@am__quote@
     
    14501432@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-GenPoly.obj `if test -f 'GenPoly/GenPoly.cc'; then $(CYGPATH_W) 'GenPoly/GenPoly.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/GenPoly.cc'; fi`
    14511433
    1452 GenPoly/driver_cfa_cpp-PolyMutator.o: GenPoly/PolyMutator.cc
    1453 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-PolyMutator.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-PolyMutator.Tpo -c -o GenPoly/driver_cfa_cpp-PolyMutator.o `test -f 'GenPoly/PolyMutator.cc' || echo '$(srcdir)/'`GenPoly/PolyMutator.cc
    1454 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-PolyMutator.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-PolyMutator.Po
    1455 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/PolyMutator.cc' object='GenPoly/driver_cfa_cpp-PolyMutator.o' libtool=no @AMDEPBACKSLASH@
    1456 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1457 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-PolyMutator.o `test -f 'GenPoly/PolyMutator.cc' || echo '$(srcdir)/'`GenPoly/PolyMutator.cc
    1458 
    1459 GenPoly/driver_cfa_cpp-PolyMutator.obj: GenPoly/PolyMutator.cc
    1460 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-PolyMutator.obj -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-PolyMutator.Tpo -c -o GenPoly/driver_cfa_cpp-PolyMutator.obj `if test -f 'GenPoly/PolyMutator.cc'; then $(CYGPATH_W) 'GenPoly/PolyMutator.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/PolyMutator.cc'; fi`
    1461 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-PolyMutator.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-PolyMutator.Po
    1462 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/PolyMutator.cc' object='GenPoly/driver_cfa_cpp-PolyMutator.obj' libtool=no @AMDEPBACKSLASH@
    1463 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1464 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-PolyMutator.obj `if test -f 'GenPoly/PolyMutator.cc'; then $(CYGPATH_W) 'GenPoly/PolyMutator.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/PolyMutator.cc'; fi`
    1465 
    14661434GenPoly/driver_cfa_cpp-ScrubTyVars.o: GenPoly/ScrubTyVars.cc
    14671435@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-ScrubTyVars.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Tpo -c -o GenPoly/driver_cfa_cpp-ScrubTyVars.o `test -f 'GenPoly/ScrubTyVars.cc' || echo '$(srcdir)/'`GenPoly/ScrubTyVars.cc
     
    15061474@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-Specialize.obj `if test -f 'GenPoly/Specialize.cc'; then $(CYGPATH_W) 'GenPoly/Specialize.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/Specialize.cc'; fi`
    15071475
    1508 GenPoly/driver_cfa_cpp-CopyParams.o: GenPoly/CopyParams.cc
    1509 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-CopyParams.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-CopyParams.Tpo -c -o GenPoly/driver_cfa_cpp-CopyParams.o `test -f 'GenPoly/CopyParams.cc' || echo '$(srcdir)/'`GenPoly/CopyParams.cc
    1510 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-CopyParams.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-CopyParams.Po
    1511 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/CopyParams.cc' object='GenPoly/driver_cfa_cpp-CopyParams.o' libtool=no @AMDEPBACKSLASH@
    1512 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1513 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-CopyParams.o `test -f 'GenPoly/CopyParams.cc' || echo '$(srcdir)/'`GenPoly/CopyParams.cc
    1514 
    1515 GenPoly/driver_cfa_cpp-CopyParams.obj: GenPoly/CopyParams.cc
    1516 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-CopyParams.obj -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-CopyParams.Tpo -c -o GenPoly/driver_cfa_cpp-CopyParams.obj `if test -f 'GenPoly/CopyParams.cc'; then $(CYGPATH_W) 'GenPoly/CopyParams.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/CopyParams.cc'; fi`
    1517 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-CopyParams.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-CopyParams.Po
    1518 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/CopyParams.cc' object='GenPoly/driver_cfa_cpp-CopyParams.obj' libtool=no @AMDEPBACKSLASH@
    1519 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1520 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-CopyParams.obj `if test -f 'GenPoly/CopyParams.cc'; then $(CYGPATH_W) 'GenPoly/CopyParams.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/CopyParams.cc'; fi`
    1521 
    15221476GenPoly/driver_cfa_cpp-FindFunction.o: GenPoly/FindFunction.cc
    15231477@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-FindFunction.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-FindFunction.Tpo -c -o GenPoly/driver_cfa_cpp-FindFunction.o `test -f 'GenPoly/FindFunction.cc' || echo '$(srcdir)/'`GenPoly/FindFunction.cc
     
    15341488@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-FindFunction.obj `if test -f 'GenPoly/FindFunction.cc'; then $(CYGPATH_W) 'GenPoly/FindFunction.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/FindFunction.cc'; fi`
    15351489
    1536 GenPoly/driver_cfa_cpp-DeclMutator.o: GenPoly/DeclMutator.cc
    1537 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-DeclMutator.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-DeclMutator.Tpo -c -o GenPoly/driver_cfa_cpp-DeclMutator.o `test -f 'GenPoly/DeclMutator.cc' || echo '$(srcdir)/'`GenPoly/DeclMutator.cc
    1538 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-DeclMutator.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-DeclMutator.Po
    1539 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/DeclMutator.cc' object='GenPoly/driver_cfa_cpp-DeclMutator.o' libtool=no @AMDEPBACKSLASH@
    1540 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1541 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-DeclMutator.o `test -f 'GenPoly/DeclMutator.cc' || echo '$(srcdir)/'`GenPoly/DeclMutator.cc
    1542 
    1543 GenPoly/driver_cfa_cpp-DeclMutator.obj: GenPoly/DeclMutator.cc
    1544 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-DeclMutator.obj -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-DeclMutator.Tpo -c -o GenPoly/driver_cfa_cpp-DeclMutator.obj `if test -f 'GenPoly/DeclMutator.cc'; then $(CYGPATH_W) 'GenPoly/DeclMutator.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/DeclMutator.cc'; fi`
    1545 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-DeclMutator.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-DeclMutator.Po
    1546 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/DeclMutator.cc' object='GenPoly/driver_cfa_cpp-DeclMutator.obj' libtool=no @AMDEPBACKSLASH@
    1547 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1548 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-DeclMutator.obj `if test -f 'GenPoly/DeclMutator.cc'; then $(CYGPATH_W) 'GenPoly/DeclMutator.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/DeclMutator.cc'; fi`
    1549 
    15501490GenPoly/driver_cfa_cpp-InstantiateGeneric.o: GenPoly/InstantiateGeneric.cc
    15511491@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-InstantiateGeneric.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-InstantiateGeneric.Tpo -c -o GenPoly/driver_cfa_cpp-InstantiateGeneric.o `test -f 'GenPoly/InstantiateGeneric.cc' || echo '$(srcdir)/'`GenPoly/InstantiateGeneric.cc
     
    25832523@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    25842524@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Mutator.obj `if test -f 'SynTree/Mutator.cc'; then $(CYGPATH_W) 'SynTree/Mutator.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Mutator.cc'; fi`
    2585 
    2586 SynTree/driver_cfa_cpp-AddStmtVisitor.o: SynTree/AddStmtVisitor.cc
    2587 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-AddStmtVisitor.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-AddStmtVisitor.Tpo -c -o SynTree/driver_cfa_cpp-AddStmtVisitor.o `test -f 'SynTree/AddStmtVisitor.cc' || echo '$(srcdir)/'`SynTree/AddStmtVisitor.cc
    2588 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-AddStmtVisitor.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-AddStmtVisitor.Po
    2589 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/AddStmtVisitor.cc' object='SynTree/driver_cfa_cpp-AddStmtVisitor.o' libtool=no @AMDEPBACKSLASH@
    2590 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2591 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-AddStmtVisitor.o `test -f 'SynTree/AddStmtVisitor.cc' || echo '$(srcdir)/'`SynTree/AddStmtVisitor.cc
    2592 
    2593 SynTree/driver_cfa_cpp-AddStmtVisitor.obj: SynTree/AddStmtVisitor.cc
    2594 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-AddStmtVisitor.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-AddStmtVisitor.Tpo -c -o SynTree/driver_cfa_cpp-AddStmtVisitor.obj `if test -f 'SynTree/AddStmtVisitor.cc'; then $(CYGPATH_W) 'SynTree/AddStmtVisitor.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/AddStmtVisitor.cc'; fi`
    2595 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-AddStmtVisitor.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-AddStmtVisitor.Po
    2596 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/AddStmtVisitor.cc' object='SynTree/driver_cfa_cpp-AddStmtVisitor.obj' libtool=no @AMDEPBACKSLASH@
    2597 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2598 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-AddStmtVisitor.obj `if test -f 'SynTree/AddStmtVisitor.cc'; then $(CYGPATH_W) 'SynTree/AddStmtVisitor.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/AddStmtVisitor.cc'; fi`
    25992525
    26002526SynTree/driver_cfa_cpp-TypeSubstitution.o: SynTree/TypeSubstitution.cc
  • src/Parser/DeclarationNode.cc

    r78315272 r3f7e12cb  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 10 17:02:00 2017
    13 // Update Count     : 1021
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Sep 23 18:16:48 2017
     13// Update Count     : 1024
    1414//
    1515
     
    4040using namespace std;
    4141
    42 // These must remain in the same order as the corresponding DeclarationNode enumerations.
    43 const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "NoBasicTypeNames" };
     42// These must harmonize with the corresponding DeclarationNode enumerations.
     43const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "int128", "float80", "float128", "NoBasicTypeNames" };
    4444const char * DeclarationNode::complexTypeNames[] = { "_Complex", "_Imaginary", "NoComplexTypeNames" };
    4545const char * DeclarationNode::signednessNames[] = { "signed", "unsigned", "NoSignednessNames" };
     
    10311031
    10321032        if ( variable.tyClass != NoTypeClass ) {
    1033                 static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype };
    1034                 assertf( sizeof(kindMap)/sizeof(kindMap[0] == NoTypeClass-1), "DeclarationNode::build: kindMap is out of sync." );
     1033                // otype is internally converted to dtype + otype parameters
     1034                static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype };
     1035                assertf( sizeof(kindMap)/sizeof(kindMap[0]) == NoTypeClass, "DeclarationNode::build: kindMap is out of sync." );
    10351036                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    1036                 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.initializer ? variable.initializer->buildType() : nullptr );
     1037                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
    10371038                buildList( variable.assertions, ret->get_assertions() );
    10381039                return ret;
  • src/Parser/ExpressionNode.cc

    r78315272 r3f7e12cb  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep 14 23:09:34 2017
    13 // Update Count     : 690
     12// Last Modified On : Wed Sep 27 22:51:55 2017
     13// Update Count     : 781
    1414//
    1515
     
    6060static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }
    6161
     62static const char * lnthsInt[2][6] = {
     63        { "int8_t", "int16_t", "int32_t", "int64_t", "size_t", },
     64        { "uint8_t", "uint16_t", "uint32_t", "uint64_t", "size_t", }
     65}; // lnthsInt
     66
     67static inline void checkLNInt( string & str, int & lnth, int & size ) {
     68        string::size_type posn = str.find_first_of( "lL" ), start = posn;
     69  if ( posn == string::npos ) return;
     70        size = 4;                                                                                       // assume largest size
     71        posn += 1;                                                                                      // advance to size
     72        if ( str[posn] == '8' ) {                                                       // 8
     73                lnth = 0;
     74        } else if ( str[posn] == '1' ) {
     75                posn += 1;
     76                if ( str[posn] == '6' ) {                                               // 16
     77                        lnth = 1;
     78                } else {                                                                                // 128
     79                        posn += 1;
     80                        lnth = 5;
     81                } // if
     82        } else {
     83                if ( str[posn] == '3' ) {                                               // 32
     84                        lnth = 2;
     85                } else if ( str[posn] == '6' ) {                                // 64
     86                        lnth = 3;
     87                } else {
     88                        assertf( false, "internal error, bad integral length %s", str.c_str() );
     89                } // if
     90                posn += 1;
     91        } // if
     92        str.erase( start, posn - start + 1 );                           // remove length suffix
     93} // checkLNInt
     94
    6295static void sepNumeric( string & str, string & units ) {
    6396        string::size_type posn = str.find_first_of( "`" );
     
    69102
    70103Expression * build_constantInteger( string & str ) {
    71         static const BasicType::Kind kind[2][5] = {
     104        static const BasicType::Kind kind[2][6] = {
    72105                // short (h) must be before char (hh)
    73                 { BasicType::ShortSignedInt, BasicType::SignedChar, BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt },
    74                 { BasicType::ShortUnsignedInt, BasicType::UnsignedChar, BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt },
     106                { BasicType::ShortSignedInt, BasicType::SignedChar, BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt, BasicType::SignedInt128, },
     107                { BasicType::ShortUnsignedInt, BasicType::UnsignedChar, BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::UnsignedInt128, },
    75108        };
    76109
    77         string units;                                                                           // units
     110        string units;
    78111        sepNumeric( str, units );                                                       // separate constant from units
    79112
    80113        bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
    81         int size;                                                                                       // 0 => short, 1 => char, 2 => int, 3 => long int, 4 => long long int, 5 => size_t
     114        int size;                                                                                       // 0 => short, 1 => char, 2 => int, 3 => long int, 4 => long long int, 5 => int128
     115        int lnth = -1;                                                                          // literal length
     116
    82117        unsigned long long int v;                                                       // converted integral value
    83118        size_t last = str.length() - 1;                                         // last character of constant
     
    140175                        } // if
    141176                        str.erase( last - size - 1, size + 1 );         // remove 'h'/"hh"
     177                } else {                                                                                // suffix "ln" ?
     178                        checkLNInt( str, lnth, size );
    142179                } // if
    143180        } else if ( checkL( str[ last ] ) ) {                           // suffix 'l' ?
     
    163200                str.erase( last - size, size + 1 );                             // remove 'h'/"hh"
    164201        } else if ( checkZ( str[last] ) ) {                                     // suffix 'z' ?
    165                 size = 5;
     202                lnth = 4;
    166203                str.erase( last, 1 );                                                   // remove 'z'
    167         } // if
    168 
     204        } else {                                                                                        // suffix "ln" ?
     205                checkLNInt( str, lnth, size );
     206        } // if
     207
     208        assert( 0 <= size && size < 6 );
     209        // Constant type is correct for overload resolving.
    169210        ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );
    170         if ( Unsigned && size < 2 ) {                                           // less than int ?
    171                 // int i = -1uh => 65535 not -1, so cast is necessary for unsigned, which eliminates warnings for large values.
     211        if ( Unsigned && size < 2 ) {                                           // hh or h, less than int ?
     212                // int i = -1uh => 65535 not -1, so cast is necessary for unsigned, which unfortunately eliminates warnings for large values.
    172213                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ) );
    173         } else if ( size == 5 ) {                                                       // explicit cast to size_t
    174                 ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), "size_t", false ) );
     214        } else if ( lnth != -1 ) {                                                      // explicit length ?
     215                if ( lnth == 5 ) {                                                              // int128 ?
     216                        size = 5;
     217                        ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ) );
     218                } else {
     219                        ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), lnthsInt[Unsigned][lnth], false ) );
     220                } // if
    175221        } // if
    176222  CLEANUP:
     
    182228        return ret;
    183229} // build_constantInteger
     230
     231
     232static inline void checkLNFloat( string & str, int & lnth, int & size ) {
     233        string::size_type posn = str.find_first_of( "lL" ), start = posn;
     234  if ( posn == string::npos ) return;
     235        size = 2;                                                                                       // assume largest size
     236        lnth = 0;
     237        posn += 1;                                                                                      // advance to size
     238        if ( str[posn] == '3' ) {                                                       // 32
     239                size = 0;
     240        } else if ( str[posn] == '6' ) {                                        // 64
     241                size = 1;
     242        } else if ( str[posn] == '8' || str[posn] == '1' ) { // 80, 128
     243                size = 2;
     244                if ( str[posn] == '1' ) posn += 1;
     245        } else {
     246                assertf( false, "internal error, bad floating point length %s", str.c_str() );
     247        } // if
     248        posn += 1;
     249        str.erase( start, posn - start + 1 );                           // remove length suffix
     250} // checkLNFloat
     251
    184252
    185253Expression * build_constantFloat( string & str ) {
     
    189257        };
    190258
    191         string units;                                                                           // units
     259        string units;
    192260        sepNumeric( str, units );                                                       // separate constant from units
    193261
    194262        bool complx = false;                                                            // real, complex
    195         int size = 1;                                                                           // 0 => float, 1 => double (default), 2 => long double
     263        int size = 1;                                                                           // 0 => float, 1 => double, 2 => long double
     264        int lnth = -1;                                                                          // literal length
    196265        // floating-point constant has minimum of 2 characters: 1. or .1
    197266        size_t last = str.length() - 1;
     
    211280        } else if ( checkL( str[last] ) ) {                                     // long double ?
    212281                size = 2;
     282        } else {
     283                size = 1;                                                                               // double (default)
     284                checkLNFloat( str, lnth, size );
    213285        } // if
    214286        if ( ! complx && checkI( str[last - 1] ) ) {            // imaginary ?
     
    216288        } // if
    217289
     290        assert( 0 <= size && size < 3 );
    218291        Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );
     292        if ( lnth != -1 ) {                                                                     // explicit length ?
     293                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][size] ) );
     294        } // if
    219295        if ( units.length() != 0 ) {
    220296                ret = new UntypedExpr( new NameExpr( units ), { ret } );
     
    321397
    322398NameExpr * build_varref( const string * name ) {
    323         NameExpr * expr = new NameExpr( *name, nullptr );
     399        NameExpr * expr = new NameExpr( *name );
    324400        delete name;
    325401        return expr;
     
    412488        list< Expression * > args;
    413489        buildMoveList( expr_node, args );
    414         return new UntypedExpr( maybeMoveBuild< Expression >(function), args, nullptr );
     490        return new UntypedExpr( maybeMoveBuild< Expression >(function), args );
    415491} // build_func
    416492
  • src/Parser/ParseNode.h

    r78315272 r3f7e12cb  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep 14 23:09:39 2017
    13 // Update Count     : 815
     12// Last Modified On : Sat Sep 23 18:11:22 2017
     13// Update Count     : 821
    1414//
    1515
     
    4747#define YYLTYPE_IS_DECLARED 1 /* alert the parser that we have our own definition */
    4848
    49 extern char * yyfilename;
    50 extern int yylineno;
    5149extern YYLTYPE yylloc;
    5250
     
    197195class DeclarationNode : public ParseNode {
    198196  public:
    199         enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, NoBasicType };
     197        // These enumerations must harmonize with their names.
     198        enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, Int128, Float80, Float128, NoBasicType };
     199        static const char * basicTypeNames[];
    200200        enum ComplexType { Complex, Imaginary, NoComplexType };
     201        static const char * complexTypeNames[];
    201202        enum Signedness { Signed, Unsigned, NoSignedness };
     203        static const char * signednessNames[];
    202204        enum Length { Short, Long, LongLong, NoLength };
     205        static const char * lengthNames[];
    203206        enum Aggregate { Struct, Union, Trait, Coroutine, Monitor, Thread, NoAggregate };
     207        static const char * aggregateNames[];
    204208        enum TypeClass { Otype, Dtype, Ftype, Ttype, NoTypeClass };
     209        static const char * typeClassNames[];
    205210        enum BuiltinType { Valist, Zero, One, NoBuiltinType };
    206 
    207         static const char * basicTypeNames[];
    208         static const char * complexTypeNames[];
    209         static const char * signednessNames[];
    210         static const char * lengthNames[];
    211         static const char * aggregateNames[];
    212         static const char * typeClassNames[];
    213211        static const char * builtinTypeNames[];
    214212
  • src/Parser/StatementNode.cc

    r78315272 r3f7e12cb  
    234234                target,
    235235                maybeMoveBuild<Statement >( stmt ),
    236                 maybeMoveBuild<Expression>( when )
     236                notZeroExpr( maybeMoveBuild<Expression>( when ) )
    237237        });
    238238
     
    250250        delete targetExpr;
    251251
    252         node->clauses.push_back( WaitForStmt::Clause{
     252        node->clauses.insert( node->clauses.begin(), WaitForStmt::Clause{
    253253                std::move( target ),
    254254                maybeMoveBuild<Statement >( stmt ),
    255                 maybeMoveBuild<Expression>( when )
     255                notZeroExpr( maybeMoveBuild<Expression>( when ) )
    256256        });
    257257
     
    265265                node->timeout.time      = maybeMoveBuild<Expression>( timeout );
    266266                node->timeout.statement = maybeMoveBuild<Statement >( stmt    );
    267                 node->timeout.condition = maybeMoveBuild<Expression>( when    );
     267                node->timeout.condition = notZeroExpr( maybeMoveBuild<Expression>( when ) );
    268268        }
    269269        else {
    270                 node->orelse.statement  = maybeMoveBuild<Statement >( stmt    );
    271                 node->orelse.condition  = maybeMoveBuild<Expression>( when    );
     270                node->orelse.statement  = maybeMoveBuild<Statement >( stmt );
     271                node->orelse.condition  = notZeroExpr( maybeMoveBuild<Expression>( when ) );
    272272        }
    273273
     
    280280        node->timeout.time      = maybeMoveBuild<Expression>( timeout );
    281281        node->timeout.statement = maybeMoveBuild<Statement >( stmt    );
    282         node->timeout.condition = maybeMoveBuild<Expression>( when    );
     282        node->timeout.condition = notZeroExpr( maybeMoveBuild<Expression>( when ) );
    283283
    284284        node->orelse.statement = maybeMoveBuild<Statement >( else_stmt );
    285         node->orelse.condition = maybeMoveBuild<Expression>( else_when );
     285        node->orelse.condition  = notZeroExpr( maybeMoveBuild<Expression>( else_when ) );
    286286
    287287        return node;
    288288}
    289 
    290 // WaitForStmt::Target build_waitfor( const std::string * name, ExpressionNode * arguments ) {
    291 //       return WaitForStmt::Clause{
    292 
    293 //       };
    294 // }
    295289
    296290Statement *build_compound( StatementNode *first ) {
  • src/Parser/TypeData.cc

    r78315272 r3f7e12cb  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  1 23:13:38 2017
    13 // Update Count     : 569
     12// Last Modified On : Mon Sep 25 18:33:41 2017
     13// Update Count     : 587
    1414//
    1515
     
    9898} // TypeData::TypeData
    9999
     100
    100101TypeData::~TypeData() {
    101102        delete base;
     
    161162        } // switch
    162163} // TypeData::~TypeData
     164
    163165
    164166TypeData * TypeData::clone() const {
     
    235237} // TypeData::clone
    236238
     239
    237240void TypeData::print( ostream &os, int indent ) const {
    238241        for ( int i = 0; i < Type::NumTypeQualifier; i += 1 ) {
     
    399402} // TypeData::print
    400403
     404
    401405template< typename ForallList >
    402406void buildForall( const DeclarationNode * firstNode, ForallList &outputList ) {
    403407        buildList( firstNode, outputList );
    404         for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i ) {
     408        auto n = firstNode;
     409        for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i, n = (DeclarationNode*)n->get_next() ) {
    405410                TypeDecl * td = static_cast<TypeDecl *>(*i);
    406                 if ( td->get_kind() == TypeDecl::Any ) {
     411                if ( n->variable.tyClass == DeclarationNode::Otype ) {
    407412                        // add assertion parameters to `type' tyvars in reverse order
    408413                        // add dtor:  void ^?{}(T *)
     
    430435                } // if
    431436        } // for
    432 }
     437} // buildForall
     438
    433439
    434440Type * typebuild( const TypeData * td ) {
     
    477483} // typebuild
    478484
     485
    479486TypeData * typeextractAggregate( const TypeData * td, bool toplevel ) {
    480487        TypeData * ret = nullptr;
     
    504511} // typeextractAggregate
    505512
     513
    506514Type::Qualifiers buildQualifiers( const TypeData * td ) {
    507515        return td->qualifiers;
    508516} // buildQualifiers
    509517
     518
     519static string genTSError( string msg, DeclarationNode::BasicType basictype ) {
     520        throw SemanticError( string( "invalid type specifier \"" ) + msg + "\" for type \"" + DeclarationNode::basicTypeNames[basictype] + "\"." );
     521} // genTSError
     522
    510523Type * buildBasicType( const TypeData * td ) {
    511524        BasicType::Kind ret;
     
    513526        switch ( td->basictype ) {
    514527          case DeclarationNode::Void:
    515                 if ( td->signedness != DeclarationNode::NoSignedness && td->length != DeclarationNode::NoLength ) {
    516                         throw SemanticError( "invalid type specifier \"void\" in type: ", td );
    517                 } // if
    518 
     528                if ( td->signedness != DeclarationNode::NoSignedness ) {
     529                        genTSError( DeclarationNode::signednessNames[ td->signedness ], td->basictype );
     530                } // if
     531                if ( td->length != DeclarationNode::NoLength ) {
     532                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
     533                } // if
    519534                return new VoidType( buildQualifiers( td ) );
    520535                break;
     
    522537          case DeclarationNode::Bool:
    523538                if ( td->signedness != DeclarationNode::NoSignedness ) {
    524                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessNames[ td->signedness ] + " in type: ", td );
     539                        genTSError( DeclarationNode::signednessNames[ td->signedness ], td->basictype );
    525540                } // if
    526541                if ( td->length != DeclarationNode::NoLength ) {
    527                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthNames[ td->length ] + " in type: ", td );
     542                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    528543                } // if
    529544
     
    538553
    539554                if ( td->length != DeclarationNode::NoLength ) {
    540                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthNames[ td->length ] + " in type: ", td );
     555                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    541556                } // if
    542557
     
    557572                break;
    558573
     574          case DeclarationNode::Int128:
     575                ret = td->signedness == 1 ? BasicType::UnsignedInt128 : BasicType::SignedInt128;
     576                if ( td->length != DeclarationNode::NoLength ) {
     577                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
     578                } // if
     579                break;
     580
    559581          case DeclarationNode::Float:
     582          case DeclarationNode::Float80:
     583          case DeclarationNode::Float128:
    560584          case DeclarationNode::Double:
    561585          case DeclarationNode::LongDouble:                                     // not set until below
     
    568592          FloatingPoint: ;
    569593                if ( td->signedness != DeclarationNode::NoSignedness ) {
    570                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessNames[ td->signedness ] + " in type: ", td );
     594                        genTSError( DeclarationNode::signednessNames[ td->signedness ], td->basictype );
    571595                } // if
    572596                if ( td->length == DeclarationNode::Short || td->length == DeclarationNode::LongLong ) {
    573                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthNames[ td->length ] + " in type: ", td );
     597                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    574598                } // if
    575599                if ( td->basictype == DeclarationNode::Float && td->length == DeclarationNode::Long ) {
    576                         throw SemanticError( "invalid type specifier \"long\" in type: ", td );
     600                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    577601                } // if
    578602                if ( td->length == DeclarationNode::Long ) {
     
    593617                goto Integral;
    594618          default:
    595                 assert(false);
     619                assertf( false, "unknown basic type" );
    596620                return nullptr;
    597621        } // switch
     
    601625        return bt;
    602626} // buildBasicType
     627
    603628
    604629PointerType * buildPointer( const TypeData * td ) {
     
    612637        return pt;
    613638} // buildPointer
     639
    614640
    615641ArrayType * buildArray( const TypeData * td ) {
     
    626652} // buildArray
    627653
     654
    628655ReferenceType * buildReference( const TypeData * td ) {
    629656        ReferenceType * rt;
     
    637664} // buildReference
    638665
     666
    639667AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    640668        assert( td->kind == TypeData::Aggregate );
     
    665693        return at;
    666694} // buildAggregate
     695
    667696
    668697ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
     
    722751} // buildAggInst
    723752
     753
    724754ReferenceToType * buildAggInst( const TypeData * td ) {
    725755        assert( td->kind == TypeData::AggregateInst );
     
    761791} // buildAggInst
    762792
     793
    763794NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, Type::StorageClasses scs, LinkageSpec::Spec linkage ) {
    764795        assert( td->kind == TypeData::Symbolic );
     
    768799                ret = new TypedefDecl( name, scs, typebuild( td->base ), linkage );
    769800        } else {
    770                 ret = new TypeDecl( name, scs, typebuild( td->base ), TypeDecl::Any );
     801                ret = new TypeDecl( name, scs, typebuild( td->base ), TypeDecl::Dtype, true );
    771802        } // if
    772803        buildList( td->symbolic.params, ret->get_parameters() );
     
    774805        return ret;
    775806} // buildSymbolic
     807
    776808
    777809EnumDecl * buildEnum( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
     
    790822} // buildEnum
    791823
     824
    792825TypeInstType * buildSymbolicInst( const TypeData * td ) {
    793826        assert( td->kind == TypeData::SymbolicInst );
     
    797830        return ret;
    798831} // buildSymbolicInst
     832
    799833
    800834TupleType * buildTuple( const TypeData * td ) {
     
    807841} // buildTuple
    808842
     843
    809844TypeofType * buildTypeof( const TypeData * td ) {
    810845        assert( td->kind == TypeData::Typeof );
     
    813848        return new TypeofType( buildQualifiers( td ), td->typeexpr->build() );
    814849} // buildTypeof
     850
    815851
    816852Declaration * buildDecl( const TypeData * td, const string &name, Type::StorageClasses scs, Expression * bitfieldWidth, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, Expression *asmName, Initializer * init, std::list< Attribute * > attributes ) {
     
    836872        return nullptr;
    837873} // buildDecl
     874
    838875
    839876FunctionType * buildFunction( const TypeData * td ) {
     
    857894        return ft;
    858895} // buildFunction
     896
    859897
    860898// Transform KR routine declarations into C99 routine declarations:
  • src/Parser/lex.ll

    r78315272 r3f7e12cb  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sun Sep 10 22:29:15 2017
    13  * Update Count     : 620
     12 * Last Modified On : Wed Oct 25 13:53:56 2017
     13 * Update Count     : 634
    1414 */
    1515
     
    9393                                // numeric constants, CFA: '_' in constant
    9494hex_quad {hex}("_"?{hex}){3}
    95 length ("ll"|"LL"|[lL])|("hh"|"HH"|[hH])
     95size_opt (8|16|32|64|128)?
     96length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hH])
    9697integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))?{user_suffix_opt}
    9798
     
    109110                                // GCC: D (double) and iI (imaginary) suffixes, and DL (long double)
    110111exponent "_"?[eE]"_"?[+-]?{decimal_digits}
    111 floating_suffix ([fFdDlL]?[iI]?)|([iI][lLfFdD])
     112floating_size 32|64|80|128
     113floating_length ([fFdDlL]|[lL]{floating_size})
     114floating_suffix ({floating_length}?[iI]?)|([iI]{floating_length})
    112115floating_suffix_opt ("_"?({floating_suffix}|"DL"))?{user_suffix_opt}
    113116decimal_digits ({decimal})|({decimal}({decimal}|"_")*{decimal})
     
    230233__extension__   { KEYWORD_RETURN(EXTENSION); }                  // GCC
    231234extern                  { KEYWORD_RETURN(EXTERN); }
    232 fallthrough             { KEYWORD_RETURN(FALLTHRU); }                   // CFA
    233235fallthru                { KEYWORD_RETURN(FALLTHRU); }                   // CFA
     236fallthrough             { KEYWORD_RETURN(FALLTHROUGH); }                // CFA
    234237finally                 { KEYWORD_RETURN(FINALLY); }                    // CFA
    235238float                   { KEYWORD_RETURN(FLOAT); }
    236 __float128              { KEYWORD_RETURN(FLOAT); }                              // GCC
     239__float80               { KEYWORD_RETURN(FLOAT80); }                    // GCC
     240float80                 { KEYWORD_RETURN(FLOAT80); }                    // GCC
     241__float128              { KEYWORD_RETURN(FLOAT128); }                   // GCC
     242float128                { KEYWORD_RETURN(FLOAT128); }                   // GCC
    237243for                             { KEYWORD_RETURN(FOR); }
    238244forall                  { KEYWORD_RETURN(FORALL); }                             // CFA
     
    249255__inline__              { KEYWORD_RETURN(INLINE); }                             // GCC
    250256int                             { KEYWORD_RETURN(INT); }
    251 __int128                { KEYWORD_RETURN(INT); }                                // GCC
    252 __int128_t              { KEYWORD_RETURN(INT); }                                // GCC
     257__int128                { KEYWORD_RETURN(INT128); }                             // GCC
     258int128                  { KEYWORD_RETURN(INT128); }                             // GCC
    253259__label__               { KEYWORD_RETURN(LABEL); }                              // GCC
    254260long                    { KEYWORD_RETURN(LONG); }
     
    285291__typeof                { KEYWORD_RETURN(TYPEOF); }                             // GCC
    286292__typeof__              { KEYWORD_RETURN(TYPEOF); }                             // GCC
    287 __uint128_t             { KEYWORD_RETURN(INT); }                                // GCC
    288293union                   { KEYWORD_RETURN(UNION); }
    289294unsigned                { KEYWORD_RETURN(UNSIGNED); }
  • src/Parser/parser.yy

    r78315272 r3f7e12cb  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep 14 23:07:12 2017
    13 // Update Count     : 2815
     12// Last Modified On : Wed Oct 25 12:28:54 2017
     13// Update Count     : 2893
    1414//
    1515
     
    4343#define YYDEBUG_LEXER_TEXT (yylval)                                             // lexer loads this up each time
    4444#define YYDEBUG 1                                                                               // get the pretty debugging code to compile
    45 #define YYERROR_VERBOSE
     45#define YYERROR_VERBOSE                                                                 // more information in syntax errors
    4646
    4747#undef __GNUC_MINOR__
     
    117117bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
    118118
    119 # define YYLLOC_DEFAULT(Cur, Rhs, N)                            \
    120 do                                                              \
    121         if (N) {                                                      \
    122                 (Cur).first_line   = YYRHSLOC(Rhs, 1).first_line;           \
    123                 (Cur).first_column = YYRHSLOC(Rhs, 1).first_column;         \
    124                 (Cur).last_line    = YYRHSLOC(Rhs, N).last_line;            \
    125                 (Cur).last_column  = YYRHSLOC(Rhs, N).last_column;          \
    126                 (Cur).filename     = YYRHSLOC(Rhs, 1).filename;             \
    127         } else {                                                      \
    128                 (Cur).first_line   = (Cur).last_line   =                    \
    129                         YYRHSLOC(Rhs, 0).last_line;                               \
    130                 (Cur).first_column = (Cur).last_column =                    \
    131                         YYRHSLOC(Rhs, 0).last_column;                             \
    132                 (Cur).filename     = YYRHSLOC(Rhs, 0).filename;             \
    133         }                                                             \
    134 while (0)
     119// https://www.gnu.org/software/bison/manual/bison.html#Location-Type
     120#define YYLLOC_DEFAULT(Cur, Rhs, N)                                                                                             \
     121if ( N ) {                                                                                                                                              \
     122        (Cur).first_line   = YYRHSLOC( Rhs, 1 ).first_line;                                                     \
     123        (Cur).first_column = YYRHSLOC( Rhs, 1 ).first_column;                                           \
     124        (Cur).last_line    = YYRHSLOC( Rhs, N ).last_line;                                                      \
     125        (Cur).last_column  = YYRHSLOC( Rhs, N ).last_column;                                            \
     126        (Cur).filename     = YYRHSLOC( Rhs, 1 ).filename;                                                       \
     127} else {                                                                                                                                                \
     128        (Cur).first_line   = (Cur).last_line = YYRHSLOC( Rhs, 0 ).last_line;            \
     129        (Cur).first_column = (Cur).last_column = YYRHSLOC( Rhs, 0 ).last_column;        \
     130        (Cur).filename     = YYRHSLOC( Rhs, 0 ).filename;                                                       \
     131}
    135132%}
    136133
    137134%define parse.error verbose
    138135
    139 // Types declaration
     136// Types declaration for productions
    140137%union
    141138{
     
    173170%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
    174171%token BOOL COMPLEX IMAGINARY                                                   // C99
     172%token INT128 FLOAT80 FLOAT128                                                  // GCC
    175173%token ZERO_T ONE_T                                                                             // CFA
    176174%token VALIST                                                                                   // GCC
     
    182180%token ATTRIBUTE EXTENSION                                                              // GCC
    183181%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    184 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA
     182%token CHOOSE DISABLE ENABLE FALLTHRU FALLTHROUGH TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA
    185183%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
    186184%token ALIGNAS ALIGNOF GENERIC STATICASSERT                             // C11
     
    252250%type<sn> exception_statement                   handler_clause                          finally_clause
    253251%type<catch_kind> handler_key
     252%type<sn> mutex_statement
    254253%type<en> when_clause                                   when_clause_opt                         waitfor                                         timeout
    255254%type<sn> waitfor_statement
     
    363362%precedence ELSE        // token precedence for start of else clause in IF/WAITFOR statement
    364363
    365 %locations
     364%locations                      // support location tracking for error messages
    366365
    367366%start translation_unit                                                                 // parse-tree root
     
    458457        | '(' compound_statement ')'                                            // GCC, lambda expression
    459458                { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); }
    460         | primary_expression '{' argument_expression_list '}' // CFA, constructor call
    461                 {
    462                         Token fn;
    463                         fn.str = new std::string( "?{}" );                      // location undefined - use location of '{'?
    464                         $$ = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) );
    465                 }
    466459        | type_name '.' no_attr_identifier                                      // CFA, nested type
    467                 { $$ = nullptr; }                                                               // FIX ME
     460                { throw SemanticError("Qualified names are currently unimplemented."); $$ = nullptr; }                                                          // FIX ME
    468461        | type_name '.' '[' push field_list pop ']'                     // CFA, nested type / tuple field selector
    469                 { $$ = nullptr; }                                                               // FIX ME
     462                { throw SemanticError("Qualified names are currently unimplemented."); $$ = nullptr; }                                                          // FIX ME
    470463        ;
    471464
     
    478471                // equivalent to the old x[i,j].
    479472                { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, $4 ) ); }
     473        | postfix_expression '{' argument_expression_list '}' // CFA, constructor call
     474                {
     475                        Token fn;
     476                        fn.str = new std::string( "?{}" );                      // location undefined - use location of '{'?
     477                        $$ = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) );
     478                }
    480479        | postfix_expression '(' argument_expression_list ')'
    481480                { $$ = new ExpressionNode( build_func( $1, $3 ) ); }
     
    809808        | jump_statement
    810809        | with_statement
     810        | mutex_statement
    811811        | waitfor_statement
    812812        | exception_statement
     
    974974        ;
    975975
     976fall_through_name:                                                                              // CFA
     977        FALLTHRU
     978        | FALLTHROUGH
     979        ;
     980
    976981fall_through:                                                                                   // CFA
    977         FALLTHRU
     982        fall_through_name
    978983                { $$ = nullptr; }
    979         | FALLTHRU ';'
     984        | fall_through_name ';'
    980985                { $$ = nullptr; }
    981986        ;
     
    10331038        ;
    10341039
     1040// If MUTEX becomes a general qualifier, there are shift/reduce conflicts, so change syntax to "with mutex".
     1041mutex_statement:
     1042        MUTEX '(' argument_expression_list ')' statement
     1043                { $$ = nullptr; }                                                               // FIX ME
     1044        ;
     1045
    10351046when_clause:
    10361047        WHEN '(' comma_expression ')'
     
    15511562        | VOLATILE
    15521563                { $$ = DeclarationNode::newTypeQualifier( Type::Volatile ); }
    1553         | MUTEX
    1554                 { $$ = DeclarationNode::newTypeQualifier( Type::Mutex ); }
    15551564        | ATOMIC
    15561565                { $$ = DeclarationNode::newTypeQualifier( Type::Atomic ); }
     
    16061615
    16071616basic_type_name:
    1608         CHAR
     1617        VOID
     1618                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     1619        | BOOL                                                                                          // C99
     1620                { $$ = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
     1621        | CHAR
    16091622                { $$ = DeclarationNode::newBasicType( DeclarationNode::Char ); }
     1623        | INT
     1624                { $$ = DeclarationNode::newBasicType( DeclarationNode::Int ); }
     1625        | INT128
     1626                { $$ = DeclarationNode::newBasicType( DeclarationNode::Int128 ); }
     1627        | FLOAT
     1628                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float ); }
     1629        | FLOAT80
     1630                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float80 ); }
     1631        | FLOAT128
     1632                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float128 ); }
    16101633        | DOUBLE
    16111634                { $$ = DeclarationNode::newBasicType( DeclarationNode::Double ); }
    1612         | FLOAT
    1613                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Float ); }
    1614         | INT
    1615                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Int ); }
    1616         | LONG
    1617                 { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
    1618         | SHORT
    1619                 { $$ = DeclarationNode::newLength( DeclarationNode::Short ); }
     1635        | COMPLEX                                                                                       // C99
     1636                { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
     1637        | IMAGINARY                                                                                     // C99
     1638                { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
    16201639        | SIGNED
    16211640                { $$ = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
    16221641        | UNSIGNED
    16231642                { $$ = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
    1624         | VOID
    1625                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
    1626         | BOOL                                                                                          // C99
    1627                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
    1628         | COMPLEX                                                                                       // C99
    1629                 { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
    1630         | IMAGINARY                                                                                     // C99
    1631                 { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
     1643        | SHORT
     1644                { $$ = DeclarationNode::newLength( DeclarationNode::Short ); }
     1645        | LONG
     1646                { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
    16321647        | ZERO_T
    16331648                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }
     
    24762491        | TYPEDEFname
    24772492        | TYPEGENname
     2493        | FALLTHROUGH
     2494                { $$ = Token{ new string( "fallthrough" ), { nullptr, -1 } }; }
    24782495        | CONST
    24792496                { $$ = Token{ new string( "__const__" ), { nullptr, -1 } }; }
     
    26992716        paren_identifier attribute_list_opt
    27002717                { $$ = $1->addQualifiers( $2 ); }
     2718        | '&' MUTEX paren_identifier attribute_list_opt
     2719                { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( Type::Mutex ), OperKinds::AddressOf ) )->addQualifiers( $4 ); }
    27012720        | identifier_parameter_ptr
    27022721        | identifier_parameter_array attribute_list_opt
     
    27392758//
    27402759//              typedef int foo;
     2760//              forall( otype T ) struct foo;
    27412761//              int f( int foo ); // redefine typedef name in new scope
    27422762//
     
    27462766        typedef attribute_list_opt
    27472767                { $$ = $1->addQualifiers( $2 ); }
     2768        | '&' MUTEX typedef attribute_list_opt
     2769                { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( Type::Mutex ), OperKinds::AddressOf ) )->addQualifiers( $4 ); }
    27482770        | type_parameter_ptr
    27492771        | type_parameter_array attribute_list_opt
     
    28922914abstract_parameter_declarator:
    28932915        abstract_parameter_ptr
     2916        | '&' MUTEX attribute_list_opt
     2917                { $$ = DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( Type::Mutex ), OperKinds::AddressOf )->addQualifiers( $3 ); }
    28942918        | abstract_parameter_array attribute_list_opt
    28952919                { $$ = $1->addQualifiers( $2 ); }
  • src/Parser/parserutility.cc

    r78315272 r3f7e12cb  
    2929
    3030Expression *notZeroExpr( Expression *orig ) {
     31        if( !orig ) return nullptr;
    3132        UntypedExpr *comparison = new UntypedExpr( new NameExpr( "?!=?" ) );
    3233        comparison->get_args().push_back( orig );
  • src/ResolvExpr/AdjustExprType.cc

    r78315272 r3f7e12cb  
    1414//
    1515
     16#include "Common/PassVisitor.h"
    1617#include "SymTab/Indexer.h"       // for Indexer
    1718#include "SynTree/Declaration.h"  // for TypeDecl, TypeDecl::Kind::Ftype
     
    2122
    2223namespace ResolvExpr {
    23         class AdjustExprType : public Mutator {
    24                 typedef Mutator Parent;
    25                 using Parent::mutate;
     24        class AdjustExprType : public WithShortCircuiting {
    2625          public:
    2726                AdjustExprType( const TypeEnvironment &env, const SymTab::Indexer &indexer );
     27                void premutate( VoidType * ) { visit_children = false; }
     28                void premutate( BasicType * ) { visit_children = false; }
     29                void premutate( PointerType * ) { visit_children = false; }
     30                void premutate( ArrayType * ) { visit_children = false; }
     31                void premutate( FunctionType * ) { visit_children = false; }
     32                void premutate( StructInstType * ) { visit_children = false; }
     33                void premutate( UnionInstType * ) { visit_children = false; }
     34                void premutate( EnumInstType * ) { visit_children = false; }
     35                void premutate( TraitInstType * ) { visit_children = false; }
     36                void premutate( TypeInstType * ) { visit_children = false; }
     37                void premutate( TupleType * ) { visit_children = false; }
     38                void premutate( VarArgsType * ) { visit_children = false; }
     39                void premutate( ZeroType * ) { visit_children = false; }
     40                void premutate( OneType * ) { visit_children = false; }
     41
     42                Type * postmutate( ArrayType *arrayType );
     43                Type * postmutate( FunctionType *functionType );
     44                Type * postmutate( TypeInstType *aggregateUseType );
     45
    2846          private:
    29                 virtual Type* mutate( VoidType *voidType );
    30                 virtual Type* mutate( BasicType *basicType );
    31                 virtual Type* mutate( PointerType *pointerType );
    32                 virtual Type* mutate( ArrayType *arrayType );
    33                 virtual Type* mutate( FunctionType *functionType );
    34                 virtual Type* mutate( StructInstType *aggregateUseType );
    35                 virtual Type* mutate( UnionInstType *aggregateUseType );
    36                 virtual Type* mutate( EnumInstType *aggregateUseType );
    37                 virtual Type* mutate( TraitInstType *aggregateUseType );
    38                 virtual Type* mutate( TypeInstType *aggregateUseType );
    39                 virtual Type* mutate( TupleType *tupleType );
    40                 virtual Type* mutate( VarArgsType *varArgsType );
    41                 virtual Type* mutate( ZeroType *zeroType );
    42                 virtual Type* mutate( OneType *oneType );
    43 
    4447                const TypeEnvironment &env;
    4548                const SymTab::Indexer &indexer;
     
    4750
    4851        void adjustExprType( Type *&type, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
    49                 AdjustExprType adjuster( env, indexer );
     52                PassVisitor<AdjustExprType> adjuster( env, indexer );
    5053                Type *newType = type->acceptMutator( adjuster );
    5154                type = newType;
     
    5659        }
    5760
    58         Type *AdjustExprType::mutate( VoidType *voidType ) {
    59                 return voidType;
    60         }
    61 
    62         Type *AdjustExprType::mutate( BasicType *basicType ) {
    63                 return basicType;
    64         }
    65 
    66         Type *AdjustExprType::mutate( PointerType *pointerType ) {
    67                 return pointerType;
    68         }
    69 
    70         Type *AdjustExprType::mutate( ArrayType *arrayType ) {
    71                 // need to recursively mutate the base type in order for multi-dimensional arrays to work.
    72                 PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->get_base()->clone()->acceptMutator( *this ) );
     61        Type * AdjustExprType::postmutate( ArrayType * arrayType ) {
     62                PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->base );
     63                arrayType->base = nullptr;
    7364                delete arrayType;
    7465                return pointerType;
    7566        }
    7667
    77         Type *AdjustExprType::mutate( FunctionType *functionType ) {
    78                 PointerType *pointerType = new PointerType( Type::Qualifiers(), functionType );
    79                 return pointerType;
     68        Type * AdjustExprType::postmutate( FunctionType * functionType ) {
     69                return new PointerType( Type::Qualifiers(), functionType );
    8070        }
    8171
    82         Type *AdjustExprType::mutate( StructInstType *aggregateUseType ) {
    83                 return aggregateUseType;
    84         }
    85 
    86         Type *AdjustExprType::mutate( UnionInstType *aggregateUseType ) {
    87                 return aggregateUseType;
    88         }
    89 
    90         Type *AdjustExprType::mutate( EnumInstType *aggregateUseType ) {
    91                 return aggregateUseType;
    92         }
    93 
    94         Type *AdjustExprType::mutate( TraitInstType *aggregateUseType ) {
    95                 return aggregateUseType;
    96         }
    97 
    98         Type *AdjustExprType::mutate( TypeInstType *typeInst ) {
     72        Type * AdjustExprType::postmutate( TypeInstType * typeInst ) {
    9973                EqvClass eqvClass;
    10074                if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
     
    11387                return typeInst;
    11488        }
    115 
    116         Type *AdjustExprType::mutate( TupleType *tupleType ) {
    117                 return tupleType;
    118         }
    119 
    120         Type *AdjustExprType::mutate( VarArgsType *varArgsType ) {
    121                 return varArgsType;
    122         }
    123 
    124         Type *AdjustExprType::mutate( ZeroType *zeroType ) {
    125                 return zeroType;
    126         }
    127 
    128         Type *AdjustExprType::mutate( OneType *oneType ) {
    129                 return oneType;
    130         }
    13189} // namespace ResolvExpr
    13290
  • src/ResolvExpr/Alternative.cc

    r78315272 r3f7e12cb  
    6666        }
    6767
    68         void Alternative::print( std::ostream &os, int indent ) const {
    69                 os << std::string( indent, ' ' ) << "Cost " << cost << ": ";
     68        void Alternative::print( std::ostream &os, Indenter indent ) const {
     69                os << "Cost " << cost << ": ";
    7070                if ( expr ) {
    71                         expr->print( os, indent );
    72                         os << "(types:" << std::endl;
    73                         os << std::string( indent+4, ' ' );
    74                         expr->get_result()->print( os, indent + 4 );
    75                         os << std::endl << ")" << std::endl;
     71                        expr->print( os, indent+1 );
     72                        os << std::endl << indent << "(types:" << std::endl;
     73                        os << indent+1;
     74                        expr->result->print( os, indent+1 );
     75                        os << std::endl << indent << ")" << std::endl;
    7676                } else {
    7777                        os << "Null expression!" << std::endl;
    7878                } // if
    79                 os << std::string( indent, ' ' ) << "Environment: ";
    80                 env.print( os, indent+2 );
     79                os << indent << "Environment: ";
     80                env.print( os, indent+1 );
    8181                os << std::endl;
    8282        }
  • src/ResolvExpr/Alternative.h

    r78315272 r3f7e12cb  
    3939                ~Alternative();
    4040
    41                 void print( std::ostream &os, int indent = 0 ) const;
     41                void print( std::ostream &os, Indenter indent = {} ) const;
    4242
    4343                Cost cost;
  • src/ResolvExpr/AlternativeFinder.cc

    r78315272 r3f7e12cb  
    7676
    7777        namespace {
    78                 void printAlts( const AltList &list, std::ostream &os, int indent = 0 ) {
     78                void printAlts( const AltList &list, std::ostream &os, unsigned int indentAmt = 0 ) {
     79                        Indenter indent = { Indenter::tabsize, indentAmt };
    7980                        for ( AltList::const_iterator i = list.begin(); i != list.end(); ++i ) {
    8081                                i->print( os, indent );
     
    122123                                                )
    123124                                                mapPlace->second.isAmbiguous = true;
     125                                        } else {
     126                                                PRINT(
     127                                                        std::cerr << "cost " << candidate->cost << " loses to " << mapPlace->second.candidate->cost << std::endl;
     128                                                )
    124129                                        }
    125130                                } else {
     
    127132                                }
    128133                        }
    129 
    130                         PRINT(
    131                                 std::cerr << "there are " << selected.size() << " alternatives before elimination" << std::endl;
    132                         )
    133134
    134135                        // accept the alternatives that were unambiguous
     
    145146                        expr->get_result()->accept( global_renamer );
    146147                }
    147 
    148                 void referenceToRvalueConversion( Expression *& expr ) {
    149                         if ( dynamic_cast< ReferenceType * >( expr->get_result() ) ) {
    150                                 // cast away reference from expr
    151                                 expr = new CastExpr( expr, expr->get_result()->stripReferences()->clone() );
    152                         }
    153                 }
    154148        } // namespace
     149
     150        void referenceToRvalueConversion( Expression *& expr ) {
     151                if ( dynamic_cast< ReferenceType * >( expr->get_result() ) ) {
     152                        // cast away reference from expr
     153                        expr = new CastExpr( expr, expr->get_result()->stripReferences()->clone() );
     154                }
     155        }
    155156
    156157        template< typename InputIterator, typename OutputIterator >
     
    175176        }
    176177
    177         void AlternativeFinder::find( Expression *expr, bool adjust, bool prune ) {
     178        void AlternativeFinder::find( Expression *expr, bool adjust, bool prune, bool failFast ) {
    178179                expr->accept( *this );
    179                 if ( alternatives.empty() ) {
     180                if ( failFast && alternatives.empty() ) {
    180181                        throw SemanticError( "No reasonable alternatives for expression ", expr );
    181182                }
    182                 for ( AltList::iterator i = alternatives.begin(); i != alternatives.end(); ++i ) {
    183                         if ( adjust ) {
    184                                 adjustExprType( i->expr->get_result(), i->env, indexer );
    185                         }
    186                 }
    187183                if ( prune ) {
     184                        auto oldsize = alternatives.size();
    188185                        PRINT(
    189186                                std::cerr << "alternatives before prune:" << std::endl;
     
    192189                        AltList::iterator oldBegin = alternatives.begin();
    193190                        pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ) );
    194                         if ( alternatives.begin() == oldBegin ) {
     191                        if ( failFast && alternatives.begin() == oldBegin ) {
    195192                                std::ostringstream stream;
    196193                                AltList winners;
    197194                                findMinCost( alternatives.begin(), alternatives.end(), back_inserter( winners ) );
    198                                 stream << "Cannot choose between " << winners.size() << " alternatives for expression ";
     195                                stream << "Cannot choose between " << winners.size() << " alternatives for expression\n";
    199196                                expr->print( stream );
    200                                 stream << "Alternatives are:";
    201                                 printAlts( winners, stream, 8 );
     197                                stream << "Alternatives are:\n";
     198                                printAlts( winners, stream, 1 );
    202199                                throw SemanticError( stream.str() );
    203200                        }
    204201                        alternatives.erase( oldBegin, alternatives.end() );
     202                        PRINT(
     203                                std::cerr << "there are " << oldsize << " alternatives before elimination" << std::endl;
     204                        )
    205205                        PRINT(
    206206                                std::cerr << "there are " << alternatives.size() << " alternatives after elimination" << std::endl;
    207207                        )
     208                }
     209                // adjust types after pruning so that types substituted by pruneAlternatives are correctly adjusted
     210                for ( AltList::iterator i = alternatives.begin(); i != alternatives.end(); ++i ) {
     211                        if ( adjust ) {
     212                                adjustExprType( i->expr->get_result(), i->env, indexer );
     213                        }
    208214                }
    209215
     
    215221        }
    216222
    217         void AlternativeFinder::findWithAdjustment( Expression *expr, bool prune ) {
    218                 find( expr, true, prune );
     223        void AlternativeFinder::findWithAdjustment( Expression *expr ) {
     224                find( expr, true );
     225        }
     226
     227        void AlternativeFinder::findWithoutPrune( Expression * expr ) {
     228                find( expr, true, false );
     229        }
     230
     231        void AlternativeFinder::maybeFind( Expression * expr ) {
     232                find( expr, true, true, false );
    219233        }
    220234
     
    299313                Cost convCost = conversionCost( actualType, formalType, indexer, env );
    300314                PRINT(
    301                         std::cerr << std::endl << "cost is" << convCost << std::endl;
     315                        std::cerr << std::endl << "cost is " << convCost << std::endl;
    302316                )
    303317                if ( convCost == Cost::infinity ) {
     
    305319                }
    306320                convCost.incPoly( polyCost( formalType, env, indexer ) + polyCost( actualType, env, indexer ) );
     321                PRINT(
     322                        std::cerr << "cost with polycost is " << convCost << std::endl;
     323                )
    307324                return convCost;
    308325        }
     
    310327        Cost computeExpressionConversionCost( Expression *& actualExpr, Type * formalType, const SymTab::Indexer &indexer, const TypeEnvironment & env ) {
    311328                Cost convCost = computeConversionCost( actualExpr->result, formalType, indexer, env );
    312                 // if ( convCost != Cost::zero ) {
    313 
    314                 // xxx - temporary -- ignore poly cost, since this causes some polymorphic functions to be cast, which causes the specialize
    315                 // pass to try to specialize them, which currently does not work. Once that is fixed, remove the next 3 lines and uncomment the
    316                 // previous line.
     329
     330                // if there is a non-zero conversion cost, ignoring poly cost, then the expression requires conversion.
     331                // ignore poly cost for now, since this requires resolution of the cast to infer parameters and this
     332                // does not currently work for the reason stated below.
    317333                Cost tmpCost = convCost;
    318334                tmpCost.incPoly( -tmpCost.get_polyCost() );
     
    357373                                if ( function->get_isVarArgs() ) {
    358374                                        convCost.incUnsafe();
     375                                        PRINT( std::cerr << "end of formals with varargs function: inc unsafe: " << convCost << std::endl; ; )
    359376                                        // convert reference-typed expressions to value-typed expressions
    360377                                        referenceToRvalueConversion( *actualExpr );
     
    365382                        }
    366383                        Type * formalType = (*formal)->get_type();
    367                         PRINT(
    368                                 std::cerr << std::endl << "converting ";
    369                                 actualType->print( std::cerr, 8 );
    370                                 std::cerr << std::endl << " to ";
    371                                 formalType->print( std::cerr, 8 );
    372                                 std::cerr << std::endl << "environment is: ";
    373                                 alt.env.print( std::cerr, 8 );
    374                                 std::cerr << std::endl;
    375                         )
    376384                        convCost += computeExpressionConversionCost( *actualExpr, formalType, indexer, alt.env );
    377385                        ++formal; // can't be in for-loop update because of the continue
     
    481489                                Alternative newerAlt( newAlt );
    482490                                newerAlt.env = newEnv;
    483                                 assert( (*candidate)->get_uniqueId() );
     491                                assertf( (*candidate)->get_uniqueId(), "Assertion candidate does not have a unique ID: %s", toString( *candidate ).c_str() );
    484492                                DeclarationWithType *candDecl = static_cast< DeclarationWithType* >( Declaration::declFromId( (*candidate)->get_uniqueId() ) );
    485493
     
    507515                                        std::cerr << std::endl;
    508516                                )
    509                                 ApplicationExpr *appExpr = static_cast< ApplicationExpr* >( newerAlt.expr );
    510517                                // follow the current assertion's ID chain to find the correct set of inferred parameters to add the candidate to (i.e. the set of inferred parameters belonging to the entity which requested the assertion parameter).
    511                                 InferredParams * inferParameters = &appExpr->get_inferParams();
     518                                InferredParams * inferParameters = &newerAlt.expr->get_inferParams();
    512519                                for ( UniqueId id : cur->second.idChain ) {
    513520                                        inferParameters = (*inferParameters)[ id ].inferParams.get();
     
    786793               
    787794                return ! results.empty();
    788         }
     795        }       
    789796
    790797        template<typename OutputIterator>
    791         void AlternativeFinder::makeFunctionAlternatives( const Alternative& func,
    792                         FunctionType* funcType, const std::vector< AlternativeFinder >& args,
     798        void AlternativeFinder::makeFunctionAlternatives( const Alternative &func,
     799                        FunctionType *funcType, const std::vector< AlternativeFinder > &args,
    793800                        OutputIterator out ) {
    794801                OpenVarSet funcOpenVars;
    795802                AssertionSet funcNeed, funcHave;
    796                 TypeEnvironment funcEnv;
     803                TypeEnvironment funcEnv( func.env );
    797804                makeUnifiableVars( funcType, funcOpenVars, funcNeed );
    798805                // add all type variables as open variables now so that those not used in the parameter
    799806                // list are still considered open.
    800807                funcEnv.add( funcType->get_forall() );
    801 
     808               
    802809                if ( targetType && ! targetType->isVoid() && ! funcType->get_returnVals().empty() ) {
    803810                        // attempt to narrow based on expected target type
    804                         Type* returnType = funcType->get_returnVals().front()->get_type();
     811                        Type * returnType = funcType->get_returnVals().front()->get_type();
    805812                        if ( ! unify( returnType, targetType, funcEnv, funcNeed, funcHave, funcOpenVars,
    806813                                        indexer ) ) {
     
    905912
    906913                // find function operators
     914                static NameExpr *opExpr = new NameExpr( "?()" );
    907915                AlternativeFinder funcOpFinder( indexer, env );
    908                 NameExpr *opExpr = new NameExpr( "?()" );
    909                 try {
    910                         funcOpFinder.findWithAdjustment( opExpr );
    911                 } catch( SemanticError &e ) {
    912                         // it's ok if there aren't any defined function ops
    913                 }
     916                // it's ok if there aren't any defined function ops
     917                funcOpFinder.maybeFind( opExpr);
    914918                PRINT(
    915919                        std::cerr << "known function ops:" << std::endl;
    916                         printAlts( funcOpFinder.alternatives, std::cerr, 8 );
     920                        printAlts( funcOpFinder.alternatives, std::cerr, 1 );
    917921                )
    918922
     
    10281032        bool isLvalue( Expression *expr ) {
    10291033                // xxx - recurse into tuples?
    1030                 return expr->has_result() && ( expr->get_result()->get_lvalue() || dynamic_cast< ReferenceType * >( expr->get_result() ) );
     1034                return expr->result && ( expr->get_result()->get_lvalue() || dynamic_cast< ReferenceType * >( expr->get_result() ) );
    10311035        }
    10321036
     
    11031107                                thisCost.incSafe( discardedValues );
    11041108                                Alternative newAlt( restructureCast( i->expr->clone(), toType ), i->env, i->cost, thisCost );
    1105                                 // xxx - this doesn't work at the moment, since inferParameters requires an ApplicationExpr as the alternative.
    1106                                 // Once this works, it should be possible to infer parameters on a cast expression and specialize any function.
    1107 
    1108                                 // inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( candidates ) );
    1109                                 candidates.emplace_back( std::move( newAlt ) );
     1109                                inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( candidates ) );
    11101110                        } // if
    11111111                } // for
     
    11231123                AlternativeFinder finder( indexer, env );
    11241124                // don't prune here, since it's guaranteed all alternatives will have the same type
    1125                 // (giving the alternatives different types is half of the point of ConstructorExpr nodes)
    1126                 finder.findWithAdjustment( castExpr->get_arg(), false );
     1125                finder.findWithoutPrune( castExpr->get_arg() );
    11271126                for ( Alternative & alt : finder.alternatives ) {
    11281127                        alternatives.push_back( Alternative(
     
    11631162                PRINT( std::cerr << "nameExpr is " << nameExpr->get_name() << std::endl; )
    11641163                for ( std::list< DeclarationWithType* >::iterator i = declList.begin(); i != declList.end(); ++i ) {
    1165                         VariableExpr newExpr( *i, nameExpr->get_argName() );
     1164                        VariableExpr newExpr( *i );
    11661165                        alternatives.push_back( Alternative( newExpr.clone(), env, Cost::zero ) );
    11671166                        PRINT(
     
    13981397                findSubExprs( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end(), back_inserter( subExprAlternatives ) );
    13991398                std::list< AltList > possibilities;
    1400                 // TODO re-write to use iterative method
    14011399                combos( subExprAlternatives.begin(), subExprAlternatives.end(), back_inserter( possibilities ) );
    14021400                for ( std::list< AltList >::const_iterator i = possibilities.begin(); i != possibilities.end(); ++i ) {
     
    14221420                // don't prune here, since it's guaranteed all alternatives will have the same type
    14231421                // (giving the alternatives different types is half of the point of ConstructorExpr nodes)
    1424                 finder.findWithAdjustment( ctorExpr->get_callExpr(), false );
     1422                finder.findWithoutPrune( ctorExpr->get_callExpr() );
    14251423                for ( Alternative & alt : finder.alternatives ) {
    14261424                        alternatives.push_back( Alternative( new ConstructorExpr( alt.expr->clone() ), alt.env, alt.cost ) );
     
    14591457                // O(N^2) checks of d-types with e-types
    14601458                for ( InitAlternative & initAlt : initExpr->get_initAlts() ) {
    1461                         Type * toType = resolveTypeof( initAlt.type, indexer );
     1459                        Type * toType = resolveTypeof( initAlt.type->clone(), indexer );
    14621460                        SymTab::validateType( toType, &indexer );
    14631461                        adjustExprType( toType, env, indexer );
     
    14881486                                        // count one safe conversion for each value that is thrown away
    14891487                                        thisCost.incSafe( discardedValues );
    1490                                         candidates.push_back( Alternative( new InitExpr( restructureCast( alt.expr->clone(), toType ), initAlt.designation->clone() ), newEnv, alt.cost, thisCost ) );
     1488                                        Alternative newAlt( new InitExpr( restructureCast( alt.expr->clone(), toType ), initAlt.designation->clone() ), newEnv, alt.cost, thisCost );
     1489                                        inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( candidates ) );
    14911490                                }
    14921491                        }
  • src/ResolvExpr/AlternativeFinder.h

    r78315272 r3f7e12cb  
    6161                }
    6262
    63                 void find( Expression *expr, bool adjust = false, bool prune = true );
     63                void find( Expression *expr, bool adjust = false, bool prune = true, bool failFast = true );
    6464                /// Calls find with the adjust flag set; adjustment turns array and function types into equivalent pointer types
    65                 void findWithAdjustment( Expression *expr, bool prune = true );
     65                void findWithAdjustment( Expression *expr );
     66                /// Calls find with the adjust flag set and prune flag unset; pruning ensures there is at most one alternative per result type
     67                void findWithoutPrune( Expression *expr );
     68                /// Calls find with the adjust and prune flags set, failFast flags unset; fail fast ensures that there is at least one resulting alternative
     69                void maybeFind( Expression *expr );
    6670                AltList &get_alternatives() { return alternatives; }
    6771
     
    7781                const SymTab::Indexer &get_indexer() const { return indexer; }
    7882                const TypeEnvironment &get_environ() const { return env; }
     83
     84                /// Runs a new alternative finder on each element in [begin, end)
     85                /// and writes each alternative finder to out.
     86                template< typename InputIterator, typename OutputIterator >
     87                void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
    7988          private:
    8089                virtual void visit( ApplicationExpr *applicationExpr );
     
    108117                virtual void visit( StmtExpr *stmtExpr );
    109118                virtual void visit( UntypedInitExpr *initExpr );
    110                 /// Runs a new alternative finder on each element in [begin, end)
    111                 /// and writes each alternative finder to out.
    112                 template< typename InputIterator, typename OutputIterator >
    113                 void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
    114119
    115120                /// Adds alternatives for anonymous members
     
    134139
    135140        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
     141        void referenceToRvalueConversion( Expression *& expr );
    136142
    137143        template< typename InputIterator, typename OutputIterator >
  • src/ResolvExpr/CastCost.cc

    r78315272 r3f7e12cb  
    2424#include "typeops.h"                     // for typesCompatibleIgnoreQualifiers
    2525
     26#if 0
     27#define PRINT(x) x
     28#else
     29#define PRINT(x)
     30#endif
    2631
    2732namespace ResolvExpr {
     
    5257                        } // if
    5358                } // if
     59
     60                PRINT(
     61                        std::cerr << "castCost ::: src is ";
     62                        src->print( std::cerr );
     63                        std::cerr << std::endl << "dest is ";
     64                        dest->print( std::cerr );
     65                        std::cerr << std::endl << "env is" << std::endl;
     66                        env.print( std::cerr, 8 );
     67                )
     68
    5469                if ( typesCompatibleIgnoreQualifiers( src, dest, indexer, env ) ) {
     70                        PRINT( std::cerr << "compatible!" << std::endl; )
    5571                        return Cost::zero;
    5672                } else if ( dynamic_cast< VoidType* >( dest ) ) {
    5773                        return Cost::safe;
    5874                } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * > ( dest ) ) {
     75                        PRINT( std::cerr << "conversionCost: dest is reference" << std::endl; )
    5976                        return convertToReferenceCost( src, refType, indexer, env, [](Type * t1, Type * t2, const TypeEnvironment & env, const SymTab::Indexer & indexer) {
    6077                                return ptrsCastable( t1, t2, env, indexer );
  • src/ResolvExpr/CommonType.cc

    r78315272 r3f7e12cb  
    1010// Created On       : Sun May 17 06:59:27 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 16:24:31 2017
    13 // Update Count     : 7
     12// Last Modified On : Mon Sep 25 15:18:17 2017
     13// Update Count     : 9
    1414//
    1515
     
    6161        };
    6262
    63         Type * handleReference( ReferenceType * refType, Type * other, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment & env, const OpenVarSet &openVars ) {
    64                 Type * result = nullptr, * common = nullptr;
     63        Type * handleReference( Type * t1, Type * t2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment & env, const OpenVarSet &openVars ) {
     64                Type * common = nullptr;
    6565                AssertionSet have, need;
    6666                OpenVarSet newOpen( openVars );
    6767                // need unify to bind type variables
    68                 if ( unify( refType->get_base(), other, env, have, need, newOpen, indexer, common ) ) {
    69                         // std::cerr << "unify success" << std::endl;
    70                         if ( widenSecond ) {
    71                                 // std::cerr << "widen second" << std::endl;
    72                                 if ( widenFirst || other->get_qualifiers() <= refType->get_qualifiers() ) {
    73                                         result = new ReferenceType( refType->get_qualifiers(), common ); // refType->clone();
    74                                         result->get_qualifiers() |= other->get_qualifiers();
    75                                 }
    76                         } else if ( widenFirst ) {
    77                                 // std::cerr << "widen first" << std::endl;
    78                                 if ( widenSecond || refType->get_qualifiers() <= other->get_qualifiers() ) {
    79                                         result = common;
    80                                         result->get_qualifiers() |= refType->get_qualifiers();
    81                                 }
    82                         }
    83                 } else {
    84                         // std::cerr << "exact unify failed: " << refType << " " << other << std::endl;
    85                 }
    86                 // std::cerr << "common type of reference [" << refType << "] and non-reference [" << other << "] is [" << result << "]" << std::endl;
    87                 return result;
     68                if ( unify( t1, t2, env, have, need, newOpen, indexer, common ) ) {
     69                        // std::cerr << "unify success: " << widenFirst << " " << widenSecond << std::endl;
     70                        if ( (widenFirst || t2->get_qualifiers() <= t1->get_qualifiers()) && (widenSecond || t1->get_qualifiers() <= t2->get_qualifiers()) ) {
     71                                // std::cerr << "widen okay" << std::endl;
     72                                common->get_qualifiers() |= t1->get_qualifiers();
     73                                common->get_qualifiers() |= t2->get_qualifiers();
     74                                return common;
     75                        }
     76                }
     77                // std::cerr << "exact unify failed: " << t1 << " " << t2 << std::endl;
     78                return nullptr;
    8879        }
    8980
     
    9990
    10091                        // special case where one type has a reference depth of 1 larger than the other
    101                         if ( diff > 0 ) {
    102                                 return handleReference( strict_dynamic_cast<ReferenceType *>( type1 ), type2, widenFirst, widenSecond, indexer, env, openVars );
    103                         } else if ( diff < 0 ) {
    104                                 return handleReference( strict_dynamic_cast<ReferenceType *>( type2 ), type1, widenSecond, widenFirst, indexer, env, openVars );
     92                        if ( diff > 0 || diff < 0 ) {
     93                                Type * result = nullptr;
     94                                if ( ReferenceType * ref1 = dynamic_cast< ReferenceType * >( type1 ) ) {
     95                                        // formal is reference, so result should be reference
     96                                        result = handleReference( ref1->base, type2, widenFirst, widenSecond, indexer, env, openVars );
     97                                        if ( result ) result = new ReferenceType( ref1->get_qualifiers(), result );
     98                                } else {
     99                                        // formal is value, so result should be value
     100                                        ReferenceType * ref2 = strict_dynamic_cast< ReferenceType * > ( type2 );
     101                                        result = handleReference( type1, ref2->base, widenFirst, widenSecond, indexer, env, openVars );
     102                                }
     103                                // std::cerr << "common type of reference [" << type1 << "] and [" << type2 << "] is [" << result << "]" << std::endl;
     104                                return result;
    105105                        }
    106106                        // otherwise, both are reference types of the same depth and this is handled by the CommonType visitor.
     
    150150        static const BasicType::Kind combinedType[ BasicType::NUMBER_OF_BASIC_TYPES ][ BasicType::NUMBER_OF_BASIC_TYPES ] =
    151151        {
    152 /*              Bool            Char    SignedChar      UnsignedChar    ShortSignedInt  ShortUnsignedInt        SignedInt       UnsignedInt     LongSignedInt   LongUnsignedInt LongLongSignedInt       LongLongUnsignedInt     Float   Double  LongDouble      FloatComplex    DoubleComplex   LongDoubleComplex       FloatImaginary  DoubleImaginary LongDoubleImaginary */
    153                 /* Bool */      { BasicType::Bool,              BasicType::Char,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    154                 /* Char */      { BasicType::Char,              BasicType::Char,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    155                 /* SignedChar */        { BasicType::SignedChar,        BasicType::UnsignedChar,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    156                 /* UnsignedChar */      { BasicType::UnsignedChar,      BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    157                 /* ShortSignedInt */    { BasicType::ShortSignedInt,    BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    158                 /* ShortUnsignedInt */  { BasicType::ShortUnsignedInt,  BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    159                 /* SignedInt */         { BasicType::SignedInt,         BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    160                 /* UnsignedInt */       { BasicType::UnsignedInt,               BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    161                 /* LongSignedInt */     { BasicType::LongSignedInt,             BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    162                 /* LongUnsignedInt */   { BasicType::LongUnsignedInt,   BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    163                 /* LongLongSignedInt */         { BasicType::LongLongSignedInt, BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    164                 /* LongLongUnsignedInt */       { BasicType::LongLongUnsignedInt,       BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    165                 /* Float */     { BasicType::Float,     BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    166                 /* Double */    { BasicType::Double,    BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::LongDouble,  BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    167                 /* LongDouble */        { BasicType::LongDouble,                BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex },
    168                 /* FloatComplex */      { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    169                 /* DoubleComplex */     { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    170                 /* LongDoubleComplex */         { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex },
    171                 /* FloatImaginary */    { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatImaginary,      BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary },
    172                 /* DoubleImaginary */   { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleImaginary,     BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary },
    173                 /* LongDoubleImaginary */       { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary }
     152/*              Bool            Char    SignedChar      UnsignedChar    ShortSignedInt  ShortUnsignedInt        SignedInt       UnsignedInt     LongSignedInt   LongUnsignedInt LongLongSignedInt       LongLongUnsignedInt     Float   Double  LongDouble      FloatComplex    DoubleComplex   LongDoubleComplex       FloatImaginary  DoubleImaginary LongDoubleImaginary   SignedInt128   UnsignedInt128 */
     153                /* Bool */      { BasicType::Bool,              BasicType::Char,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     154                /* Char */      { BasicType::Char,              BasicType::Char,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     155                /* SignedChar */        { BasicType::SignedChar,        BasicType::UnsignedChar,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     156                /* UnsignedChar */      { BasicType::UnsignedChar,      BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     157                /* ShortSignedInt */    { BasicType::ShortSignedInt,    BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     158                /* ShortUnsignedInt */  { BasicType::ShortUnsignedInt,  BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     159                /* SignedInt */         { BasicType::SignedInt,         BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     160                /* UnsignedInt */       { BasicType::UnsignedInt,               BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     161                /* LongSignedInt */     { BasicType::LongSignedInt,             BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     162                /* LongUnsignedInt */   { BasicType::LongUnsignedInt,   BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     163                /* LongLongSignedInt */         { BasicType::LongLongSignedInt, BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     164                /* LongLongUnsignedInt */       { BasicType::LongLongUnsignedInt,       BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     165                /* Float */     { BasicType::Float,     BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Float,       BasicType::Float, },
     166                /* Double */    { BasicType::Double,    BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::LongDouble,  BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Double,      BasicType::Double, },
     167                /* LongDouble */        { BasicType::LongDouble,                BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDouble,  BasicType::LongDouble, },
     168                /* FloatComplex */      { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::FloatComplex, },
     169                /* DoubleComplex */     { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex, },
     170                /* LongDoubleComplex */         { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex, },
     171                /* FloatImaginary */    { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatImaginary,      BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::FloatImaginary,      BasicType::FloatImaginary, },
     172                /* DoubleImaginary */   { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleImaginary,     BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::DoubleImaginary,     BasicType::DoubleImaginary, },
     173                /* LongDoubleImaginary */       { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary },
     174                /* SignedInt128 */      { BasicType::SignedInt128,      BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     175                /* UnsignedInt128 */    { BasicType::UnsignedInt128,    BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::UnsignedInt128,      BasicType::UnsignedInt128, },
    174176        };
    175177
  • src/ResolvExpr/ConversionCost.cc

    r78315272 r3f7e12cb  
    1010// Created On       : Sun May 17 07:06:19 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 17:35:46 2016
    13 // Update Count     : 6
     12// Last Modified On : Mon Sep 25 15:43:34 2017
     13// Update Count     : 10
    1414//
    1515
     
    2828
    2929namespace ResolvExpr {
    30         const Cost Cost::zero = Cost( 0, 0, 0, 0 );
    31         const Cost Cost::infinity = Cost( -1, -1, -1, -1 );
    32         const Cost Cost::unsafe = Cost( 1, 0, 0, 0 );
    33         const Cost Cost::poly = Cost( 0, 1, 0, 0 );
    34         const Cost Cost::safe = Cost( 0, 0, 1, 0 );
    35         const Cost Cost::reference = Cost( 0, 0, 0, 1 );
     30        const Cost Cost::zero =      Cost(  0,  0,  0, 0 );
     31        const Cost Cost::infinity =  Cost( -1, -1, -1, -1 );
     32        const Cost Cost::unsafe =    Cost(  1,  0,  0, 0 );
     33        const Cost Cost::poly =      Cost(  0,  1,  0, 0 );
     34        const Cost Cost::safe =      Cost(  0,  0,  1, 0 );
     35        const Cost Cost::reference = Cost(  0,  0,  0, 1 );
    3636
    3737#if 0
     
    113113                                        int assignResult = func( srcAsRef->get_base(), destAsRef->get_base(), env, indexer );
    114114                                        PRINT( std::cerr << "comparing references: " << assignResult << " " << srcAsRef << " " << destAsRef << std::endl; )
    115                                         if ( assignResult < 0 ) {
     115                                        if ( assignResult > 0 ) {
    116116                                                return Cost::safe;
    117                                         } else if ( assignResult > 0 ) {
     117                                        } else if ( assignResult < 0 ) {
    118118                                                return Cost::unsafe;
    119119                                        } // if
     
    219219*/
    220220
    221         static const int costMatrix[ BasicType::NUMBER_OF_BASIC_TYPES ][ BasicType::NUMBER_OF_BASIC_TYPES ] =
    222         {
    223         /* Src \ Dest:  Bool    Char    SChar   UChar   Short   UShort  Int     UInt    Long    ULong   LLong   ULLong  Float   Double  LDbl    FCplex  DCplex  LDCplex FImag   DImag   LDImag */
    224                 /* Bool */      { 0,    1,              1,              2,              3,              4,              5,              6,              6,              7,              8,              9,              10,             11,             12,             11,             12,             13,             -1,             -1,             -1 },
    225                 /* Char */      { -1,   0,              -1,             1,              2,              3,              4,              5,              5,              6,              7,              8,              9,              10,             11,             10,             11,             12,             -1,             -1,             -1 },
    226                 /* SChar */ { -1,       -1,             0,              1,              2,              3,              4,              5,              5,              6,              7,              8,              9,              10,             11,             10,             11,             12,             -1,             -1,             -1 },
    227                 /* UChar */ { -1,       -1,             -1,             0,              1,              2,              3,              4,              4,              5,              6,              7,              8,              9,              10,             9,              10,             11,             -1,             -1,             -1 },
    228                 /* Short */ { -1,       -1,             -1,             -1,             0,              1,              2,              3,              3,              4,              5,              6,              7,              8,              9,              8,              9,              10,             -1,             -1,             -1 },
    229                 /* UShort */{ -1,       -1,             -1,             -1,             -1,             0,              1,              2,              2,              3,              4,              5,              6,              7,              8,              7,              8,              9,              -1,             -1,             -1 },
    230                 /* Int */       { -1,   -1,             -1,             -1,             -1,             -1,             0,              1,              1,              2,              3,              4,              5,              6,              7,              6,              7,              8,              -1,             -1,             -1 },
    231                 /* UInt */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             1,              2,              3,              4,              5,              6,              5,              6,              7,              -1,             -1,             -1 },
    232                 /* Long */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              4,              5,              6,              5,              6,              7,              -1,             -1,             -1 },
    233                 /* ULong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              4,              5,              4,              5,              6,              -1,             -1,             -1 },
    234                 /* LLong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              4,              3,              4,              5,              -1,             -1,             -1 },
    235                 /* ULLong */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              2,              3,              4,              -1,             -1,             -1 },
    236                 /* Float */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              1,              2,              3,              -1,             -1,             -1 },
    237                 /* Double */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             1,              2,              -1,             -1,             -1 },
    238                 /* LDbl */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             1,              -1,             -1,             -1 },
    239                 /* FCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              -1,             -1,             -1 },
    240                 /* DCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             -1,             -1 },
    241                 /* LDCplex */{ -1,      -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             -1 },
    242                 /* FImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              0,              1,              2 },
    243                 /* DImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              -1,             0,              1 },
    244                 /* LDImag */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             0 }
     221        static const int costMatrix[ BasicType::NUMBER_OF_BASIC_TYPES ][ BasicType::NUMBER_OF_BASIC_TYPES ] = {
     222        /* Src \ Dest:  Bool    Char    SChar   UChar   Short   UShort  Int     UInt    Long    ULong   LLong   ULLong  Float   Double  LDbl    FCplex  DCplex  LDCplex FImag   DImag   LDImag  I128,   U128 */
     223                /* Bool */      { 0,    1,              1,              2,              3,              4,              5,              6,              6,              7,              8,              9,              12,             13,             14,             12,             13,             14,             -1,             -1,             -1,             10,             11,     },
     224                /* Char */      { -1,   0,              -1,             1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,     },
     225                /* SChar */ { -1,       -1,             0,              1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,     },
     226                /* UChar */ { -1,       -1,             -1,             0,              1,              2,              3,              4,              4,              5,              6,              7,              10,             11,             12,             10,             11,             12,             -1,             -1,             -1,             8,              9,      },
     227                /* Short */ { -1,       -1,             -1,             -1,             0,              1,              2,              3,              3,              4,              5,              6,              9,              10,             11,             9,              10,             11,             -1,             -1,             -1,             7,              8,      },
     228                /* UShort */{ -1,       -1,             -1,             -1,             -1,             0,              1,              2,              2,              3,              4,              5,              8,              9,              10,             8,              9,              10,             -1,             -1,             -1,             6,              7,      },
     229                /* Int */       { -1,   -1,             -1,             -1,             -1,             -1,             0,              1,              1,              2,              3,              4,              7,              8,              9,              7,              8,              9,              -1,             -1,             -1,             5,              6,      },
     230                /* UInt */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,      },
     231                /* Long */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,      },
     232                /* ULong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              5,              6,              7,              5,              6,              7,              -1,             -1,             -1,             3,              4,      },
     233                /* LLong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              4,              5,              6,              4,              5,              6,              -1,             -1,             -1,             2,              3,      },
     234                /* ULLong */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              3,              4,              5,              3,              4,              5,              -1,             -1,             -1,             1,              2,      },
     235
     236                /* Float */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              1,              2,              3,              -1,             -1,             -1,             -1,             -1,     },
     237                /* Double */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             1,              2,              -1,             -1,             -1,             -1,             -1,     },
     238                /* LDbl */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             1,              -1,             -1,             -1,             -1,             -1,     },
     239                /* FCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              -1,             -1,             -1,             -1,             -1,     },
     240                /* DCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             -1,             -1,             -1,             -1,     },
     241                /* LDCplex */{ -1,      -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             -1,             -1,             -1,     },
     242                /* FImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              0,              1,              2,              -1,             -1,     },
     243                /* DImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              -1,             0,              1,              -1,             -1,     },
     244                /* LDImag */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             0,              -1,             -1,     },
     245
     246                /* I128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             2,              3,              4,              3,              4,              5,              -1,             -1,             -1,             0,              1,      },
     247                /* U128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              2,              3,              4,              -1,             -1,             -1,             -1,             0,      },
    245248        };
    246249
     
    266269        }
    267270
    268         void ConversionCost::visit(PointerType *pointerType) {
     271        void ConversionCost::visit( PointerType * pointerType ) {
    269272                if ( PointerType *destAsPtr = dynamic_cast< PointerType* >( dest ) ) {
    270273                        PRINT( std::cerr << pointerType << " ===> " << destAsPtr; )
     
    281284                                }
    282285                        } else {  // xxx - this discards qualifiers from consideration -- reducing qualifiers is a safe conversion; is this right?
    283                                 int assignResult = ptrsAssignable( pointerType->get_base(), destAsPtr->get_base(), env );
     286                                int assignResult = ptrsAssignable( pointerType->base, destAsPtr->base, env );
    284287                                PRINT( std::cerr << " :: " << assignResult << std::endl; )
    285                                 if ( assignResult < 0 && pointerType->get_base()->get_qualifiers() <= destAsPtr->get_qualifiers() ) {
     288                                if ( assignResult > 0 && pointerType->get_base()->get_qualifiers() <= destAsPtr->get_qualifiers() ) {
    286289                                        cost = Cost::safe;
    287                                 } else if ( assignResult > 0 ) {
     290                                } else if ( assignResult < 0 ) {
    288291                                        cost = Cost::unsafe;
    289292                                } // if
    290293                                // assignResult == 0 means Cost::Infinity
    291294                        } // if
    292                 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) {
     295                } else if ( dynamic_cast< ZeroType * >( dest ) ) {
    293296                        cost = Cost::unsafe;
    294297                } // if
    295298        }
    296299
    297         void ConversionCost::visit(__attribute((unused)) ArrayType *arrayType) {}
    298 
    299         void ConversionCost::visit(ReferenceType *refType) {
     300        void ConversionCost::visit( ArrayType * ) {}
     301
     302        void ConversionCost::visit( ReferenceType * refType ) {
    300303                // Note: dest can never be a reference, since it would have been caught in an earlier check
    301304                assert( ! dynamic_cast< ReferenceType * >( dest ) );
     
    303306                // recursively compute conversion cost from T1 to T2.
    304307                // cv can be safely dropped because of 'implicit dereference' behavior.
    305                 refType->get_base()->accept( *this );
    306                 if ( refType->get_base()->get_qualifiers() == dest->get_qualifiers() ) {
     308                refType->base->accept( *this );
     309                if ( refType->base->get_qualifiers() == dest->get_qualifiers() ) {
    307310                        cost.incReference();  // prefer exact qualifiers
    308                 } else if ( refType->get_base()->get_qualifiers() < dest->get_qualifiers() ) {
     311                } else if ( refType->base->get_qualifiers() < dest->get_qualifiers() ) {
    309312                        cost.incSafe(); // then gaining qualifiers
    310313                } else {
     
    314317        }
    315318
    316         void ConversionCost::visit(__attribute((unused)) FunctionType *functionType) {}
    317 
    318         void ConversionCost::visit(StructInstType *inst) {
     319        void ConversionCost::visit( FunctionType * ) {}
     320
     321        void ConversionCost::visit( StructInstType * inst ) {
    319322                if ( StructInstType *destAsInst = dynamic_cast< StructInstType* >( dest ) ) {
    320                         if ( inst->get_name() == destAsInst->get_name() ) {
    321                                 cost = Cost::zero;
    322                         } // if
    323                 } // if
    324         }
    325 
    326         void ConversionCost::visit(UnionInstType *inst) {
    327                 if ( StructInstType *destAsInst = dynamic_cast< StructInstType* >( dest ) ) {
    328                         if ( inst->get_name() == destAsInst->get_name() ) {
    329                                 cost = Cost::zero;
    330                         } // if
    331                 } // if
    332         }
    333 
    334         void ConversionCost::visit( __attribute((unused)) EnumInstType *inst ) {
     323                        if ( inst->name == destAsInst->name ) {
     324                                cost = Cost::zero;
     325                        } // if
     326                } // if
     327        }
     328
     329        void ConversionCost::visit( UnionInstType * inst ) {
     330                if ( UnionInstType *destAsInst = dynamic_cast< UnionInstType* >( dest ) ) {
     331                        if ( inst->name == destAsInst->name ) {
     332                                cost = Cost::zero;
     333                        } // if
     334                } // if
     335        }
     336
     337        void ConversionCost::visit( EnumInstType * ) {
    335338                static Type::Qualifiers q;
    336339                static BasicType integer( q, BasicType::SignedInt );
     
    341344        }
    342345
    343         void ConversionCost::visit( __attribute((unused)) TraitInstType *inst) {
    344         }
    345 
    346         void ConversionCost::visit(TypeInstType *inst) {
     346        void ConversionCost::visit( TraitInstType * ) {}
     347
     348        void ConversionCost::visit( TypeInstType *inst ) {
    347349                EqvClass eqvClass;
    348350                NamedTypeDecl *namedType;
     
    363365        }
    364366
    365         void ConversionCost::visit( __attribute((unused)) TupleType *tupleType) {
     367        void ConversionCost::visit( TupleType * tupleType ) {
    366368                Cost c = Cost::zero;
    367                 if ( TupleType *destAsTuple = dynamic_cast< TupleType* >( dest ) ) {
    368                         std::list< Type* >::const_iterator srcIt = tupleType->get_types().begin();
    369                         std::list< Type* >::const_iterator destIt = destAsTuple->get_types().begin();
     369                if ( TupleType * destAsTuple = dynamic_cast< TupleType * >( dest ) ) {
     370                        std::list< Type * >::const_iterator srcIt = tupleType->get_types().begin();
     371                        std::list< Type * >::const_iterator destIt = destAsTuple->get_types().begin();
    370372                        while ( srcIt != tupleType->get_types().end() && destIt != destAsTuple->get_types().end() ) {
    371373                                Cost newCost = conversionCost( *srcIt++, *destIt++, indexer, env );
     
    383385        }
    384386
    385         void ConversionCost::visit( __attribute((unused)) VarArgsType *varArgsType) {
     387        void ConversionCost::visit( VarArgsType * ) {
    386388                if ( dynamic_cast< VarArgsType* >( dest ) ) {
    387389                        cost = Cost::zero;
     
    389391        }
    390392
    391         void ConversionCost::visit( __attribute((unused)) ZeroType *zeroType) {
    392                 if ( dynamic_cast< ZeroType* >( dest ) ) {
     393        void ConversionCost::visit( ZeroType * ) {
     394                if ( dynamic_cast< ZeroType * >( dest ) ) {
    393395                        cost = Cost::zero;
    394396                } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {
     
    406408        }
    407409
    408         void ConversionCost::visit( __attribute((unused)) OneType *oneType) {
    409                 if ( dynamic_cast< OneType* >( dest ) ) {
     410        void ConversionCost::visit( OneType * ) {
     411                if ( dynamic_cast< OneType * >( dest ) ) {
    410412                        cost = Cost::zero;
    411413                } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {
  • src/ResolvExpr/CurrentObject.cc

    r78315272 r3f7e12cb  
    260260
    261261                AggregateIterator( const std::string & kind, const std::string & name, Type * inst, const MemberList & members ) : kind( kind ), name( name ), inst( inst ), members( members ), curMember( members.begin() ), sub( makeGenericSubstitution( inst ) ) {
     262                        PRINT( std::cerr << "Creating " << kind << "(" << name << ")"; )
    262263                        init();
    263264                }
  • src/ResolvExpr/PolyCost.cc

    r78315272 r3f7e12cb  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // PolyCost.cc -- 
     7// PolyCost.cc --
    88//
    99// Author           : Richard C. Bilson
     
    3131        };
    3232
    33         int polyCost( Type *type, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
     33        int polyCost( Type *type, const TypeEnvironment & env, const SymTab::Indexer &indexer ) {
    3434                PolyCost coster( env, indexer );
    3535                type->accept( coster );
     
    3737        }
    3838
    39         PolyCost::PolyCost( const TypeEnvironment &env, const SymTab::Indexer &indexer ) : result( 0 ), env( env ), indexer( indexer ) {
     39        PolyCost::PolyCost( const TypeEnvironment & env, const SymTab::Indexer & indexer ) : result( 0 ), env( env ), indexer( indexer ) {
    4040        }
    4141
    42         void PolyCost::visit(TypeInstType *typeInst) {
     42        void PolyCost::visit(TypeInstType * typeInst) {
    4343                EqvClass eqvClass;
    44                 if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
     44                if ( env.lookup( typeInst->name, eqvClass ) ) {
    4545                        if ( eqvClass.type ) {
    46                                 if ( TypeInstType *otherTypeInst = dynamic_cast< TypeInstType* >( eqvClass.type ) ) {
    47                                         if ( indexer.lookupType( otherTypeInst->get_name() ) ) {
     46                                if ( TypeInstType * otherTypeInst = dynamic_cast< TypeInstType* >( eqvClass.type ) ) {
     47                                        if ( indexer.lookupType( otherTypeInst->name ) ) {
     48                                                // bound to opaque type
    4849                                                result += 1;
    4950                                        } // if
    5051                                } else {
     52                                        // bound to concrete type
    5153                                        result += 1;
    5254                                } // if
  • src/ResolvExpr/PtrsAssignable.cc

    r78315272 r3f7e12cb  
    4747
    4848        int ptrsAssignable( Type *src, Type *dest, const TypeEnvironment &env ) {
     49                // std::cerr << "assignable: " << src << " | " << dest << std::endl;
    4950                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
    5051                        EqvClass eqvClass;
     
    5455                } // if
    5556                if ( dynamic_cast< VoidType* >( dest ) ) {
    56                         return 1;
     57                        // void * = T * for any T is unsafe
     58                        // xxx - this should be safe, but that currently breaks the build
     59                        return -1;
    5760                } else {
    5861                        PtrsAssignable ptrs( dest, env );
     
    6568
    6669        void PtrsAssignable::visit( __attribute((unused)) VoidType *voidType ) {
    67                 if ( dynamic_cast< FunctionType* >( dest ) ) {
    68                         result = 0;
    69                 } else {
    70                         result = -1;
     70                if ( ! dynamic_cast< FunctionType* >( dest ) ) {
     71                        // T * = void * is safe for any T that is not a function type.
     72                        // xxx - this should be unsafe...
     73                        result = 1;
    7174                } // if
    7275        }
     
    7578        void PtrsAssignable::visit( __attribute__((unused)) PointerType *pointerType ) {}
    7679        void PtrsAssignable::visit( __attribute__((unused)) ArrayType *arrayType ) {}
    77         void PtrsAssignable::visit( __attribute__((unused)) FunctionType *functionType ) {
    78                 result = -1;
    79         }
     80        void PtrsAssignable::visit( __attribute__((unused)) FunctionType *functionType ) {}
    8081
    8182        void PtrsAssignable::visit(  __attribute__((unused)) StructInstType *inst ) {}
     
    8384
    8485        void PtrsAssignable::visit( EnumInstType * ) {
    85                 if ( dynamic_cast< EnumInstType* >( dest ) ) {
     86                if ( dynamic_cast< BasicType* >( dest ) ) {
     87                        // int * = E *, etc. is safe. This isn't technically correct, as each
     88                        // enum has one basic type that it is compatible with, an that type can
     89                        // differ from enum to enum. Without replicating GCC's internal logic,
     90                        // there is no way to know which type this particular enum is compatible
     91                        // with, so punt on this for now.
    8692                        result = 1;
    87                 } else if ( BasicType *bt = dynamic_cast< BasicType* >( dest ) ) {
    88                         result = bt->get_kind() == BasicType::SignedInt;
    8993                }
    9094        }
     
    9498                EqvClass eqvClass;
    9599                if ( env.lookup( inst->get_name(), eqvClass ) && eqvClass.type ) {
     100                        // T * = S * for any S depends on the type bound to T
    96101                        result = ptrsAssignable( eqvClass.type, dest, env );
    97                 } else {
    98                         result = 0;
    99102                } // if
    100103        }
  • src/ResolvExpr/PtrsCastable.cc

    r78315272 r3f7e12cb  
    5050        };
    5151
    52         int objectCast( Type *src, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
    53                 if ( dynamic_cast< FunctionType* >( src ) ) {
    54                         return -1;
    55                 } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( src ) ) {
    56                         EqvClass eqvClass;
    57                         if ( NamedTypeDecl *ntDecl = indexer.lookupType( typeInst->get_name() ) ) {
    58                                 if ( TypeDecl *tyDecl = dynamic_cast< TypeDecl* >( ntDecl ) ) {
    59                                         if ( tyDecl->get_kind() == TypeDecl::Ftype ) {
     52        namespace {
     53                int objectCast( Type *src, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
     54                        if ( dynamic_cast< FunctionType* >( src ) ) {
     55                                return -1;
     56                        } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( src ) ) {
     57                                EqvClass eqvClass;
     58                                if ( NamedTypeDecl *ntDecl = indexer.lookupType( typeInst->get_name() ) ) {
     59                                        if ( TypeDecl *tyDecl = dynamic_cast< TypeDecl* >( ntDecl ) ) {
     60                                                if ( tyDecl->get_kind() == TypeDecl::Ftype ) {
     61                                                        return -1;
     62                                                } // if
     63                                        } //if
     64                                } else if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
     65                                        if ( eqvClass.data.kind == TypeDecl::Ftype ) {
    6066                                                return -1;
    6167                                        } // if
    62                                 } //if
    63                         } else if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
    64                                 if ( eqvClass.data.kind == TypeDecl::Ftype ) {
    65                                         return -1;
    6668                                } // if
    67                         } // if
    68                 } //if
    69                 return 1;
    70         }
    71         int functionCast( Type *src, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
    72                 return -1 * objectCast( src, env, indexer );  // reverse the sense of objectCast
     69                        } //if
     70                        return 1;
     71                }
     72                int functionCast( Type *src, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
     73                        return -1 * objectCast( src, env, indexer );  // reverse the sense of objectCast
     74                }
    7375        }
    7476
     
    9395        }
    9496
    95         void PtrsCastable::visit( __attribute__((unused)) VoidType *voidType) {
     97        void PtrsCastable::visit( VoidType * ) {
    9698                result = objectCast( dest, env, indexer );
    9799        }
    98100
    99         void PtrsCastable::visit( __attribute__((unused)) BasicType *basicType) {
     101        void PtrsCastable::visit( BasicType * ) {
    100102                result = objectCast( dest, env, indexer );
    101103        }
    102104
    103         void PtrsCastable::visit( __attribute__((unused)) PointerType *pointerType) {
     105        void PtrsCastable::visit( PointerType * ) {
    104106                result = objectCast( dest, env, indexer );
    105107        }
    106108
    107         void PtrsCastable::visit( __attribute__((unused)) ArrayType *arrayType) {
     109        void PtrsCastable::visit( ArrayType * ) {
    108110                result = objectCast( dest, env, indexer );
    109111        }
    110112
    111         void PtrsCastable::visit( __attribute__((unused)) FunctionType *functionType) {
     113        void PtrsCastable::visit( FunctionType * ) {
    112114                // result = -1;
    113115                result = functionCast( dest, env, indexer );
    114116        }
    115117
    116         void PtrsCastable::visit( __attribute__((unused)) StructInstType *inst) {
     118        void PtrsCastable::visit( StructInstType * ) {
    117119                result = objectCast( dest, env, indexer );
    118120        }
    119121
    120         void PtrsCastable::visit( __attribute__((unused)) UnionInstType *inst) {
     122        void PtrsCastable::visit( UnionInstType * ) {
    121123                result = objectCast( dest, env, indexer );
    122124        }
    123125
    124         void PtrsCastable::visit( __attribute__((unused)) EnumInstType *inst) {
     126        void PtrsCastable::visit( EnumInstType * ) {
    125127                if ( dynamic_cast< EnumInstType* >( dest ) ) {
    126128                        result = 1;
     
    136138        }
    137139
    138         void PtrsCastable::visit( __attribute__((unused)) TraitInstType *inst ) {}
     140        void PtrsCastable::visit( TraitInstType * ) {}
    139141
    140142        void PtrsCastable::visit(TypeInstType *inst) {
     
    143145        }
    144146
    145         void PtrsCastable::visit( __attribute__((unused)) TupleType *tupleType) {
     147        void PtrsCastable::visit( TupleType * ) {
    146148                result = objectCast( dest, env, indexer );
    147149        }
    148150
    149         void PtrsCastable::visit( __attribute__((unused)) VarArgsType *varArgsType) {
     151        void PtrsCastable::visit( VarArgsType * ) {
    150152                result = objectCast( dest, env, indexer );
    151153        }
    152154
    153         void PtrsCastable::visit( __attribute__((unused)) ZeroType *zeroType) {
     155        void PtrsCastable::visit( ZeroType * ) {
    154156                result = objectCast( dest, env, indexer );
    155157        }
    156158
    157         void PtrsCastable::visit( __attribute__((unused)) OneType *oneType) {
     159        void PtrsCastable::visit( OneType * ) {
    158160                result = objectCast( dest, env, indexer );
    159161        }
  • src/ResolvExpr/ResolveTypeof.cc

    r78315272 r3f7e12cb  
    1818#include <cassert>               // for assert
    1919
     20#include "Common/PassVisitor.h"  // for PassVisitor
    2021#include "Resolver.h"            // for resolveInVoidContext
    2122#include "SynTree/Expression.h"  // for Expression
     
    4142        }
    4243
    43         class ResolveTypeof : public Mutator {
     44        class ResolveTypeof : public WithShortCircuiting {
    4445          public:
    4546                ResolveTypeof( const SymTab::Indexer &indexer ) : indexer( indexer ) {}
    46                 Type *mutate( TypeofType *typeofType );
     47                void premutate( TypeofType *typeofType );
     48                Type * postmutate( TypeofType *typeofType );
    4749
    4850          private:
     
    5052        };
    5153
    52         Type *resolveTypeof( Type *type, const SymTab::Indexer &indexer ) {
    53                 ResolveTypeof mutator( indexer );
     54        Type * resolveTypeof( Type *type, const SymTab::Indexer &indexer ) {
     55                PassVisitor<ResolveTypeof> mutator( indexer );
    5456                return type->acceptMutator( mutator );
    5557        }
    5658
    57         Type *ResolveTypeof::mutate( TypeofType *typeofType ) {
     59        void ResolveTypeof::premutate( TypeofType * ) {
     60                visit_children = false;
     61        }
     62
     63        Type * ResolveTypeof::postmutate( TypeofType *typeofType ) {
    5864#if 0
    59                 std::cout << "resolving typeof: ";
    60                 typeofType->print( std::cout );
    61                 std::cout << std::endl;
     65                std::cerr << "resolving typeof: ";
     66                typeofType->print( std::cerr );
     67                std::cerr << std::endl;
    6268#endif
    63                 if ( typeofType->get_expr() ) {
    64                         Expression *newExpr = resolveInVoidContext( typeofType->get_expr(), indexer );
    65                         assert( newExpr->has_result() && ! newExpr->get_result()->isVoid() );
    66                         Type *newType = newExpr->get_result();
    67                         newExpr->set_result( nullptr );
     69                if ( typeofType->expr ) {
     70                        Expression * newExpr = resolveInVoidContext( typeofType->expr, indexer );
     71                        assert( newExpr->result && ! newExpr->result->isVoid() );
     72                        Type * newType = newExpr->result;
     73                        newExpr->result = nullptr;
    6874                        delete typeofType;
    6975                        delete newExpr;
  • src/ResolvExpr/Resolver.cc

    r78315272 r3f7e12cb  
    4040#include "SynTree/Visitor.h"             // for acceptAll, maybeAccept
    4141#include "typeops.h"                     // for extractResultType
     42#include "Unify.h"                       // for unify
    4243
    4344using namespace std;
     
    5253                void previsit( FunctionDecl *functionDecl );
    5354                void postvisit( FunctionDecl *functionDecl );
    54                 void previsit( ObjectDecl *functionDecl );
     55                void previsit( ObjectDecl *objectDecll );
    5556                void previsit( TypeDecl *typeDecl );
    5657                void previsit( EnumDecl * enumDecl );
     
    7172                void previsit( ThrowStmt *throwStmt );
    7273                void previsit( CatchStmt *catchStmt );
     74                void previsit( WaitForStmt * stmt );
    7375
    7476                void previsit( SingleInit *singleInit );
     
    9597        }
    9698
     99        void resolveDecl( Declaration * decl, const SymTab::Indexer &indexer ) {
     100                PassVisitor<Resolver> resolver( indexer );
     101                maybeAccept( decl, resolver );
     102        }
     103
    97104        // used in resolveTypeof
    98105        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer ) {
     
    102109
    103110        namespace {
    104                 void finishExpr( Expression *expr, const TypeEnvironment &env ) {
    105                         expr->set_env( new TypeSubstitution );
     111                void finishExpr( Expression *expr, const TypeEnvironment &env, TypeSubstitution * oldenv = nullptr ) {
     112                        expr->env = oldenv ? oldenv->clone() : new TypeSubstitution;
    106113                        env.makeSubstitution( *expr->get_env() );
    107114                }
     115
     116                void removeExtraneousCast( Expression *& expr, const SymTab::Indexer & indexer ) {
     117                        if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
     118                                if ( ResolvExpr::typesCompatible( castExpr->arg->result, castExpr->result, indexer ) ) {
     119                                        // cast is to the same type as its argument, so it's unnecessary -- remove it
     120                                        expr = castExpr->arg;
     121                                        castExpr->arg = nullptr;
     122                                        std::swap( expr->env, castExpr->env );
     123                                        delete castExpr;
     124                                }
     125                        }
     126                }
    108127        } // namespace
    109128
    110         Expression *findVoidExpression( Expression *untyped, const SymTab::Indexer &indexer ) {
     129        void findVoidExpression( Expression *& untyped, const SymTab::Indexer &indexer ) {
    111130                global_renamer.reset();
    112131                TypeEnvironment env;
    113132                Expression *newExpr = resolveInVoidContext( untyped, indexer, env );
    114                 finishExpr( newExpr, env );
    115                 return newExpr;
     133                finishExpr( newExpr, env, untyped->env );
     134                delete untyped;
     135                untyped = newExpr;
     136        }
     137
     138        void findSingleExpression( Expression *&untyped, const SymTab::Indexer &indexer ) {
     139                if ( ! untyped ) return;
     140                TypeEnvironment env;
     141                AlternativeFinder finder( indexer, env );
     142                finder.find( untyped );
     143                #if 0
     144                if ( finder.get_alternatives().size() != 1 ) {
     145                        std::cerr << "untyped expr is ";
     146                        untyped->print( std::cerr );
     147                        std::cerr << std::endl << "alternatives are:";
     148                        for ( const Alternative & alt : finder.get_alternatives() ) {
     149                                alt.print( std::cerr );
     150                        } // for
     151                } // if
     152                #endif
     153                assertf( finder.get_alternatives().size() == 1, "findSingleExpression: must have exactly one alternative at the end." );
     154                Alternative &choice = finder.get_alternatives().front();
     155                Expression *newExpr = choice.expr->clone();
     156                finishExpr( newExpr, choice.env, untyped->env );
     157                delete untyped;
     158                untyped = newExpr;
     159        }
     160
     161        void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer & indexer ) {
     162                assert( untyped && type );
     163                untyped = new CastExpr( untyped, type );
     164                findSingleExpression( untyped, indexer );
     165                removeExtraneousCast( untyped, indexer );
    116166        }
    117167
    118168        namespace {
    119                 Expression *findSingleExpression( Expression *untyped, const SymTab::Indexer &indexer ) {
    120                         TypeEnvironment env;
    121                         AlternativeFinder finder( indexer, env );
    122                         finder.find( untyped );
    123 #if 0
    124                         if ( finder.get_alternatives().size() != 1 ) {
    125                                 std::cout << "untyped expr is ";
    126                                 untyped->print( std::cout );
    127                                 std::cout << std::endl << "alternatives are:";
    128                                 for ( std::list< Alternative >::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
    129                                         i->print( std::cout );
    130                                 } // for
    131                         } // if
    132 #endif
    133                         assertf( finder.get_alternatives().size() == 1, "findSingleExpression: must have exactly one alternative at the end." );
    134                         Alternative &choice = finder.get_alternatives().front();
    135                         Expression *newExpr = choice.expr->clone();
    136                         finishExpr( newExpr, choice.env );
    137                         return newExpr;
    138                 }
    139 
    140169                bool isIntegralType( Type *type ) {
    141170                        if ( dynamic_cast< EnumInstType * >( type ) ) {
     
    150179                }
    151180
    152                 Expression *findIntegralExpression( Expression *untyped, const SymTab::Indexer &indexer ) {
     181                void findIntegralExpression( Expression *& untyped, const SymTab::Indexer &indexer ) {
    153182                        TypeEnvironment env;
    154183                        AlternativeFinder finder( indexer, env );
     
    179208                                throw SemanticError( "No interpretations for case control expression", untyped );
    180209                        } // if
    181                         finishExpr( newExpr, *newEnv );
    182                         return newExpr;
     210                        finishExpr( newExpr, *newEnv, untyped->env );
     211                        delete untyped;
     212                        untyped = newExpr;
    183213                }
    184214
     
    205235        void Resolver::handlePtrType( PtrType * type ) {
    206236                if ( type->get_dimension() ) {
    207                         CastExpr *castExpr = new CastExpr( type->get_dimension(), SymTab::SizeType->clone() );
    208                         Expression *newExpr = findSingleExpression( castExpr, indexer );
    209                         delete type->get_dimension();
    210                         type->set_dimension( newExpr );
     237                        findSingleExpression( type->dimension, SymTab::SizeType->clone(), indexer );
    211238                }
    212239        }
     
    238265                functionReturn = ResolvExpr::extractResultType( functionDecl->get_functionType() );
    239266        }
    240 
    241267
    242268        void Resolver::postvisit( FunctionDecl *functionDecl ) {
     
    262288        void Resolver::previsit( ExprStmt *exprStmt ) {
    263289                visit_children = false;
    264                 assertf( exprStmt->get_expr(), "ExprStmt has null Expression in resolver" );
    265                 Expression *newExpr = findVoidExpression( exprStmt->get_expr(), indexer );
    266                 delete exprStmt->get_expr();
    267                 exprStmt->set_expr( newExpr );
     290                assertf( exprStmt->expr, "ExprStmt has null Expression in resolver" );
     291                findVoidExpression( exprStmt->expr, indexer );
    268292        }
    269293
    270294        void Resolver::previsit( AsmExpr *asmExpr ) {
    271295                visit_children = false;
    272                 Expression *newExpr = findVoidExpression( asmExpr->get_operand(), indexer );
    273                 delete asmExpr->get_operand();
    274                 asmExpr->set_operand( newExpr );
     296                findVoidExpression( asmExpr->operand, indexer );
    275297                if ( asmExpr->get_inout() ) {
    276                         newExpr = findVoidExpression( asmExpr->get_inout(), indexer );
    277                         delete asmExpr->get_inout();
    278                         asmExpr->set_inout( newExpr );
     298                        findVoidExpression( asmExpr->inout, indexer );
    279299                } // if
    280300        }
     
    287307
    288308        void Resolver::previsit( IfStmt *ifStmt ) {
    289                 Expression *newExpr = findSingleExpression( ifStmt->get_condition(), indexer );
    290                 delete ifStmt->get_condition();
    291                 ifStmt->set_condition( newExpr );
     309                findSingleExpression( ifStmt->condition, indexer );
    292310        }
    293311
    294312        void Resolver::previsit( WhileStmt *whileStmt ) {
    295                 Expression *newExpr = findSingleExpression( whileStmt->get_condition(), indexer );
    296                 delete whileStmt->get_condition();
    297                 whileStmt->set_condition( newExpr );
     313                findSingleExpression( whileStmt->condition, indexer );
    298314        }
    299315
    300316        void Resolver::previsit( ForStmt *forStmt ) {
    301                 if ( forStmt->get_condition() ) {
    302                         Expression * newExpr = findSingleExpression( forStmt->get_condition(), indexer );
    303                         delete forStmt->get_condition();
    304                         forStmt->set_condition( newExpr );
     317                if ( forStmt->condition ) {
     318                        findSingleExpression( forStmt->condition, indexer );
    305319                } // if
    306320
    307                 if ( forStmt->get_increment() ) {
    308                         Expression * newExpr = findVoidExpression( forStmt->get_increment(), indexer );
    309                         delete forStmt->get_increment();
    310                         forStmt->set_increment( newExpr );
     321                if ( forStmt->increment ) {
     322                        findVoidExpression( forStmt->increment, indexer );
    311323                } // if
    312324        }
     
    314326        void Resolver::previsit( SwitchStmt *switchStmt ) {
    315327                GuardValue( currentObject );
    316                 Expression *newExpr;
    317                 newExpr = findIntegralExpression( switchStmt->get_condition(), indexer );
    318                 delete switchStmt->get_condition();
    319                 switchStmt->set_condition( newExpr );
    320 
    321                 currentObject = CurrentObject( newExpr->get_result() );
     328                findIntegralExpression( switchStmt->condition, indexer );
     329
     330                currentObject = CurrentObject( switchStmt->condition->result );
    322331        }
    323332
     
    326335                        std::list< InitAlternative > initAlts = currentObject.getOptions();
    327336                        assertf( initAlts.size() == 1, "SwitchStmt did not correctly resolve an integral expression." );
    328                         CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initAlts.front().type->clone() );
    329                         Expression * newExpr = findSingleExpression( castExpr, indexer );
    330                         castExpr = strict_dynamic_cast< CastExpr * >( newExpr );
    331                         caseStmt->set_condition( castExpr->get_arg() );
    332                         castExpr->set_arg( nullptr );
     337                        // must remove cast from case statement because RangeExpr cannot be cast.
     338                        Expression * newExpr = new CastExpr( caseStmt->condition, initAlts.front().type->clone() );
     339                        findSingleExpression( newExpr, indexer );
     340                        CastExpr * castExpr = strict_dynamic_cast< CastExpr * >( newExpr );
     341                        caseStmt->condition = castExpr->arg;
     342                        castExpr->arg = nullptr;
    333343                        delete castExpr;
    334344                }
     
    339349                // must resolve the argument for a computed goto
    340350                if ( branchStmt->get_type() == BranchStmt::Goto ) { // check for computed goto statement
    341                         if ( Expression * arg = branchStmt->get_computedTarget() ) {
    342                                 VoidType v = Type::Qualifiers();                // cast to void * for the alternative finder
    343                                 PointerType pt( Type::Qualifiers(), v.clone() );
    344                                 CastExpr * castExpr = new CastExpr( arg, pt.clone() );
    345                                 Expression * newExpr = findSingleExpression( castExpr, indexer ); // find best expression
    346                                 branchStmt->set_target( newExpr );
     351                        if ( branchStmt->computedTarget ) {
     352                                // computed goto argument is void *
     353                                findSingleExpression( branchStmt->computedTarget, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), indexer );
    347354                        } // if
    348355                } // if
     
    351358        void Resolver::previsit( ReturnStmt *returnStmt ) {
    352359                visit_children = false;
    353                 if ( returnStmt->get_expr() ) {
    354                         CastExpr *castExpr = new CastExpr( returnStmt->get_expr(), functionReturn->clone() );
    355                         Expression *newExpr = findSingleExpression( castExpr, indexer );
    356                         delete castExpr;
    357                         returnStmt->set_expr( newExpr );
     360                if ( returnStmt->expr ) {
     361                        findSingleExpression( returnStmt->expr, functionReturn->clone(), indexer );
    358362                } // if
    359363        }
     
    366370                                indexer.lookupStruct( "__cfaehm__base_exception_t" );
    367371                        assert( exception_decl );
    368                         Expression * wrapped = new CastExpr(
    369                                 throwStmt->get_expr(),
    370                                 new PointerType(
    371                                         noQualifiers,
    372                                         new StructInstType(
    373                                                 noQualifiers,
    374                                                 exception_decl
    375                                                 )
    376                                         )
    377                                 );
    378                         Expression * newExpr = findSingleExpression( wrapped, indexer );
    379                         throwStmt->set_expr( newExpr );
     372                        Type * exceptType = new PointerType( noQualifiers, new StructInstType( noQualifiers, exception_decl ) );
     373                        findSingleExpression( throwStmt->expr, exceptType, indexer );
    380374                }
    381375        }
    382376
    383377        void Resolver::previsit( CatchStmt *catchStmt ) {
    384                 if ( catchStmt->get_cond() ) {
    385                         Expression * wrapped = new CastExpr(
    386                                 catchStmt->get_cond(),
    387                                 new BasicType( noQualifiers, BasicType::Bool )
    388                                 );
    389                         catchStmt->set_cond( findSingleExpression( wrapped, indexer ) );
     378                if ( catchStmt->cond ) {
     379                        findSingleExpression( catchStmt->cond, new BasicType( noQualifiers, BasicType::Bool ), indexer );
     380                }
     381        }
     382
     383        template< typename iterator_t >
     384        inline bool advance_to_mutex( iterator_t & it, const iterator_t & end ) {
     385                while( it != end && !(*it)->get_type()->get_mutex() ) {
     386                        it++;
     387                }
     388
     389                return it != end;
     390        }
     391
     392        void Resolver::previsit( WaitForStmt * stmt ) {
     393                visit_children = false;
     394
     395                // Resolve all clauses first
     396                for( auto& clause : stmt->clauses ) {
     397
     398                        TypeEnvironment env;
     399                        AlternativeFinder funcFinder( indexer, env );
     400
     401                        // Find all alternatives for a function in canonical form
     402                        funcFinder.findWithAdjustment( clause.target.function );
     403
     404                        if ( funcFinder.get_alternatives().empty() ) {
     405                                stringstream ss;
     406                                ss << "Use of undeclared indentifier '";
     407                                ss << strict_dynamic_cast<NameExpr*>( clause.target.function )->name;
     408                                ss << "' in call to waitfor";
     409                                throw SemanticError( ss.str() );
     410                        }
     411
     412                        // Find all alternatives for all arguments in canonical form
     413                        std::list< AlternativeFinder > argAlternatives;
     414                        funcFinder.findSubExprs( clause.target.arguments.begin(), clause.target.arguments.end(), back_inserter( argAlternatives ) );
     415
     416                        // List all combinations of arguments
     417                        std::list< AltList > possibilities;
     418                        combos( argAlternatives.begin(), argAlternatives.end(), back_inserter( possibilities ) );
     419
     420                        AltList                func_candidates;
     421                        std::vector< AltList > args_candidates;
     422
     423                        // For every possible function :
     424                        //      try matching the arguments to the parameters
     425                        //      not the other way around because we have more arguments than parameters
     426                        SemanticError errors;
     427                        for ( Alternative & func : funcFinder.get_alternatives() ) {
     428                                try {
     429                                        PointerType * pointer = dynamic_cast< PointerType* >( func.expr->get_result()->stripReferences() );
     430                                        if( !pointer ) {
     431                                                throw SemanticError( "candidate not viable: not a pointer type\n", func.expr->get_result() );
     432                                        }
     433
     434                                        FunctionType * function = dynamic_cast< FunctionType* >( pointer->get_base() );
     435                                        if( !function ) {
     436                                                throw SemanticError( "candidate not viable: not a function type\n", pointer->get_base() );
     437                                        }
     438
     439
     440                                        {
     441                                                auto param     = function->parameters.begin();
     442                                                auto param_end = function->parameters.end();
     443
     444                                                if( !advance_to_mutex( param, param_end ) ) {
     445                                                        throw SemanticError("candidate function not viable: no mutex parameters\n", function);
     446                                                }
     447                                        }
     448
     449                                        Alternative newFunc( func );
     450                                        // Strip reference from function
     451                                        referenceToRvalueConversion( newFunc.expr );
     452
     453                                        // For all the set of arguments we have try to match it with the parameter of the current function alternative
     454                                        for ( auto & argsList : possibilities ) {
     455
     456                                                try {
     457                                                        // Declare data structures need for resolution
     458                                                        OpenVarSet openVars;
     459                                                        AssertionSet resultNeed, resultHave;
     460                                                        TypeEnvironment resultEnv;
     461
     462                                                        // Load type variables from arguemnts into one shared space
     463                                                        simpleCombineEnvironments( argsList.begin(), argsList.end(), resultEnv );
     464
     465                                                        // Make sure we don't widen any existing bindings
     466                                                        for ( auto & i : resultEnv ) {
     467                                                                i.allowWidening = false;
     468                                                        }
     469
     470                                                        // Find any unbound type variables
     471                                                        resultEnv.extractOpenVars( openVars );
     472
     473                                                        auto param     = function->parameters.begin();
     474                                                        auto param_end = function->parameters.end();
     475
     476                                                        // For every arguments of its set, check if it matches one of the parameter
     477                                                        // The order is important
     478                                                        for( auto & arg : argsList ) {
     479
     480                                                                // Ignore non-mutex arguments
     481                                                                if( !advance_to_mutex( param, param_end ) ) {
     482                                                                        // We ran out of parameters but still have arguments
     483                                                                        // this function doesn't match
     484                                                                        throw SemanticError("candidate function not viable: too many mutex arguments\n", function);
     485                                                                }
     486
     487                                                                // Check if the argument matches the parameter type in the current scope
     488                                                                if( ! unify( (*param)->get_type(), arg.expr->get_result(), resultEnv, resultNeed, resultHave, openVars, this->indexer ) ) {
     489                                                                        // Type doesn't match
     490                                                                        stringstream ss;
     491                                                                        ss << "candidate function not viable: no known convertion from '";
     492                                                                        arg.expr->get_result()->print( ss );
     493                                                                        ss << "' to '";
     494                                                                        (*param)->get_type()->print( ss );
     495                                                                        ss << "'\n";
     496                                                                        throw SemanticError(ss.str(), function);
     497                                                                }
     498
     499                                                                param++;
     500                                                        }
     501
     502                                                        // All arguments match !
     503
     504                                                        // Check if parameters are missing
     505                                                        if( advance_to_mutex( param, param_end ) ) {
     506                                                                // We ran out of arguments but still have parameters left
     507                                                                // this function doesn't match
     508                                                                throw SemanticError("candidate function not viable: too few mutex arguments\n", function);
     509                                                        }
     510
     511                                                        // All parameters match !
     512
     513                                                        // Finish the expressions to tie in the proper environments
     514                                                        finishExpr( newFunc.expr, resultEnv );
     515                                                        for( Alternative & alt : argsList ) {
     516                                                                finishExpr( alt.expr, resultEnv );
     517                                                        }
     518
     519                                                        // This is a match store it and save it for later
     520                                                        func_candidates.push_back( newFunc );
     521                                                        args_candidates.push_back( argsList );
     522
     523                                                }
     524                                                catch( SemanticError &e ) {
     525                                                        errors.append( e );
     526                                                }
     527                                        }
     528                                }
     529                                catch( SemanticError &e ) {
     530                                        errors.append( e );
     531                                }
     532                        }
     533
     534                        // Make sure we got the right number of arguments
     535                        if( func_candidates.empty() )    { SemanticError top( "No alternatives for function in call to waitfor"  ); top.append( errors ); throw top; }
     536                        if( args_candidates.empty() )    { SemanticError top( "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; }
     537                        if( func_candidates.size() > 1 ) { SemanticError top( "Ambiguous function in call to waitfor"            ); top.append( errors ); throw top; }
     538                        if( args_candidates.size() > 1 ) { SemanticError top( "Ambiguous arguments in call to waitfor"           ); top.append( errors ); throw top; }
     539
     540
     541                        // Swap the results from the alternative with the unresolved values.
     542                        // Alternatives will handle deletion on destruction
     543                        std::swap( clause.target.function, func_candidates.front().expr );
     544                        for( auto arg_pair : group_iterate( clause.target.arguments, args_candidates.front() ) ) {
     545                                std::swap ( std::get<0>( arg_pair), std::get<1>( arg_pair).expr );
     546                        }
     547
     548                        // Resolve the conditions as if it were an IfStmt
     549                        // Resolve the statments normally
     550                        findSingleExpression( clause.condition, this->indexer );
     551                        clause.statement->accept( *visitor );
     552                }
     553
     554
     555                if( stmt->timeout.statement ) {
     556                        // Resolve the timeout as an size_t for now
     557                        // Resolve the conditions as if it were an IfStmt
     558                        // Resolve the statments normally
     559                        findSingleExpression( stmt->timeout.time, new BasicType( noQualifiers, BasicType::LongLongUnsignedInt ), this->indexer );
     560                        findSingleExpression( stmt->timeout.condition, this->indexer );
     561                        stmt->timeout.statement->accept( *visitor );
     562                }
     563
     564                if( stmt->orelse.statement ) {
     565                        // Resolve the conditions as if it were an IfStmt
     566                        // Resolve the statments normally
     567                        findSingleExpression( stmt->orelse.condition, this->indexer );
     568                        stmt->orelse.statement->accept( *visitor );
    390569                }
    391570        }
     
    403582                visit_children = false;
    404583                // resolve initialization using the possibilities as determined by the currentObject cursor
    405                 UntypedInitExpr * untyped = new UntypedInitExpr( singleInit->get_value(), currentObject.getOptions() );
    406                 Expression * newExpr = findSingleExpression( untyped, indexer );
     584                Expression * newExpr = new UntypedInitExpr( singleInit->value, currentObject.getOptions() );
     585                findSingleExpression( newExpr, indexer );
    407586                InitExpr * initExpr = strict_dynamic_cast< InitExpr * >( newExpr );
    408587
     
    411590
    412591                // discard InitExpr wrapper and retain relevant pieces
    413                 newExpr = initExpr->get_expr();
    414                 newExpr->set_env( initExpr->get_env() );
    415                 initExpr->set_expr( nullptr );
    416                 initExpr->set_env( nullptr );
     592                newExpr = initExpr->expr;
     593                initExpr->expr = nullptr;
     594                std::swap( initExpr->env, newExpr->env );
     595                std::swap( initExpr->inferParams, newExpr->inferParams ) ;
    417596                delete initExpr;
    418597
    419598                // get the actual object's type (may not exactly match what comes back from the resolver due to conversions)
    420599                Type * initContext = currentObject.getCurrentType();
     600
     601                removeExtraneousCast( newExpr, indexer );
    421602
    422603                // check if actual object's type is char[]
     
    426607                                if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) {
    427608                                        if ( isCharType( pt->get_base() ) ) {
    428                                                 // strip cast if we're initializing a char[] with a char *, e.g.  char x[] = "hello";
    429                                                 CastExpr *ce = strict_dynamic_cast< CastExpr * >( newExpr );
    430                                                 newExpr = ce->get_arg();
    431                                                 ce->set_arg( nullptr );
    432                                                 delete ce;
     609                                                if ( CastExpr *ce = dynamic_cast< CastExpr * >( newExpr ) ) {
     610                                                        // strip cast if we're initializing a char[] with a char *, e.g.  char x[] = "hello";
     611                                                        newExpr = ce->get_arg();
     612                                                        ce->set_arg( nullptr );
     613                                                        std::swap( ce->env, newExpr->env );
     614                                                        delete ce;
     615                                                }
    433616                                        }
    434617                                }
     
    437620
    438621                // set initializer expr to resolved express
    439                 singleInit->set_value( newExpr );
     622                singleInit->value = newExpr;
    440623
    441624                // move cursor to next object in preparation for next initializer
  • src/ResolvExpr/Resolver.h

    r78315272 r3f7e12cb  
    2929        /// Checks types and binds syntactic constructs to typed representations
    3030        void resolve( std::list< Declaration * > translationUnit );
    31         Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer );
    32         Expression *findVoidExpression( Expression *untyped, const SymTab::Indexer &indexer );
     31        void resolveDecl( Declaration *, const SymTab::Indexer &indexer );
     32        Expression *resolveInVoidContext( Expression * expr, const SymTab::Indexer &indexer );
     33        void findVoidExpression( Expression *& untyped, const SymTab::Indexer &indexer );
     34        void findSingleExpression( Expression *& untyped, const SymTab::Indexer &indexer );
    3335        void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer );
    3436        void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer );
  • src/ResolvExpr/TypeEnvironment.cc

    r78315272 r3f7e12cb  
    6868        }
    6969
    70         void EqvClass::print( std::ostream &os, int indent ) const {
    71                 os << std::string( indent, ' ' ) << "( ";
     70        void EqvClass::print( std::ostream &os, Indenter indent ) const {
     71                os << "( ";
    7272                std::copy( vars.begin(), vars.end(), std::ostream_iterator< std::string >( os, " " ) );
    7373                os << ")";
    7474                if ( type ) {
    7575                        os << " -> ";
    76                         type->print( os, indent );
     76                        type->print( os, indent+1 );
    7777                } // if
    7878                if ( ! allowWidening ) {
     
    123123                for ( std::list< EqvClass >::const_iterator theClass = env.begin(); theClass != env.end(); ++theClass ) {
    124124                        for ( std::set< std::string >::const_iterator theVar = theClass->vars.begin(); theVar != theClass->vars.end(); ++theVar ) {
    125 ///       std::cout << "adding " << *theVar;
     125///       std::cerr << "adding " << *theVar;
    126126                                if ( theClass->type ) {
    127 ///         std::cout << " bound to ";
    128 ///         theClass->type->print( std::cout );
    129 ///         std::cout << std::endl;
     127///         std::cerr << " bound to ";
     128///         theClass->type->print( std::cerr );
     129///         std::cerr << std::endl;
    130130                                        sub.add( *theVar, theClass->type );
    131131                                } else if ( theVar != theClass->vars.begin() ) {
    132132                                        TypeInstType *newTypeInst = new TypeInstType( Type::Qualifiers(), *theClass->vars.begin(), theClass->data.kind == TypeDecl::Ftype );
    133 ///         std::cout << " bound to variable " << *theClass->vars.begin() << std::endl;
     133///         std::cerr << " bound to variable " << *theClass->vars.begin() << std::endl;
    134134                                        sub.add( *theVar, newTypeInst );
    135135                                        delete newTypeInst;
     
    144144        }
    145145
    146         void TypeEnvironment::print( std::ostream &os, int indent ) const {
     146        void TypeEnvironment::print( std::ostream &os, Indenter indent ) const {
    147147                for ( std::list< EqvClass >::const_iterator i = env.begin(); i != env.end(); ++i ) {
    148148                        i->print( os, indent );
  • src/ResolvExpr/TypeEnvironment.h

    r78315272 r3f7e12cb  
    6868                EqvClass &operator=( const EqvClass &other );
    6969                ~EqvClass();
    70                 void print( std::ostream &os, int indent = 0 ) const;
     70                void print( std::ostream &os, Indenter indent = {} ) const;
    7171        };
    7272
     
    8080                void makeSubstitution( TypeSubstitution &result ) const;
    8181                bool isEmpty() const { return env.empty(); }
    82                 void print( std::ostream &os, int indent = 0 ) const;
     82                void print( std::ostream &os, Indenter indent = {} ) const;
    8383                void combine( const TypeEnvironment &second, Type *(*combineFunc)( Type*, Type* ) );
    8484                void simpleCombine( const TypeEnvironment &second );
  • src/ResolvExpr/Unify.cc

    r78315272 r3f7e12cb  
    1717#include <iterator>               // for back_insert_iterator, back_inserter
    1818#include <map>                    // for _Rb_tree_const_iterator, _Rb_tree_i...
    19 #include <memory>                 // for unique_ptr, auto_ptr
     19#include <memory>                 // for unique_ptr
    2020#include <set>                    // for set
    2121#include <string>                 // for string, operator==, operator!=, bas...
    2222#include <utility>                // for pair
    2323
     24#include "Common/PassVisitor.h"   // for PassVisitor
    2425#include "FindOpenVars.h"         // for findOpenVars
    2526#include "Parser/LinkageSpec.h"   // for C
     
    137138        bool tyVarCompatible( const TypeDecl::Data & data, Type *type ) {
    138139                switch ( data.kind ) {
    139                   case TypeDecl::Any:
    140140                  case TypeDecl::Dtype:
    141141                        // to bind to an object type variable, the type must not be a function type.
     
    169169                                Type *common = 0;
    170170                                // attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to
    171                                 std::auto_ptr< Type > newType( curClass.type->clone() );
     171                                std::unique_ptr< Type > newType( curClass.type->clone() );
    172172                                newType->get_qualifiers() = typeInst->get_qualifiers();
    173173                                if ( unifyInexact( newType.get(), other, env, needAssertions, haveAssertions, openVars, widenMode & WidenMode( curClass.allowWidening, true ), indexer, common ) ) {
     
    458458                if ( otherArray && arrayType->get_isVarLen() == otherArray->get_isVarLen() ) {
    459459
    460                         // not positive this is correct in all cases, but it's needed for typedefs
    461                         if ( arrayType->get_isVarLen() || otherArray->get_isVarLen() ) {
    462                                 return;
    463                         }
    464 
    465460                        if ( ! arrayType->get_isVarLen() && ! otherArray->get_isVarLen() &&
    466461                                arrayType->get_dimension() != 0 && otherArray->get_dimension() != 0 ) {
     
    537532        /// If this isn't done then argument lists can have wildly different
    538533        /// size and structure, when they should be compatible.
    539         struct TtypeExpander : public Mutator {
    540                 TypeEnvironment & env;
    541                 TtypeExpander( TypeEnvironment & env ) : env( env ) {}
    542                 Type * mutate( TypeInstType * typeInst ) {
     534        struct TtypeExpander : public WithShortCircuiting {
     535                TypeEnvironment & tenv;
     536                TtypeExpander( TypeEnvironment & tenv ) : tenv( tenv ) {}
     537                void premutate( TypeInstType * ) { visit_children = false; }
     538                Type * postmutate( TypeInstType * typeInst ) {
    543539                        EqvClass eqvClass;
    544                         if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
     540                        if ( tenv.lookup( typeInst->get_name(), eqvClass ) ) {
    545541                                if ( eqvClass.data.kind == TypeDecl::Ttype ) {
    546542                                        // expand ttype parameter into its actual type
     
    560556                dst.clear();
    561557                for ( DeclarationWithType * dcl : src ) {
    562                         TtypeExpander expander( env );
     558                        PassVisitor<TtypeExpander> expander( env );
    563559                        dcl->acceptMutator( expander );
    564560                        std::list< Type * > types;
     
    750746                        std::list<Type *> types1, types2;
    751747
    752                         TtypeExpander expander( env );
     748                        PassVisitor<TtypeExpander> expander( env );
    753749                        flat1->acceptMutator( expander );
    754750                        flat2->acceptMutator( expander );
  • src/SymTab/Autogen.cc

    r78315272 r3f7e12cb  
    1616#include "Autogen.h"
    1717
    18 #include <cstddef>                 // for NULL
    1918#include <algorithm>               // for count_if
    2019#include <cassert>                 // for strict_dynamic_cast, assert, assertf
     
    2726#include "AddVisit.h"              // for addVisit
    2827#include "CodeGen/OperatorTable.h" // for isCtorDtor, isCtorDtorAssign
     28#include "Common/PassVisitor.h"    // for PassVisitor
    2929#include "Common/ScopedMap.h"      // for ScopedMap<>::const_iterator, Scope...
    3030#include "Common/utility.h"        // for cloneAll, operator+
    31 #include "GenPoly/DeclMutator.h"   // for DeclMutator
    3231#include "GenPoly/ScopedSet.h"     // for ScopedSet, ScopedSet<>::iterator
     32#include "InitTweak/GenInit.h"     // for fixReturnStatements
     33#include "ResolvExpr/Resolver.h"   // for resolveDecl
    3334#include "SymTab/Mangler.h"        // for Mangler
    3435#include "SynTree/Attribute.h"     // For Attribute
     
    4243namespace SymTab {
    4344        Type * SizeType = 0;
    44         typedef ScopedMap< std::string, bool > TypeMap;
    45 
    46         /// Data used to generate functions generically. Specifically, the name of the generated function, a function which generates the routine protoype, and a map which contains data to determine whether a function should be generated.
     45
     46        /// Data used to generate functions generically. Specifically, the name of the generated function and a function which generates the routine protoype
    4747        struct FuncData {
    4848                typedef FunctionType * (*TypeGen)( Type * );
    49                 FuncData( const std::string & fname, const TypeGen & genType, TypeMap & map ) : fname( fname ), genType( genType ), map( map ) {}
     49                FuncData( const std::string & fname, const TypeGen & genType ) : fname( fname ), genType( genType ) {}
    5050                std::string fname;
    5151                TypeGen genType;
    52                 TypeMap & map;
    53         };
    54 
    55         class AutogenerateRoutines final : public Visitor {
    56             template< typename Visitor >
    57             friend void acceptAndAdd( std::list< Declaration * > &translationUnit, Visitor &visitor );
    58             template< typename Visitor >
    59             friend void addVisitStatementList( std::list< Statement* > &stmts, Visitor &visitor );
    60           public:
    61                 std::list< Declaration * > &get_declsToAdd() { return declsToAdd; }
    62 
    63                 typedef Visitor Parent;
    64                 using Parent::visit;
    65 
     52        };
     53
     54        struct AutogenerateRoutines final : public WithDeclsToAdd, public WithVisitorRef<AutogenerateRoutines>, public WithGuards, public WithShortCircuiting, public WithIndexer {
    6655                AutogenerateRoutines();
    6756
    68                 virtual void visit( EnumDecl *enumDecl );
    69                 virtual void visit( StructDecl *structDecl );
    70                 virtual void visit( UnionDecl *structDecl );
    71                 virtual void visit( TypeDecl *typeDecl );
    72                 virtual void visit( TraitDecl *ctxDecl );
    73                 virtual void visit( FunctionDecl *functionDecl );
    74 
    75                 virtual void visit( FunctionType *ftype );
    76                 virtual void visit( PointerType *ftype );
    77 
    78                 virtual void visit( CompoundStmt *compoundStmt );
    79                 virtual void visit( SwitchStmt *switchStmt );
     57                void previsit( EnumDecl * enumDecl );
     58                void previsit( StructDecl * structDecl );
     59                void previsit( UnionDecl * structDecl );
     60                void previsit( TypeDecl * typeDecl );
     61                void previsit( TraitDecl * traitDecl );
     62                void previsit( FunctionDecl * functionDecl );
     63
     64                void previsit( FunctionType * ftype );
     65                void previsit( PointerType * ptype );
     66
     67                void previsit( CompoundStmt * compoundStmt );
    8068
    8169          private:
    82                 template< typename StmtClass > void visitStatement( StmtClass *stmt );
    83 
    84                 std::list< Declaration * > declsToAdd, declsToAddAfter;
    85                 std::set< std::string > structsDone;
     70
     71                GenPoly::ScopedSet< std::string > structsDone;
    8672                unsigned int functionNesting = 0;     // current level of nested functions
    87                 /// Note: the following maps could be ScopedSets, but it should be easier to work
    88                 /// deleted functions in if they are maps, since the value false can be inserted
    89                 /// at the current scope without affecting outer scopes or requiring copies.
    90                 TypeMap copyable, assignable, constructable, destructable;
     73
     74                InitTweak::ManagedTypes managedTypes;
    9175                std::vector< FuncData > data;
    9276        };
    9377
    9478        /// generates routines for tuple types.
    95         /// Doesn't really need to be a mutator, but it's easier to reuse DeclMutator than it is to use AddVisit
    96         /// or anything we currently have that supports adding new declarations for visitors
    97         class AutogenTupleRoutines : public GenPoly::DeclMutator {
    98           public:
    99                 typedef GenPoly::DeclMutator Parent;
    100                 using Parent::mutate;
    101 
    102                 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl );
    103 
    104                 virtual Type * mutate( TupleType *tupleType );
    105 
    106                 virtual CompoundStmt * mutate( CompoundStmt *compoundStmt );
     79        struct AutogenTupleRoutines : public WithDeclsToAdd, public WithVisitorRef<AutogenTupleRoutines>, public WithGuards, public WithShortCircuiting {
     80                void previsit( FunctionDecl * functionDecl );
     81
     82                void postvisit( TupleType * tupleType );
     83
     84                void previsit( CompoundStmt * compoundStmt );
    10785
    10886          private:
     
    11290
    11391        void autogenerateRoutines( std::list< Declaration * > &translationUnit ) {
    114                 AutogenerateRoutines generator;
    115                 acceptAndAdd( translationUnit, generator );
     92                PassVisitor<AutogenerateRoutines> generator;
     93                acceptAll( translationUnit, generator );
    11694
    11795                // needs to be done separately because AutogenerateRoutines skips types that appear as function arguments, etc.
    11896                // AutogenTupleRoutines tupleGenerator;
    119                 // tupleGenerator.mutateDeclarationList( translationUnit );
     97                // acceptAll( translationUnit, tupleGenerator );
     98        }
     99
     100        //=============================================================================================
     101        // FuncGenerator definitions
     102        //=============================================================================================
     103        class FuncGenerator {
     104        public:
     105                std::list< Declaration * > definitions, forwards;
     106
     107                FuncGenerator( Type * type, const std::vector< FuncData > & data, unsigned int functionNesting, SymTab::Indexer & indexer ) : type( type ), data( data ), functionNesting( functionNesting ), indexer( indexer ) {}
     108
     109                virtual bool shouldAutogen() const = 0;
     110                void genStandardFuncs();
     111                virtual void genFieldCtors() = 0;
     112        protected:
     113                Type * type;
     114                const std::vector< FuncData > & data;
     115                unsigned int functionNesting;
     116                SymTab::Indexer & indexer;
     117
     118                virtual void genFuncBody( FunctionDecl * dcl ) = 0;
     119                virtual bool isConcurrentType() const = 0;
     120
     121                void resolve( FunctionDecl * dcl );
     122                void generatePrototypes( std::list< FunctionDecl * > & newFuncs );
     123        };
     124
     125        class StructFuncGenerator : public FuncGenerator {
     126                StructDecl * aggregateDecl;
     127        public:
     128                StructFuncGenerator( StructDecl * aggregateDecl, StructInstType * refType, const std::vector< FuncData > & data,  unsigned int functionNesting, SymTab::Indexer & indexer ) : FuncGenerator( refType, data, functionNesting, indexer ), aggregateDecl( aggregateDecl) {}
     129
     130                virtual bool shouldAutogen() const override;
     131                virtual bool isConcurrentType() const override;
     132
     133                virtual void genFuncBody( FunctionDecl * dcl ) override;
     134                virtual void genFieldCtors() override;
     135
     136        private:
     137                /// generates a single struct member operation (constructor call, destructor call, assignment call)
     138                void makeMemberOp( ObjectDecl * dstParam, Expression * src, DeclarationWithType * field, FunctionDecl * func, bool forward = true );
     139
     140                /// generates the body of a struct function by iterating the struct members (via parameters) - generates default ctor, copy ctor, assignment, and dtor bodies, but NOT field ctor bodies
     141                template<typename Iterator>
     142                void makeFunctionBody( Iterator member, Iterator end, FunctionDecl * func, bool forward = true );
     143
     144                /// generate the body of a constructor which takes parameters that match fields, e.g.
     145                /// void ?{}(A *, int) and void?{}(A *, int, int) for a struct A which has two int fields.
     146                template<typename Iterator>
     147                void makeFieldCtorBody( Iterator member, Iterator end, FunctionDecl * func );
     148        };
     149
     150        class UnionFuncGenerator : public FuncGenerator {
     151                UnionDecl * aggregateDecl;
     152        public:
     153                UnionFuncGenerator( UnionDecl * aggregateDecl, UnionInstType * refType, const std::vector< FuncData > & data,  unsigned int functionNesting, SymTab::Indexer & indexer ) : FuncGenerator( refType, data, functionNesting, indexer ), aggregateDecl( aggregateDecl) {}
     154
     155                virtual bool shouldAutogen() const override;
     156                virtual bool isConcurrentType() const override;
     157
     158                virtual void genFuncBody( FunctionDecl * dcl ) override;
     159                virtual void genFieldCtors() override;
     160
     161        private:
     162                /// generates a single struct member operation (constructor call, destructor call, assignment call)
     163                template<typename OutputIterator>
     164                void makeMemberOp( ObjectDecl * srcParam, ObjectDecl * dstParam, OutputIterator out );
     165
     166                /// generates the body of a struct function by iterating the struct members (via parameters) - generates default ctor, copy ctor, assignment, and dtor bodies, but NOT field ctor bodies
     167                template<typename Iterator>
     168                void makeFunctionBody( Iterator member, Iterator end, FunctionDecl * func, bool forward = true );
     169
     170                /// generate the body of a constructor which takes parameters that match fields, e.g.
     171                /// void ?{}(A *, int) and void?{}(A *, int, int) for a struct A which has two int fields.
     172                template<typename Iterator>
     173                void makeFieldCtorBody( Iterator member, Iterator end, FunctionDecl * func );
     174        };
     175
     176        class EnumFuncGenerator : public FuncGenerator {
     177        public:
     178                EnumFuncGenerator( EnumInstType * refType, const std::vector< FuncData > & data,  unsigned int functionNesting, SymTab::Indexer & indexer ) : FuncGenerator( refType, data, functionNesting, indexer ) {}
     179
     180                virtual bool shouldAutogen() const override;
     181                virtual bool isConcurrentType() const override;
     182
     183                virtual void genFuncBody( FunctionDecl * dcl ) override;
     184                virtual void genFieldCtors() override;
     185
     186        private:
     187        };
     188
     189        class TypeFuncGenerator : public FuncGenerator {
     190                TypeDecl * typeDecl;
     191        public:
     192                TypeFuncGenerator( TypeDecl * typeDecl, TypeInstType * refType, const std::vector<FuncData> & data, unsigned int functionNesting, SymTab::Indexer & indexer ) : FuncGenerator( refType, data, functionNesting, indexer ), typeDecl( typeDecl ) {}
     193
     194                virtual bool shouldAutogen() const override;
     195                virtual void genFuncBody( FunctionDecl * dcl ) override;
     196                virtual bool isConcurrentType() const override;
     197                virtual void genFieldCtors() override;
     198        };
     199
     200        //=============================================================================================
     201        // helper functions
     202        //=============================================================================================
     203        void generateFunctions( FuncGenerator & gen, std::list< Declaration * > & declsToAdd ) {
     204                if ( ! gen.shouldAutogen() ) return;
     205
     206                // generate each of the functions based on the supplied FuncData objects
     207                gen.genStandardFuncs();
     208                gen.genFieldCtors();
     209
     210                declsToAdd.splice( declsToAdd.end(), gen.forwards );
     211                declsToAdd.splice( declsToAdd.end(), gen.definitions );
    120212        }
    121213
    122214        bool isUnnamedBitfield( ObjectDecl * obj ) {
    123                 return obj != NULL && obj->get_name() == "" && obj->get_bitfieldWidth() != NULL;
     215                return obj != nullptr && obj->name == "" && obj->bitfieldWidth != nullptr;
    124216        }
    125217
     
    127219        void addForwardDecl( FunctionDecl * functionDecl, std::list< Declaration * > & declsToAdd ) {
    128220                FunctionDecl * decl = functionDecl->clone();
    129                 delete decl->get_statements();
    130                 decl->set_statements( NULL );
     221                delete decl->statements;
     222                decl->statements = nullptr;
    131223                declsToAdd.push_back( decl );
    132224                decl->fixUniqueId();
    133225        }
    134226
     227        const std::list< TypeDecl * > getGenericParams( Type * t ) {
     228                std::list< TypeDecl * > * ret = nullptr;
     229                if ( StructInstType * inst = dynamic_cast< StructInstType * > ( t ) ) {
     230                        ret = inst->get_baseParameters();
     231                } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( t ) ) {
     232                        ret = inst->get_baseParameters();
     233                }
     234                return ret ? *ret : std::list< TypeDecl * >();
     235        }
     236
    135237        /// given type T, generate type of default ctor/dtor, i.e. function type void (*) (T *)
    136238        FunctionType * genDefaultType( Type * paramType ) {
     239                const auto & typeParams = getGenericParams( paramType );
    137240                FunctionType *ftype = new FunctionType( Type::Qualifiers(), false );
     241                cloneAll( typeParams, ftype->forall );
    138242                ObjectDecl *dstParam = new ObjectDecl( "_dst", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), paramType->clone() ), nullptr );
    139                 ftype->get_parameters().push_back( dstParam );
    140 
     243                ftype->parameters.push_back( dstParam );
    141244                return ftype;
    142245        }
     
    146249                FunctionType *ftype = genDefaultType( paramType );
    147250                ObjectDecl *srcParam = new ObjectDecl( "_src", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
    148                 ftype->get_parameters().push_back( srcParam );
     251                ftype->parameters.push_back( srcParam );
    149252                return ftype;
    150253        }
     
    154257                FunctionType *ftype = genCopyType( paramType );
    155258                ObjectDecl *returnVal = new ObjectDecl( "_ret", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
    156                 ftype->get_returnVals().push_back( returnVal );
     259                ftype->returnVals.push_back( returnVal );
    157260                return ftype;
    158261        }
     
    171274        }
    172275
    173         /// inserts base type of first argument into map if pred(funcDecl) is true
    174         void insert( FunctionDecl *funcDecl, TypeMap & map, FunctionDecl * (*pred)(Declaration *) ) {
    175                 // insert type into constructable, etc. map if appropriate
    176                 if ( pred( funcDecl ) ) {
    177                         FunctionType * ftype = funcDecl->get_functionType();
    178                         assert( ! ftype->get_parameters().empty() );
    179                         Type * t = InitTweak::getPointerBase( ftype->get_parameters().front()->get_type() );
    180                         assert( t );
    181                         map.insert( Mangler::mangleType( t ), true );
    182                 }
    183         }
    184 
    185         /// using map and t, determines if is constructable, etc.
    186         bool lookup( const TypeMap & map, Type * t ) {
    187                 assertf( t, "Autogenerate lookup was given non-type: %s", toString( t ).c_str() );
    188                 if ( dynamic_cast< PointerType * >( t ) ) {
    189                         // will need more complicated checking if we want this to work with pointer types, since currently
    190                         return true;
    191                 } else if ( ArrayType * at = dynamic_cast< ArrayType * >( t ) ) {
    192                         // an array's constructor, etc. is generated on the fly based on the base type's constructor, etc.
    193                         return lookup( map, at->get_base() );
    194                 }
    195                 TypeMap::const_iterator it = map.find( Mangler::mangleType( t ) );
    196                 if ( it != map.end() ) return it->second;
    197                 // something that does not appear in the map is by default not constructable, etc.
    198                 return false;
    199         }
    200 
    201         /// using map and aggr, examines each member to determine if constructor, etc. should be generated
    202         template<typename Container>
    203         bool shouldGenerate( const TypeMap & map, const Container & container ) {
    204                 for ( Type * t : container ) {
    205                         if ( ! lookup( map, t ) ) return false;
    206                 }
    207                 return true;
    208         }
    209 
    210         /// data structure for abstracting the generation of special functions
    211         template< typename OutputIterator, typename Container >
    212         struct FuncGenerator {
    213                 const Container & container;
    214                 Type *refType;
    215                 unsigned int functionNesting;
    216                 const std::list< TypeDecl* > & typeParams;
    217                 OutputIterator out;
    218                 FuncGenerator( const Container & container, Type *refType, unsigned int functionNesting, const std::list< TypeDecl* > & typeParams, OutputIterator out ) : container( container ), refType( refType ), functionNesting( functionNesting ), typeParams( typeParams ), out( out ) {}
    219 
    220                 /// generates a function (?{}, ?=?, ^?{}) based on the data argument and members. If function is generated, inserts the type into the map.
    221                 void gen( const FuncData & data, bool concurrent_type ) {
    222                         if ( ! shouldGenerate( data.map, container ) ) return;
    223                         FunctionType * ftype = data.genType( refType );
    224 
    225                         if ( concurrent_type && CodeGen::isDestructor( data.fname ) ) {
     276        Type * declToType( Declaration * decl ) {
     277                if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) {
     278                        return dwt->get_type();
     279                }
     280                return nullptr;
     281        }
     282
     283        Type * declToTypeDeclBase( Declaration * decl ) {
     284                if ( TypeDecl * td = dynamic_cast< TypeDecl * >( decl ) ) {
     285                        return td->base;
     286                }
     287                return nullptr;
     288        }
     289
     290        //=============================================================================================
     291        // FuncGenerator member definitions
     292        //=============================================================================================
     293        void FuncGenerator::genStandardFuncs() {
     294                std::list< FunctionDecl * > newFuncs;
     295                generatePrototypes( newFuncs );
     296
     297                for ( FunctionDecl * dcl : newFuncs ) {
     298                        genFuncBody( dcl );
     299                        if ( CodeGen::isAssignment( dcl->name ) ) {
     300                                // assignment needs to return a value
     301                                FunctionType * assignType = dcl->type;
     302                                assert( assignType->parameters.size() == 2 );
     303                                assert( assignType->returnVals.size() == 1 );
     304                                ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( assignType->parameters.front() );
     305                                dcl->statements->push_back( new ReturnStmt( noLabels, new VariableExpr( dstParam ) ) );
     306                        }
     307                        resolve( dcl );
     308                }
     309        }
     310
     311        void FuncGenerator::generatePrototypes( std::list< FunctionDecl * > & newFuncs ) {
     312                bool concurrent_type = isConcurrentType();
     313                for ( const FuncData & d : data ) {
     314                        // generate a function (?{}, ?=?, ^?{}) based on the current FuncData.
     315                        FunctionType * ftype = d.genType( type );
     316
     317                        // destructor for concurrent type must be mutex
     318                        if ( concurrent_type && CodeGen::isDestructor( d.fname ) ) {
    226319                                ftype->parameters.front()->get_type()->set_mutex( true );
    227320                        }
    228321
    229                         cloneAll( typeParams, ftype->forall );
    230                         *out++ = genFunc( data.fname, ftype, functionNesting );
    231                         data.map.insert( Mangler::mangleType( refType ), true );
    232                 }
    233         };
    234 
    235         template< typename OutputIterator, typename Container >
    236         FuncGenerator<OutputIterator, Container> makeFuncGenerator( const Container & container, Type *refType, unsigned int functionNesting, const std::list< TypeDecl* > & typeParams, OutputIterator out ) {
    237                 return FuncGenerator<OutputIterator, Container>( container, refType, functionNesting, typeParams, out );
    238         }
    239 
    240         /// generates a single enumeration assignment expression
    241         ApplicationExpr * genEnumAssign( FunctionType * ftype, FunctionDecl * assignDecl ) {
    242                 // enum copy construct and assignment is just C-style assignment.
    243                 // this looks like a bad recursive call, but code gen will turn it into
    244                 // a C-style assignment.
    245                 // This happens before function pointer type conversion, so need to do it manually here
    246                 // NOTE: ftype is not necessarily the functionType belonging to assignDecl - ftype is the
    247                 // type of the function that this expression is being generated for (so that the correct
    248                 // parameters) are using in the variable exprs
    249                 assert( ftype->get_parameters().size() == 2 );
    250                 ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
    251                 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
    252 
    253                 VariableExpr * assignVarExpr = new VariableExpr( assignDecl );
    254                 Type * assignVarExprType = assignVarExpr->get_result();
    255                 assignVarExprType = new PointerType( Type::Qualifiers(), assignVarExprType );
    256                 assignVarExpr->set_result( assignVarExprType );
    257                 ApplicationExpr * assignExpr = new ApplicationExpr( assignVarExpr );
    258                 assignExpr->get_args().push_back( new VariableExpr( dstParam ) );
    259                 assignExpr->get_args().push_back( new VariableExpr( srcParam ) );
    260                 return assignExpr;
    261         }
    262 
    263         // E ?=?(E volatile*, int),
    264         //   ?=?(E _Atomic volatile*, int);
    265         void makeEnumFunctions( EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) {
    266 
    267                 // T ?=?(E *, E);
    268                 FunctionType *assignType = genAssignType( refType );
    269 
    270                 // void ?{}(E *); void ^?{}(E *);
    271                 FunctionType * ctorType = genDefaultType( refType->clone() );
    272                 FunctionType * dtorType = genDefaultType( refType->clone() );
    273 
    274                 // void ?{}(E *, E);
    275                 FunctionType *copyCtorType = genCopyType( refType->clone() );
    276 
    277                 // add unused attribute to parameters of default constructor and destructor
    278                 ctorType->get_parameters().front()->get_attributes().push_back( new Attribute( "unused" ) );
    279                 dtorType->get_parameters().front()->get_attributes().push_back( new Attribute( "unused" ) );
    280 
    281                 // xxx - should we also generate void ?{}(E *, int) and E ?{}(E *, E)?
    282                 // right now these cases work, but that might change.
    283 
    284                 // xxx - Temporary: make these functions intrinsic so they codegen as C assignment.
    285                 // Really they're something of a cross between instrinsic and autogen, so should
    286                 // probably make a new linkage type
    287                 FunctionDecl *assignDecl = genFunc( "?=?", assignType, functionNesting, true );
    288                 FunctionDecl *ctorDecl = genFunc( "?{}", ctorType, functionNesting, true );
    289                 FunctionDecl *copyCtorDecl = genFunc( "?{}", copyCtorType, functionNesting, true );
    290                 FunctionDecl *dtorDecl = genFunc( "^?{}", dtorType, functionNesting, true );
    291 
    292                 // body is either return stmt or expr stmt
    293                 assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, genEnumAssign( assignType, assignDecl ) ) );
    294                 copyCtorDecl->get_statements()->get_kids().push_back( new ExprStmt( noLabels, genEnumAssign( copyCtorType, assignDecl ) ) );
    295 
    296                 declsToAdd.push_back( ctorDecl );
    297                 declsToAdd.push_back( copyCtorDecl );
    298                 declsToAdd.push_back( dtorDecl );
    299                 declsToAdd.push_back( assignDecl ); // assignment should come last since it uses copy constructor in return
    300         }
    301 
    302         /// generates a single struct member operation (constructor call, destructor call, assignment call)
    303         void makeStructMemberOp( ObjectDecl * dstParam, Expression * src, DeclarationWithType * field, FunctionDecl * func, bool forward = true ) {
     322                        newFuncs.push_back( genFunc( d.fname, ftype, functionNesting ) );
     323                }
     324        }
     325
     326        void FuncGenerator::resolve( FunctionDecl * dcl ) {
     327                try {
     328                        ResolvExpr::resolveDecl( dcl, indexer );
     329                        if ( functionNesting == 0 ) {
     330                                // forward declare if top-level struct, so that
     331                                // type is complete as soon as its body ends
     332                                // Note: this is necessary if we want structs which contain
     333                                // generic (otype) structs as members.
     334                                addForwardDecl( dcl, forwards );
     335                        }
     336                        definitions.push_back( dcl );
     337                        indexer.addId( dcl );
     338                } catch ( SemanticError err ) {
     339                        // okay if decl does not resolve - that means the function should not be generated
     340                        delete dcl;
     341                }
     342        }
     343
     344        bool StructFuncGenerator::shouldAutogen() const {
     345                // Builtins do not use autogeneration.
     346                return ! aggregateDecl->linkage.is_builtin;
     347        }
     348        bool StructFuncGenerator::isConcurrentType() const { return aggregateDecl->is_thread() || aggregateDecl->is_monitor(); }
     349
     350        void StructFuncGenerator::genFuncBody( FunctionDecl * dcl ) {
     351                // generate appropriate calls to member ctor, assignment
     352                // destructor needs to do everything in reverse, so pass "forward" based on whether the function is a destructor
     353                if ( ! CodeGen::isDestructor( dcl->name ) ) {
     354                        makeFunctionBody( aggregateDecl->members.begin(), aggregateDecl->members.end(), dcl );
     355                } else {
     356                        makeFunctionBody( aggregateDecl->members.rbegin(), aggregateDecl->members.rend(), dcl, false );
     357                }
     358        }
     359
     360        void StructFuncGenerator::genFieldCtors() {
     361                // field ctors are only generated if default constructor and copy constructor are both generated
     362                unsigned numCtors = std::count_if( definitions.begin(), definitions.end(), [](Declaration * dcl) { return CodeGen::isConstructor( dcl->name ); } );
     363
     364                // Field constructors are only generated if default and copy constructor
     365                // are generated, since they need access to both
     366                if ( numCtors != 2 ) return;
     367
     368                // create constructors which take each member type as a parameter.
     369                // for example, for struct A { int x, y; }; generate
     370                //   void ?{}(A *, int) and void ?{}(A *, int, int)
     371                FunctionType * memCtorType = genDefaultType( type );
     372                for ( Declaration * member : aggregateDecl->members ) {
     373                        DeclarationWithType * field = strict_dynamic_cast<DeclarationWithType *>( member );
     374                        if ( isUnnamedBitfield( dynamic_cast< ObjectDecl * > ( field ) ) ) {
     375                                // don't make a function whose parameter is an unnamed bitfield
     376                                continue;
     377                        }
     378                        memCtorType->parameters.push_back( new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, 0, field->get_type()->clone(), 0 ) );
     379                        FunctionDecl * ctor = genFunc( "?{}", memCtorType->clone(), functionNesting );
     380                        makeFieldCtorBody( aggregateDecl->members.begin(), aggregateDecl->members.end(), ctor );
     381                        resolve( ctor );
     382                }
     383                delete memCtorType;
     384        }
     385
     386        void StructFuncGenerator::makeMemberOp( ObjectDecl * dstParam, Expression * src, DeclarationWithType * field, FunctionDecl * func, bool forward ) {
    304387                InitTweak::InitExpander srcParam( src );
    305388
    306389                // assign to destination
    307                 Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), strict_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) );
    308                 genImplicitCall( srcParam, dstselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward );
    309         }
    310 
    311         /// generates the body of a struct function by iterating the struct members (via parameters) - generates default ctor, copy ctor, assignment, and dtor bodies, but NOT field ctor bodies
     390                Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), strict_dynamic_cast< ReferenceType* >( dstParam->get_type() )->base->clone() ) );
     391                genImplicitCall( srcParam, dstselect, func->name, back_inserter( func->statements->kids ), field, forward );
     392        }
     393
    312394        template<typename Iterator>
    313         void makeStructFunctionBody( Iterator member, Iterator end, FunctionDecl * func, bool forward = true ) {
     395        void StructFuncGenerator::makeFunctionBody( Iterator member, Iterator end, FunctionDecl * func, bool forward ) {
    314396                for ( ; member != end; ++member ) {
    315397                        if ( DeclarationWithType *field = dynamic_cast< DeclarationWithType * >( *member ) ) { // otherwise some form of type declaration, e.g. Aggregate
     
    321403                                }
    322404
    323                                 if ( type->get_const() && func->get_name() == "?=?" ) {
     405                                if ( type->get_const() && CodeGen::isAssignment( func->name ) ) {
    324406                                        // don't assign const members, but do construct/destruct
    325407                                        continue;
    326408                                }
    327409
    328                                 if ( field->get_name() == "" ) {
    329                                         // don't assign to anonymous members
    330                                         // xxx - this is a temporary fix. Anonymous members tie into
    331                                         // our inheritance model. I think the correct way to handle this is to
    332                                         // cast the structure to the type of the member and let the resolver
    333                                         // figure out whether it's valid and have a pass afterwards that fixes
    334                                         // the assignment to use pointer arithmetic with the offset of the
    335                                         // member, much like how generic type members are handled.
    336                                         continue;
    337                                 }
    338 
    339410                                assert( ! func->get_functionType()->get_parameters().empty() );
    340411                                ObjectDecl * dstParam = dynamic_cast<ObjectDecl*>( func->get_functionType()->get_parameters().front() );
    341                                 ObjectDecl * srcParam = NULL;
     412                                ObjectDecl * srcParam = nullptr;
    342413                                if ( func->get_functionType()->get_parameters().size() == 2 ) {
    343414                                        srcParam = dynamic_cast<ObjectDecl*>( func->get_functionType()->get_parameters().back() );
    344415                                }
     416
    345417                                // srcParam may be NULL, in which case we have default ctor/dtor
    346418                                assert( dstParam );
    347419
    348                                 Expression *srcselect = srcParam ? new MemberExpr( field, new VariableExpr( srcParam ) ) : NULL;
    349                                 makeStructMemberOp( dstParam, srcselect, field, func, forward );
     420                                Expression *srcselect = srcParam ? new MemberExpr( field, new VariableExpr( srcParam ) ) : nullptr;
     421                                makeMemberOp( dstParam, srcselect, field, func, forward );
    350422                        } // if
    351423                } // for
    352         } // makeStructFunctionBody
    353 
    354         /// generate the body of a constructor which takes parameters that match fields, e.g.
    355         /// void ?{}(A *, int) and void?{}(A *, int, int) for a struct A which has two int fields.
     424        } // makeFunctionBody
     425
    356426        template<typename Iterator>
    357         void makeStructFieldCtorBody( Iterator member, Iterator end, FunctionDecl * func ) {
    358                 FunctionType * ftype = func->get_functionType();
    359                 std::list<DeclarationWithType*> & params = ftype->get_parameters();
     427        void StructFuncGenerator::makeFieldCtorBody( Iterator member, Iterator end, FunctionDecl * func ) {
     428                FunctionType * ftype = func->type;
     429                std::list<DeclarationWithType*> & params = ftype->parameters;
    360430                assert( params.size() >= 2 );  // should not call this function for default ctor, etc.
    361431
     
    369439                                        // don't make a function whose parameter is an unnamed bitfield
    370440                                        continue;
    371                                 } else if ( field->get_name() == "" ) {
    372                                         // don't assign to anonymous members
    373                                         // xxx - this is a temporary fix. Anonymous members tie into
    374                                         // our inheritance model. I think the correct way to handle this is to
    375                                         // cast the structure to the type of the member and let the resolver
    376                                         // figure out whether it's valid and have a pass afterwards that fixes
    377                                         // the assignment to use pointer arithmetic with the offset of the
    378                                         // member, much like how generic type members are handled.
    379                                         continue;
    380441                                } else if ( parameter != params.end() ) {
    381442                                        // matching parameter, initialize field with copy ctor
    382443                                        Expression *srcselect = new VariableExpr(*parameter);
    383                                         makeStructMemberOp( dstParam, srcselect, field, func );
     444                                        makeMemberOp( dstParam, srcselect, field, func );
    384445                                        ++parameter;
    385446                                } else {
    386447                                        // no matching parameter, initialize field with default ctor
    387                                         makeStructMemberOp( dstParam, NULL, field, func );
     448                                        makeMemberOp( dstParam, nullptr, field, func );
    388449                                }
    389450                        }
     
    391452        }
    392453
    393         Type * declToType( Declaration * decl ) {
    394                 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) {
    395                         return dwt->get_type();
    396                 }
    397                 return nullptr;
    398         }
    399 
    400         /// generates struct constructors, destructor, and assignment functions
    401         void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) {
     454        bool UnionFuncGenerator::shouldAutogen() const {
    402455                // Builtins do not use autogeneration.
    403                 if ( aggregateDecl->get_linkage() == LinkageSpec::BuiltinCFA ||
    404                          aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) {
    405                         return;
    406                 }
    407 
    408                 // Make function polymorphic in same parameters as generic struct, if applicable
    409                 const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
    410 
    411                 // generate each of the functions based on the supplied FuncData objects
    412                 std::list< FunctionDecl * > newFuncs;
    413                 // structure that iterates aggregate decl members, returning their types
    414                 auto generator = makeFuncGenerator( lazy_map( aggregateDecl->members, declToType ), refType, functionNesting, typeParams, back_inserter( newFuncs ) );
    415                 for ( const FuncData & d : data ) {
    416                         generator.gen( d, aggregateDecl->is_thread() || aggregateDecl->is_monitor() );
    417                 }
    418 
     456                return ! aggregateDecl->linkage.is_builtin;
     457        }
     458
     459        // xxx - is this right?
     460        bool UnionFuncGenerator::isConcurrentType() const { return false; };
     461
     462        /// generate a single union assignment expression (using memcpy)
     463        template< typename OutputIterator >
     464        void UnionFuncGenerator::makeMemberOp( ObjectDecl * srcParam, ObjectDecl * dstParam, OutputIterator out ) {
     465                UntypedExpr *copy = new UntypedExpr( new NameExpr( "__builtin_memcpy" ) );
     466                copy->args.push_back( new AddressExpr( new VariableExpr( dstParam ) ) );
     467                copy->args.push_back( new AddressExpr( new VariableExpr( srcParam ) ) );
     468                copy->args.push_back( new SizeofExpr( srcParam->get_type()->clone() ) );
     469                *out++ = new ExprStmt( noLabels, copy );
     470        }
     471
     472        /// generates the body of a union assignment/copy constructor/field constructor
     473        void UnionFuncGenerator::genFuncBody( FunctionDecl * funcDecl ) {
     474                FunctionType * ftype = funcDecl->type;
     475                if ( InitTweak::isCopyConstructor( funcDecl ) || InitTweak::isAssignment( funcDecl ) ) {
     476                        assert( ftype->parameters.size() == 2 );
     477                        ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->parameters.front() );
     478                        ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->parameters.back() );
     479                        makeMemberOp( srcParam, dstParam, back_inserter( funcDecl->statements->kids ) );
     480                } else {
     481                        // default ctor/dtor body is empty - add unused attribute to parameter to silence warnings
     482                        assert( ftype->parameters.size() == 1 );
     483                        ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->parameters.front() );
     484                        dstParam->attributes.push_back( new Attribute( "unused" ) );
     485                }
     486        }
     487
     488        /// generate the body of a constructor which takes parameters that match fields, e.g.
     489        /// void ?{}(A *, int) and void?{}(A *, int, int) for a struct A which has two int fields.
     490        void UnionFuncGenerator::genFieldCtors() {
    419491                // field ctors are only generated if default constructor and copy constructor are both generated
    420                 unsigned numCtors = std::count_if( newFuncs.begin(), newFuncs.end(), [](FunctionDecl * dcl) { return CodeGen::isConstructor( dcl->get_name() ); } );
    421 
    422                 if ( functionNesting == 0 ) {
    423                         // forward declare if top-level struct, so that
    424                         // type is complete as soon as its body ends
    425                         // Note: this is necessary if we want structs which contain
    426                         // generic (otype) structs as members.
    427                         for ( FunctionDecl * dcl : newFuncs ) {
    428                                 addForwardDecl( dcl, declsToAdd );
    429                         }
    430                 }
    431 
    432                 for ( FunctionDecl * dcl : newFuncs ) {
    433                         // generate appropriate calls to member ctor, assignment
    434                         // destructor needs to do everything in reverse, so pass "forward" based on whether the function is a destructor
    435                         if ( ! CodeGen::isDestructor( dcl->get_name() ) ) {
    436                                 makeStructFunctionBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), dcl );
    437                         } else {
    438                                 makeStructFunctionBody( aggregateDecl->get_members().rbegin(), aggregateDecl->get_members().rend(), dcl, false );
    439                         }
    440                         if ( CodeGen::isAssignment( dcl->get_name() ) ) {
    441                                 // assignment needs to return a value
    442                                 FunctionType * assignType = dcl->get_functionType();
    443                                 assert( assignType->get_parameters().size() == 2 );
    444                                 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( assignType->get_parameters().back() );
    445                                 dcl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
    446                         }
    447                         declsToAdd.push_back( dcl );
    448                 }
    449 
    450                 // create constructors which take each member type as a parameter.
    451                 // for example, for struct A { int x, y; }; generate
    452                 //   void ?{}(A *, int) and void ?{}(A *, int, int)
     492                unsigned numCtors = std::count_if( definitions.begin(), definitions.end(), [](Declaration * dcl) { return CodeGen::isConstructor( dcl->get_name() ); } );
     493
    453494                // Field constructors are only generated if default and copy constructor
    454495                // are generated, since they need access to both
    455                 if ( numCtors == 2 ) {
    456                         FunctionType * memCtorType = genDefaultType( refType );
    457                         cloneAll( typeParams, memCtorType->get_forall() );
    458                         for ( std::list<Declaration *>::iterator i = aggregateDecl->get_members().begin(); i != aggregateDecl->get_members().end(); ++i ) {
    459                                 DeclarationWithType * member = dynamic_cast<DeclarationWithType *>( *i );
    460                                 assert( member );
    461                                 if ( isUnnamedBitfield( dynamic_cast< ObjectDecl * > ( member ) ) ) {
    462                                         // don't make a function whose parameter is an unnamed bitfield
    463                                         continue;
    464                                 } else if ( member->get_name() == "" ) {
    465                                         // don't assign to anonymous members
    466                                         // xxx - this is a temporary fix. Anonymous members tie into
    467                                         // our inheritance model. I think the correct way to handle this is to
    468                                         // cast the structure to the type of the member and let the resolver
    469                                         // figure out whether it's valid/choose the correct unnamed member
    470                                         continue;
    471                                 }
    472                                 memCtorType->get_parameters().push_back( new ObjectDecl( member->get_name(), Type::StorageClasses(), LinkageSpec::Cforall, 0, member->get_type()->clone(), 0 ) );
    473                                 FunctionDecl * ctor = genFunc( "?{}", memCtorType->clone(), functionNesting );
    474                                 makeStructFieldCtorBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), ctor );
    475                                 declsToAdd.push_back( ctor );
    476                         }
    477                         delete memCtorType;
    478                 }
    479         }
    480 
    481         /// generate a single union assignment expression (using memcpy)
    482         template< typename OutputIterator >
    483         void makeUnionFieldsAssignment( ObjectDecl * srcParam, ObjectDecl * dstParam, OutputIterator out ) {
    484                 UntypedExpr *copy = new UntypedExpr( new NameExpr( "__builtin_memcpy" ) );
    485                 copy->get_args().push_back( new AddressExpr( new VariableExpr( dstParam ) ) );
    486                 copy->get_args().push_back( new AddressExpr( new VariableExpr( srcParam ) ) );
    487                 copy->get_args().push_back( new SizeofExpr( srcParam->get_type()->clone() ) );
    488                 *out++ = new ExprStmt( noLabels, copy );
    489         }
    490 
    491         /// generates the body of a union assignment/copy constructor/field constructor
    492         void makeUnionAssignBody( FunctionDecl * funcDecl ) {
    493                 FunctionType * ftype = funcDecl->get_functionType();
    494                 assert( ftype->get_parameters().size() == 2 );
    495                 ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
    496                 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
    497 
    498                 makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( funcDecl->get_statements()->get_kids() ) );
    499                 if ( CodeGen::isAssignment( funcDecl->get_name() ) ) {
    500                         // also generate return statement in assignment
    501                         funcDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
    502                 }
    503         }
    504 
    505         /// generates union constructors, destructors, and assignment operator
    506         void makeUnionFunctions( UnionDecl *aggregateDecl, UnionInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd ) {
    507                 // Make function polymorphic in same parameters as generic union, if applicable
    508                 const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
    509 
    510                 // default ctor/dtor need only first parameter
    511                 // void ?{}(T *); void ^?{}(T *);
    512                 FunctionType *ctorType = genDefaultType( refType );
    513                 FunctionType *dtorType = genDefaultType( refType );
    514 
    515                 // copy ctor needs both parameters
    516                 // void ?{}(T *, T);
    517                 FunctionType *copyCtorType = genCopyType( refType );
    518 
    519                 // assignment needs both and return value
    520                 // T ?=?(T *, T);
    521                 FunctionType *assignType = genAssignType( refType );
    522 
    523                 cloneAll( typeParams, ctorType->get_forall() );
    524                 cloneAll( typeParams, dtorType->get_forall() );
    525                 cloneAll( typeParams, copyCtorType->get_forall() );
    526                 cloneAll( typeParams, assignType->get_forall() );
    527 
    528                 // add unused attribute to parameters of default constructor and destructor
    529                 ctorType->get_parameters().front()->get_attributes().push_back( new Attribute( "unused" ) );
    530                 dtorType->get_parameters().front()->get_attributes().push_back( new Attribute( "unused" ) );
    531 
    532                 // Routines at global scope marked "static" to prevent multiple definitions is separate translation units
    533                 // because each unit generates copies of the default routines for each aggregate.
    534                 FunctionDecl *assignDecl = genFunc( "?=?", assignType, functionNesting );
    535                 FunctionDecl *ctorDecl = genFunc( "?{}",  ctorType, functionNesting );
    536                 FunctionDecl *copyCtorDecl = genFunc( "?{}", copyCtorType, functionNesting );
    537                 FunctionDecl *dtorDecl = genFunc( "^?{}", dtorType, functionNesting );
    538 
    539                 makeUnionAssignBody( assignDecl );
    540 
    541                 // body of assignment and copy ctor is the same
    542                 makeUnionAssignBody( copyCtorDecl );
     496                if ( numCtors != 2 ) return;
    543497
    544498                // create a constructor which takes the first member type as a parameter.
     
    546500                // void ?{}(A *, int)
    547501                // This is to mimic C's behaviour which initializes the first member of the union.
    548                 std::list<Declaration *> memCtors;
    549                 for ( Declaration * member : aggregateDecl->get_members() ) {
    550                         if ( DeclarationWithType * field = dynamic_cast< DeclarationWithType * >( member ) ) {
    551                                 ObjectDecl * srcParam = new ObjectDecl( "src", Type::StorageClasses(), LinkageSpec::Cforall, 0, field->get_type()->clone(), 0 );
    552 
    553                                 FunctionType * memCtorType = ctorType->clone();
    554                                 memCtorType->get_parameters().push_back( srcParam );
    555                                 FunctionDecl * ctor = genFunc( "?{}", memCtorType, functionNesting );
    556 
    557                                 makeUnionAssignBody( ctor );
    558                                 memCtors.push_back( ctor );
    559                                 // only generate a ctor for the first field
     502                FunctionType * memCtorType = genDefaultType( type );
     503                for ( Declaration * member : aggregateDecl->members ) {
     504                        DeclarationWithType * field = strict_dynamic_cast<DeclarationWithType *>( member );
     505                        if ( isUnnamedBitfield( dynamic_cast< ObjectDecl * > ( field ) ) ) {
     506                                // don't make a function whose parameter is an unnamed bitfield
    560507                                break;
    561508                        }
    562                 }
    563 
    564                 declsToAdd.push_back( ctorDecl );
    565                 declsToAdd.push_back( copyCtorDecl );
    566                 declsToAdd.push_back( dtorDecl );
    567                 declsToAdd.push_back( assignDecl ); // assignment should come last since it uses copy constructor in return
    568                 declsToAdd.splice( declsToAdd.end(), memCtors );
    569         }
    570 
     509                        memCtorType->parameters.push_back( new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, nullptr, field->get_type()->clone(), nullptr ) );
     510                        FunctionDecl * ctor = genFunc( "?{}", memCtorType->clone(), functionNesting );
     511                        ObjectDecl * srcParam = strict_dynamic_cast<ObjectDecl *>( ctor->type->parameters.back() );
     512                        srcParam->fixUniqueId();
     513                        ObjectDecl * dstParam = InitTweak::getParamThis( ctor->type );
     514                        makeMemberOp( srcParam, dstParam, back_inserter( ctor->statements->kids ) );
     515                        resolve( ctor );
     516                        // only generate one field ctor for unions
     517                        break;
     518                }
     519                delete memCtorType;
     520        }
     521
     522        void EnumFuncGenerator::genFuncBody( FunctionDecl * funcDecl ) {
     523                // xxx - Temporary: make these functions intrinsic so they codegen as C assignment.
     524                // Really they're something of a cross between instrinsic and autogen, so should
     525                // probably make a new linkage type
     526                funcDecl->linkage = LinkageSpec::Intrinsic;
     527                FunctionType * ftype = funcDecl->type;
     528                if ( InitTweak::isCopyConstructor( funcDecl ) || InitTweak::isAssignment( funcDecl ) ) {
     529                        assert( ftype->parameters.size() == 2 );
     530                        ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->parameters.front() );
     531                        ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->parameters.back() );
     532
     533                        // enum copy construct and assignment is just C-style assignment.
     534                        // this looks like a bad recursive call, but code gen will turn it into
     535                        // a C-style assignment.
     536                        // This happens before function pointer type conversion, so need to do it manually here
     537                        ApplicationExpr * callExpr = new ApplicationExpr( VariableExpr::functionPointer( funcDecl ) );
     538                        callExpr->get_args().push_back( new VariableExpr( dstParam ) );
     539                        callExpr->get_args().push_back( new VariableExpr( srcParam ) );
     540                        funcDecl->statements->push_back( new ExprStmt( noLabels, callExpr ) );
     541                } else {
     542                        // default ctor/dtor body is empty - add unused attribute to parameter to silence warnings
     543                        assert( ftype->parameters.size() == 1 );
     544                        ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->parameters.front() );
     545                        dstParam->attributes.push_back( new Attribute( "unused" ) );
     546                }
     547        }
     548
     549        bool EnumFuncGenerator::shouldAutogen() const { return true; }
     550        bool EnumFuncGenerator::isConcurrentType() const { return false; }
     551        // enums do not have field constructors
     552        void EnumFuncGenerator::genFieldCtors() {}
     553
     554        bool TypeFuncGenerator::shouldAutogen() const { return true; };
     555
     556        void TypeFuncGenerator::genFuncBody( FunctionDecl * dcl ) {
     557                FunctionType * ftype = dcl->type;
     558                assertf( ftype->parameters.size() == 1 || ftype->parameters.size() == 2, "Incorrect number of parameters in autogenerated typedecl function: %zd", ftype->parameters.size() );
     559                DeclarationWithType * dst = ftype->parameters.front();
     560                DeclarationWithType * src = ftype->parameters.size() == 2 ? ftype->parameters.back() : nullptr;
     561                // generate appropriate calls to member ctor, assignment
     562                UntypedExpr * expr = new UntypedExpr( new NameExpr( dcl->name ) );
     563                expr->args.push_back( new CastExpr( new VariableExpr( dst ), new ReferenceType( Type::Qualifiers(), typeDecl->base->clone() ) ) );
     564                if ( src ) expr->args.push_back( new CastExpr( new VariableExpr( src ), typeDecl->base->clone() ) );
     565                dcl->statements->kids.push_back( new ExprStmt( noLabels, expr ) );
     566        };
     567
     568        // xxx - should reach in and determine if base type is concurrent?
     569        bool TypeFuncGenerator::isConcurrentType() const { return false; };
     570
     571        // opaque types do not have field constructors
     572        void TypeFuncGenerator::genFieldCtors() {};
     573
     574        //=============================================================================================
     575        // Visitor definitions
     576        //=============================================================================================
    571577        AutogenerateRoutines::AutogenerateRoutines() {
    572578                // the order here determines the order that these functions are generated.
    573579                // assignment should come last since it uses copy constructor in return.
    574                 data.push_back( FuncData( "?{}", genDefaultType, constructable ) );
    575                 data.push_back( FuncData( "?{}", genCopyType, copyable ) );
    576                 data.push_back( FuncData( "^?{}", genDefaultType, destructable ) );
    577                 data.push_back( FuncData( "?=?", genAssignType, assignable ) );
    578         }
    579 
    580         void AutogenerateRoutines::visit( EnumDecl *enumDecl ) {
    581                 if ( ! enumDecl->get_members().empty() ) {
    582                         EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() );
    583                         // enumInst->set_baseEnum( enumDecl );
    584                         makeEnumFunctions( enumInst, functionNesting, declsToAddAfter );
    585                 }
    586         }
    587 
    588         void AutogenerateRoutines::visit( StructDecl *structDecl ) {
    589                 if ( structDecl->has_body() && structsDone.find( structDecl->get_name() ) == structsDone.end() ) {
    590                         StructInstType structInst( Type::Qualifiers(), structDecl->get_name() );
    591                         for ( TypeDecl * typeDecl : structDecl->get_parameters() ) {
    592                                 // need to visit assertions so that they are added to the appropriate maps
    593                                 acceptAll( typeDecl->get_assertions(), *this );
    594                                 structInst.get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) );
    595                         }
     580                data.emplace_back( "?{}", genDefaultType );
     581                data.emplace_back( "?{}", genCopyType );
     582                data.emplace_back( "^?{}", genDefaultType );
     583                data.emplace_back( "?=?", genAssignType );
     584        }
     585
     586        void AutogenerateRoutines::previsit( EnumDecl * enumDecl ) {
     587                // must visit children (enum constants) to add them to the indexer
     588                if ( enumDecl->has_body() ) {
     589                        EnumInstType enumInst( Type::Qualifiers(), enumDecl->get_name() );
     590                        enumInst.set_baseEnum( enumDecl );
     591                        EnumFuncGenerator gen( &enumInst, data, functionNesting, indexer );
     592                        generateFunctions( gen, declsToAddAfter );
     593                }
     594        }
     595
     596        void AutogenerateRoutines::previsit( StructDecl * structDecl ) {
     597                visit_children = false;
     598                if ( structDecl->has_body() ) {
     599                        StructInstType structInst( Type::Qualifiers(), structDecl->name );
    596600                        structInst.set_baseStruct( structDecl );
    597                         makeStructFunctions( structDecl, &structInst, functionNesting, declsToAddAfter, data );
    598                         structsDone.insert( structDecl->get_name() );
     601                        for ( TypeDecl * typeDecl : structDecl->parameters ) {
     602                                structInst.parameters.push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->name, typeDecl ) ) );
     603                        }
     604                        StructFuncGenerator gen( structDecl, &structInst, data, functionNesting, indexer );
     605                        generateFunctions( gen, declsToAddAfter );
    599606                } // if
    600607        }
    601608
    602         void AutogenerateRoutines::visit( UnionDecl *unionDecl ) {
    603                 if ( ! unionDecl->get_members().empty() ) {
     609        void AutogenerateRoutines::previsit( UnionDecl * unionDecl ) {
     610                visit_children = false;
     611                if ( unionDecl->has_body()  ) {
    604612                        UnionInstType unionInst( Type::Qualifiers(), unionDecl->get_name() );
    605613                        unionInst.set_baseUnion( unionDecl );
     
    607615                                unionInst.get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) );
    608616                        }
    609                         makeUnionFunctions( unionDecl, &unionInst, functionNesting, declsToAddAfter );
     617                        UnionFuncGenerator gen( unionDecl, &unionInst, data, functionNesting, indexer );
     618                        generateFunctions( gen, declsToAddAfter );
    610619                } // if
    611620        }
    612621
    613         Type * declToTypeDeclBase( Declaration * decl ) {
    614                 if ( TypeDecl * td = dynamic_cast< TypeDecl * >( decl ) ) {
    615                         return td->base;
    616                 }
    617                 return nullptr;
    618         }
    619 
    620622        // generate ctor/dtors/assign for typedecls, e.g., otype T = int *;
    621         void AutogenerateRoutines::visit( TypeDecl *typeDecl ) {
     623        void AutogenerateRoutines::previsit( TypeDecl * typeDecl ) {
     624                visit_children = false;
    622625                if ( ! typeDecl->base ) return;
    623626
    624                 // generate each of the functions based on the supplied FuncData objects
    625                 std::list< FunctionDecl * > newFuncs;
    626                 std::list< Declaration * > tds { typeDecl };
    627                 std::list< TypeDecl * > typeParams;
    628627                TypeInstType refType( Type::Qualifiers(), typeDecl->name, typeDecl );
    629                 auto generator = makeFuncGenerator( lazy_map( tds, declToTypeDeclBase ), &refType, functionNesting, typeParams, back_inserter( newFuncs ) );
    630                 for ( const FuncData & d : data ) {
    631                         generator.gen( d, false );
    632                 }
    633 
    634                 if ( functionNesting == 0 ) {
    635                         // forward declare if top-level struct, so that
    636                         // type is complete as soon as its body ends
    637                         // Note: this is necessary if we want structs which contain
    638                         // generic (otype) structs as members.
    639                         for ( FunctionDecl * dcl : newFuncs ) {
    640                                 addForwardDecl( dcl, declsToAddAfter );
    641                         }
    642                 }
    643 
    644                 for ( FunctionDecl * dcl : newFuncs ) {
    645                         FunctionType * ftype = dcl->type;
    646                         assertf( ftype->parameters.size() == 1 || ftype->parameters.size() == 2, "Incorrect number of parameters in autogenerated typedecl function: %zd", ftype->parameters.size() );
    647                         DeclarationWithType * dst = ftype->parameters.front();
    648                         DeclarationWithType * src = ftype->parameters.size() == 2 ? ftype->parameters.back() : nullptr;
    649                         // generate appropriate calls to member ctor, assignment
    650                         // destructor needs to do everything in reverse, so pass "forward" based on whether the function is a destructor
    651                         UntypedExpr * expr = new UntypedExpr( new NameExpr( dcl->name ) );
    652                         expr->args.push_back( new CastExpr( new VariableExpr( dst ), new ReferenceType( Type::Qualifiers(), typeDecl->base->clone() ) ) );
    653                         if ( src ) expr->args.push_back( new CastExpr( new VariableExpr( src ), typeDecl->base->clone() ) );
    654                         dcl->statements->kids.push_back( new ExprStmt( noLabels, expr ) );
    655                         if ( CodeGen::isAssignment( dcl->get_name() ) ) {
    656                                 // assignment needs to return a value
    657                                 FunctionType * assignType = dcl->type;
    658                                 assert( assignType->parameters.size() == 2 );
    659                                 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( assignType->parameters.back() );
    660                                 dcl->statements->kids.push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
    661                         }
    662                         declsToAddAfter.push_back( dcl );
    663                 }
    664         }
    665 
    666         void addDecls( std::list< Declaration * > &declsToAdd, std::list< Statement * > &statements, std::list< Statement * >::iterator i ) {
    667                 for ( std::list< Declaration * >::iterator decl = declsToAdd.begin(); decl != declsToAdd.end(); ++decl ) {
    668                         statements.insert( i, new DeclStmt( noLabels, *decl ) );
    669                 } // for
    670                 declsToAdd.clear();
    671         }
    672 
    673         void AutogenerateRoutines::visit( FunctionType *) {
     628                TypeFuncGenerator gen( typeDecl, &refType, data, functionNesting, indexer );
     629                generateFunctions( gen, declsToAddAfter );
     630        }
     631
     632        void AutogenerateRoutines::previsit( FunctionType *) {
    674633                // ensure that we don't add assignment ops for types defined as part of the function
    675         }
    676 
    677         void AutogenerateRoutines::visit( PointerType *) {
     634                visit_children = false;
     635        }
     636
     637        void AutogenerateRoutines::previsit( PointerType *) {
    678638                // ensure that we don't add assignment ops for types defined as part of the pointer
    679         }
    680 
    681         void AutogenerateRoutines::visit( TraitDecl *) {
     639                visit_children = false;
     640        }
     641
     642        void AutogenerateRoutines::previsit( TraitDecl * ) {
    682643                // ensure that we don't add assignment ops for types defined as part of the trait
    683         }
    684 
    685         template< typename StmtClass >
    686         inline void AutogenerateRoutines::visitStatement( StmtClass *stmt ) {
    687                 std::set< std::string > oldStructs = structsDone;
    688                 addVisit( stmt, *this );
    689                 structsDone = oldStructs;
    690         }
    691 
    692         void AutogenerateRoutines::visit( FunctionDecl *functionDecl ) {
     644                visit_children = false;
     645        }
     646
     647        void AutogenerateRoutines::previsit( FunctionDecl * functionDecl ) {
     648                visit_children = false;
    693649                // record the existence of this function as appropriate
    694                 insert( functionDecl, constructable, InitTweak::isDefaultConstructor );
    695                 insert( functionDecl, assignable, InitTweak::isAssignment );
    696                 insert( functionDecl, copyable, InitTweak::isCopyConstructor );
    697                 insert( functionDecl, destructable, InitTweak::isDestructor );
    698 
    699                 maybeAccept( functionDecl->get_functionType(), *this );
     650                managedTypes.handleDWT( functionDecl );
     651
     652                maybeAccept( functionDecl->type, *visitor );
    700653                functionNesting += 1;
    701                 maybeAccept( functionDecl->get_statements(), *this );
     654                maybeAccept( functionDecl->statements, *visitor );
    702655                functionNesting -= 1;
    703656        }
    704657
    705         void AutogenerateRoutines::visit( CompoundStmt *compoundStmt ) {
    706                 constructable.beginScope();
    707                 assignable.beginScope();
    708                 copyable.beginScope();
    709                 destructable.beginScope();
    710                 visitStatement( compoundStmt );
    711                 constructable.endScope();
    712                 assignable.endScope();
    713                 copyable.endScope();
    714                 destructable.endScope();
    715         }
    716 
    717         void AutogenerateRoutines::visit( SwitchStmt *switchStmt ) {
    718                 visitStatement( switchStmt );
     658        void AutogenerateRoutines::previsit( CompoundStmt * ) {
     659                GuardScope( managedTypes );
     660                GuardScope( structsDone );
    719661        }
    720662
     
    734676        }
    735677
    736         Type * AutogenTupleRoutines::mutate( TupleType * tupleType ) {
    737                 tupleType = strict_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) );
     678        void AutogenTupleRoutines::postvisit( TupleType * tupleType ) {
    738679                std::string mangleName = SymTab::Mangler::mangleType( tupleType );
    739                 if ( seenTuples.find( mangleName ) != seenTuples.end() ) return tupleType;
     680                if ( seenTuples.find( mangleName ) != seenTuples.end() ) return;
    740681                seenTuples.insert( mangleName );
    741682
     
    755696                        if ( TypeInstType * ty = dynamic_cast< TypeInstType * >( t ) ) {
    756697                                if ( ! done.count( ty->get_baseType() ) ) {
    757                                         TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), Type::StorageClasses(), nullptr, TypeDecl::Any );
     698                                        TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), Type::StorageClasses(), nullptr, TypeDecl::Dtype, true );
    758699                                        TypeInstType * inst = new TypeInstType( Type::Qualifiers(), newDecl->get_name(), newDecl );
    759700                                        newDecl->get_assertions().push_back( new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Cforall, genAssignType( inst ), nullptr,
     
    785726                makeTupleFunctionBody( dtorDecl );
    786727
    787                 addDeclaration( ctorDecl );
    788                 addDeclaration( copyCtorDecl );
    789                 addDeclaration( dtorDecl );
    790                 addDeclaration( assignDecl ); // assignment should come last since it uses copy constructor in return
    791 
    792                 return tupleType;
    793         }
    794 
    795         DeclarationWithType * AutogenTupleRoutines::mutate( FunctionDecl *functionDecl ) {
    796                 functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) );
     728                declsToAddBefore.push_back( ctorDecl );
     729                declsToAddBefore.push_back( copyCtorDecl );
     730                declsToAddBefore.push_back( dtorDecl );
     731                declsToAddBefore.push_back( assignDecl ); // assignment should come last since it uses copy constructor in return
     732        }
     733
     734        void AutogenTupleRoutines::previsit( FunctionDecl *functionDecl ) {
     735                visit_children = false;
     736                maybeAccept( functionDecl->type, *visitor );
    797737                functionNesting += 1;
    798                 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
     738                maybeAccept( functionDecl->statements, *visitor );
    799739                functionNesting -= 1;
    800                 return functionDecl;
    801         }
    802 
    803         CompoundStmt * AutogenTupleRoutines::mutate( CompoundStmt *compoundStmt ) {
    804                 seenTuples.beginScope();
    805                 compoundStmt = strict_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) );
    806                 seenTuples.endScope();
    807                 return compoundStmt;
     740        }
     741
     742        void AutogenTupleRoutines::previsit( CompoundStmt * ) {
     743                GuardScope( seenTuples );
    808744        }
    809745} // SymTab
  • src/SymTab/Autogen.h

    r78315272 r3f7e12cb  
    1919#include <string>                 // for string
    2020
     21#include "CodeGen/OperatorTable.h"
    2122#include "Common/UniqueName.h"    // for UniqueName
    2223#include "InitTweak/InitTweak.h"  // for InitExpander
     
    4445        extern FunctionDecl * dereferenceOperator;
    4546
    46         // temporary
     47        // generate the type of an assignment function for paramType
    4748        FunctionType * genAssignType( Type * paramType );
     49
     50        // generate the type of a default constructor or destructor for paramType
     51        FunctionType * genDefaultType( Type * paramType );
     52
     53        // generate the type of a copy constructor for paramType
     54        FunctionType * genCopyType( Type * paramType );
    4855
    4956        /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
     
    5461        /// optionally returns a statement which must be inserted prior to the containing loop, if there is one
    5562        template< typename OutputIterator >
    56         Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) {
     63        Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression * dstParam, std::string fname, OutputIterator out, Type * type, bool addCast = false ) {
     64                bool isReferenceCtorDtor = false;
     65                if ( dynamic_cast< ReferenceType * >( type ) && CodeGen::isCtorDtor( fname ) ) {
     66                        // reference constructors are essentially application of the rebind operator.
     67                        // apply & to both arguments, do not need a cast
     68                        fname = "?=?";
     69                        dstParam = new AddressExpr( dstParam );
     70                        addCast = false;
     71                        isReferenceCtorDtor = true;
     72                }
     73
    5774                // want to be able to generate assignment, ctor, and dtor generically,
    5875                // so fname is either ?=?, ?{}, or ^?{}
    59                 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) );
     76                UntypedExpr * fExpr = new UntypedExpr( new NameExpr( fname ) );
    6077
    6178                if ( addCast ) {
     
    7289                        dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) );
    7390                }
    74                 fExpr->get_args().push_back( dstParam );
     91                fExpr->args.push_back( dstParam );
    7592
    7693                Statement * listInit = srcParam.buildListInit( fExpr );
    7794
    78                 std::list< Expression * > args = *++srcParam;
    79                 fExpr->get_args().splice( fExpr->get_args().end(), args );
     95                // fetch next set of arguments
     96                ++srcParam;
     97
     98                // return if adding reference fails - will happen on default constructor and destructor
     99                if ( isReferenceCtorDtor && ! srcParam.addReference() ) {
     100                        delete fExpr;
     101                        return listInit;
     102                }
     103
     104                std::list< Expression * > args = *srcParam;
     105                fExpr->args.splice( fExpr->args.end(), args );
    80106
    81107                *out++ = new ExprStmt( noLabels, fExpr );
     
    99125                        // generate: for ( int i = 0; i < N; ++i )
    100126                        begin = new ConstantExpr( Constant::from_int( 0 ) );
    101                         end = array->get_dimension()->clone();
     127                        end = array->dimension->clone();
    102128                        cmp = new NameExpr( "?<?" );
    103129                        update = new NameExpr( "++?" );
     
    105131                        // generate: for ( int i = N-1; i >= 0; --i )
    106132                        begin = new UntypedExpr( new NameExpr( "?-?" ) );
    107                         ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() );
    108                         ((UntypedExpr*)begin)->get_args().push_back( new ConstantExpr( Constant::from_int( 1 ) ) );
     133                        ((UntypedExpr*)begin)->args.push_back( array->dimension->clone() );
     134                        ((UntypedExpr*)begin)->args.push_back( new ConstantExpr( Constant::from_int( 1 ) ) );
    109135                        end = new ConstantExpr( Constant::from_int( 0 ) );
    110136                        cmp = new NameExpr( "?>=?" );
     
    115141
    116142                UntypedExpr *cond = new UntypedExpr( cmp );
    117                 cond->get_args().push_back( new VariableExpr( index ) );
    118                 cond->get_args().push_back( end );
     143                cond->args.push_back( new VariableExpr( index ) );
     144                cond->args.push_back( end );
    119145
    120146                UntypedExpr *inc = new UntypedExpr( update );
    121                 inc->get_args().push_back( new VariableExpr( index ) );
     147                inc->args.push_back( new VariableExpr( index ) );
    122148
    123149                UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
    124                 dstIndex->get_args().push_back( dstParam );
    125                 dstIndex->get_args().push_back( new VariableExpr( index ) );
     150                dstIndex->args.push_back( dstParam );
     151                dstIndex->args.push_back( new VariableExpr( index ) );
    126152                dstParam = dstIndex;
    127153
    128154                // srcParam must keep track of the array indices to build the
    129155                // source parameter and/or array list initializer
    130                 srcParam.addArrayIndex( new VariableExpr( index ), array->get_dimension()->clone() );
     156                srcParam.addArrayIndex( new VariableExpr( index ), array->dimension->clone() );
    131157
    132158                // for stmt's body, eventually containing call
    133159                CompoundStmt * body = new CompoundStmt( noLabels );
    134                 Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->get_kids() ), array->get_base(), addCast, forward );
     160                Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->kids ), array->base, addCast, forward );
    135161
    136162                // block containing for stmt and index variable
    137163                std::list<Statement *> initList;
    138164                CompoundStmt * block = new CompoundStmt( noLabels );
    139                 block->get_kids().push_back( new DeclStmt( noLabels, index ) );
     165                block->push_back( new DeclStmt( noLabels, index ) );
    140166                if ( listInit ) block->get_kids().push_back( listInit );
    141                 block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, body ) );
     167                block->push_back( new ForStmt( noLabels, initList, cond, inc, body ) );
    142168
    143169                *out++ = block;
     
    145171
    146172        template< typename OutputIterator >
    147         Statement * genCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast, bool forward ) {
     173        Statement * genCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast, bool forward ) {
    148174                if ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
    149175                        genArrayCall( srcParam, dstParam, fname, out, at, addCast, forward );
     
    159185        /// ImplicitCtorDtorStmt node.
    160186        template< typename OutputIterator >
    161         void genImplicitCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, DeclarationWithType * decl, bool forward = true ) {
     187        void genImplicitCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, DeclarationWithType * decl, bool forward = true ) {
    162188                ObjectDecl *obj = dynamic_cast<ObjectDecl *>( decl );
    163189                assert( obj );
     
    167193                bool addCast = (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && ! obj->get_bitfieldWidth() ) );
    168194                std::list< Statement * > stmts;
    169                 genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->get_type(), addCast, forward );
     195                genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->type, addCast, forward );
    170196
    171197                // currently genCall should produce at most one element, but if that changes then the next line needs to be updated to grab the statement which contains the call
  • src/SymTab/FixFunction.cc

    r78315272 r3f7e12cb  
    2626        FixFunction::FixFunction() : isVoid( false ) {}
    2727
    28         DeclarationWithType * FixFunction::mutate(FunctionDecl *functionDecl) {
    29                 ObjectDecl *pointer = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClasses(), functionDecl->get_linkage(), 0, new PointerType( Type::Qualifiers(), functionDecl->get_type() ), 0, functionDecl->get_attributes() );
    30                 functionDecl->get_attributes().clear();
    31                 // can't delete function type because it may contain assertions, but can't transfer ownership without a clone since set_type checks for nullptr
    32                 functionDecl->set_type( functionDecl->get_type()->clone() );
     28
     29        DeclarationWithType * FixFunction::postmutate(FunctionDecl *functionDecl) {
     30                // can't delete function type because it may contain assertions, so transfer ownership to new object
     31                ObjectDecl *pointer = new ObjectDecl( functionDecl->name, functionDecl->get_storageClasses(), functionDecl->linkage, nullptr, new PointerType( Type::Qualifiers(), functionDecl->type ), nullptr, functionDecl->attributes );
     32                functionDecl->attributes.clear();
     33                functionDecl->type = nullptr;
    3334                delete functionDecl;
    3435                return pointer;
    3536        }
    3637
    37         Type * FixFunction::mutate(VoidType *voidType) {
    38                 isVoid = true;
    39                 return voidType;
    40         }
    41 
    42         Type * FixFunction::mutate(BasicType *basicType) {
    43                 return basicType;
    44         }
    45 
    46         Type * FixFunction::mutate(PointerType *pointerType) {
    47                 return pointerType;
    48         }
    49 
    50         Type * FixFunction::mutate(ArrayType *arrayType) {
     38        Type * FixFunction::postmutate(ArrayType *arrayType) {
    5139                // need to recursively mutate the base type in order for multi-dimensional arrays to work.
    52                 PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->get_base()->clone()->acceptMutator( *this ), maybeClone( arrayType->get_dimension() ), arrayType->get_isVarLen(), arrayType->get_isStatic() );
     40                PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->base, arrayType->dimension, arrayType->isVarLen, arrayType->isStatic );
     41                arrayType->base = nullptr;
     42                arrayType->dimension = nullptr;
    5343                delete arrayType;
    5444                return pointerType;
    5545        }
    5646
    57         Type * FixFunction::mutate(StructInstType *aggregateUseType) {
    58                 return aggregateUseType;
     47        void FixFunction::premutate(VoidType *) {
     48                isVoid = true;
    5949        }
    6050
    61         Type * FixFunction::mutate(UnionInstType *aggregateUseType) {
    62                 return aggregateUseType;
    63         }
    64 
    65         Type * FixFunction::mutate(EnumInstType *aggregateUseType) {
    66                 return aggregateUseType;
    67         }
    68 
    69         Type * FixFunction::mutate(TraitInstType *aggregateUseType) {
    70                 return aggregateUseType;
    71         }
    72 
    73         Type * FixFunction::mutate(TypeInstType *aggregateUseType) {
    74                 return aggregateUseType;
    75         }
    76 
    77         Type * FixFunction::mutate(TupleType *tupleType) {
    78                 return tupleType;
    79         }
    80 
    81         Type * FixFunction::mutate(VarArgsType *varArgsType) {
    82                 return varArgsType;
    83         }
    84 
    85         Type * FixFunction::mutate(ZeroType *zeroType) {
    86                 return zeroType;
    87         }
    88 
    89         Type * FixFunction::mutate(OneType *oneType) {
    90                 return oneType;
    91         }
     51        void FixFunction::premutate(FunctionDecl *) { visit_children = false; }
     52        void FixFunction::premutate(ArrayType *) { visit_children = false; }
     53        void FixFunction::premutate(BasicType *) { visit_children = false; }
     54        void FixFunction::premutate(PointerType *) { visit_children = false; }
     55        void FixFunction::premutate(StructInstType *) { visit_children = false; }
     56        void FixFunction::premutate(UnionInstType *) { visit_children = false; }
     57        void FixFunction::premutate(EnumInstType *) { visit_children = false; }
     58        void FixFunction::premutate(TraitInstType *) { visit_children = false; }
     59        void FixFunction::premutate(TypeInstType *) { visit_children = false; }
     60        void FixFunction::premutate(TupleType *) { visit_children = false; }
     61        void FixFunction::premutate(VarArgsType *) { visit_children = false; }
     62        void FixFunction::premutate(ZeroType *) { visit_children = false; }
     63        void FixFunction::premutate(OneType *) { visit_children = false; }
    9264} // namespace SymTab
    9365
  • src/SymTab/FixFunction.h

    r78315272 r3f7e12cb  
    1616#pragma once
    1717
    18 #include "SynTree/Mutator.h"  // for Mutator
    19 #include "SynTree/SynTree.h"  // for Types
     18#include "Common/PassVisitor.h" // for PassVisitor
     19#include "SynTree/SynTree.h"    // for Types
    2020
    2121namespace SymTab {
    2222        /// Replaces function and array types by equivalent pointer types.
    23         class FixFunction : public Mutator {
     23        class FixFunction : public WithShortCircuiting {
    2424                typedef Mutator Parent;
    2525          public:
    2626                FixFunction();
    2727
    28                 bool get_isVoid() const { return isVoid; }
    29                 void set_isVoid( bool newValue ) { isVoid = newValue; }
    30           private:
    31                 virtual DeclarationWithType* mutate(FunctionDecl *functionDecl);
     28                void premutate(FunctionDecl *functionDecl);
     29                DeclarationWithType* postmutate(FunctionDecl *functionDecl);
    3230
    33                 virtual Type* mutate(VoidType *voidType);
    34                 virtual Type* mutate(BasicType *basicType);
    35                 virtual Type* mutate(PointerType *pointerType);
    36                 virtual Type* mutate(ArrayType *arrayType);
    37                 virtual Type* mutate(StructInstType *aggregateUseType);
    38                 virtual Type* mutate(UnionInstType *aggregateUseType);
    39                 virtual Type* mutate(EnumInstType *aggregateUseType);
    40                 virtual Type* mutate(TraitInstType *aggregateUseType);
    41                 virtual Type* mutate(TypeInstType *aggregateUseType);
    42                 virtual Type* mutate(TupleType *tupleType);
    43                 virtual Type* mutate(VarArgsType *varArgsType);
    44                 virtual Type* mutate(ZeroType *zeroType);
    45                 virtual Type* mutate(OneType *oneType);
     31                Type * postmutate(ArrayType * arrayType);
     32
     33                void premutate(ArrayType * arrayType);
     34                void premutate(VoidType * voidType);
     35                void premutate(BasicType * basicType);
     36                void premutate(PointerType * pointerType);
     37                void premutate(StructInstType * aggregateUseType);
     38                void premutate(UnionInstType * aggregateUseType);
     39                void premutate(EnumInstType * aggregateUseType);
     40                void premutate(TraitInstType * aggregateUseType);
     41                void premutate(TypeInstType * aggregateUseType);
     42                void premutate(TupleType * tupleType);
     43                void premutate(VarArgsType * varArgsType);
     44                void premutate(ZeroType * zeroType);
     45                void premutate(OneType * oneType);
    4646
    4747                bool isVoid;
  • src/SymTab/Indexer.cc

    r78315272 r3f7e12cb  
    4040
    4141namespace SymTab {
    42         struct NewScope {
    43                 NewScope( SymTab::Indexer & indexer ) : indexer( indexer ) { indexer.enterScope(); }
    44                 ~NewScope() { indexer.leaveScope(); }
    45                 SymTab::Indexer & indexer;
    46         };
    47 
    48         template< typename TreeType, typename VisitorType >
    49         inline void acceptNewScope( TreeType *tree, VisitorType &visitor ) {
    50                 visitor.enterScope();
    51                 maybeAccept( tree, visitor );
    52                 visitor.leaveScope();
    53         }
    54 
    5542        typedef std::unordered_map< std::string, DeclarationWithType* > MangleTable;
    5643        typedef std::unordered_map< std::string, MangleTable > IdTable;
     
    198185        }
    199186
    200         Indexer::Indexer( bool _doDebug ) : tables( 0 ), scope( 0 ), doDebug( _doDebug ) {}
    201 
    202         Indexer::Indexer( const Indexer &that ) : tables( newRef( that.tables ) ), scope( that.scope ), doDebug( that.doDebug ) {}
    203 
    204         Indexer::Indexer( Indexer &&that ) : tables( that.tables ), scope( that.scope ), doDebug( that.doDebug ) {
     187        Indexer::Indexer() : tables( 0 ), scope( 0 ) {}
     188
     189        Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {}
     190
     191        Indexer::Indexer( Indexer &&that ) : doDebug( that.doDebug ), tables( that.tables ), scope( that.scope ) {
    205192                that.tables = 0;
    206193        }
     
    420407                makeWritable();
    421408
    422                 const std::string &name = decl->get_name();
     409                const std::string &name = decl->name;
    423410                std::string mangleName;
    424                 if ( LinkageSpec::isOverridable( decl->get_linkage() ) ) {
     411                if ( LinkageSpec::isOverridable( decl->linkage ) ) {
    425412                        // mangle the name without including the appropriate suffix, so overridable routines are placed into the
    426413                        // same "bucket" as their user defined versions.
     
    431418
    432419                // this ensures that no two declarations with the same unmangled name at the same scope both have C linkage
    433                 if ( ! LinkageSpec::isMangled( decl->get_linkage() ) ) {
     420                if ( ! LinkageSpec::isMangled( decl->linkage ) ) {
    434421                        // NOTE this is broken in Richard's original code in such a way that it never triggers (it
    435422                        // doesn't check decls that have the same manglename, and all C-linkage decls are defined to
     
    584571
    585572                if ( doDebug ) {
    586                         std::cout << "--- Entering scope " << scope << std::endl;
     573                        std::cerr << "--- Entering scope " << scope << std::endl;
    587574                }
    588575        }
    589576
    590577        void Indexer::leaveScope() {
    591                 using std::cout;
     578                using std::cerr;
    592579
    593580                assert( scope > 0 && "cannot leave initial scope" );
     581                if ( doDebug ) {
     582                        cerr << "--- Leaving scope " << scope << " containing" << std::endl;
     583                }
    594584                --scope;
    595585
    596586                while ( tables && tables->scope > scope ) {
    597587                        if ( doDebug ) {
    598                                 cout << "--- Leaving scope " << tables->scope << " containing" << std::endl;
    599                                 dump( tables->idTable, cout );
    600                                 dump( tables->typeTable, cout );
    601                                 dump( tables->structTable, cout );
    602                                 dump( tables->enumTable, cout );
    603                                 dump( tables->unionTable, cout );
    604                                 dump( tables->traitTable, cout );
     588                                dump( tables->idTable, cerr );
     589                                dump( tables->typeTable, cerr );
     590                                dump( tables->structTable, cerr );
     591                                dump( tables->enumTable, cerr );
     592                                dump( tables->unionTable, cerr );
     593                                dump( tables->traitTable, cerr );
    605594                        }
    606595
  • src/SymTab/Indexer.h

    r78315272 r3f7e12cb  
    2626        class Indexer {
    2727          public:
    28                 explicit Indexer( bool useDebug = false );
     28                explicit Indexer();
    2929
    3030                Indexer( const Indexer &that );
     
    7676                void addTrait( TraitDecl *decl );
    7777
     78                bool doDebug = false; ///< Display debugging trace?
    7879          private:
    7980                struct Impl;
     
    8182                Impl *tables;         ///< Copy-on-write instance of table data structure
    8283                unsigned long scope;  ///< Scope index of this pointer
    83                 bool doDebug;         ///< Display debugging trace?
    8484
    8585                /// Takes a new ref to a table (returns null if null)
  • src/SymTab/Mangler.cc

    r78315272 r3f7e12cb  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:40:29 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:31:00 2017
    13 // Update Count     : 21
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Sep 25 15:49:26 2017
     13// Update Count     : 23
    1414//
    1515#include "Mangler.h"
     
    3131
    3232namespace SymTab {
    33         std::string Mangler::mangleType( Type *ty ) {
    34                 Mangler mangler( false, true );
     33        std::string Mangler::mangleType( Type * ty ) {
     34                Mangler mangler( false, true, true );
    3535                maybeAccept( ty, mangler );
    3636                return mangler.get_mangleName();
    3737        }
    3838
    39         Mangler::Mangler( bool mangleOverridable, bool typeMode )
    40                 : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ), typeMode( typeMode ) {}
     39        std::string Mangler::mangleConcrete( Type* ty ) {
     40                Mangler mangler( false, false, false );
     41                maybeAccept( ty, mangler );
     42                return mangler.get_mangleName();
     43        }
     44
     45        Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams )
     46                : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ), typeMode( typeMode ), mangleGenericParams( mangleGenericParams ) {}
    4147
    4248        Mangler::Mangler( const Mangler &rhs ) : mangleName() {
     
    4854        }
    4955
    50         void Mangler::mangleDecl( DeclarationWithType *declaration ) {
     56        void Mangler::mangleDecl( DeclarationWithType * declaration ) {
    5157                bool wasTopLevel = isTopLevel;
    5258                if ( isTopLevel ) {
     
    7985        }
    8086
    81         void Mangler::visit( ObjectDecl *declaration ) {
     87        void Mangler::visit( ObjectDecl * declaration ) {
    8288                mangleDecl( declaration );
    8389        }
    8490
    85         void Mangler::visit( FunctionDecl *declaration ) {
     91        void Mangler::visit( FunctionDecl * declaration ) {
    8692                mangleDecl( declaration );
    8793        }
    8894
    89         void Mangler::visit( VoidType *voidType ) {
     95        void Mangler::visit( VoidType * voidType ) {
    9096                printQualifiers( voidType );
    9197                mangleName << "v";
    9298        }
    9399
    94         void Mangler::visit( BasicType *basicType ) {
     100        void Mangler::visit( BasicType * basicType ) {
    95101                static const char *btLetter[] = {
    96102                        "b",    // Bool
     
    115121                        "Id",   // DoubleImaginary
    116122                        "Ir",   // LongDoubleImaginary
     123                        "w",    // SignedInt128
     124                        "Uw",   // UnsignedInt128
    117125                };
    118126
     
    121129        }
    122130
    123         void Mangler::visit( PointerType *pointerType ) {
     131        void Mangler::visit( PointerType * pointerType ) {
    124132                printQualifiers( pointerType );
    125133                mangleName << "P";
     
    127135        }
    128136
    129         void Mangler::visit( ArrayType *arrayType ) {
     137        void Mangler::visit( ArrayType * arrayType ) {
    130138                // TODO: encode dimension
    131139                printQualifiers( arrayType );
     
    134142        }
    135143
    136         void Mangler::visit( ReferenceType *refType ) {
     144        void Mangler::visit( ReferenceType * refType ) {
    137145                printQualifiers( refType );
    138146                mangleName << "R";
     
    149157        }
    150158
    151         void Mangler::visit( FunctionType *functionType ) {
     159        void Mangler::visit( FunctionType * functionType ) {
    152160                printQualifiers( functionType );
    153161                mangleName << "F";
     
    160168        }
    161169
    162         void Mangler::mangleRef( ReferenceToType *refType, std::string prefix ) {
     170        void Mangler::mangleRef( ReferenceToType * refType, std::string prefix ) {
    163171                printQualifiers( refType );
    164172
    165173                mangleName << ( refType->get_name().length() + prefix.length() ) << prefix << refType->get_name();
    166         }
    167 
    168         void Mangler::mangleGenericRef( ReferenceToType *refType, std::string prefix ) {
    169                 printQualifiers( refType );
    170 
    171                 std::ostringstream oldName( mangleName.str() );
    172                 mangleName.clear();
    173 
    174                 mangleName << prefix << refType->get_name();
    175 
    176                 std::list< Expression* >& params = refType->get_parameters();
    177                 if ( ! params.empty() ) {
    178                         mangleName << "_";
    179                         for ( std::list< Expression* >::const_iterator param = params.begin(); param != params.end(); ++param ) {
    180                                 TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
    181                                 assertf(paramType, "Aggregate parameters should be type expressions: %s", toString(*param).c_str());
    182                                 maybeAccept( paramType->get_type(), *this );
     174
     175                if ( mangleGenericParams ) {
     176                        std::list< Expression* >& params = refType->get_parameters();
     177                        if ( ! params.empty() ) {
     178                                mangleName << "_";
     179                                for ( std::list< Expression* >::const_iterator param = params.begin(); param != params.end(); ++param ) {
     180                                        TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
     181                                        assertf(paramType, "Aggregate parameters should be type expressions: %s", toString(*param).c_str());
     182                                        maybeAccept( paramType->get_type(), *this );
     183                                }
     184                                mangleName << "_";
    183185                        }
    184                         mangleName << "_";
    185186                }
    186 
    187                 oldName << mangleName.str().length() << mangleName.str();
    188                 mangleName.str( oldName.str() );
    189         }
    190 
    191         void Mangler::visit( StructInstType *aggregateUseType ) {
    192                 if ( typeMode ) mangleGenericRef( aggregateUseType, "s" );
    193                 else mangleRef( aggregateUseType, "s" );
    194         }
    195 
    196         void Mangler::visit( UnionInstType *aggregateUseType ) {
    197                 if ( typeMode ) mangleGenericRef( aggregateUseType, "u" );
    198                 else mangleRef( aggregateUseType, "u" );
    199         }
    200 
    201         void Mangler::visit( EnumInstType *aggregateUseType ) {
     187        }
     188
     189        void Mangler::visit( StructInstType * aggregateUseType ) {
     190                mangleRef( aggregateUseType, "s" );
     191        }
     192
     193        void Mangler::visit( UnionInstType * aggregateUseType ) {
     194                mangleRef( aggregateUseType, "u" );
     195        }
     196
     197        void Mangler::visit( EnumInstType * aggregateUseType ) {
    202198                mangleRef( aggregateUseType, "e" );
    203199        }
    204200
    205         void Mangler::visit( TypeInstType *typeInst ) {
     201        void Mangler::visit( TypeInstType * typeInst ) {
    206202                VarMapType::iterator varNum = varNums.find( typeInst->get_name() );
    207203                if ( varNum == varNums.end() ) {
     
    212208                        numStream << varNum->second.first;
    213209                        switch ( (TypeDecl::Kind )varNum->second.second ) {
    214                           case TypeDecl::Any:
    215                                 mangleName << "t";
    216                                 break;
    217210                          case TypeDecl::Dtype:
    218211                                mangleName << "d";
     
    231224        }
    232225
    233         void Mangler::visit( TupleType *tupleType ) {
     226        void Mangler::visit( TupleType * tupleType ) {
    234227                printQualifiers( tupleType );
    235228                mangleName << "T";
    236                 acceptAll( tupleType->get_types(), *this );
     229                acceptAll( tupleType->types, *this );
    237230                mangleName << "_";
    238231        }
    239232
    240         void Mangler::visit( VarArgsType *varArgsType ) {
     233        void Mangler::visit( VarArgsType * varArgsType ) {
    241234                printQualifiers( varArgsType );
    242235                mangleName << "VARGS";
    243236        }
    244237
    245         void Mangler::visit( __attribute__((unused)) ZeroType *zeroType ) {
     238        void Mangler::visit( ZeroType * ) {
    246239                mangleName << "Z";
    247240        }
    248241
    249         void Mangler::visit( __attribute__((unused)) OneType *oneType ) {
     242        void Mangler::visit( OneType * ) {
    250243                mangleName << "O";
    251244        }
    252245
    253         void Mangler::visit( TypeDecl *decl ) {
     246        void Mangler::visit( TypeDecl * decl ) {
    254247                static const char *typePrefix[] = { "BT", "BD", "BF" };
    255                 mangleName << typePrefix[ decl->get_kind() ] << ( decl->get_name().length() + 1 ) << decl->get_name();
     248                mangleName << typePrefix[ decl->get_kind() ] << ( decl->name.length() + 1 ) << decl->name;
    256249        }
    257250
     
    262255        }
    263256
    264         void Mangler::printQualifiers( Type *type ) {
     257        void Mangler::printQualifiers( Type * type ) {
    265258                // skip if not including qualifiers
    266259                if ( typeMode ) return;
     
    270263                        int tcount = 0, dcount = 0, fcount = 0, vcount = 0;
    271264                        mangleName << "A";
    272                         for ( Type::ForallList::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     265                        for ( Type::ForallList::iterator i = type->forall.begin(); i != type->forall.end(); ++i ) {
    273266                                switch ( (*i)->get_kind() ) {
    274                                   case TypeDecl::Any:
    275                                         tcount++;
    276                                         break;
    277267                                  case TypeDecl::Dtype:
    278268                                        dcount++;
     
    287277                                        assert( false );
    288278                                } // switch
    289                                 varNums[ (*i )->get_name() ] = std::pair< int, int >( nextVarNum++, (int )(*i )->get_kind() );
    290                                 for ( std::list< DeclarationWithType* >::iterator assert = (*i )->get_assertions().begin(); assert != (*i )->get_assertions().end(); ++assert ) {
    291                                         Mangler sub_mangler( mangleOverridable, typeMode );
     279                                varNums[ (*i)->name ] = std::pair< int, int >( nextVarNum++, (int)(*i)->get_kind() );
     280                                for ( std::list< DeclarationWithType* >::iterator assert = (*i)->assertions.begin(); assert != (*i)->assertions.end(); ++assert ) {
     281                                        Mangler sub_mangler( mangleOverridable, typeMode, mangleGenericParams );
    292282                                        sub_mangler.nextVarNum = nextVarNum;
    293283                                        sub_mangler.isTopLevel = false;
     
    307297                        mangleName << "V";
    308298                } // if
     299                if ( type->get_mutex() ) {
     300                        mangleName << "M";
     301                } // if
    309302                // Removed due to restrict not affecting function compatibility in GCC
    310303//              if ( type->get_isRestrict() ) {
     
    312305//              } // if
    313306                if ( type->get_lvalue() ) {
     307                        // mangle based on whether the type is lvalue, so that the resolver can differentiate lvalues and rvalues
    314308                        mangleName << "L";
    315                 } // if
     309                }
    316310                if ( type->get_atomic() ) {
    317311                        mangleName << "A";
  • src/SymTab/Mangler.h

    r78315272 r3f7e12cb  
    3030                /// Mangle syntax tree object; primary interface to clients
    3131                template< typename SynTreeClass >
    32             static std::string mangle( SynTreeClass *decl, bool mangleOverridable = true, bool typeMode = false );
     32            static std::string mangle( SynTreeClass *decl, bool mangleOverridable = true, bool typeMode = false, bool mangleGenericParams = true );
    3333                /// Mangle a type name; secondary interface
    3434                static std::string mangleType( Type* ty );
     35                /// Mangle ignoring generic type parameters
     36                static std::string mangleConcrete( Type* ty );
     37
    3538
    3639                virtual void visit( ObjectDecl *declaration );
     
    6265                bool mangleOverridable;         ///< Specially mangle overridable built-in methods
    6366                bool typeMode;                  ///< Produce a unique mangled name for a type
     67                bool mangleGenericParams;       ///< Include generic parameters in name mangling if true
    6468
    65                 Mangler( bool mangleOverridable, bool typeMode );
     69                Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams );
    6670                Mangler( const Mangler & );
    6771
    6872                void mangleDecl( DeclarationWithType *declaration );
    6973                void mangleRef( ReferenceToType *refType, std::string prefix );
    70                 void mangleGenericRef( ReferenceToType *refType, std::string prefix );
    7174
    7275                void printQualifiers( Type *type );
     
    7477
    7578        template< typename SynTreeClass >
    76         std::string Mangler::mangle( SynTreeClass *decl, bool mangleOverridable, bool typeMode ) {
    77                 Mangler mangler( mangleOverridable, typeMode );
     79        std::string Mangler::mangle( SynTreeClass *decl, bool mangleOverridable, bool typeMode, bool mangleGenericParams ) {
     80                Mangler mangler( mangleOverridable, typeMode, mangleGenericParams );
    7881                maybeAccept( decl, mangler );
    7982                return mangler.get_mangleName();
  • src/SymTab/Validate.cc

    r78315272 r3f7e12cb  
    5656#include "FixFunction.h"               // for FixFunction
    5757#include "Indexer.h"                   // for Indexer
     58#include "InitTweak/GenInit.h"         // for fixReturnStatements
    5859#include "InitTweak/InitTweak.h"       // for isCtorDtorAssign
    5960#include "Parser/LinkageSpec.h"        // for C
     
    150151        /// Replaces array and function types in forall lists by appropriate pointer type and assigns each Object and Function declaration a unique ID.
    151152        struct ForallPointerDecay final {
    152                 void previsit( ObjectDecl *object );
    153                 void previsit( FunctionDecl *func );
     153                void previsit( ObjectDecl * object );
     154                void previsit( FunctionDecl * func );
     155                void previsit( StructDecl * aggrDecl );
     156                void previsit( UnionDecl * aggrDecl );
    154157        };
    155158
     
    265268                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    266269                ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
     270                acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
    267271                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    268272                acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
    269                 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist
    270273                VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
     274                ReturnChecker::checkFunctionReturns( translationUnit );
     275                InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
    271276                Concurrency::applyKeywords( translationUnit );
     277                acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
    272278                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
    273279                Concurrency::implementMutexFuncs( translationUnit );
    274280                Concurrency::implementThreadStarter( translationUnit );
    275                 ReturnChecker::checkFunctionReturns( translationUnit );
    276281                mutateAll( translationUnit, compoundliteral );
    277                 acceptAll( translationUnit, fpd );
    278282                ArrayLength::computeLength( translationUnit );
    279                 acceptAll( translationUnit, finder );
     283                acceptAll( translationUnit, finder ); // xxx - remove this pass soon
    280284                mutateAll( translationUnit, labelAddrFixer );
    281285        }
     
    368372                        DWTIterator begin( dwts.begin() ), end( dwts.end() );
    369373                        if ( begin == end ) return;
    370                         FixFunction fixer;
     374                        PassVisitor<FixFunction> fixer;
    371375                        DWTIterator i = begin;
    372376                        *i = (*i)->acceptMutator( fixer );
    373                         if ( fixer.get_isVoid() ) {
     377                        if ( fixer.pass.isVoid ) {
    374378                                DWTIterator j = i;
    375379                                ++i;
     
    382386                                ++i;
    383387                                for ( ; i != end; ++i ) {
    384                                         FixFunction fixer;
     388                                        PassVisitor<FixFunction> fixer;
    385389                                        *i = (*i)->acceptMutator( fixer );
    386                                         if ( fixer.get_isVoid() ) {
     390                                        if ( fixer.pass.isVoid ) {
    387391                                                throw SemanticError( "invalid type void in function type ", func );
    388392                                        } // if
     
    579583
    580584        /// Fix up assertions - flattens assertion lists, removing all trait instances
    581         void forallFixer( Type * func ) {
    582                 for ( TypeDecl * type : func->get_forall() ) {
     585        void forallFixer( std::list< TypeDecl * > & forall, BaseSyntaxNode * node ) {
     586                for ( TypeDecl * type : forall ) {
    583587                        std::list< DeclarationWithType * > asserts;
    584588                        asserts.splice( asserts.end(), type->assertions );
     
    596600                        // apply FixFunction to every assertion to check for invalid void type
    597601                        for ( DeclarationWithType *& assertion : type->assertions ) {
    598                                 FixFunction fixer;
     602                                PassVisitor<FixFunction> fixer;
    599603                                assertion = assertion->acceptMutator( fixer );
    600                                 if ( fixer.get_isVoid() ) {
    601                                         throw SemanticError( "invalid type void in assertion of function ", func );
     604                                if ( fixer.pass.isVoid ) {
     605                                        throw SemanticError( "invalid type void in assertion of function ", node );
    602606                                } // if
    603607                        } // for
     
    607611
    608612        void ForallPointerDecay::previsit( ObjectDecl *object ) {
    609                 forallFixer( object->get_type() );
    610                 if ( PointerType *pointer = dynamic_cast< PointerType * >( object->get_type() ) ) {
    611                         forallFixer( pointer->get_base() );
     613                forallFixer( object->type->forall, object );
     614                if ( PointerType *pointer = dynamic_cast< PointerType * >( object->type ) ) {
     615                        forallFixer( pointer->base->forall, object );
    612616                } // if
    613617                object->fixUniqueId();
     
    615619
    616620        void ForallPointerDecay::previsit( FunctionDecl *func ) {
    617                 forallFixer( func->get_type() );
     621                forallFixer( func->type->forall, func );
    618622                func->fixUniqueId();
     623        }
     624
     625        void ForallPointerDecay::previsit( StructDecl * aggrDecl ) {
     626                forallFixer( aggrDecl->parameters, aggrDecl );
     627        }
     628
     629        void ForallPointerDecay::previsit( UnionDecl * aggrDecl ) {
     630                forallFixer( aggrDecl->parameters, aggrDecl );
    619631        }
    620632
     
    656668                }
    657669                filter( translationUnit, isTypedef, true );
    658 
    659670        }
    660671
     
    664675                TypedefMap::const_iterator def = typedefNames.find( typeInst->get_name() );
    665676                if ( def != typedefNames.end() ) {
    666                         Type *ret = def->second.first->get_base()->clone();
     677                        Type *ret = def->second.first->base->clone();
    667678                        ret->get_qualifiers() |= typeInst->get_qualifiers();
    668679                        // place instance parameters on the typedef'd type
    669                         if ( ! typeInst->get_parameters().empty() ) {
     680                        if ( ! typeInst->parameters.empty() ) {
    670681                                ReferenceToType *rtt = dynamic_cast<ReferenceToType*>(ret);
    671682                                if ( ! rtt ) {
    672                                         throw SemanticError("cannot apply type parameters to base type of " + typeInst->get_name());
     683                                        throw SemanticError("Cannot apply type parameters to base type of " + typeInst->name);
    673684                                }
    674685                                rtt->get_parameters().clear();
    675                                 cloneAll( typeInst->get_parameters(), rtt->get_parameters() );
    676                                 mutateAll( rtt->get_parameters(), *visitor );  // recursively fix typedefs on parameters
     686                                cloneAll( typeInst->parameters, rtt->parameters );
     687                                mutateAll( rtt->parameters, *visitor );  // recursively fix typedefs on parameters
    677688                        } // if
    678689                        delete typeInst;
     
    680691                } else {
    681692                        TypeDeclMap::const_iterator base = typedeclNames.find( typeInst->get_name() );
    682                         assertf( base != typedeclNames.end(), "Cannot find typedecl name %s", typeInst->get_name().c_str() );
     693                        assertf( base != typedeclNames.end(), "Cannot find typedecl name %s", typeInst->name.c_str() );
    683694                        typeInst->set_baseType( base->second );
    684695                } // if
    685696                return typeInst;
     697        }
     698
     699        struct VarLenChecker : WithShortCircuiting {
     700                void previsit( FunctionType * ) { visit_children = false; }
     701                void previsit( ArrayType * at ) {
     702                        isVarLen |= at->isVarLen;
     703                }
     704                bool isVarLen = false;
     705        };
     706
     707        bool isVariableLength( Type * t ) {
     708                PassVisitor<VarLenChecker> varLenChecker;
     709                maybeAccept( t, varLenChecker );
     710                return varLenChecker.pass.isVarLen;
    686711        }
    687712
     
    694719                        Type * t2 = typedefNames[ tyDecl->get_name() ].first->get_base();
    695720                        if ( ! ResolvExpr::typesCompatible( t1, t2, Indexer() ) ) {
    696                                 throw SemanticError( "cannot redefine typedef: " + tyDecl->get_name() );
     721                                throw SemanticError( "Cannot redefine typedef: " + tyDecl->name );
     722                        }
     723                        // cannot redefine VLA typedefs
     724                        if ( isVariableLength( t1 ) || isVariableLength( t2 ) ) {
     725                                throw SemanticError( "Cannot redefine typedef: " + tyDecl->name );
    697726                        }
    698727                } else {
  • src/SynTree/AddressExpr.cc

    r78315272 r3f7e12cb  
    3333        Type * addrType( Type * type ) {
    3434                if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( type ) ) {
    35                         return new ReferenceType( refType->get_qualifiers(), addrType( refType->get_base() ) );
     35                        return new ReferenceType( refType->get_qualifiers(), addrType( refType->base ) );
    3636                } else {
    3737                        return new PointerType( Type::Qualifiers(), type->clone() );
     
    4040}
    4141
    42 AddressExpr::AddressExpr( Expression *arg, Expression *_aname ) : Expression( _aname ), arg( arg ) {
    43         if ( arg->has_result() ) {
    44                 if ( arg->get_result()->get_lvalue() ) {
     42AddressExpr::AddressExpr( Expression *arg ) : Expression(), arg( arg ) {
     43        if ( arg->result ) {
     44                if ( arg->result->get_lvalue() ) {
    4545                        // lvalue, retains all layers of reference and gains a pointer inside the references
    46                         set_result( addrType( arg->get_result() ) );
     46                        set_result( addrType( arg->result ) );
    4747                } else {
    4848                        // taking address of non-lvalue -- must be a reference, loses one layer of reference
    49                         ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->get_result() );
    50                         set_result( addrType( refType->get_base() ) );
     49                        ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->result );
     50                        set_result( addrType( refType->base ) );
    5151                }
    5252                // result of & is never an lvalue
     
    6262}
    6363
    64 void AddressExpr::print( std::ostream &os, int indent ) const {
     64void AddressExpr::print( std::ostream &os, Indenter indent ) const {
    6565        os << "Address of:" << std::endl;
    6666        if ( arg ) {
    67                 os << std::string( indent+2, ' ' );
    68                 arg->print( os, indent+2 );
     67                os << indent+1;
     68                arg->print( os, indent+1 );
    6969        } // if
    7070}
     
    7777LabelAddressExpr::~LabelAddressExpr() {}
    7878
    79 void LabelAddressExpr::print( std::ostream & os, int indent ) const {
    80         os << "Address of label:" << std::endl << std::string( indent+2, ' ' ) << arg;
     79void LabelAddressExpr::print( std::ostream & os, Indenter ) const {
     80        os << "Address of label:" << arg;
    8181}
    8282
  • src/SynTree/AggregateDecl.cc

    r78315272 r3f7e12cb  
    4141}
    4242
    43 void AggregateDecl::print( std::ostream &os, int indent ) const {
     43void AggregateDecl::print( std::ostream &os, Indenter indent ) const {
    4444        using std::string;
    4545        using std::endl;
    4646
    47         os << typeString() << " " << get_name() << ":";
     47        os << typeString() << " " << name << ":";
    4848        if ( get_linkage() != LinkageSpec::Cforall ) {
    49                 os << " " << LinkageSpec::linkageName( get_linkage() );
     49                os << " " << LinkageSpec::linkageName( linkage );
    5050        } // if
    51         os << " with body " << has_body() << endl;
     51        os << " with body " << has_body();
    5252
    5353        if ( ! parameters.empty() ) {
    54                 os << endl << string( indent+2, ' ' ) << "with parameters" << endl;
    55                 printAll( parameters, os, indent+4 );
     54                os << endl << indent << "... with parameters" << endl;
     55                printAll( parameters, os, indent+1 );
    5656        } // if
    5757        if ( ! members.empty() ) {
    58                 os << endl << string( indent+2, ' ' ) << "with members" << endl;
    59                 printAll( members, os, indent+4 );
     58                os << endl << indent << "... with members" << endl;
     59                printAll( members, os, indent+1 );
    6060        } // if
    6161        if ( ! attributes.empty() ) {
    62                 os << endl << string( indent+2, ' ' ) << "with attributes" << endl;
    63                 printAll( attributes, os, indent+4 );
     62                os << endl << indent << "... with attributes" << endl;
     63                printAll( attributes, os, indent+1 );
    6464        } // if
     65        os << endl;
    6566}
    6667
    67 void AggregateDecl::printShort( std::ostream &os, int indent ) const {
     68void AggregateDecl::printShort( std::ostream &os, Indenter indent ) const {
    6869        using std::string;
    6970        using std::endl;
    7071
    71         os << typeString() << " " << get_name();
    72         os << string( indent+2, ' ' ) << "with body " << has_body() << endl;
     72        os << typeString() << " " << name << " with body " << has_body() << endl;
    7373
    7474        if ( ! parameters.empty() ) {
    75                 os << endl << string( indent+2, ' ' ) << "with parameters" << endl;
    76                 printAll( parameters, os, indent+4 );
     75                os << indent << "... with parameters" << endl;
     76                printAll( parameters, os, indent+1 );
    7777        } // if
    7878}
  • src/SynTree/ApplicationExpr.cc

    r78315272 r3f7e12cb  
    5555        set_result( ResolvExpr::extractResultType( function ) );
    5656
    57         assert( has_result() );
     57        assert( result );
    5858}
    5959
    6060ApplicationExpr::ApplicationExpr( const ApplicationExpr &other ) :
    61                 Expression( other ), function( maybeClone( other.function ) ), inferParams( other.inferParams ) {
     61                Expression( other ), function( maybeClone( other.function ) ) {
    6262        cloneAll( other.args, args );
    6363}
     
    6868}
    6969
    70 void printInferParams( const InferredParams & inferParams, std::ostream &os, int indent, int level ) {
    71         if ( ! inferParams.empty() ) {
    72                 os << std::string(indent, ' ') << "with inferred parameters " << level << ":" << std::endl;
    73                 for ( InferredParams::const_iterator i = inferParams.begin(); i != inferParams.end(); ++i ) {
    74                         os << std::string(indent+2, ' ');
    75                         Declaration::declFromId( i->second.decl )->printShort( os, indent+2 );
    76                         os << std::endl;
    77                         printInferParams( *i->second.inferParams, os, indent+2, level+1 );
    78                 } // for
     70void ApplicationExpr::print( std::ostream &os, Indenter indent ) const {
     71        os << "Application of" << std::endl << indent+1;
     72        function->print( os, indent+1 );
     73        os << std::endl;
     74        if ( ! args.empty() ) {
     75                os << indent << "... to arguments" << std::endl;
     76                printAll( args, os, indent+1 );
    7977        } // if
    80 }
    81 
    82 void ApplicationExpr::print( std::ostream &os, int indent ) const {
    83         os << "Application of" << std::endl << std::string(indent+2, ' ');
    84         function->print( os, indent+2 );
    85         if ( ! args.empty() ) {
    86                 os << std::string( indent, ' ' ) << "to arguments" << std::endl;
    87                 printAll( args, os, indent+2 );
    88         } // if
    89         printInferParams( inferParams, os, indent+2, 0 );
    9078        Expression::print( os, indent );
    9179}
  • src/SynTree/ArrayType.cc

    r78315272 r3f7e12cb  
    3939}
    4040
    41 void ArrayType::print( std::ostream &os, int indent ) const {
     41void ArrayType::print( std::ostream &os, Indenter indent ) const {
    4242        Type::print( os, indent );
    4343        if ( isStatic ) {
  • src/SynTree/AttrType.cc

    r78315272 r3f7e12cb  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // AttrType.cc.cc -- 
     7// AttrType.cc.cc --
    88//
    99// Author           : Richard C. Bilson
     
    4242}
    4343
    44 void AttrType::print( std::ostream &os, int indent ) const {
     44void AttrType::print( std::ostream &os, Indenter indent ) const {
    4545        Type::print( os, indent );
    4646        os << "attribute " << name << " applied to ";
  • src/SynTree/Attribute.cc

    r78315272 r3f7e12cb  
    2828}
    2929
    30 void Attribute::print( std::ostream &os, int indent ) const {
     30void Attribute::print( std::ostream &os, Indenter indent ) const {
    3131  using std::endl;
    3232  using std::string;
     
    3636    if ( ! parameters.empty() ) {
    3737      os << " with parameters: " << endl;
    38       printAll( parameters, os, indent );
     38      printAll( parameters, os, indent+1 );
    3939    }
    4040  }
  • src/SynTree/Attribute.h

    r78315272 r3f7e12cb  
    2020#include <string>  // for string, operator==
    2121
     22#include "BaseSyntaxNode.h"
     23#include "Mutator.h"
     24#include "Visitor.h"
     25
    2226class Expression;
    2327
    2428// GCC attribute
    2529// https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/Attribute-Syntax.html#Attribute-Syntax
    26 class Attribute {
     30class Attribute : public BaseSyntaxNode {
    2731  public:
     32        std::string name;
     33        // to keep things nice and tight, use NameExpr for special identifier parameters
     34        std::list< Expression * > parameters;
     35
    2836        Attribute( std::string name = "", const std::list< Expression * > & parameters = std::list< Expression * >() ) : name( name ), parameters( parameters ) {}
    2937        Attribute( const Attribute &other );
     
    3543        bool empty() const { return name == ""; }
    3644
    37         Attribute * clone() const { return new Attribute( *this ); }
    38         void print( std:: ostream &os, int indent = 0 ) const;
    39   private:
    40         std::string name;
    41         // to keep things nice and tight, use NameExpr for special identifier parameters
    42         std::list< Expression * > parameters;
     45        Attribute * clone() const override { return new Attribute( *this ); }
     46        virtual void accept( Visitor & v ) override { v.visit( this ); }
     47        virtual Attribute * acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     48        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    4349};
    4450
  • src/SynTree/BaseSyntaxNode.h

    r78315272 r3f7e12cb  
    1717
    1818#include "Common/CodeLocation.h"
     19#include "Common/Indenter.h"
    1920class Visitor;
     21class Mutator;
    2022
    2123class BaseSyntaxNode {
     
    2527        virtual ~BaseSyntaxNode() {}
    2628
     29        virtual BaseSyntaxNode * clone() const = 0;
    2730        virtual void accept( Visitor & v ) = 0;
    28   virtual void print( std::ostream & os, int indent = 0 ) const = 0;
     31        virtual BaseSyntaxNode * acceptMutator( Mutator & m ) = 0;
     32  /// Notes:
     33  /// * each node is responsible for indenting its children.
     34  /// * Expressions should not finish with a newline, since the expression's parent has better information.
     35        virtual void print( std::ostream & os, Indenter indent = {} ) const = 0;
     36  void print( std::ostream & os, unsigned int indent ) {
     37    print( os, Indenter{ Indenter::tabsize, indent });
     38  }
    2939};
     40
     41std::ostream & operator<<( std::ostream & out, const BaseSyntaxNode * node );
    3042
    3143// Local Variables: //
  • src/SynTree/BasicType.cc

    r78315272 r3f7e12cb  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // BasicType.cc -- 
     7// BasicType.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 11 12:52:05 2017
    13 // Update Count     : 9
     12// Last Modified On : Mon Sep 25 14:14:03 2017
     13// Update Count     : 11
    1414//
    1515
     
    2424BasicType::BasicType( const Type::Qualifiers &tq, Kind bt, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), kind( bt ) {}
    2525
    26 void BasicType::print( std::ostream &os, int indent ) const {
     26void BasicType::print( std::ostream &os, Indenter indent ) const {
    2727        Type::print( os, indent );
    2828        os << BasicType::typeNames[ kind ];
     
    4343          case LongLongSignedInt:
    4444          case LongLongUnsignedInt:
     45          case SignedInt128:
     46          case UnsignedInt128:
    4547                return true;
    4648          case Float:
  • src/SynTree/CommaExpr.cc

    r78315272 r3f7e12cb  
    2121#include "Type.h"            // for Type
    2222
    23 CommaExpr::CommaExpr( Expression *arg1, Expression *arg2, Expression *_aname )
    24                 : Expression( _aname ), arg1( arg1 ), arg2( arg2 ) {
     23CommaExpr::CommaExpr( Expression *arg1, Expression *arg2 )
     24                : Expression(), arg1( arg1 ), arg2( arg2 ) {
    2525        // xxx - result of a comma expression is never an lvalue, so should set lvalue
    2626        // to false on all result types. Actually doing this causes some strange things
     
    3939}
    4040
    41 void CommaExpr::print( std::ostream &os, int indent ) const {
     41void CommaExpr::print( std::ostream &os, Indenter indent ) const {
    4242        os << "Comma Expression:" << std::endl;
    43         os << std::string( indent+2, ' ' );
    44         arg1->print( os, indent+2 );
     43        os << (indent+1);
     44        arg1->print( os, indent+1 );
    4545        os << std::endl;
    46         os << std::string( indent+2, ' ' );
    47         arg2->print( os, indent+2 );
     46        os << (indent+1);
     47        arg2->print( os, indent+1 );
    4848        Expression::print( os, indent );
    4949}
  • src/SynTree/CompoundStmt.cc

    r78315272 r3f7e12cb  
    2929
    3030CompoundStmt::CompoundStmt( std::list<Label> labels ) : Statement( labels ) {
     31}
     32
     33CompoundStmt::CompoundStmt( std::list<Statement *> stmts ) : Statement( noLabels ), kids( stmts ) {
    3134}
    3235
     
    7073}
    7174
    72 void CompoundStmt::print( std::ostream &os, int indent ) const {
    73         os << "CompoundStmt" << endl ;
    74         printAll( kids, os, indent + 2 );
     75void CompoundStmt::print( std::ostream &os, Indenter indent ) const {
     76        os << "CompoundStmt" << endl;
     77        printAll( kids, os, indent+1 );
    7578}
    7679
  • src/SynTree/Constant.cc

    r78315272 r3f7e12cb  
    3434}
    3535
     36Constant Constant::from_char( char c ) {
     37        return Constant( new BasicType( Type::Qualifiers(), BasicType::Char ), std::to_string( c ), (unsigned long long int)c );
     38}
     39
    3640Constant Constant::from_int( int i ) {
    3741        return Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), std::to_string( i ), (unsigned long long int)i );
     
    6771}
    6872
    69 void Constant::print( std::ostream &os ) const {
     73void Constant::print( std::ostream &os, Indenter ) const {
    7074        os << "(" << rep << " " << val.ival;
    7175        if ( type ) {
  • src/SynTree/Constant.h

    r78315272 r3f7e12cb  
    1919#include <string>     // for string
    2020
     21#include "BaseSyntaxNode.h"
    2122#include "Mutator.h"  // for Mutator
    2223#include "Visitor.h"  // for Visitor
     
    2425class Type;
    2526
    26 class Constant {
     27class Constant : public BaseSyntaxNode {
    2728  public:
    2829        Constant( Type * type, std::string rep, unsigned long long val );
     
    3031        Constant( const Constant & other );
    3132        virtual ~Constant();
     33
     34        virtual Constant * clone() const { return new Constant( *this ); }
    3235
    3336        Type * get_type() { return type; }
     
    4043        /// generates a boolean constant of the given bool
    4144        static Constant from_bool( bool b );
     45        /// generates a char constant of the given char
     46        static Constant from_char( char c );
    4247        /// generates an integer constant of the given int
    4348        static Constant from_int( int i );
     
    5257        virtual void accept( Visitor & v ) { v.visit( this ); }
    5358        virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    54         virtual void print( std::ostream & os ) const;
     59        virtual void print( std::ostream & os, Indenter indent = 0 ) const;
    5560  private:
    5661        Type * type;
  • src/SynTree/DeclStmt.cc

    r78315272 r3f7e12cb  
    3333}
    3434
    35 void DeclStmt::print( std::ostream &os, int indent ) const {
     35void DeclStmt::print( std::ostream &os, Indenter indent ) const {
    3636        assert( decl != 0 );
    3737        os << "Declaration of ";
  • src/SynTree/Declaration.cc

    r78315272 r3f7e12cb  
    4242
    4343void Declaration::fixUniqueId() {
     44        // don't need to set unique ID twice
     45        if ( uniqueId ) return;
    4446        uniqueId = ++lastUniqueId;
    4547        idMap[ uniqueId ] = this;
     
    5961}
    6062
    61 std::ostream & operator<<( std::ostream & out, const Declaration * decl ) {
    62         if ( decl ){
    63                 decl->print( out );
    64         } else {
    65                 out << "nullptr";
    66         }
    67         return out;
    68 }
    69 
    7063
    7164AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", Type::StorageClasses(), LinkageSpec::C ), stmt( stmt ) {
     
    7972}
    8073
    81 void AsmDecl::print( std::ostream &os, int indent ) const {
     74void AsmDecl::print( std::ostream &os, Indenter indent ) const {
    8275        stmt->print( os, indent );
    8376}
    8477
    85 void AsmDecl::printShort( std::ostream &os, int indent ) const {
     78void AsmDecl::printShort( std::ostream &os, Indenter indent ) const {
    8679        stmt->print( os, indent );
    8780}
  • src/SynTree/Declaration.h

    r78315272 r3f7e12cb  
    6161
    6262        void fixUniqueId( void );
    63         virtual Declaration *clone() const = 0;
    64         virtual void accept( Visitor &v ) = 0;
    65         virtual Declaration *acceptMutator( Mutator &m ) = 0;
    66         virtual void print( std::ostream &os, int indent = 0 ) const = 0;
    67         virtual void printShort( std::ostream &os, int indent = 0 ) const = 0;
     63        virtual Declaration *clone() const override = 0;
     64        virtual void accept( Visitor &v ) override = 0;
     65        virtual Declaration *acceptMutator( Mutator &m ) override = 0;
     66        virtual void print( std::ostream &os, Indenter indent = {} ) const override = 0;
     67        virtual void printShort( std::ostream &os, Indenter indent = {} ) const = 0;
    6868
    6969        static void dumpIds( std::ostream &os );
     
    106106        //void set_functionSpecifiers( Type::FuncSpecifiers newValue ) { fs = newValue; }
    107107
    108         virtual DeclarationWithType *clone() const = 0;
    109         virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0;
     108        virtual DeclarationWithType *clone() const override = 0;
     109        virtual DeclarationWithType *acceptMutator( Mutator &m )  override = 0;
    110110
    111111        virtual Type * get_type() const = 0;
     
    128128        virtual ~ObjectDecl();
    129129
    130         virtual Type * get_type() const { return type; }
    131         virtual void set_type(Type *newType) { type = newType; }
     130        virtual Type * get_type() const override { return type; }
     131        virtual void set_type(Type *newType) override { type = newType; }
    132132
    133133        Initializer *get_init() const { return init; }
     
    139139        static ObjectDecl * newObject( const std::string & name, Type * type, Initializer * init );
    140140
    141         virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); }
    142         virtual void accept( Visitor &v ) { v.visit( this ); }
    143         virtual DeclarationWithType *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    144         virtual void print( std::ostream &os, int indent = 0 ) const;
    145         virtual void printShort( std::ostream &os, int indent = 0 ) const;
     141        virtual ObjectDecl *clone() const override { return new ObjectDecl( *this ); }
     142        virtual void accept( Visitor &v ) override { v.visit( this ); }
     143        virtual DeclarationWithType *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     144        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     145        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
    146146};
    147147
     
    157157        virtual ~FunctionDecl();
    158158
    159         Type * get_type() const { return type; }
    160         virtual void set_type(Type * t) { type = strict_dynamic_cast< FunctionType* >( t ); }
     159        virtual Type * get_type() const override { return type; }
     160        virtual void set_type(Type * t) override { type = strict_dynamic_cast< FunctionType* >( t ); }
    161161
    162162        FunctionType * get_functionType() const { return type; }
     
    165165        void set_statements( CompoundStmt *newValue ) { statements = newValue; }
    166166
    167         virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); }
    168         virtual void accept( Visitor &v ) { v.visit( this ); }
    169         virtual DeclarationWithType *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    170         virtual void print( std::ostream &os, int indent = 0 ) const;
    171         virtual void printShort( std::ostream &os, int indent = 0 ) const;
     167        static FunctionDecl * newFunction( const std::string & name, FunctionType * type, CompoundStmt * statements );
     168
     169        virtual FunctionDecl *clone() const override { return new FunctionDecl( *this ); }
     170        virtual void accept( Visitor &v ) override { v.visit( this ); }
     171        virtual DeclarationWithType *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     172        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     173        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
    172174};
    173175
     
    190192        virtual std::string typeString() const = 0;
    191193
    192         virtual NamedTypeDecl *clone() const = 0;
    193         virtual void print( std::ostream &os, int indent = 0 ) const;
    194         virtual void printShort( std::ostream &os, int indent = 0 ) const;
     194        virtual NamedTypeDecl *clone() const override = 0;
     195        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     196        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
    195197};
    196198
     
    198200        typedef NamedTypeDecl Parent;
    199201  public:
    200         enum Kind { Any, Dtype, Ftype, Ttype };
     202        enum Kind { Dtype, Ftype, Ttype };
    201203
    202204        Type * init;
     
    214216        };
    215217
    216         TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init = nullptr );
     218        TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, bool sized, Type * init = nullptr );
    217219        TypeDecl( const TypeDecl &other );
    218220        virtual ~TypeDecl();
     
    223225        TypeDecl * set_init( Type * newValue ) { init = newValue; return this; }
    224226
    225         bool isComplete() const { return kind == Any || sized; }
     227        bool isComplete() const { return sized; }
    226228        bool get_sized() const { return sized; }
    227229        TypeDecl * set_sized( bool newValue ) { sized = newValue; return this; }
    228230
    229         virtual std::string typeString() const;
     231        virtual std::string typeString() const override;
    230232        virtual std::string genTypeString() const;
    231233
    232         virtual TypeDecl *clone() const { return new TypeDecl( *this ); }
    233         virtual void accept( Visitor &v ) { v.visit( this ); }
    234         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    235         virtual void print( std::ostream &os, int indent = 0 ) const;
     234        virtual TypeDecl *clone() const override { return new TypeDecl( *this ); }
     235        virtual void accept( Visitor &v ) override { v.visit( this ); }
     236        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     237        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    236238
    237239  private:
     
    245247        TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
    246248
    247         virtual std::string typeString() const;
    248 
    249         virtual TypedefDecl *clone() const { return new TypedefDecl( *this ); }
    250         virtual void accept( Visitor &v ) { v.visit( this ); }
    251         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     249        virtual std::string typeString() const override;
     250
     251        virtual TypedefDecl *clone() const override { return new TypedefDecl( *this ); }
     252        virtual void accept( Visitor &v ) override { v.visit( this ); }
     253        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    252254  private:
    253255};
     
    274276        AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; }
    275277
    276         virtual void print( std::ostream &os, int indent = 0 ) const;
    277         virtual void printShort( std::ostream &os, int indent = 0 ) const;
     278        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     279        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
    278280  protected:
    279281        virtual std::string typeString() const = 0;
     
    290292        bool is_thread() { return kind == DeclarationNode::Thread; }
    291293
    292         virtual StructDecl *clone() const { return new StructDecl( *this ); }
    293         virtual void accept( Visitor &v ) { v.visit( this ); }
    294         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     294        virtual StructDecl *clone() const override { return new StructDecl( *this ); }
     295        virtual void accept( Visitor &v ) override { v.visit( this ); }
     296        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    295297  private:
    296298        DeclarationNode::Aggregate kind;
    297         virtual std::string typeString() const;
     299        virtual std::string typeString() const override;
    298300};
    299301
     
    304306        UnionDecl( const UnionDecl &other ) : Parent( other ) {}
    305307
    306         virtual UnionDecl *clone() const { return new UnionDecl( *this ); }
    307         virtual void accept( Visitor &v ) { v.visit( this ); }
    308         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    309   private:
    310         virtual std::string typeString() const;
     308        virtual UnionDecl *clone() const override { return new UnionDecl( *this ); }
     309        virtual void accept( Visitor &v ) override { v.visit( this ); }
     310        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     311  private:
     312        virtual std::string typeString() const override;
    311313};
    312314
     
    317319        EnumDecl( const EnumDecl &other ) : Parent( other ) {}
    318320
    319         virtual EnumDecl *clone() const { return new EnumDecl( *this ); }
    320         virtual void accept( Visitor &v ) { v.visit( this ); }
    321         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    322   private:
    323         virtual std::string typeString() const;
     321        virtual EnumDecl *clone() const override { return new EnumDecl( *this ); }
     322        virtual void accept( Visitor &v ) override { v.visit( this ); }
     323        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     324  private:
     325        virtual std::string typeString() const override;
    324326};
    325327
     
    332334        TraitDecl( const TraitDecl &other ) : Parent( other ) {}
    333335
    334         virtual TraitDecl *clone() const { return new TraitDecl( *this ); }
    335         virtual void accept( Visitor &v ) { v.visit( this ); }
    336         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    337   private:
    338         virtual std::string typeString() const;
     336        virtual TraitDecl *clone() const override { return new TraitDecl( *this ); }
     337        virtual void accept( Visitor &v ) override { v.visit( this ); }
     338        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     339  private:
     340        virtual std::string typeString() const override;
    339341};
    340342
     
    350352        void set_stmt( AsmStmt *newValue ) { stmt = newValue; }
    351353
    352         virtual AsmDecl *clone() const { return new AsmDecl( *this ); }
    353         virtual void accept( Visitor &v ) { v.visit( this ); }
    354         virtual AsmDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    355         virtual void print( std::ostream &os, int indent = 0 ) const;
    356         virtual void printShort( std::ostream &os, int indent = 0 ) const;
    357 };
    358 
    359 std::ostream & operator<<( std::ostream & out, const Declaration * decl );
     354        virtual AsmDecl *clone() const override { return new AsmDecl( *this ); }
     355        virtual void accept( Visitor &v ) override { v.visit( this ); }
     356        virtual AsmDecl *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     357        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     358        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
     359};
     360
    360361std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data );
    361362
  • src/SynTree/Expression.cc

    r78315272 r3f7e12cb  
    3333#include "GenPoly/Lvalue.h"
    3434
    35 Expression::Expression( Expression *_aname ) : result( 0 ), env( 0 ), argName( _aname ) {}
    36 
    37 Expression::Expression( const Expression &other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) {
     35void printInferParams( const InferredParams & inferParams, std::ostream &os, Indenter indent, int level ) {
     36        if ( ! inferParams.empty() ) {
     37                os << indent << "with inferred parameters " << level << ":" << std::endl;
     38                for ( InferredParams::const_iterator i = inferParams.begin(); i != inferParams.end(); ++i ) {
     39                        os << indent+1;
     40                        Declaration::declFromId( i->second.decl )->printShort( os, indent+1 );
     41                        os << std::endl;
     42                        printInferParams( *i->second.inferParams, os, indent+1, level+1 );
     43                } // for
     44        } // if
     45}
     46
     47Expression::Expression() : result( 0 ), env( 0 ) {}
     48
     49Expression::Expression( const Expression &other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), extension( other.extension ), inferParams( other.inferParams ) {
    3850}
    3951
    4052Expression::~Expression() {
    4153        delete env;
    42         delete argName; // xxx -- there's a problem in cloning ConstantExpr I still don't know how to fix
    4354        delete result;
    4455}
    4556
    46 void Expression::print( std::ostream &os, int indent ) const {
     57void Expression::print( std::ostream &os, Indenter indent ) const {
     58        printInferParams( inferParams, os, indent+1, 0 );
     59
    4760        if ( env ) {
    48                 os << std::string( indent, ' ' ) << "with environment:" << std::endl;
    49                 env->print( os, indent+2 );
     61                os << std::endl << indent << "... with environment:" << std::endl;
     62                env->print( os, indent+1 );
    5063        } // if
    5164
    52         if ( argName ) {
    53                 os << std::string( indent, ' ' ) << "with designator:";
    54                 argName->print( os, indent+2 );
     65        if ( extension ) {
     66                os << std::endl << indent << "... with extension:";
    5567        } // if
    56 
    57         if ( extension ) {
    58                 os << std::string( indent, ' ' ) << "with extension:";
    59         } // if
    60 }
    61 
    62 ConstantExpr::ConstantExpr( Constant _c, Expression *_aname ) : Expression( _aname ), constant( _c ) {
     68}
     69
     70ConstantExpr::ConstantExpr( Constant _c ) : Expression(), constant( _c ) {
    6371        set_result( constant.get_type()->clone() );
    6472}
     
    6977ConstantExpr::~ConstantExpr() {}
    7078
    71 void ConstantExpr::print( std::ostream &os, int indent ) const {
     79void ConstantExpr::print( std::ostream &os, Indenter indent ) const {
    7280        os << "constant expression " ;
    7381        constant.print( os );
     
    7583}
    7684
    77 VariableExpr::VariableExpr( DeclarationWithType *_var, Expression *_aname ) : Expression( _aname ), var( _var ) {
     85VariableExpr::VariableExpr( DeclarationWithType *_var ) : Expression(), var( _var ) {
    7886        assert( var );
    7987        assert( var->get_type() );
     
    96104}
    97105
    98 void VariableExpr::print( std::ostream &os, int indent ) const {
     106void VariableExpr::print( std::ostream &os, Indenter indent ) const {
    99107        os << "Variable Expression: ";
    100 
    101         Declaration *decl = get_var();
    102         if ( decl != 0) decl->printShort(os, indent + 2);
    103         os << std::endl;
    104         Expression::print( os, indent );
    105 }
    106 
    107 SizeofExpr::SizeofExpr( Expression *expr_, Expression *_aname ) :
    108                 Expression( _aname ), expr(expr_), type(0), isType(false) {
     108        var->printShort(os, indent);
     109        Expression::print( os, indent );
     110}
     111
     112SizeofExpr::SizeofExpr( Expression *expr_ ) :
     113                Expression(), expr(expr_), type(0), isType(false) {
    109114        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    110115}
    111116
    112 SizeofExpr::SizeofExpr( Type *type_, Expression *_aname ) :
    113                 Expression( _aname ), expr(0), type(type_), isType(true) {
     117SizeofExpr::SizeofExpr( Type *type_ ) :
     118                Expression(), expr(0), type(type_), isType(true) {
    114119        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    115120}
     
    124129}
    125130
    126 void SizeofExpr::print( std::ostream &os, int indent) const {
     131void SizeofExpr::print( std::ostream &os, Indenter indent) const {
    127132        os << "Sizeof Expression on: ";
    128 
    129         if (isType)
    130                 type->print(os, indent + 2);
    131         else
    132                 expr->print(os, indent + 2);
    133 
    134         os << std::endl;
    135         Expression::print( os, indent );
    136 }
    137 
    138 AlignofExpr::AlignofExpr( Expression *expr_, Expression *_aname ) :
    139                 Expression( _aname ), expr(expr_), type(0), isType(false) {
     133        if (isType) type->print(os, indent+1);
     134        else expr->print(os, indent+1);
     135        Expression::print( os, indent );
     136}
     137
     138AlignofExpr::AlignofExpr( Expression *expr_ ) :
     139                Expression(), expr(expr_), type(0), isType(false) {
    140140        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    141141}
    142142
    143 AlignofExpr::AlignofExpr( Type *type_, Expression *_aname ) :
    144                 Expression( _aname ), expr(0), type(type_), isType(true) {
     143AlignofExpr::AlignofExpr( Type *type_ ) :
     144                Expression(), expr(0), type(type_), isType(true) {
    145145        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    146146}
     
    155155}
    156156
    157 void AlignofExpr::print( std::ostream &os, int indent) const {
     157void AlignofExpr::print( std::ostream &os, Indenter indent) const {
    158158        os << "Alignof Expression on: ";
    159 
    160         if (isType)
    161                 type->print(os, indent + 2);
    162         else
    163                 expr->print(os, indent + 2);
    164 
    165         os << std::endl;
    166         Expression::print( os, indent );
    167 }
    168 
    169 UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type_, const std::string &member_, Expression *_aname ) :
    170                 Expression( _aname ), type(type_), member(member_) {
     159        if (isType) type->print(os, indent+1);
     160        else expr->print(os, indent+1);
     161        Expression::print( os, indent );
     162}
     163
     164UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type, const std::string &member ) :
     165                Expression(), type(type), member(member) {
     166        assert( type );
    171167        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    172168}
     
    179175}
    180176
    181 void UntypedOffsetofExpr::print( std::ostream &os, int indent) const {
    182         os << std::string( indent, ' ' ) << "Untyped Offsetof Expression on member " << member << " of ";
    183 
    184         if ( type ) {
    185                 type->print(os, indent + 2);
    186         } else {
    187                 os << "<NULL>";
    188         }
    189 
    190         os << std::endl;
    191         Expression::print( os, indent );
    192 }
    193 
    194 OffsetofExpr::OffsetofExpr( Type *type_, DeclarationWithType *member_, Expression *_aname ) :
    195                 Expression( _aname ), type(type_), member(member_) {
     177void UntypedOffsetofExpr::print( std::ostream &os, Indenter indent) const {
     178        os << "Untyped Offsetof Expression on member " << member << " of ";
     179        type->print(os, indent+1);
     180        Expression::print( os, indent );
     181}
     182
     183OffsetofExpr::OffsetofExpr( Type *type, DeclarationWithType *member ) :
     184                Expression(), type(type), member(member) {
     185        assert( member );
     186        assert( type );
    196187        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    197188}
     
    204195}
    205196
    206 void OffsetofExpr::print( std::ostream &os, int indent) const {
    207         os << std::string( indent, ' ' ) << "Offsetof Expression on member ";
    208 
    209         if ( member ) {
    210                 os << member->get_name();
    211         } else {
    212                 os << "<NULL>";
    213         }
    214 
    215         os << " of ";
    216 
    217         if ( type ) {
    218                 type->print(os, indent + 2);
    219         } else {
    220                 os << "<NULL>";
    221         }
    222 
    223         os << std::endl;
    224         Expression::print( os, indent );
    225 }
    226 
    227 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) {
     197void OffsetofExpr::print( std::ostream &os, Indenter indent) const {
     198        os << "Offsetof Expression on member " << member->name << " of ";
     199        type->print(os, indent+1);
     200        Expression::print( os, indent );
     201}
     202
     203OffsetPackExpr::OffsetPackExpr( StructInstType *type ) : Expression(), type( type ) {
     204        assert( type );
    228205        set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
    229206}
     
    233210OffsetPackExpr::~OffsetPackExpr() { delete type; }
    234211
    235 void OffsetPackExpr::print( std::ostream &os, int indent ) const {
    236         os << std::string( indent, ' ' ) << "Offset pack expression on ";
    237 
    238         if ( type ) {
    239                 type->print(os, indent + 2);
    240         } else {
    241                 os << "<NULL>";
    242         }
    243 
    244         os << std::endl;
    245         Expression::print( os, indent );
    246 }
    247 
    248 AttrExpr::AttrExpr( Expression *attr, Expression *expr_, Expression *_aname ) :
    249                 Expression( _aname ), attr( attr ), expr(expr_), type(0), isType(false) {
    250 }
    251 
    252 AttrExpr::AttrExpr( Expression *attr, Type *type_, Expression *_aname ) :
    253                 Expression( _aname ), attr( attr ), expr(0), type(type_), isType(true) {
     212void OffsetPackExpr::print( std::ostream &os, Indenter indent ) const {
     213        os << "Offset pack expression on ";
     214        type->print(os, indent+1);
     215        Expression::print( os, indent );
     216}
     217
     218AttrExpr::AttrExpr( Expression *attr, Expression *expr_ ) :
     219                Expression(), attr( attr ), expr(expr_), type(0), isType(false) {
     220}
     221
     222AttrExpr::AttrExpr( Expression *attr, Type *type_ ) :
     223                Expression(), attr( attr ), expr(0), type(type_), isType(true) {
    254224}
    255225
     
    264234}
    265235
    266 void AttrExpr::print( std::ostream &os, int indent) const {
     236void AttrExpr::print( std::ostream &os, Indenter indent) const {
    267237        os << "Attr ";
    268         attr->print( os, indent + 2 );
     238        attr->print( os, indent+1);
    269239        if ( isType || expr ) {
    270240                os << "applied to: ";
    271 
    272                 if (isType)
    273                         type->print(os, indent + 2);
    274                 else
    275                         expr->print(os, indent + 2);
     241                if (isType) type->print(os, indent+1);
     242                else expr->print(os, indent+1);
    276243        } // if
    277 
    278         os << std::endl;
    279         Expression::print( os, indent );
    280 }
    281 
    282 CastExpr::CastExpr( Expression *arg_, Type *toType, Expression *_aname ) : Expression( _aname ), arg(arg_) {
     244        Expression::print( os, indent );
     245}
     246
     247CastExpr::CastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
    283248        set_result(toType);
    284249}
    285250
    286 CastExpr::CastExpr( Expression *arg_, Expression *_aname ) : Expression( _aname ), arg(arg_) {
     251CastExpr::CastExpr( Expression *arg_ ) : Expression(), arg(arg_) {
    287252        set_result( new VoidType( Type::Qualifiers() ) );
    288253}
     
    295260}
    296261
    297 void CastExpr::print( std::ostream &os, int indent ) const {
    298         os << "Cast of:" << std::endl << std::string( indent+2, ' ' );
    299         arg->print(os, indent+2);
    300         os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
    301         os << std::string( indent+2, ' ' );
     262void CastExpr::print( std::ostream &os, Indenter indent ) const {
     263        os << "Cast of:" << std::endl << indent+1;
     264        arg->print(os, indent+1);
     265        os << std::endl << indent << "... to:";
    302266        if ( result->isVoid() ) {
    303                 os << "nothing";
     267                os << " nothing";
    304268        } else {
    305                 result->print( os, indent+2 );
     269                os << std::endl << indent+1;
     270                result->print( os, indent+1 );
    306271        } // if
    307         os << std::endl;
    308272        Expression::print( os, indent );
    309273}
     
    320284}
    321285
    322 void VirtualCastExpr::print( std::ostream &os, int indent ) const {
    323         os << "Virtual Cast of:" << std::endl << std::string( indent+2, ' ' );
    324         arg->print(os, indent+2);
    325         os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
    326         os << std::string( indent+2, ' ' );
     286void VirtualCastExpr::print( std::ostream &os, Indenter indent ) const {
     287        os << "Virtual Cast of:" << std::endl << indent+1;
     288        arg->print(os, indent+1);
     289        os << std::endl << indent << "... to:";
    327290        if ( ! result ) {
    328                 os << "unknown";
     291                os << " unknown";
    329292        } else {
    330                 result->print( os, indent+2 );
     293                os << std::endl << indent+1;
     294                result->print( os, indent+1 );
    331295        } // if
    332         os << std::endl;
    333         Expression::print( os, indent );
    334 }
    335 
    336 UntypedMemberExpr::UntypedMemberExpr( Expression * _member, Expression *_aggregate, Expression *_aname ) :
    337                 Expression( _aname ), member(_member), aggregate(_aggregate) {}
     296        Expression::print( os, indent );
     297}
     298
     299UntypedMemberExpr::UntypedMemberExpr( Expression * member, Expression *aggregate ) :
     300                Expression(), member(member), aggregate(aggregate) {
     301        assert( aggregate );
     302}
    338303
    339304UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr &other ) :
     
    346311}
    347312
    348 void UntypedMemberExpr::print( std::ostream &os, int indent ) const {
    349         os << "Untyped Member Expression, with field: " << std::endl;
    350         os << std::string( indent+2, ' ' );
    351         get_member()->print(os, indent+4);
    352         os << std::string( indent+2, ' ' );
    353 
    354         Expression *agg = get_aggregate();
    355         os << "from aggregate: " << std::endl;
    356         if (agg != 0) {
    357                 os << std::string( indent + 4, ' ' );
    358                 agg->print(os, indent + 4);
    359         }
    360         os << std::string( indent+2, ' ' );
     313void UntypedMemberExpr::print( std::ostream &os, Indenter indent ) const {
     314        os << "Untyped Member Expression, with field: " << std::endl << indent+1;
     315        member->print(os, indent+1 );
     316        os << indent << "... from aggregate: " << std::endl << indent+1;
     317        aggregate->print(os, indent+1);
    361318        Expression::print( os, indent );
    362319}
     
    377334
    378335
    379 MemberExpr::MemberExpr( DeclarationWithType *_member, Expression *_aggregate, Expression *_aname ) :
    380                 Expression( _aname ), member(_member), aggregate(_aggregate) {
     336MemberExpr::MemberExpr( DeclarationWithType *member, Expression *aggregate ) :
     337                Expression(), member(member), aggregate(aggregate) {
     338        assert( member );
     339        assert( aggregate );
    381340
    382341        TypeSubstitution sub( makeSub( aggregate->get_result() ) );
     
    396355}
    397356
    398 void MemberExpr::print( std::ostream &os, int indent ) const {
     357void MemberExpr::print( std::ostream &os, Indenter indent ) const {
    399358        os << "Member Expression, with field: " << std::endl;
    400 
    401         assert( member );
    402         os << std::string( indent + 2, ' ' );
    403         member->print( os, indent + 2 );
    404         os << std::endl;
    405 
    406         Expression *agg = get_aggregate();
    407         os << std::string( indent, ' ' ) << "from aggregate: " << std::endl;
    408         if (agg != 0) {
    409                 os << std::string( indent + 2, ' ' );
    410                 agg->print(os, indent + 2);
    411         }
    412         os << std::string( indent+2, ' ' );
    413         Expression::print( os, indent );
    414 }
    415 
    416 UntypedExpr::UntypedExpr( Expression *_function, const std::list<Expression *> &_args, Expression *_aname ) :
    417                 Expression( _aname ), function(_function), args(_args) {}
     359        os << indent+1;
     360        member->print( os, indent+1 );
     361        os << std::endl << indent << "... from aggregate: " << std::endl << indent+1;
     362        aggregate->print(os, indent + 1);
     363        Expression::print( os, indent );
     364}
     365
     366UntypedExpr::UntypedExpr( Expression *function, const std::list<Expression *> &args ) :
     367                Expression(), function(function), args(args) {}
    418368
    419369UntypedExpr::UntypedExpr( const UntypedExpr &other ) :
     
    456406
    457407
    458 void UntypedExpr::print( std::ostream &os, int indent ) const {
     408void UntypedExpr::print( std::ostream &os, Indenter indent ) const {
    459409        os << "Applying untyped: " << std::endl;
    460         os << std::string( indent+2, ' ' );
    461         function->print(os, indent + 2);
    462         os << std::string( indent, ' ' ) << "...to: " << std::endl;
    463         printAll(args, os, indent + 2);
    464         Expression::print( os, indent );
    465 }
    466 
    467 void UntypedExpr::printArgs( std::ostream &os, int indent ) const {
    468         std::list<Expression *>::const_iterator i;
    469         for (i = args.begin(); i != args.end(); i++) {
    470                 os << std::string(indent, ' ' );
    471                 (*i)->print(os, indent);
    472         }
    473 }
    474 
    475 NameExpr::NameExpr( std::string _name, Expression *_aname ) : Expression( _aname ), name(_name) {
    476         assertf(_name != "0", "Zero is not a valid name\n");
    477         assertf(_name != "1", "One is not a valid name\n");
     410        os << indent+1;
     411        function->print(os, indent+1);
     412        os << std::endl << indent << "...to: " << std::endl;
     413        printAll(args, os, indent+1);
     414        Expression::print( os, indent );
     415}
     416
     417NameExpr::NameExpr( std::string name ) : Expression(), name(name) {
     418        assertf(name != "0", "Zero is not a valid name");
     419        assertf(name != "1", "One is not a valid name");
    478420}
    479421
     
    483425NameExpr::~NameExpr() {}
    484426
    485 void NameExpr::print( std::ostream &os, int indent ) const {
    486         os << "Name: " << get_name() << std::endl;
    487         Expression::print( os, indent );
    488 }
    489 
    490 LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp, Expression *_aname ) :
    491                 Expression( _aname ), arg1(arg1_), arg2(arg2_), isAnd(andp) {
     427void NameExpr::print( std::ostream &os, Indenter indent ) const {
     428        os << "Name: " << get_name();
     429        Expression::print( os, indent );
     430}
     431
     432LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp ) :
     433                Expression(), arg1(arg1_), arg2(arg2_), isAnd(andp) {
    492434        set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    493435}
     
    502444}
    503445
    504 void LogicalExpr::print( std::ostream &os, int indent )const {
    505         os << "Short-circuited operation (" << (isAnd?"and":"or") << ") on: ";
     446void LogicalExpr::print( std::ostream &os, Indenter indent )const {
     447        os << "Short-circuited operation (" << (isAnd ? "and" : "or") << ") on: ";
    506448        arg1->print(os);
    507449        os << " and ";
    508450        arg2->print(os);
    509         os << std::endl;
    510         Expression::print( os, indent );
    511 }
    512 
    513 ConditionalExpr::ConditionalExpr( Expression *arg1_, Expression *arg2_, Expression *arg3_, Expression *_aname ) :
    514                 Expression( _aname ), arg1(arg1_), arg2(arg2_), arg3(arg3_) {}
     451        Expression::print( os, indent );
     452}
     453
     454ConditionalExpr::ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3 ) :
     455                Expression(), arg1(arg1), arg2(arg2), arg3(arg3) {}
    515456
    516457ConditionalExpr::ConditionalExpr( const ConditionalExpr &other ) :
     
    524465}
    525466
    526 void ConditionalExpr::print( std::ostream &os, int indent ) const {
    527         os << "Conditional expression on: " << std::endl;
    528         os << std::string( indent+2, ' ' );
    529         arg1->print( os, indent+2 );
    530         os << std::string( indent, ' ' ) << "First alternative:" << std::endl;
    531         os << std::string( indent+2, ' ' );
    532         arg2->print( os, indent+2 );
    533         os << std::string( indent, ' ' ) << "Second alternative:" << std::endl;
    534         os << std::string( indent+2, ' ' );
    535         arg3->print( os, indent+2 );
    536         os << std::endl;
     467void ConditionalExpr::print( std::ostream &os, Indenter indent ) const {
     468        os << "Conditional expression on: " << std::endl << indent+1;
     469        arg1->print( os, indent+1 );
     470        os << indent << "First alternative:" << std::endl << indent+1;
     471        arg2->print( os, indent+1 );
     472        os << indent << "Second alternative:" << std::endl << indent+1;
     473        arg3->print( os, indent+1 );
    537474        Expression::print( os, indent );
    538475}
     
    541478
    542479
    543 void AsmExpr::print( std::ostream &os, int indent ) const {
     480void AsmExpr::print( std::ostream &os, Indenter indent ) const {
    544481        os << "Asm Expression: " << std::endl;
    545         if ( inout ) inout->print( os, indent + 2 );
    546         if ( constraint ) constraint->print( os, indent + 2 );
    547         if ( operand ) operand->print( os, indent + 2 );
     482        if ( inout ) inout->print( os, indent+1 );
     483        if ( constraint ) constraint->print( os, indent+1 );
     484        if ( operand ) operand->print( os, indent+1 );
    548485}
    549486
     
    551488ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) {
    552489        assert( callExpr );
    553         assert( callExpr->has_result() );
     490        assert( callExpr->result );
    554491        set_result( callExpr->get_result()->clone() );
    555492}
     
    569506}
    570507
    571 void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const {
    572         os <<  "Implicit Copy Constructor Expression: " << std::endl;
    573         assert( callExpr );
    574         os << std::string( indent+2, ' ' );
    575         callExpr->print( os, indent + 2 );
    576         os << std::endl << std::string( indent, ' ' ) << "with temporaries:" << std::endl;
    577         printAll(tempDecls, os, indent+2);
    578         os << std::endl << std::string( indent, ' ' ) << "with return temporaries:" << std::endl;
    579         printAll(returnDecls, os, indent+2);
     508void ImplicitCopyCtorExpr::print( std::ostream &os, Indenter indent ) const {
     509        os <<  "Implicit Copy Constructor Expression: " << std::endl << indent+1;
     510        callExpr->print( os, indent+1 );
     511        os << std::endl << indent << "... with temporaries:" << std::endl;
     512        printAll( tempDecls, os, indent+1 );
     513        os << std::endl << indent << "... with return temporaries:" << std::endl;
     514        printAll( returnDecls, os, indent+1 );
    580515        Expression::print( os, indent );
    581516}
     
    587522        Expression * arg = InitTweak::getCallArg( callExpr, 0 );
    588523        assert( arg );
    589         set_result( maybeClone( arg->get_result() ) );
     524        set_result( maybeClone( arg->result ) );
    590525}
    591526
     
    597532}
    598533
    599 void ConstructorExpr::print( std::ostream &os, int indent ) const {
    600         os <<  "Constructor Expression: " << std::endl;
    601         assert( callExpr );
    602         os << std::string( indent+2, ' ' );
     534void ConstructorExpr::print( std::ostream &os, Indenter indent ) const {
     535        os <<  "Constructor Expression: " << std::endl << indent+1;
    603536        callExpr->print( os, indent + 2 );
    604537        Expression::print( os, indent );
     
    618551}
    619552
    620 void CompoundLiteralExpr::print( std::ostream &os, int indent ) const {
    621         os << "Compound Literal Expression: " << std::endl;
    622         os << std::string( indent+2, ' ' );
    623         get_result()->print( os, indent + 2 );
    624         os << std::string( indent+2, ' ' );
    625         initializer->print( os, indent + 2 );
     553void CompoundLiteralExpr::print( std::ostream &os, Indenter indent ) const {
     554        os << "Compound Literal Expression: " << std::endl << indent+1;
     555        result->print( os, indent+1 );
     556        os << indent+1;
     557        initializer->print( os, indent+1 );
    626558        Expression::print( os, indent );
    627559}
     
    629561RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {}
    630562RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {}
    631 void RangeExpr::print( std::ostream &os, int indent ) const {
     563void RangeExpr::print( std::ostream &os, Indenter indent ) const {
    632564        os << "Range Expression: ";
    633565        low->print( os, indent );
     
    659591        deleteAll( returnDecls );
    660592}
    661 void StmtExpr::print( std::ostream &os, int indent ) const {
    662         os << "Statement Expression: " << std::endl << std::string( indent, ' ' );
    663         statements->print( os, indent+2 );
     593void StmtExpr::print( std::ostream &os, Indenter indent ) const {
     594        os << "Statement Expression: " << std::endl << indent+1;
     595        statements->print( os, indent+1 );
    664596        if ( ! returnDecls.empty() ) {
    665                 os << std::string( indent+2, ' ' ) << "with returnDecls: ";
    666                 printAll( returnDecls, os, indent+2 );
     597                os << indent+1 << "... with returnDecls: ";
     598                printAll( returnDecls, os, indent+1 );
    667599        }
    668600        if ( ! dtors.empty() ) {
    669                 os << std::string( indent+2, ' ' ) << "with dtors: ";
    670                 printAll( dtors, os, indent+2 );
     601                os << indent+1 << "... with dtors: ";
     602                printAll( dtors, os, indent+1 );
    671603        }
    672604        Expression::print( os, indent );
     
    690622        delete var;
    691623}
    692 void UniqueExpr::print( std::ostream &os, int indent ) const {
    693         os << "Unique Expression with id:" << id << std::endl << std::string( indent+2, ' ' );
    694         get_expr()->print( os, indent+2 );
    695         if ( get_object() ) {
    696                 os << std::string( indent+2, ' ' ) << "with decl: ";
    697                 get_object()->printShort( os, indent+2 );
     624void UniqueExpr::print( std::ostream &os, Indenter indent ) const {
     625        os << "Unique Expression with id:" << id << std::endl << indent+1;
     626        expr->print( os, indent+1 );
     627        if ( object ) {
     628                os << indent << "... with decl: ";
     629                get_object()->printShort( os, indent+1 );
    698630        }
    699631        Expression::print( os, indent );
     
    713645}
    714646
    715 void UntypedInitExpr::print( std::ostream & os, int indent ) const {
    716         os << "Untyped Init Expression" << std::endl << std::string( indent+2, ' ' );
    717         expr->print( os, indent+2 );
     647void UntypedInitExpr::print( std::ostream & os, Indenter indent ) const {
     648        os << "Untyped Init Expression" << std::endl << indent+1;
     649        expr->print( os, indent+1 );
    718650        if ( ! initAlts.empty() ) {
    719651                for ( const InitAlternative & alt : initAlts ) {
    720                         os << std::string( indent+2, ' ' ) <<  "InitAlternative: ";
    721                         alt.type->print( os, indent+2 );
    722                         alt.designation->print( os, indent+2 );
     652                        os << indent+1 <<  "InitAlternative: ";
     653                        alt.type->print( os, indent+1 );
     654                        alt.designation->print( os, indent+1 );
    723655                }
    724656        }
     
    734666}
    735667
    736 void InitExpr::print( std::ostream & os, int indent ) const {
    737         os << "Init Expression" << std::endl << std::string( indent+2, ' ' );
    738         expr->print( os, indent+2 );
    739         os << std::string( indent+2, ' ' ) << "with designation: ";
    740         designation->print( os, indent+2 );
    741 }
    742 
    743 
    744 std::ostream & operator<<( std::ostream & out, const Expression * expr ) {
    745         if ( expr ) {
    746                 expr->print( out );
    747         } else {
    748                 out << "nullptr";
    749         }
    750         return out;
     668void InitExpr::print( std::ostream & os, Indenter indent ) const {
     669        os << "Init Expression" << std::endl << indent+1;
     670        expr->print( os, indent+1 );
     671        os << indent+1 << "... with designation: ";
     672        designation->print( os, indent+1 );
    751673}
    752674
  • src/SynTree/Expression.h

    r78315272 r3f7e12cb  
    3131
    3232
    33 /// Expression is the root type for all expressions
    34 class Expression : public BaseSyntaxNode{
    35   public:
    36         Type * result;
    37         TypeSubstitution * env;
    38         Expression * argName; // if expression is used as an argument, it can be "designated" by this name
    39         bool extension = false;
    40 
    41         Expression( Expression * _aname = nullptr );
    42         Expression( const Expression & other );
    43         virtual ~Expression();
    44 
    45         Type *& get_result() { return result; }
    46         const Type * get_result() const { return result; }
    47         void set_result( Type * newValue ) { result = newValue; }
    48         bool has_result() const { return result != nullptr; }
    49 
    50         TypeSubstitution * get_env() const { return env; }
    51         void set_env( TypeSubstitution * newValue ) { env = newValue; }
    52         Expression * get_argName() const { return argName; }
    53         void set_argName( Expression * name ) { argName = name; }
    54         bool get_extension() const { return extension; }
    55         Expression * set_extension( bool exten ) { extension = exten; return this; }
    56 
    57         virtual Expression * clone() const = 0;
    58         virtual void accept( Visitor & v ) = 0;
    59         virtual Expression * acceptMutator( Mutator & m ) = 0;
    60         virtual void print( std::ostream & os, int indent = 0 ) const;
    61 };
    62 
    6333struct ParamEntry;
    6434
     
    7747        Type * actualType;
    7848        Type * formalType;
    79         Expression* expr;
     49        Expression * expr;
    8050        std::unique_ptr< InferredParams > inferParams;
     51};
     52
     53/// Expression is the root type for all expressions
     54class Expression : public BaseSyntaxNode {
     55  public:
     56        Type * result;
     57        TypeSubstitution * env;
     58        bool extension = false;
     59        InferredParams inferParams;
     60
     61        Expression();
     62        Expression( const Expression & other );
     63        virtual ~Expression();
     64
     65        Type *& get_result() { return result; }
     66        const Type * get_result() const { return result; }
     67        void set_result( Type * newValue ) { result = newValue; }
     68
     69        TypeSubstitution * get_env() const { return env; }
     70        void set_env( TypeSubstitution * newValue ) { env = newValue; }
     71        bool get_extension() const { return extension; }
     72        Expression * set_extension( bool exten ) { extension = exten; return this; }
     73
     74        InferredParams & get_inferParams() { return inferParams; }
     75
     76        virtual Expression * clone() const override = 0;
     77        virtual void accept( Visitor & v ) override = 0;
     78        virtual Expression * acceptMutator( Mutator & m ) override = 0;
     79        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    8180};
    8281
     
    8786        Expression * function;
    8887        std::list<Expression *> args;
    89         InferredParams inferParams;
    9088
    9189        ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() );
     
    9694        void set_function( Expression * newValue ) { function = newValue; }
    9795        std::list<Expression *>& get_args() { return args; }
    98         InferredParams & get_inferParams() { return inferParams; }
    9996
    10097        virtual ApplicationExpr * clone() const { return new ApplicationExpr( * this ); }
    10198        virtual void accept( Visitor & v ) { v.visit( this ); }
    10299        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    103         virtual void print( std::ostream & os, int indent = 0 ) const;
     100        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    104101};
    105102
     
    112109        std::list<Expression*> args;
    113110
    114         UntypedExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >(), Expression *_aname = nullptr );
     111        UntypedExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() );
    115112        UntypedExpr( const UntypedExpr & other );
    116113        virtual ~UntypedExpr();
     
    119116        void set_function( Expression * newValue ) { function = newValue; }
    120117
    121         void set_args( std::list<Expression *> & listArgs ) { args = listArgs; }
    122118        std::list<Expression*>::iterator begin_args() { return args.begin(); }
    123119        std::list<Expression*>::iterator end_args() { return args.end(); }
     
    130126        virtual void accept( Visitor & v ) { v.visit( this ); }
    131127        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    132         virtual void print( std::ostream & os, int indent = 0 ) const;
    133         virtual void printArgs(std::ostream & os, int indent = 0) const;
     128        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    134129};
    135130
     
    139134        std::string name;
    140135
    141         NameExpr( std::string name, Expression *_aname = nullptr );
     136        NameExpr( std::string name );
    142137        NameExpr( const NameExpr & other );
    143138        virtual ~NameExpr();
     
    149144        virtual void accept( Visitor & v ) { v.visit( this ); }
    150145        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    151         virtual void print( std::ostream & os, int indent = 0 ) const;
     146        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    152147};
    153148
     
    160155        Expression * arg;
    161156
    162         AddressExpr( Expression * arg, Expression *_aname = nullptr );
     157        AddressExpr( Expression * arg );
    163158        AddressExpr( const AddressExpr & other );
    164159        virtual ~AddressExpr();
     
    170165        virtual void accept( Visitor & v ) { v.visit( this ); }
    171166        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    172         virtual void print( std::ostream & os, int indent = 0 ) const;
     167        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    173168};
    174169
     
    186181        virtual void accept( Visitor & v ) { v.visit( this ); }
    187182        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    188         virtual void print( std::ostream & os, int indent = 0 ) const;
     183        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    189184};
    190185
     
    194189        Expression * arg;
    195190
    196         CastExpr( Expression * arg, Expression *_aname = nullptr );
    197         CastExpr( Expression * arg, Type * toType, Expression *_aname = nullptr );
     191        CastExpr( Expression * arg );
     192        CastExpr( Expression * arg, Type * toType );
    198193        CastExpr( const CastExpr & other );
    199194        virtual ~CastExpr();
     
    205200        virtual void accept( Visitor & v ) { v.visit( this ); }
    206201        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    207         virtual void print( std::ostream & os, int indent = 0 ) const;
     202        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    208203};
    209204
     
    223218        virtual void accept( Visitor & v ) { v.visit( this ); }
    224219        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    225         virtual void print( std::ostream & os, int indent = 0 ) const;
     220        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    226221};
    227222
     
    232227        Expression * aggregate;
    233228
    234         UntypedMemberExpr( Expression * member, Expression * aggregate, Expression *_aname = nullptr );
     229        UntypedMemberExpr( Expression * member, Expression * aggregate );
    235230        UntypedMemberExpr( const UntypedMemberExpr & other );
    236231        virtual ~UntypedMemberExpr();
     
    244239        virtual void accept( Visitor & v ) { v.visit( this ); }
    245240        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    246         virtual void print( std::ostream & os, int indent = 0 ) const;
     241        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    247242};
    248243
     
    254249        Expression * aggregate;
    255250
    256         MemberExpr( DeclarationWithType * member, Expression * aggregate, Expression *_aname = nullptr );
     251        MemberExpr( DeclarationWithType * member, Expression * aggregate );
    257252        MemberExpr( const MemberExpr & other );
    258253        virtual ~MemberExpr();
     
    266261        virtual void accept( Visitor & v ) { v.visit( this ); }
    267262        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    268         virtual void print( std::ostream & os, int indent = 0 ) const;
     263        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    269264};
    270265
     
    275270        DeclarationWithType * var;
    276271
    277         VariableExpr( DeclarationWithType * var, Expression *_aname = nullptr );
     272        VariableExpr( DeclarationWithType * var );
    278273        VariableExpr( const VariableExpr & other );
    279274        virtual ~VariableExpr();
     
    287282        virtual void accept( Visitor & v ) { v.visit( this ); }
    288283        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    289         virtual void print( std::ostream & os, int indent = 0 ) const;
     284        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    290285};
    291286
     
    295290        Constant constant;
    296291
    297         ConstantExpr( Constant constant, Expression *_aname = nullptr );
     292        ConstantExpr( Constant constant );
    298293        ConstantExpr( const ConstantExpr & other );
    299294        virtual ~ConstantExpr();
     
    305300        virtual void accept( Visitor & v ) { v.visit( this ); }
    306301        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    307         virtual void print( std::ostream & os, int indent = 0 ) const;
     302        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    308303};
    309304
     
    315310        bool isType;
    316311
    317         SizeofExpr( Expression * expr, Expression *_aname = nullptr );
     312        SizeofExpr( Expression * expr );
    318313        SizeofExpr( const SizeofExpr & other );
    319         SizeofExpr( Type * type, Expression *_aname = nullptr );
     314        SizeofExpr( Type * type );
    320315        virtual ~SizeofExpr();
    321316
     
    330325        virtual void accept( Visitor & v ) { v.visit( this ); }
    331326        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    332         virtual void print( std::ostream & os, int indent = 0 ) const;
     327        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    333328};
    334329
     
    340335        bool isType;
    341336
    342         AlignofExpr( Expression * expr, Expression *_aname = nullptr );
     337        AlignofExpr( Expression * expr );
    343338        AlignofExpr( const AlignofExpr & other );
    344         AlignofExpr( Type * type, Expression *_aname = nullptr );
     339        AlignofExpr( Type * type );
    345340        virtual ~AlignofExpr();
    346341
     
    355350        virtual void accept( Visitor & v ) { v.visit( this ); }
    356351        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    357         virtual void print( std::ostream & os, int indent = 0 ) const;
     352        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    358353};
    359354
     
    364359        std::string member;
    365360
    366         UntypedOffsetofExpr( Type * type, const std::string & member, Expression *_aname = nullptr );
     361        UntypedOffsetofExpr( Type * type, const std::string & member );
    367362        UntypedOffsetofExpr( const UntypedOffsetofExpr & other );
    368363        virtual ~UntypedOffsetofExpr();
     
    376371        virtual void accept( Visitor & v ) { v.visit( this ); }
    377372        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    378         virtual void print( std::ostream & os, int indent = 0 ) const;
     373        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    379374};
    380375
     
    385380        DeclarationWithType * member;
    386381
    387         OffsetofExpr( Type * type, DeclarationWithType * member, Expression *_aname = nullptr );
     382        OffsetofExpr( Type * type, DeclarationWithType * member );
    388383        OffsetofExpr( const OffsetofExpr & other );
    389384        virtual ~OffsetofExpr();
     
    397392        virtual void accept( Visitor & v ) { v.visit( this ); }
    398393        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    399         virtual void print( std::ostream & os, int indent = 0 ) const;
     394        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    400395};
    401396
     
    405400        StructInstType * type;
    406401
    407         OffsetPackExpr( StructInstType * type_, Expression * aname_ = 0 );
     402        OffsetPackExpr( StructInstType * type );
    408403        OffsetPackExpr( const OffsetPackExpr & other );
    409404        virtual ~OffsetPackExpr();
     
    415410        virtual void accept( Visitor & v ) { v.visit( this ); }
    416411        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    417         virtual void print( std::ostream & os, int indent = 0 ) const;
     412        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    418413};
    419414
     
    426421        bool isType;
    427422
    428         AttrExpr(Expression * attr, Expression * expr, Expression *_aname = nullptr );
     423        AttrExpr(Expression * attr, Expression * expr );
    429424        AttrExpr( const AttrExpr & other );
    430         AttrExpr( Expression * attr, Type * type, Expression *_aname = nullptr );
     425        AttrExpr( Expression * attr, Type * type );
    431426        virtual ~AttrExpr();
    432427
     
    443438        virtual void accept( Visitor & v ) { v.visit( this ); }
    444439        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    445         virtual void print( std::ostream & os, int indent = 0 ) const;
     440        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    446441};
    447442
     
    452447        Expression * arg2;
    453448
    454         LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true, Expression *_aname = nullptr );
     449        LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true );
    455450        LogicalExpr( const LogicalExpr & other );
    456451        virtual ~LogicalExpr();
     
    465460        virtual void accept( Visitor & v ) { v.visit( this ); }
    466461        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    467         virtual void print( std::ostream & os, int indent = 0 ) const;
     462        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    468463
    469464  private:
     
    478473        Expression * arg3;
    479474
    480         ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3, Expression *_aname = nullptr );
     475        ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3 );
    481476        ConditionalExpr( const ConditionalExpr & other );
    482477        virtual ~ConditionalExpr();
     
    492487        virtual void accept( Visitor & v ) { v.visit( this ); }
    493488        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    494         virtual void print( std::ostream & os, int indent = 0 ) const;
     489        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    495490};
    496491
     
    501496        Expression * arg2;
    502497
    503         CommaExpr( Expression * arg1, Expression * arg2, Expression *_aname = nullptr );
     498        CommaExpr( Expression * arg1, Expression * arg2 );
    504499        CommaExpr( const CommaExpr & other );
    505500        virtual ~CommaExpr();
     
    513508        virtual void accept( Visitor & v ) { v.visit( this ); }
    514509        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    515         virtual void print( std::ostream & os, int indent = 0 ) const;
     510        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    516511};
    517512
     
    531526        virtual void accept( Visitor & v ) { v.visit( this ); }
    532527        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    533         virtual void print( std::ostream & os, int indent = 0 ) const;
     528        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    534529};
    535530
     
    557552        virtual void accept( Visitor & v ) { v.visit( this ); }
    558553        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    559         virtual void print( std::ostream & os, int indent = 0 ) const;
     554        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    560555
    561556        // https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Machine-Constraints.html#Machine-Constraints
     
    585580        virtual void accept( Visitor & v ) { v.visit( this ); }
    586581        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    587         virtual void print( std::ostream & os, int indent = 0 ) const;
     582        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    588583};
    589584
     
    603598        virtual void accept( Visitor & v ) { v.visit( this ); }
    604599        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    605         virtual void print( std::ostream & os, int indent = 0 ) const;
     600        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    606601};
    607602
     
    621616        virtual void accept( Visitor & v ) { v.visit( this ); }
    622617        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    623         virtual void print( std::ostream & os, int indent = 0 ) const;
     618        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    624619};
    625620
     
    640635        virtual void accept( Visitor & v ) { v.visit( this ); }
    641636        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    642         virtual void print( std::ostream & os, int indent = 0 ) const;
     637        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    643638};
    644639
     
    648643        std::list<Expression*> exprs;
    649644
    650         UntypedTupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr );
     645        UntypedTupleExpr( const std::list< Expression * > & exprs );
    651646        UntypedTupleExpr( const UntypedTupleExpr & other );
    652647        virtual ~UntypedTupleExpr();
     
    657652        virtual void accept( Visitor & v ) { v.visit( this ); }
    658653        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    659         virtual void print( std::ostream & os, int indent = 0 ) const;
     654        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    660655};
    661656
     
    665660        std::list<Expression*> exprs;
    666661
    667         TupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr );
     662        TupleExpr( const std::list< Expression * > & exprs );
    668663        TupleExpr( const TupleExpr & other );
    669664        virtual ~TupleExpr();
     
    674669        virtual void accept( Visitor & v ) { v.visit( this ); }
    675670        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    676         virtual void print( std::ostream & os, int indent = 0 ) const;
     671        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    677672};
    678673
     
    695690        virtual void accept( Visitor & v ) { v.visit( this ); }
    696691        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    697         virtual void print( std::ostream & os, int indent = 0 ) const;
     692        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    698693};
    699694
     
    703698        StmtExpr * stmtExpr = nullptr;
    704699
    705         TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname = nullptr );
     700        TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls );
    706701        TupleAssignExpr( const TupleAssignExpr & other );
    707702        virtual ~TupleAssignExpr();
     
    713708        virtual void accept( Visitor & v ) { v.visit( this ); }
    714709        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    715         virtual void print( std::ostream & os, int indent = 0 ) const;
     710        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    716711};
    717712
     
    736731        virtual void accept( Visitor & v ) { v.visit( this ); }
    737732        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    738         virtual void print( std::ostream & os, int indent = 0 ) const;
     733        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    739734};
    740735
     
    763758        virtual void accept( Visitor & v ) { v.visit( this ); }
    764759        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    765         virtual void print( std::ostream & os, int indent = 0 ) const;
     760        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    766761
    767762private:
     
    797792        virtual void accept( Visitor & v ) { v.visit( this ); }
    798793        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    799         virtual void print( std::ostream & os, int indent = 0 ) const;
     794        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    800795};
    801796
     
    818813        virtual void accept( Visitor & v ) { v.visit( this ); }
    819814        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    820         virtual void print( std::ostream & os, int indent = 0 ) const;
    821 };
    822 
    823 
    824 std::ostream & operator<<( std::ostream & out, const Expression * expr );
     815        virtual void print( std::ostream & os, Indenter indent = {} ) const;
     816};
    825817
    826818// Local Variables: //
  • src/SynTree/FunctionDecl.cc

    r78315272 r3f7e12cb  
    2626#include "Statement.h"           // for CompoundStmt
    2727#include "Type.h"                // for Type, FunctionType, Type::FuncSpecif...
     28#include "VarExprReplacer.h"
    2829
    2930extern bool translation_unit_nomain;
     
    3940FunctionDecl::FunctionDecl( const FunctionDecl &other )
    4041                : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
     42
     43        VarExprReplacer::DeclMap declMap;
     44        for ( auto p : group_iterate( other.type->parameters, type->parameters ) ) {
     45                declMap[ std::get<0>(p) ] = std::get<1>(p);
     46        }
     47        for ( auto p : group_iterate( other.type->returnVals, type->returnVals ) ) {
     48                declMap[ std::get<0>(p) ] = std::get<1>(p);
     49        }
     50        if ( ! declMap.empty() ) {
     51                VarExprReplacer replacer( declMap );
     52                accept( replacer );
     53        }
    4154}
    4255
     
    4659}
    4760
    48 void FunctionDecl::print( std::ostream &os, int indent ) const {
     61FunctionDecl * FunctionDecl::newFunction( const std::string & name, FunctionType * type, CompoundStmt * statements ) {
     62        return new FunctionDecl( name, Type::StorageClasses(), LinkageSpec::C, type, statements );
     63}
     64
     65void FunctionDecl::print( std::ostream &os, Indenter indent ) const {
    4966        using std::endl;
    5067        using std::string;
    5168
    52         if ( get_name() != "" ) {
    53                 os << get_name() << ": ";
     69        if ( name != "" ) {
     70                os << name << ": ";
    5471        } // if
    55         if ( get_linkage() != LinkageSpec::Cforall ) {
    56                 os << LinkageSpec::linkageName( get_linkage() ) << " ";
     72        if ( linkage != LinkageSpec::Cforall ) {
     73                os << LinkageSpec::linkageName( linkage ) << " ";
    5774        } // if
    5875
    59         printAll( get_attributes(), os, indent );
     76        printAll( attributes, os, indent );
    6077
    6178        get_storageClasses().print( os );
    6279        get_funcSpec().print( os );
    6380
    64         if ( get_type() ) {
    65                 get_type()->print( os, indent );
     81        if ( type ) {
     82                type->print( os, indent );
    6683        } else {
    6784                os << "untyped entity ";
     
    6986
    7087        if ( statements ) {
    71                 os << string( indent + 2, ' ' ) << "with body " << endl;
    72                 os << string( indent + 4, ' ' );
    73                 statements->print( os, indent + 4 );
     88                os << indent << "... with body " << endl << indent+1;
     89                statements->print( os, indent+1 );
    7490        } // if
    7591}
    7692
    77 void FunctionDecl::printShort( std::ostream &os, int indent ) const {
     93void FunctionDecl::printShort( std::ostream &os, Indenter indent ) const {
    7894        using std::endl;
    7995        using std::string;
    8096
    81         if ( get_name() != "" ) {
    82                 os << get_name() << ": ";
     97        if ( name != "" ) {
     98                os << name << ": ";
    8399        } // if
    84 
    85         // xxx - should printShort print attributes?
    86100
    87101        get_storageClasses().print( os );
    88102        get_funcSpec().print( os );
    89103
    90         if ( get_type() ) {
    91                 get_type()->print( os, indent );
     104        if ( type ) {
     105                type->print( os, indent );
    92106        } else {
    93107                os << "untyped entity ";
  • src/SynTree/FunctionType.cc

    r78315272 r3f7e12cb  
    5151}
    5252
    53 void FunctionType::print( std::ostream &os, int indent ) const {
     53void FunctionType::print( std::ostream &os, Indenter indent ) const {
    5454        using std::string;
    5555        using std::endl;
     
    5858        os << "function" << endl;
    5959        if ( ! parameters.empty() ) {
    60                 os << string( indent + 2, ' ' ) << "with parameters" << endl;
    61                 printAll( parameters, os, indent + 4 );
     60                os << indent << "... with parameters" << endl;
     61                printAll( parameters, os, indent+1 );
    6262                if ( isVarArgs ) {
    63                         os << string( indent + 4, ' ' ) << "and a variable number of other arguments" << endl;
     63                        os << indent+1 << "and a variable number of other arguments" << endl;
    6464                } // if
    6565        } else if ( isVarArgs ) {
    66                 os << string( indent + 4, ' ' ) << "accepting unspecified arguments" << endl;
     66                os << indent+1 << "accepting unspecified arguments" << endl;
    6767        } // if
    68         os << string( indent + 2, ' ' ) << "returning ";
     68        os << indent << "... returning ";
    6969        if ( returnVals.empty() ) {
    70                 os << endl << string( indent + 4, ' ' ) << "nothing " << endl;
     70                os << "nothing " << endl;
    7171        } else {
    7272                os << endl;
    73                 printAll( returnVals, os, indent + 4 );
     73                printAll( returnVals, os, indent+1 );
    7474        } // if
    7575}
  • src/SynTree/Initializer.cc

    r78315272 r3f7e12cb  
    3838}
    3939
    40 void Designation::print( std::ostream &os, int indent ) const {
     40void Designation::print( std::ostream &os, Indenter indent ) const {
    4141        if ( ! designators.empty() ) {
    42                 os << std::string(indent + 2, ' ' ) << "designated by: " << std::endl;
    43                 for ( std::list < Expression * >::const_iterator i = designators.begin(); i != designators.end(); i++ ) {
    44                         os << std::string(indent + 4, ' ' );
    45                         ( *i )->print(os, indent + 4 );
     42                os << "... designated by: " << std::endl;
     43                for ( const Expression * d : designators ) {
     44                        os << indent+1;
     45                        d->print(os, indent+1 );
     46                        os << std::endl;
    4647                }
    47                 os << std::endl;
    4848        } // if
    4949}
     
    6464}
    6565
    66 void SingleInit::print( std::ostream &os, int indent ) const {
    67         os << std::string(indent, ' ' ) << "Simple Initializer: " << std::endl;
    68         os << std::string(indent+4, ' ' );
    69         value->print( os, indent+4 );
     66void SingleInit::print( std::ostream &os, Indenter indent ) const {
     67        os << "Simple Initializer: ";
     68        value->print( os, indent );
    7069}
    7170
     
    9392}
    9493
    95 void ListInit::print( std::ostream &os, int indent ) const {
    96         os << std::string(indent, ' ') << "Compound initializer:  " << std::endl;
    97         for ( Designation * d : designations ) {
    98                 d->print( os, indent + 2 );
    99         }
    100 
    101         for ( const Initializer * init : initializers ) {
    102                 init->print( os, indent + 2 );
     94void ListInit::print( std::ostream &os, Indenter indent ) const {
     95        os << "Compound initializer: " << std::endl;
     96        for ( auto p : group_iterate( designations, initializers ) ) {
     97                const Designation * d = std::get<0>(p);
     98                const Initializer * init = std::get<1>(p);
     99                os << indent+1;
     100                init->print( os, indent+1 );
    103101                os << std::endl;
     102                if ( ! d->designators.empty() ) {
     103                        os << indent+1;
     104                        d->print( os, indent+1 );
     105                }
    104106        }
    105107}
     
    116118}
    117119
    118 void ConstructorInit::print( std::ostream &os, int indent ) const {
    119         os << std::endl << std::string(indent, ' ') << "Constructor initializer: " << std::endl;
     120void ConstructorInit::print( std::ostream &os, Indenter indent ) const {
     121        os << "Constructor initializer: " << std::endl;
    120122        if ( ctor ) {
    121                 os << std::string(indent+2, ' ');
    122                 os << "initially constructed with ";
    123                 ctor->print( os, indent+4 );
     123                os << indent << "... initially constructed with ";
     124                ctor->print( os, indent+1 );
    124125        } // if
    125126
    126127        if ( dtor ) {
    127                 os << std::string(indent+2, ' ');
    128                 os << "destructed with ";
    129                 dtor->print( os, indent+4 );
     128                os << indent << "... destructed with ";
     129                dtor->print( os, indent+1 );
    130130        }
    131131
    132132        if ( init ) {
    133                 os << std::string(indent+2, ' ');
    134                 os << "with fallback C-style initializer: ";
    135                 init->print( os, indent+4 );
     133                os << indent << "... with fallback C-style initializer: ";
     134                init->print( os, indent+1 );
    136135        }
    137 }
    138 
    139 std::ostream & operator<<( std::ostream & out, const Initializer * init ) {
    140         if ( init ) {
    141                 init->print( out );
    142         } else {
    143                 out << "nullptr";
    144         }
    145         return out;
    146 }
    147 
    148 std::ostream & operator<<( std::ostream & out, const Designation * des ) {
    149         if ( des ) {
    150                 des->print( out );
    151         } else {
    152                 out << "nullptr";
    153         }
    154         return out;
    155136}
    156137
  • src/SynTree/Initializer.h

    r78315272 r3f7e12cb  
    3737        std::list< Expression * > & get_designators() { return designators; }
    3838
    39         virtual Designation * clone() const { return new Designation( *this ); };
    40         virtual void accept( Visitor &v ) { v.visit( this ); }
    41         virtual Designation * acceptMutator( Mutator &m ) { return m.mutate( this ); }
    42         virtual void print( std::ostream &os, int indent = 0 ) const;
     39        virtual Designation * clone() const override { return new Designation( *this ); };
     40        virtual void accept( Visitor &v ) override { v.visit( this ); }
     41        virtual Designation * acceptMutator( Mutator &m ) override { return m.mutate( this ); }
     42        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    4343};
    4444
     
    5454        bool get_maybeConstructed() { return maybeConstructed; }
    5555
    56         virtual Initializer *clone() const = 0;
    57         virtual void accept( Visitor &v ) = 0;
    58         virtual Initializer *acceptMutator( Mutator &m ) = 0;
    59         virtual void print( std::ostream &os, int indent = 0 ) const = 0;
     56        virtual Initializer *clone() const override = 0;
     57        virtual void accept( Visitor &v ) override = 0;
     58        virtual Initializer *acceptMutator( Mutator &m ) override = 0;
     59        virtual void print( std::ostream &os, Indenter indent = {} ) const override = 0;
    6060  private:
    6161        bool maybeConstructed;
     
    7575        void set_value( Expression *newValue ) { value = newValue; }
    7676
    77         virtual SingleInit *clone() const { return new SingleInit( *this); }
    78         virtual void accept( Visitor &v ) { v.visit( this ); }
    79         virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    80         virtual void print( std::ostream &os, int indent = 0 ) const;
     77        virtual SingleInit *clone() const override { return new SingleInit( *this); }
     78        virtual void accept( Visitor &v ) override { v.visit( this ); }
     79        virtual Initializer *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     80        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    8181};
    8282
     
    103103        const_iterator end() const { return initializers.end(); }
    104104
    105         virtual ListInit *clone() const { return new ListInit( *this ); }
    106         virtual void accept( Visitor &v ) { v.visit( this ); }
    107         virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    108         virtual void print( std::ostream &os, int indent = 0 ) const;
     105        virtual ListInit *clone() const override { return new ListInit( *this ); }
     106        virtual void accept( Visitor &v ) override { v.visit( this ); }
     107        virtual Initializer *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     108        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    109109};
    110110
     
    117117        Statement * ctor;
    118118        Statement * dtor;
     119        // C-style initializer made up of SingleInit and ListInit nodes to use as a fallback
     120        // if an appropriate constructor definition is not found by the resolver
     121        Initializer * init;
    119122
    120123        ConstructorInit( Statement * ctor, Statement * dtor, Initializer * init );
     
    129132        Initializer * get_init() const { return init; }
    130133
    131         ConstructorInit *clone() const { return new ConstructorInit( *this ); }
    132         virtual void accept( Visitor &v ) { v.visit( this ); }
    133         virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    134         virtual void print( std::ostream &os, int indent = 0 ) const;
     134        ConstructorInit *clone() const override { return new ConstructorInit( *this ); }
     135        virtual void accept( Visitor &v ) override { v.visit( this ); }
     136        virtual Initializer *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     137        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    135138
    136139  private:
    137         // C-style initializer made up of SingleInit and ListInit nodes to use as a fallback
    138         // if an appropriate constructor definition is not found by the resolver
    139         Initializer * init;
    140140};
    141 
    142 std::ostream & operator<<( std::ostream & out, const Initializer * init );
    143 std::ostream & operator<<( std::ostream & out, const Designation * des );
    144141
    145142// Local Variables: //
  • src/SynTree/Mutator.cc

    r78315272 r3f7e12cb  
    1717#include <list>                // for list
    1818
     19#include "Attribute.h"         // for Attribute
    1920#include "Declaration.h"       // for ObjectDecl, Declaration, DeclarationWi...
    2021#include "Expression.h"        // for Expression, ConstantExpr, ConditionalExpr
     
    3637        objectDecl->set_init( maybeMutate( objectDecl->get_init(), *this ) );
    3738        objectDecl->set_bitfieldWidth( maybeMutate( objectDecl->get_bitfieldWidth(), *this ) );
     39        mutateAll( objectDecl->attributes, *this );
    3840        return objectDecl;
    3941}
     
    4244        functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) );
    4345        functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
     46        mutateAll( functionDecl->attributes, *this );
    4447        return functionDecl;
    4548}
     
    618621}
    619622
     623Attribute * Mutator::mutate( Attribute * attribute ) {
     624        mutateAll( attribute->parameters, *this );
     625        return attribute;
     626}
     627
     628TypeSubstitution * Mutator::mutate( TypeSubstitution * sub ) {
     629        for ( auto & p : sub->typeEnv ) {
     630                p.second = maybeMutate( p.second, *this );
     631        }
     632        for ( auto & p : sub->varEnv ) {
     633                p.second = maybeMutate( p.second, *this );
     634        }
     635        return sub;
     636}
     637
    620638// Local Variables: //
    621639// tab-width: 4 //
  • src/SynTree/Mutator.h

    r78315272 r3f7e12cb  
    2525        virtual ~Mutator();
    2626  public:
    27         virtual DeclarationWithType* mutate( ObjectDecl *objectDecl );
    28         virtual DeclarationWithType* mutate( FunctionDecl *functionDecl );
    29         virtual Declaration* mutate( StructDecl *aggregateDecl );
    30         virtual Declaration* mutate( UnionDecl *aggregateDecl );
    31         virtual Declaration* mutate( EnumDecl *aggregateDecl );
    32         virtual Declaration* mutate( TraitDecl *aggregateDecl );
    33         virtual Declaration* mutate( TypeDecl *typeDecl );
    34         virtual Declaration* mutate( TypedefDecl *typeDecl );
    35         virtual AsmDecl* mutate( AsmDecl *asmDecl );
     27        virtual DeclarationWithType * mutate( ObjectDecl * objectDecl );
     28        virtual DeclarationWithType * mutate( FunctionDecl * functionDecl );
     29        virtual Declaration * mutate( StructDecl * aggregateDecl );
     30        virtual Declaration * mutate( UnionDecl * aggregateDecl );
     31        virtual Declaration * mutate( EnumDecl * aggregateDecl );
     32        virtual Declaration * mutate( TraitDecl * aggregateDecl );
     33        virtual Declaration * mutate( TypeDecl * typeDecl );
     34        virtual Declaration * mutate( TypedefDecl * typeDecl );
     35        virtual AsmDecl * mutate( AsmDecl * asmDecl );
    3636
    37         virtual CompoundStmt* mutate( CompoundStmt *compoundStmt );
    38         virtual Statement* mutate( ExprStmt *exprStmt );
    39         virtual Statement* mutate( AsmStmt *asmStmt );
    40         virtual Statement* mutate( IfStmt *ifStmt );
    41         virtual Statement* mutate( WhileStmt *whileStmt );
    42         virtual Statement* mutate( ForStmt *forStmt );
    43         virtual Statement* mutate( SwitchStmt *switchStmt );
    44         virtual Statement* mutate( CaseStmt *caseStmt );
    45         virtual Statement* mutate( BranchStmt *branchStmt );
    46         virtual Statement* mutate( ReturnStmt *returnStmt );
    47         virtual Statement* mutate( ThrowStmt *throwStmt );
    48         virtual Statement* mutate( TryStmt *tryStmt );
    49         virtual Statement* mutate( CatchStmt *catchStmt );
    50         virtual Statement* mutate( FinallyStmt *catchStmt );
    51         virtual Statement* mutate( WaitForStmt *waitforStmt );
    52         virtual NullStmt* mutate( NullStmt *nullStmt );
    53         virtual Statement* mutate( DeclStmt *declStmt );
    54         virtual Statement* mutate( ImplicitCtorDtorStmt *impCtorDtorStmt );
     37        virtual CompoundStmt * mutate( CompoundStmt * compoundStmt );
     38        virtual Statement * mutate( ExprStmt * exprStmt );
     39        virtual Statement * mutate( AsmStmt * asmStmt );
     40        virtual Statement * mutate( IfStmt * ifStmt );
     41        virtual Statement * mutate( WhileStmt * whileStmt );
     42        virtual Statement * mutate( ForStmt * forStmt );
     43        virtual Statement * mutate( SwitchStmt * switchStmt );
     44        virtual Statement * mutate( CaseStmt * caseStmt );
     45        virtual Statement * mutate( BranchStmt * branchStmt );
     46        virtual Statement * mutate( ReturnStmt * returnStmt );
     47        virtual Statement * mutate( ThrowStmt * throwStmt );
     48        virtual Statement * mutate( TryStmt * tryStmt );
     49        virtual Statement * mutate( CatchStmt * catchStmt );
     50        virtual Statement * mutate( FinallyStmt * catchStmt );
     51        virtual Statement * mutate( WaitForStmt * waitforStmt );
     52        virtual NullStmt * mutate( NullStmt * nullStmt );
     53        virtual Statement * mutate( DeclStmt * declStmt );
     54        virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt );
    5555
    56         virtual Expression* mutate( ApplicationExpr *applicationExpr );
    57         virtual Expression* mutate( UntypedExpr *untypedExpr );
    58         virtual Expression* mutate( NameExpr *nameExpr );
    59         virtual Expression* mutate( AddressExpr *castExpr );
    60         virtual Expression* mutate( LabelAddressExpr *labAddressExpr );
    61         virtual Expression* mutate( CastExpr *castExpr );
    62         virtual Expression* mutate( VirtualCastExpr *castExpr );
    63         virtual Expression* mutate( UntypedMemberExpr *memberExpr );
    64         virtual Expression* mutate( MemberExpr *memberExpr );
    65         virtual Expression* mutate( VariableExpr *variableExpr );
    66         virtual Expression* mutate( ConstantExpr *constantExpr );
    67         virtual Expression* mutate( SizeofExpr *sizeofExpr );
    68         virtual Expression* mutate( AlignofExpr *alignofExpr );
    69         virtual Expression* mutate( UntypedOffsetofExpr *offsetofExpr );
    70         virtual Expression* mutate( OffsetofExpr *offsetofExpr );
    71         virtual Expression* mutate( OffsetPackExpr *offsetPackExpr );
    72         virtual Expression* mutate( AttrExpr *attrExpr );
    73         virtual Expression* mutate( LogicalExpr *logicalExpr );
    74         virtual Expression* mutate( ConditionalExpr *conditionalExpr );
    75         virtual Expression* mutate( CommaExpr *commaExpr );
    76         virtual Expression* mutate( TypeExpr *typeExpr );
    77         virtual Expression* mutate( AsmExpr *asmExpr );
    78         virtual Expression* mutate( ImplicitCopyCtorExpr *impCpCtorExpr );
    79         virtual Expression* mutate( ConstructorExpr *ctorExpr );
    80         virtual Expression* mutate( CompoundLiteralExpr *compLitExpr );
    81         virtual Expression* mutate( RangeExpr *rangeExpr );
    82         virtual Expression* mutate( UntypedTupleExpr *tupleExpr );
    83         virtual Expression* mutate( TupleExpr *tupleExpr );
    84         virtual Expression* mutate( TupleIndexExpr *tupleExpr );
    85         virtual Expression* mutate( TupleAssignExpr *assignExpr );
    86         virtual Expression* mutate( StmtExpr * stmtExpr );
    87         virtual Expression* mutate( UniqueExpr * uniqueExpr );
    88         virtual Expression* mutate( UntypedInitExpr * initExpr );
    89         virtual Expression* mutate( InitExpr * initExpr );
     56        virtual Expression* mutate( ApplicationExpr * applicationExpr );
     57        virtual Expression* mutate( UntypedExpr * untypedExpr );
     58        virtual Expression* mutate( NameExpr * nameExpr );
     59        virtual Expression* mutate( AddressExpr * castExpr );
     60        virtual Expression* mutate( LabelAddressExpr * labAddressExpr );
     61        virtual Expression* mutate( CastExpr * castExpr );
     62        virtual Expression* mutate( VirtualCastExpr * castExpr );
     63        virtual Expression* mutate( UntypedMemberExpr * memberExpr );
     64        virtual Expression* mutate( MemberExpr * memberExpr );
     65        virtual Expression* mutate( VariableExpr * variableExpr );
     66        virtual Expression* mutate( ConstantExpr * constantExpr );
     67        virtual Expression* mutate( SizeofExpr * sizeofExpr );
     68        virtual Expression* mutate( AlignofExpr * alignofExpr );
     69        virtual Expression* mutate( UntypedOffsetofExpr * offsetofExpr );
     70        virtual Expression* mutate( OffsetofExpr * offsetofExpr );
     71        virtual Expression* mutate( OffsetPackExpr * offsetPackExpr );
     72        virtual Expression* mutate( AttrExpr * attrExpr );
     73        virtual Expression* mutate( LogicalExpr * logicalExpr );
     74        virtual Expression* mutate( ConditionalExpr * conditionalExpr );
     75        virtual Expression* mutate( CommaExpr * commaExpr );
     76        virtual Expression* mutate( TypeExpr * typeExpr );
     77        virtual Expression* mutate( AsmExpr * asmExpr );
     78        virtual Expression* mutate( ImplicitCopyCtorExpr * impCpCtorExpr );
     79        virtual Expression* mutate( ConstructorExpr * ctorExpr );
     80        virtual Expression* mutate( CompoundLiteralExpr * compLitExpr );
     81        virtual Expression* mutate( RangeExpr * rangeExpr );
     82        virtual Expression* mutate( UntypedTupleExpr * tupleExpr );
     83        virtual Expression* mutate( TupleExpr * tupleExpr );
     84        virtual Expression* mutate( TupleIndexExpr * tupleExpr );
     85        virtual Expression* mutate( TupleAssignExpr * assignExpr );
     86        virtual Expression* mutate( StmtExpr  * stmtExpr );
     87        virtual Expression* mutate( UniqueExpr  * uniqueExpr );
     88        virtual Expression* mutate( UntypedInitExpr  * initExpr );
     89        virtual Expression* mutate( InitExpr  * initExpr );
    9090
    91         virtual Type* mutate( VoidType *basicType );
    92         virtual Type* mutate( BasicType *basicType );
    93         virtual Type* mutate( PointerType *pointerType );
    94         virtual Type* mutate( ArrayType *arrayType );
    95         virtual Type* mutate( ReferenceType *refType );
    96         virtual Type* mutate( FunctionType *functionType );
    97         virtual Type* mutate( StructInstType *aggregateUseType );
    98         virtual Type* mutate( UnionInstType *aggregateUseType );
    99         virtual Type* mutate( EnumInstType *aggregateUseType );
    100         virtual Type* mutate( TraitInstType *aggregateUseType );
    101         virtual Type* mutate( TypeInstType *aggregateUseType );
    102         virtual Type* mutate( TupleType *tupleType );
    103         virtual Type* mutate( TypeofType *typeofType );
    104         virtual Type* mutate( AttrType *attrType );
    105         virtual Type* mutate( VarArgsType *varArgsType );
    106         virtual Type* mutate( ZeroType *zeroType );
    107         virtual Type* mutate( OneType *oneType );
     91        virtual Type * mutate( VoidType * basicType );
     92        virtual Type * mutate( BasicType * basicType );
     93        virtual Type * mutate( PointerType * pointerType );
     94        virtual Type * mutate( ArrayType * arrayType );
     95        virtual Type * mutate( ReferenceType * refType );
     96        virtual Type * mutate( FunctionType * functionType );
     97        virtual Type * mutate( StructInstType * aggregateUseType );
     98        virtual Type * mutate( UnionInstType * aggregateUseType );
     99        virtual Type * mutate( EnumInstType * aggregateUseType );
     100        virtual Type * mutate( TraitInstType * aggregateUseType );
     101        virtual Type * mutate( TypeInstType * aggregateUseType );
     102        virtual Type * mutate( TupleType * tupleType );
     103        virtual Type * mutate( TypeofType * typeofType );
     104        virtual Type * mutate( AttrType * attrType );
     105        virtual Type * mutate( VarArgsType * varArgsType );
     106        virtual Type * mutate( ZeroType * zeroType );
     107        virtual Type * mutate( OneType * oneType );
    108108
    109         virtual Designation* mutate( Designation *designation );
    110         virtual Initializer* mutate( SingleInit *singleInit );
    111         virtual Initializer* mutate( ListInit *listInit );
    112         virtual Initializer* mutate( ConstructorInit *ctorInit );
     109        virtual Designation * mutate( Designation * designation );
     110        virtual Initializer * mutate( SingleInit * singleInit );
     111        virtual Initializer * mutate( ListInit * listInit );
     112        virtual Initializer * mutate( ConstructorInit * ctorInit );
    113113
    114         virtual Subrange *mutate( Subrange *subrange );
     114        virtual Subrange * mutate( Subrange * subrange );
    115115
    116         virtual Constant *mutate( Constant *constant );
     116        virtual Constant * mutate( Constant * constant );
     117
     118        virtual Attribute * mutate( Attribute * attribute );
     119
     120        virtual TypeSubstitution * mutate( TypeSubstitution * sub );
    117121  private:
    118         virtual Declaration* handleAggregateDecl(AggregateDecl *aggregateDecl );
    119         virtual Declaration* handleNamedTypeDecl(NamedTypeDecl *typeDecl );
    120         virtual Type* handleReferenceToType(ReferenceToType *aggregateUseType );
     122        virtual Declaration * handleAggregateDecl(AggregateDecl * aggregateDecl );
     123        virtual Declaration * handleNamedTypeDecl(NamedTypeDecl * typeDecl );
     124        virtual Type * handleReferenceToType(ReferenceToType * aggregateUseType );
    121125};
    122126
  • src/SynTree/NamedTypeDecl.cc

    r78315272 r3f7e12cb  
    3838}
    3939
    40 void NamedTypeDecl::print( std::ostream &os, int indent ) const {
     40void NamedTypeDecl::print( std::ostream &os, Indenter indent ) const {
    4141        using namespace std;
    4242
    43         if ( get_name() != "" ) {
    44                 os << get_name() << ": ";
    45         } // if
    46         if ( get_linkage() != LinkageSpec::Cforall ) {
    47                 os << LinkageSpec::linkageName( get_linkage() ) << " ";
     43        if ( name != "" ) os << name << ": ";
     44
     45        if ( linkage != LinkageSpec::Cforall ) {
     46                os << LinkageSpec::linkageName( linkage ) << " ";
    4847        } // if
    4948        get_storageClasses().print( os );
     
    5150        if ( base ) {
    5251                os << " for ";
    53                 base->print( os, indent );
     52                base->print( os, indent+1 );
    5453        } // if
    5554        if ( ! parameters.empty() ) {
    56                 os << endl << string( indent, ' ' ) << "with parameters" << endl;
    57                 printAll( parameters, os, indent+2 );
     55                os << endl << indent << "... with parameters" << endl;
     56                printAll( parameters, os, indent+1 );
    5857        } // if
    5958        if ( ! assertions.empty() ) {
    60                 os << endl << string( indent, ' ' ) << "with assertions" << endl;
    61                 printAll( assertions, os, indent+2 );
     59                os << endl << indent << "... with assertions" << endl;
     60                printAll( assertions, os, indent+1 );
    6261        } // if
    6362}
    6463
    65 void NamedTypeDecl::printShort( std::ostream &os, int indent ) const {
     64void NamedTypeDecl::printShort( std::ostream &os, Indenter indent ) const {
    6665        using namespace std;
    6766
    68         if ( get_name() != "" ) {
    69                 os << get_name() << ": ";
    70         } // if
     67        if ( name != "" ) os << name << ": ";
    7168        get_storageClasses().print( os );
    7269        os << typeString();
    7370        if ( base ) {
    7471                os << " for ";
    75                 base->print( os, indent );
     72                base->print( os, indent+1 );
    7673        } // if
    7774        if ( ! parameters.empty() ) {
    78                 os << endl << string( indent, ' ' ) << "with parameters" << endl;
    79                 printAll( parameters, os, indent+2 );
     75                os << endl << indent << "... with parameters" << endl;
     76                printAll( parameters, os, indent+1 );
    8077        } // if
    8178}
  • src/SynTree/ObjectDecl.cc

    r78315272 r3f7e12cb  
    4444}
    4545
    46 void ObjectDecl::print( std::ostream &os, int indent ) const {
    47         if ( get_name() != "" ) {
    48                 os << get_name() << ": ";
     46void ObjectDecl::print( std::ostream &os, Indenter indent ) const {
     47        if ( name != "" ) os << name << ": ";
     48
     49        if ( linkage != LinkageSpec::Cforall ) {
     50                os << LinkageSpec::linkageName( linkage ) << " ";
    4951        } // if
    50 
    51         if ( get_linkage() != LinkageSpec::Cforall ) {
    52                 os << LinkageSpec::linkageName( get_linkage() ) << " ";
    53         } // if
    54 
    55         printAll( get_attributes(), os, indent );
    5652
    5753        get_storageClasses().print( os );
    5854
    59         if ( get_type() ) {
    60                 get_type()->print( os, indent );
     55        if ( type ) {
     56                type->print( os, indent );
    6157        } else {
    6258                os << " untyped entity ";
     
    6460
    6561        if ( init ) {
    66                 os << " with initializer " << std::endl;
    67                 init->print( os, indent+2 );
    68                 os << std::endl << std::string(indent+2, ' ');
    69                 os << "maybeConstructed? " << init->get_maybeConstructed();
     62                os << " with initializer (" << (init->get_maybeConstructed() ? "maybe constructed" : "not constructed") << ")" << std::endl << indent+1;
     63                init->print( os, indent+1 );
     64                os << std::endl;
    7065        } // if
    7166
     67        if ( ! attributes.empty() ) {
     68                os << std::endl << indent << "... with attributes: " << std::endl;
     69                printAll( attributes, os, indent+1 );
     70        }
     71
    7272        if ( bitfieldWidth ) {
    73                 os << std::string(indent, ' ');
    74                 os << " with bitfield width ";
     73                os << indent << " with bitfield width ";
    7574                bitfieldWidth->print( os );
    7675        } // if
    7776}
    7877
    79 void ObjectDecl::printShort( std::ostream &os, int indent ) const {
     78void ObjectDecl::printShort( std::ostream &os, Indenter indent ) const {
    8079#if 0
    8180        if ( get_mangleName() != "") {
     
    8382        } else
    8483#endif
    85         if ( get_name() != "" ) {
    86                 os << get_name() << ": ";
    87         } // if
    88 
    89         // xxx - should printShort print attributes?
     84        if ( name != "" ) os << name << ": ";
    9085
    9186        get_storageClasses().print( os );
    9287
    93         if ( get_type() ) {
    94                 get_type()->print( os, indent );
     88        if ( type ) {
     89                type->print( os, indent );
    9590        } else {
    9691                os << "untyped entity ";
  • src/SynTree/PointerType.cc

    r78315272 r3f7e12cb  
    4141}
    4242
    43 void PointerType::print( std::ostream &os, int indent ) const {
     43void PointerType::print( std::ostream &os, Indenter indent ) const {
    4444        Type::print( os, indent );
    4545        if ( ! is_array() ) {
  • src/SynTree/ReferenceToType.cc

    r78315272 r3f7e12cb  
    1414//
    1515
    16 #include <stddef.h>          // for NULL
    1716#include <cassert>           // for assert
    1817#include <list>              // for list, _List_const_iterator, list<>::cons...
     
    3837}
    3938
    40 void ReferenceToType::print( std::ostream &os, int indent ) const {
     39void ReferenceToType::print( std::ostream &os, Indenter indent ) const {
    4140        using std::endl;
    4241
     
    4443        os << "instance of " << typeString() << " " << name << " ";
    4544        if ( ! parameters.empty() ) {
    46                 os << endl << std::string( indent, ' ' ) << "with parameters" << endl;
    47                 printAll( parameters, os, indent+2 );
     45                os << endl << indent << "... with parameters" << endl;
     46                printAll( parameters, os, indent+1 );
    4847        } // if
    4948}
     
    6564
    6665std::list<TypeDecl*>* StructInstType::get_baseParameters() {
    67         if ( ! baseStruct ) return NULL;
     66        if ( ! baseStruct ) return nullptr;
    6867        return &baseStruct->get_parameters();
    6968}
     
    7675}
    7776
    78 void StructInstType::print( std::ostream &os, int indent ) const {
     77void StructInstType::print( std::ostream &os, Indenter indent ) const {
    7978        using std::endl;
    8079
    81         if ( baseStruct == NULL ) ReferenceToType::print( os, indent );
     80        if ( baseStruct == nullptr ) ReferenceToType::print( os, indent );
    8281        else {
    8382                Type::print( os, indent );
    8483                os << "instance of " << typeString() << " " << name << " with body " << baseStruct->has_body() << " ";
    8584                if ( ! parameters.empty() ) {
    86                         os << endl << std::string( indent, ' ' ) << "with parameters" << endl;
    87                         printAll( parameters, os, indent+2 );
     85                        os << endl << indent << "... with parameters" << endl;
     86                        printAll( parameters, os, indent+1 );
    8887                } // if
    8988        } // if
     
    9796
    9897std::list< TypeDecl * > * UnionInstType::get_baseParameters() {
    99         if ( ! baseUnion ) return NULL;
     98        if ( ! baseUnion ) return nullptr;
    10099        return &baseUnion->get_parameters();
    101100}
     
    108107}
    109108
    110 void UnionInstType::print( std::ostream &os, int indent ) const {
     109void UnionInstType::print( std::ostream &os, Indenter indent ) const {
    111110        using std::endl;
    112111
    113         if ( baseUnion == NULL ) ReferenceToType::print( os, indent );
     112        if ( baseUnion == nullptr ) ReferenceToType::print( os, indent );
    114113        else {
    115114                Type::print( os, indent );
    116115                os << "instance of " << typeString() << " " << name << " with body " << baseUnion->has_body() << " ";
    117116                if ( ! parameters.empty() ) {
    118                         os << endl << std::string( indent, ' ' ) << "with parameters" << endl;
    119                         printAll( parameters, os, indent+2 );
     117                        os << endl << indent << "... with parameters" << endl;
     118                        printAll( parameters, os, indent+1 );
    120119                } // if
    121120        } // if
     
    129128
    130129bool EnumInstType::isComplete() const { return baseEnum ? baseEnum->has_body() : false; }
     130
     131void EnumInstType::print( std::ostream &os, Indenter indent ) const {
     132        using std::endl;
     133
     134        if ( baseEnum == nullptr ) ReferenceToType::print( os, indent );
     135        else {
     136                Type::print( os, indent );
     137                os << "instance of " << typeString() << " " << name << " with body " << baseEnum->has_body() << " ";
     138        } // if
     139}
     140
    131141
    132142std::string TraitInstType::typeString() const { return "trait"; }
     
    166176bool TypeInstType::isComplete() const { return baseType->isComplete(); }
    167177
    168 void TypeInstType::print( std::ostream &os, int indent ) const {
     178void TypeInstType::print( std::ostream &os, Indenter indent ) const {
    169179        using std::endl;
    170180
     
    172182        os << "instance of " << typeString() << " " << get_name() << " (" << ( isFtype ? "" : "not" ) << " function type) ";
    173183        if ( ! parameters.empty() ) {
    174                 os << endl << std::string( indent, ' ' ) << "with parameters" << endl;
    175                 printAll( parameters, os, indent+2 );
     184                os << endl << indent << "... with parameters" << endl;
     185                printAll( parameters, os, indent+1 );
    176186        } // if
    177187}
  • src/SynTree/ReferenceType.cc

    r78315272 r3f7e12cb  
    3535}
    3636
    37 void ReferenceType::print( std::ostream &os, int indent ) const {
     37void ReferenceType::print( std::ostream &os, Indenter indent ) const {
    3838        Type::print( os, indent );
    3939        os << "reference to ";
  • src/SynTree/Statement.cc

    r78315272 r3f7e12cb  
    3434Statement::Statement( std::list<Label> labels ) : labels( labels ) {}
    3535
    36 void Statement::print( __attribute__((unused)) std::ostream &, __attribute__((unused)) int indent ) const {}
     36void Statement::print( std::ostream & os, Indenter ) const {
     37        if ( ! labels.empty() ) {
     38                os << "Labels: {";
     39                for ( const Label & l : labels ) {
     40                        os << l << ",";
     41                }
     42                os << "}" << endl;
     43        }
     44}
    3745
    3846Statement::~Statement() {}
     
    4654}
    4755
    48 void ExprStmt::print( std::ostream &os, int indent ) const {
    49         os << "Expression Statement:" << endl << std::string( indent + 2, ' ' );
    50         expr->print( os, indent + 2 );
     56void ExprStmt::print( std::ostream &os, Indenter indent ) const {
     57        os << "Expression Statement:" << endl << indent+1;
     58        expr->print( os, indent+1 );
    5159}
    5260
     
    6775}
    6876
    69 void AsmStmt::print( std::ostream &os, int indent ) const {
     77void AsmStmt::print( std::ostream &os, Indenter indent ) const {
    7078        os << "Assembler Statement:" << endl;
    71         os << std::string( indent, ' ' ) << "instruction: " << endl << std::string( indent, ' ' );
    72         instruction->print( os, indent + 2 );
     79        os << indent+1 << "instruction: " << endl << indent;
     80        instruction->print( os, indent+1 );
    7381        if ( ! output.empty() ) {
    74                 os << endl << std::string( indent, ' ' ) << "output: " << endl;
    75                 printAll( output, os, indent + 2 );
     82                os << endl << indent+1 << "output: " << endl;
     83                printAll( output, os, indent+1 );
    7684        } // if
    7785        if ( ! input.empty() ) {
    78                 os << std::string( indent, ' ' ) << "input: " << endl << std::string( indent, ' ' );
    79                 printAll( input, os, indent + 2 );
     86                os << indent+1 << "input: " << endl;
     87                printAll( input, os, indent+1 );
    8088        } // if
    8189        if ( ! clobber.empty() ) {
    82                 os << std::string( indent, ' ' ) << "clobber: " << endl;
    83                 printAll( clobber, os, indent + 2 );
     90                os << indent+1 << "clobber: " << endl;
     91                printAll( clobber, os, indent+1 );
    8492        } // if
    8593}
     
    103111}
    104112
    105 void BranchStmt::print( std::ostream &os, int indent ) const {
    106         os << string( indent, ' ' ) << "Branch (" << brType[type] << ")" << endl ;
    107         if ( target != "" ) os << string( indent+2, ' ' ) << "with target: " << target << endl;
    108         if ( originalTarget != "" ) os << string( indent+2, ' ' ) << "with original target: " << originalTarget << endl;
    109         if ( computedTarget != nullptr ) os << string( indent+2, ' ' ) << "with computed target: " << computedTarget << endl;
     113void BranchStmt::print( std::ostream &os, Indenter indent ) const {
     114        os << "Branch (" << brType[type] << ")" << endl ;
     115        if ( target != "" ) os << indent+1 << "with target: " << target << endl;
     116        if ( originalTarget != "" ) os << indent+1 << "with original target: " << originalTarget << endl;
     117        if ( computedTarget != nullptr ) os << indent+1 << "with computed target: " << computedTarget << endl;
    110118}
    111119
     
    118126}
    119127
    120 void ReturnStmt::print( std::ostream &os, int indent ) const {
    121         os <<  "Return Statement, returning: ";
    122         if ( expr != 0 ) {
    123                 os << endl << string( indent+2, ' ' );
    124                 expr->print( os, indent + 2 );
     128void ReturnStmt::print( std::ostream &os, Indenter indent ) const {
     129        os << "Return Statement, returning: ";
     130        if ( expr != nullptr ) {
     131                os << endl << indent+1;
     132                expr->print( os, indent+1 );
    125133        }
    126134        os << endl;
     
    142150}
    143151
    144 void IfStmt::print( std::ostream &os, int indent ) const {
    145         os << "If on condition: " << endl ;
    146         os << string( indent+4, ' ' );
    147         condition->print( os, indent + 4 );
     152void IfStmt::print( std::ostream &os, Indenter indent ) const {
     153        os << "If on condition: " << endl;
     154        os << indent+1;
     155        condition->print( os, indent+1 );
    148156
    149157        if ( !initialization.empty() ) {
    150                 os << string( indent + 2, ' ' ) << "initialization: \n";
    151                 for ( std::list<Statement *>::const_iterator it = initialization.begin(); it != initialization.end(); ++it ) {
    152                         os << string( indent + 4, ' ' );
    153                         (*it)->print( os, indent + 4 );
     158                os << indent << "... with initialization: \n";
     159                for ( const Statement * stmt : initialization ) {
     160                        os << indent+1;
     161                        stmt->print( os, indent+1 );
    154162                }
    155163                os << endl;
    156164        }
    157165
    158         os << string( indent+2, ' ' ) << "... then: " << endl;
    159 
    160         os << string( indent+4, ' ' );
    161         thenPart->print( os, indent + 4 );
     166        os << indent << "... then: " << endl;
     167
     168        os << indent+1;
     169        thenPart->print( os, indent+1 );
    162170
    163171        if ( elsePart != 0 ) {
    164                 os << string( indent+2, ' ' ) << "... else: " << endl;
    165                 os << string( indent+4, ' ' );
    166                 elsePart->print( os, indent + 4 );
    167         } // if
    168 }
    169 
    170 SwitchStmt::SwitchStmt( std::list<Label> labels, Expression * condition, std::list<Statement *> &statements ):
     172                os << indent << "... else: " << endl;
     173                os << indent+1;
     174                elsePart->print( os, indent+1 );
     175        } // if
     176}
     177
     178SwitchStmt::SwitchStmt( std::list<Label> labels, Expression * condition, const std::list<Statement *> &statements ):
    171179        Statement( labels ), condition( condition ), statements( statements ) {
    172180}
     
    183191}
    184192
    185 void SwitchStmt::print( std::ostream &os, int indent ) const {
     193void SwitchStmt::print( std::ostream &os, Indenter indent ) const {
    186194        os << "Switch on condition: ";
    187195        condition->print( os );
    188196        os << endl;
    189197
    190         // statements
    191         std::list<Statement *>::const_iterator i;
    192         for ( i = statements.begin(); i != statements.end(); i++)
    193                 (*i)->print( os, indent + 4 );
    194 
    195         //for_each( statements.begin(), statements.end(), mem_fun( bind1st(&Statement::print ), os ));
    196 }
    197 
    198 CaseStmt::CaseStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements, bool deflt ) throw ( SemanticError ) :
     198        for ( const Statement * stmt : statements ) {
     199                stmt->print( os, indent+1 );
     200        }
     201}
     202
     203CaseStmt::CaseStmt( std::list<Label> labels, Expression *condition, const std::list<Statement *> &statements, bool deflt ) throw ( SemanticError ) :
    199204        Statement( labels ), condition( condition ), stmts( statements ), _isDefault( deflt ) {
    200         if ( isDefault() && condition != 0 )
    201                 throw SemanticError("default with conditions");
     205        if ( isDefault() && condition != 0 ) throw SemanticError("default case with condition: ", condition);
    202206}
    203207
     
    216220}
    217221
    218 void CaseStmt::print( std::ostream &os, int indent ) const {
    219         os << string( indent, ' ' );
    220 
    221         if ( isDefault() )
    222                 os << "Default ";
     222void CaseStmt::print( std::ostream &os, Indenter indent ) const {
     223        if ( isDefault() ) os << "Default ";
    223224        else {
    224225                os << "Case ";
    225                 condition->print( os );
    226         } // if
    227 
    228         os << endl;
    229 
    230         std::list<Statement *>::const_iterator i;
    231         for ( i = stmts.begin(); i != stmts.end(); i++)
    232                 (*i )->print( os, indent + 4 );
     226                condition->print( os, indent );
     227        } // if
     228        os << endl;
     229
     230        for ( Statement * stmt : stmts ) {
     231                stmt->print( os, indent+1 );
     232        }
    233233}
    234234
     
    246246}
    247247
    248 void WhileStmt::print( std::ostream &os, int indent ) const {
     248void WhileStmt::print( std::ostream &os, Indenter indent ) const {
    249249        os << "While on condition: " << endl ;
    250         condition->print( os, indent + 4 );
    251 
    252         os << string( indent, ' ' ) << ".... with body: " << endl;
    253 
    254         if ( body != 0 ) body->print( os, indent + 4 );
     250        condition->print( os, indent+1 );
     251
     252        os << indent << "... with body: " << endl;
     253
     254        if ( body != 0 ) body->print( os, indent+1 );
    255255}
    256256
     
    272272}
    273273
    274 void ForStmt::print( std::ostream &os, int indent ) const {
    275         os << "Labels: {";
    276         for ( std::list<Label>::const_iterator it = get_labels().begin(); it != get_labels().end(); ++it) {
    277                 os << *it << ",";
    278         }
    279         os << "}" << endl;
    280 
    281         os << string( indent, ' ' ) << "For Statement" << endl ;
    282 
    283         os << string( indent + 2, ' ' ) << "initialization: \n";
    284         for ( std::list<Statement *>::const_iterator it = initialization.begin(); it != initialization.end(); ++it ) {
    285                 os << string( indent + 4, ' ' );
    286                 (*it)->print( os, indent + 4 );
    287         }
    288 
    289         os << "\n" << string( indent + 2, ' ' ) << "condition: \n";
    290         if ( condition != 0 ) {
    291                 os << string( indent + 4, ' ' );
    292                 condition->print( os, indent + 4 );
    293         }
    294 
    295         os << "\n" << string( indent + 2, ' ' ) << "increment: \n";
    296         if ( increment != 0 ) {
    297                 os << string( indent + 4, ' ' );
    298                 increment->print( os, indent + 4 );
    299         }
    300 
    301         os << "\n" << string( indent + 2, ' ' ) << "statement block: \n";
     274void ForStmt::print( std::ostream &os, Indenter indent ) const {
     275        Statement::print( os, indent ); // print labels
     276
     277        os << "For Statement" << endl;
     278
     279        if ( ! initialization.empty() ) {
     280                os << indent << "... initialization: \n";
     281                for ( Statement * stmt : initialization ) {
     282                        os << indent+1;
     283                        stmt->print( os, indent+1 );
     284                }
     285        }
     286
     287        if ( condition != nullptr ) {
     288                os << indent << "... condition: \n" << indent+1;
     289                condition->print( os, indent+1 );
     290        }
     291
     292        if ( increment != nullptr ) {
     293                os << "\n" << indent << "... increment: \n" << indent+1;
     294                increment->print( os, indent+1 );
     295        }
     296
    302297        if ( body != 0 ) {
    303                 os << string( indent + 4, ' ' );
    304                 body->print( os, indent + 4 );
    305         }
    306 
     298                os << "\n" << indent << "... with body: \n" << indent+1;
     299                body->print( os, indent+1 );
     300        }
    307301        os << endl;
    308302}
     
    322316}
    323317
    324 void ThrowStmt::print( std::ostream &os, int indent) const {
     318void ThrowStmt::print( std::ostream &os, Indenter indent) const {
     319        if ( target ) os << "Non-Local ";
     320        os << "Throw Statement, raising: ";
     321        expr->print(os, indent+1);
    325322        if ( target ) {
    326                 os << "Non-Local ";
    327         }
    328         os << "Throw Statement, raising: ";
    329         expr->print(os, indent + 4);
    330         if ( target ) {
    331                 os << "At: ";
    332                 target->print(os, indent + 4);
     323                os << "... at: ";
     324                target->print(os, indent+1);
    333325        }
    334326}
     
    348340}
    349341
    350 void TryStmt::print( std::ostream &os, int indent ) const {
     342void TryStmt::print( std::ostream &os, Indenter indent ) const {
    351343        os << "Try Statement" << endl;
    352         os << string( indent + 2, ' ' ) << "with block:" << endl;
    353         os << string( indent + 4, ' ' );
    354         block->print( os, indent + 4 );
     344        os << indent << "... with block:" << endl << indent+1;
     345        block->print( os, indent+1 );
    355346
    356347        // handlers
    357         os << string( indent + 2, ' ' ) << "and handlers:" << endl;
    358         for ( std::list<CatchStmt *>::const_iterator i = handlers.begin(); i != handlers.end(); i++) {
    359                 os << string( indent + 4, ' ' );
    360                 (*i )->print( os, indent + 4 );
     348        os << indent << "... and handlers:" << endl;
     349        for ( const CatchStmt * stmt : handlers ) {
     350                os << indent+1;
     351                stmt->print( os, indent+1 );
    361352        }
    362353
    363354        // finally block
    364355        if ( finallyBlock != 0 ) {
    365                 os << string( indent + 2, ' ' ) << "and finally:" << endl;
    366                 finallyBlock->print( os, indent + 4 );
     356                os << indent << "... and finally:" << endl << indent+1;
     357                finallyBlock->print( os, indent+1 );
    367358        } // if
    368359}
     
    370361CatchStmt::CatchStmt( std::list<Label> labels, Kind kind, Declaration *decl, Expression *cond, Statement *body ) :
    371362        Statement( labels ), kind ( kind ), decl ( decl ), cond ( cond ), body( body ) {
     363                assertf( decl, "Catch clause must have a declaration." );
    372364}
    373365
     
    381373}
    382374
    383 void CatchStmt::print( std::ostream &os, int indent ) const {
     375void CatchStmt::print( std::ostream &os, Indenter indent ) const {
    384376        os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl;
    385377
    386         os << string( indent + 2, ' ' ) << "... catching: ";
    387         if ( decl ) {
    388                 decl->printShort( os, indent + 4 );
    389                 os << endl;
    390         }
    391         else
    392                 os << string( indent + 4 , ' ' ) << ">>> Error:  this catch clause must have a declaration <<<" << endl;
     378        os << indent << "... catching: ";
     379        decl->printShort( os, indent+1 );
     380        os << endl;
    393381
    394382        if ( cond ) {
    395                 os << string( indent + 2, ' ' ) << "with conditional:" << endl;
    396                 os << string( indent + 4, ' ' );
    397                 cond->print( os, indent + 4 );
    398         }
    399         else
    400                 os << string( indent + 2, ' ' ) << "with no conditional" << endl;
    401 
    402         os << string( indent + 2, ' ' ) << "with block:" << endl;
    403         os << string( indent + 4, ' ' );
    404         body->print( os, indent + 4 );
     383                os << indent << "... with conditional:" << endl << indent+1;
     384                cond->print( os, indent+1 );
     385        }
     386
     387        os << indent << "... with block:" << endl;
     388        os << indent+1;
     389        body->print( os, indent+1 );
    405390}
    406391
     
    417402}
    418403
    419 void FinallyStmt::print( std::ostream &os, int indent ) const {
     404void FinallyStmt::print( std::ostream &os, Indenter indent ) const {
    420405        os << "Finally Statement" << endl;
    421         os << string( indent + 2, ' ' ) << "with block:" << endl;
    422         os << string( indent + 4, ' ' );
    423         block->print( os, indent + 4 );
     406        os << indent << "... with block:" << endl << indent+1;
     407        block->print( os, indent+1 );
    424408}
    425409
     
    465449}
    466450
    467 void WaitForStmt::print( std::ostream &os, int indent ) const {
     451void WaitForStmt::print( std::ostream &os, Indenter indent ) const {
    468452        os << "Waitfor Statement" << endl;
    469         os << string( indent + 2, ' ' ) << "with block:" << endl;
    470         os << string( indent + 4, ' ' );
     453        os << indent << "... with block:" << endl << indent+1;
    471454        // block->print( os, indent + 4 );
    472455}
     
    475458NullStmt::NullStmt() : Statement( std::list<Label>() ) {}
    476459
    477 void NullStmt::print( std::ostream &os, __attribute__((unused)) int indent ) const {
    478         os << "Null Statement" << endl ;
     460void NullStmt::print( std::ostream &os, Indenter ) const {
     461        os << "Null Statement" << endl;
    479462}
    480463
     
    490473}
    491474
    492 void ImplicitCtorDtorStmt::print( std::ostream &os, int indent ) const {
     475void ImplicitCtorDtorStmt::print( std::ostream &os, Indenter indent ) const {
    493476        os << "Implicit Ctor Dtor Statement" << endl;
    494         os << string( indent + 2, ' ' ) << "with Ctor/Dtor: ";
    495         callStmt->print( os, indent + 2);
    496         os << endl;
    497 }
    498 
    499 std::ostream & operator<<( std::ostream & out, const Statement * statement ) {
    500         if ( statement ) {
    501                 statement->print( out );
    502         } else {
    503                 out << "nullptr";
    504         }
    505         return out;
     477        os << indent << "... with Ctor/Dtor: ";
     478        callStmt->print( os, indent+1);
     479        os << endl;
    506480}
    507481
  • src/SynTree/Statement.h

    r78315272 r3f7e12cb  
    4343        const std::list<Label> & get_labels() const { return labels; }
    4444
    45         virtual Statement *clone() const = 0;
    46         virtual void accept( Visitor &v ) = 0;
    47         virtual Statement *acceptMutator( Mutator &m ) = 0;
    48         virtual void print( std::ostream &os, int indent = 0 ) const;
     45        virtual Statement *clone() const override = 0;
     46        virtual void accept( Visitor &v ) override = 0;
     47        virtual Statement *acceptMutator( Mutator &m ) override = 0;
     48        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    4949};
    5050
     
    5454
    5555        CompoundStmt( std::list<Label> labels );
     56        CompoundStmt( std::list<Statement *> stmts );
    5657        CompoundStmt( const CompoundStmt &other );
    5758        virtual ~CompoundStmt();
     
    6162        void push_front( Statement * stmt ) { kids.push_front( stmt ); }
    6263
    63         virtual CompoundStmt *clone() const { return new CompoundStmt( *this ); }
    64         virtual void accept( Visitor &v ) { v.visit( this ); }
    65         virtual CompoundStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    66         virtual void print( std::ostream &os, int indent = 0 ) const;
     64        virtual CompoundStmt *clone() const override { return new CompoundStmt( *this ); }
     65        virtual void accept( Visitor &v ) override { v.visit( this ); }
     66        virtual CompoundStmt *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     67        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    6768};
    6869
     
    7273        NullStmt( std::list<Label> labels );
    7374
    74         virtual NullStmt *clone() const { return new NullStmt( *this ); }
    75         virtual void accept( Visitor &v ) { v.visit( this ); }
    76         virtual NullStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    77         virtual void print( std::ostream &os, int indent = 0 ) const;
     75        virtual NullStmt *clone() const override { return new NullStmt( *this ); }
     76        virtual void accept( Visitor &v ) override { v.visit( this ); }
     77        virtual NullStmt *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     78        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    7879};
    7980
     
    8990        void set_expr( Expression *newValue ) { expr = newValue; }
    9091
    91         virtual ExprStmt *clone() const { return new ExprStmt( *this ); }
    92         virtual void accept( Visitor &v ) { v.visit( this ); }
    93         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    94         virtual void print( std::ostream &os, int indent = 0 ) const;
     92        virtual ExprStmt *clone() const override { return new ExprStmt( *this ); }
     93        virtual void accept( Visitor &v ) override { v.visit( this ); }
     94        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     95        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    9596};
    9697
     
    123124        virtual void accept( Visitor & v ) { v.visit( this ); }
    124125        virtual Statement * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    125         virtual void print( std::ostream & os, int indent = 0 ) const;
     126        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    126127};
    127128
     
    146147        void set_elsePart( Statement *newValue ) { elsePart = newValue; }
    147148
    148         virtual IfStmt *clone() const { return new IfStmt( *this ); }
    149         virtual void accept( Visitor &v ) { v.visit( this ); }
    150         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    151         virtual void print( std::ostream &os, int indent = 0 ) const;
     149        virtual IfStmt *clone() const override { return new IfStmt( *this ); }
     150        virtual void accept( Visitor &v ) override { v.visit( this ); }
     151        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     152        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    152153};
    153154
     
    157158        std::list<Statement *> statements;
    158159
    159         SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements );
     160        SwitchStmt( std::list<Label> labels, Expression *condition, const std::list<Statement *> &statements );
    160161        SwitchStmt( const SwitchStmt &other );
    161162        virtual ~SwitchStmt();
     
    166167        std::list<Statement *> & get_statements() { return statements; }
    167168
    168         virtual void accept( Visitor &v ) { v.visit( this ); }
    169         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    170 
    171         virtual SwitchStmt *clone() const { return new SwitchStmt( *this ); }
    172         virtual void print( std::ostream &os, int indent = 0 ) const;
     169        virtual void accept( Visitor &v ) override { v.visit( this ); }
     170        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     171
     172        virtual SwitchStmt *clone() const override { return new SwitchStmt( *this ); }
     173        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    173174
    174175};
     
    179180        std::list<Statement *> stmts;
    180181
    181         CaseStmt( std::list<Label> labels, Expression *conditions, std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
     182        CaseStmt( std::list<Label> labels, Expression *conditions, const std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
    182183        CaseStmt( const CaseStmt &other );
    183184        virtual ~CaseStmt();
     
    194195        void set_statements( std::list<Statement *> &newValue ) { stmts = newValue; }
    195196
    196         virtual void accept( Visitor &v ) { v.visit( this ); }
    197         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    198 
    199         virtual CaseStmt *clone() const { return new CaseStmt( *this ); }
    200         virtual void print( std::ostream &os, int indent = 0 ) const;
     197        virtual void accept( Visitor &v ) override { v.visit( this ); }
     198        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     199
     200        virtual CaseStmt *clone() const override { return new CaseStmt( *this ); }
     201        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    201202  private:
    202203        bool _isDefault;
     
    221222        void set_isDoWhile( bool newValue ) { isDoWhile = newValue; }
    222223
    223         virtual WhileStmt *clone() const { return new WhileStmt( *this ); }
    224         virtual void accept( Visitor &v ) { v.visit( this ); }
    225         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    226         virtual void print( std::ostream &os, int indent = 0 ) const;
     224        virtual WhileStmt *clone() const override { return new WhileStmt( *this ); }
     225        virtual void accept( Visitor &v ) override { v.visit( this ); }
     226        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     227        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    227228};
    228229
     
    247248        void set_body( Statement *newValue ) { body = newValue; }
    248249
    249         virtual ForStmt *clone() const { return new ForStmt( *this ); }
    250         virtual void accept( Visitor &v ) { v.visit( this ); }
    251         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    252         virtual void print( std::ostream &os, int indent = 0 ) const;
     250        virtual ForStmt *clone() const override { return new ForStmt( *this ); }
     251        virtual void accept( Visitor &v ) override { v.visit( this ); }
     252        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     253        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    253254};
    254255
     
    276277        const char *get_typename() { return brType[ type ]; }
    277278
    278         virtual BranchStmt *clone() const { return new BranchStmt( *this ); }
    279         virtual void accept( Visitor &v ) { v.visit( this ); }
    280         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    281         virtual void print( std::ostream &os, int indent = 0 ) const;
     279        virtual BranchStmt *clone() const override { return new BranchStmt( *this ); }
     280        virtual void accept( Visitor &v ) override { v.visit( this ); }
     281        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     282        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    282283  private:
    283284        static const char *brType[];
     
    295296        void set_expr( Expression *newValue ) { expr = newValue; }
    296297
    297         virtual ReturnStmt *clone() const { return new ReturnStmt( *this ); }
    298         virtual void accept( Visitor &v ) { v.visit( this ); }
    299         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    300         virtual void print( std::ostream &os, int indent = 0 ) const;
     298        virtual ReturnStmt *clone() const override { return new ReturnStmt( *this ); }
     299        virtual void accept( Visitor &v ) override { v.visit( this ); }
     300        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     301        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    301302};
    302303
     
    319320        void set_target( Expression * newTarget ) { target = newTarget; }
    320321
    321         virtual ThrowStmt *clone() const { return new ThrowStmt( *this ); }
    322         virtual void accept( Visitor &v ) { v.visit( this ); }
    323         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    324         virtual void print( std::ostream &os, int indent = 0 ) const;
     322        virtual ThrowStmt *clone() const override { return new ThrowStmt( *this ); }
     323        virtual void accept( Visitor &v ) override { v.visit( this ); }
     324        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     325        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    325326};
    326327
     
    342343        void set_finally( FinallyStmt *newValue ) { finallyBlock = newValue; }
    343344
    344         virtual TryStmt *clone() const { return new TryStmt( *this ); }
    345         virtual void accept( Visitor &v ) { v.visit( this ); }
    346         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    347         virtual void print( std::ostream &os, int indent = 0 ) const;
     345        virtual TryStmt *clone() const override { return new TryStmt( *this ); }
     346        virtual void accept( Visitor &v ) override { v.visit( this ); }
     347        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     348        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    348349};
    349350
     
    370371        void set_body( Statement *newValue ) { body = newValue; }
    371372
    372         virtual CatchStmt *clone() const { return new CatchStmt( *this ); }
    373         virtual void accept( Visitor &v ) { v.visit( this ); }
    374         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    375         virtual void print( std::ostream &os, int indent = 0 ) const;
     373        virtual CatchStmt *clone() const override { return new CatchStmt( *this ); }
     374        virtual void accept( Visitor &v ) override { v.visit( this ); }
     375        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     376        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    376377};
    377378
     
    387388        void set_block( CompoundStmt *newValue ) { block = newValue; }
    388389
    389         virtual FinallyStmt *clone() const { return new FinallyStmt( *this ); }
    390         virtual void accept( Visitor &v ) { v.visit( this ); }
    391         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    392         virtual void print( std::ostream &os, int indent = 0 ) const;
     390        virtual FinallyStmt *clone() const override { return new FinallyStmt( *this ); }
     391        virtual void accept( Visitor &v ) override { v.visit( this ); }
     392        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     393        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    393394};
    394395
     
    424425        } orelse;
    425426
    426         virtual WaitForStmt *clone() const { return new WaitForStmt( *this ); }
    427         virtual void accept( Visitor &v ) { v.visit( this ); }
    428         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    429         virtual void print( std::ostream &os, int indent = 0 ) const;
     427        virtual WaitForStmt *clone() const override { return new WaitForStmt( *this ); }
     428        virtual void accept( Visitor &v ) override { v.visit( this ); }
     429        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     430        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    430431
    431432};
     
    444445        void set_decl( Declaration *newValue ) { decl = newValue; }
    445446
    446         virtual DeclStmt *clone() const { return new DeclStmt( *this ); }
    447         virtual void accept( Visitor &v ) { v.visit( this ); }
    448         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    449         virtual void print( std::ostream &os, int indent = 0 ) const;
     447        virtual DeclStmt *clone() const override { return new DeclStmt( *this ); }
     448        virtual void accept( Visitor &v ) override { v.visit( this ); }
     449        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     450        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    450451};
    451452
     
    466467        void set_callStmt( Statement * newValue ) { callStmt = newValue; }
    467468
    468         virtual ImplicitCtorDtorStmt *clone() const { return new ImplicitCtorDtorStmt( *this ); }
    469         virtual void accept( Visitor &v ) { v.visit( this ); }
    470         virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    471         virtual void print( std::ostream &os, int indent = 0 ) const;
    472 };
    473 
    474 
    475 std::ostream & operator<<( std::ostream & out, const Statement * statement );
     469        virtual ImplicitCtorDtorStmt *clone() const override { return new ImplicitCtorDtorStmt( *this ); }
     470        virtual void accept( Visitor &v ) override { v.visit( this ); }
     471        virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     472        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     473};
    476474
    477475// Local Variables: //
  • src/SynTree/TupleExpr.cc

    r78315272 r3f7e12cb  
    2828#include "Type.h"               // for TupleType, Type
    2929
    30 UntypedTupleExpr::UntypedTupleExpr( const std::list< Expression * > & exprs, Expression *_aname ) : Expression( _aname ), exprs( exprs ) {
     30UntypedTupleExpr::UntypedTupleExpr( const std::list< Expression * > & exprs ) : Expression(), exprs( exprs ) {
    3131}
    3232
     
    3939}
    4040
    41 void UntypedTupleExpr::print( std::ostream &os, int indent ) const {
     41void UntypedTupleExpr::print( std::ostream &os, Indenter indent ) const {
    4242        os << "Untyped Tuple:" << std::endl;
    43         printAll( exprs, os, indent+2 );
     43        printAll( exprs, os, indent+1 );
    4444        Expression::print( os, indent );
    4545}
    4646
    47 TupleExpr::TupleExpr( const std::list< Expression * > & exprs, Expression *_aname ) : Expression( _aname ), exprs( exprs ) {
     47TupleExpr::TupleExpr( const std::list< Expression * > & exprs ) : Expression(), exprs( exprs ) {
    4848        set_result( Tuples::makeTupleType( exprs ) );
    4949}
     
    5757}
    5858
    59 void TupleExpr::print( std::ostream &os, int indent ) const {
     59void TupleExpr::print( std::ostream &os, Indenter indent ) const {
    6060        os << "Tuple:" << std::endl;
    61         printAll( exprs, os, indent+2 );
     61        printAll( exprs, os, indent+1 );
    6262        Expression::print( os, indent );
    6363}
     
    7878}
    7979
    80 void TupleIndexExpr::print( std::ostream &os, int indent ) const {
     80void TupleIndexExpr::print( std::ostream &os, Indenter indent ) const {
    8181        os << "Tuple Index Expression, with tuple:" << std::endl;
    82         os << std::string( indent+2, ' ' );
    83         tuple->print( os, indent+2 );
    84         os << std::string( indent+2, ' ' ) << "with index: " << index << std::endl;
     82        os << indent+1;
     83        tuple->print( os, indent+1 );
     84        os << indent+1 << "with index: " << index << std::endl;
    8585        Expression::print( os, indent );
    8686}
    8787
    88 TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname ) : Expression( _aname ) {
     88TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls ) : Expression() {
    8989        // convert internally into a StmtExpr which contains the declarations and produces the tuple of the assignments
    9090        set_result( Tuples::makeTupleType( assigns ) );
     
    109109}
    110110
    111 void TupleAssignExpr::print( std::ostream &os, int indent ) const {
     111void TupleAssignExpr::print( std::ostream &os, Indenter indent ) const {
    112112        os << "Tuple Assignment Expression, with stmt expr:" << std::endl;
    113         os << std::string( indent+2, ' ' );
    114         stmtExpr->print( os, indent+4 );
     113        os << indent+1;
     114        stmtExpr->print( os, indent+1 );
    115115        Expression::print( os, indent );
    116116}
  • src/SynTree/TupleType.cc

    r78315272 r3f7e12cb  
    4848}
    4949
    50 void TupleType::print( std::ostream &os, int indent ) const {
     50void TupleType::print( std::ostream &os, Indenter indent ) const {
    5151        Type::print( os, indent );
    5252        os << "tuple of types" << std::endl;
    53         printAll( types, os, indent+2 );
     53        printAll( types, os, indent+1 );
    5454}
    5555
  • src/SynTree/Type.cc

    r78315272 r3f7e12cb  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 11 13:21:25 2017
    13 // Update Count     : 37
     12// Last Modified On : Mon Sep 25 15:16:32 2017
     13// Update Count     : 38
    1414//
    1515#include "Type.h"
     
    4545        "double _Imaginary",
    4646        "long double _Imaginary",
     47        "__int128",
     48        "unsigned __int128",
    4749};
    4850
     
    7375        Type * type;
    7476        ReferenceType * ref;
    75         for ( type = this; (ref = dynamic_cast<ReferenceType *>( type )); type = ref->get_base() );
     77        for ( type = this; (ref = dynamic_cast<ReferenceType *>( type )); type = ref->base );
    7678        return type;
    7779}
     
    7981int Type::referenceDepth() const { return 0; }
    8082
    81 void Type::print( std::ostream &os, int indent ) const {
     83void Type::print( std::ostream &os, Indenter indent ) const {
    8284        if ( ! forall.empty() ) {
    8385                os << "forall" << std::endl;
    84                 printAll( forall, os, indent + 4 );
    85                 os << std::string( indent+2, ' ' );
     86                printAll( forall, os, indent+1 );
     87                os << ++indent;
    8688        } // if
    8789
    8890        if ( ! attributes.empty() ) {
    89                 os << endl << string( indent+2, ' ' ) << "with attributes" << endl;
    90                 printAll( attributes, os, indent+4 );
     91                os << "with attributes" << endl;
     92                printAll( attributes, os, indent+1 );
    9193        } // if
    9294
     
    99101const Type::Qualifiers noQualifiers;
    100102
    101 std::ostream & operator<<( std::ostream & out, const Type * type ) {
    102         if ( type ) {
    103                 type->print( out );
    104         } else {
    105                 out << "nullptr";
    106         } // if
    107         return out;
    108 }
    109 
    110103// Local Variables: //
    111104// tab-width: 4 //
  • src/SynTree/Type.h

    r78315272 r3f7e12cb  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Aug  9 14:25:00 2017
    13 // Update Count     : 152
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Sep 25 14:14:01 2017
     13// Update Count     : 154
    1414//
    1515
     
    181181        virtual void accept( Visitor & v ) = 0;
    182182        virtual Type *acceptMutator( Mutator & m ) = 0;
    183         virtual void print( std::ostream & os, int indent = 0 ) const;
     183        virtual void print( std::ostream & os, Indenter indent = {} ) const;
    184184};
    185185
     
    192192        VoidType( const Type::Qualifiers & tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    193193
    194         virtual unsigned size() const { return 0; };
    195         virtual bool isComplete() const { return false; }
    196 
    197         virtual VoidType *clone() const { return new VoidType( *this ); }
    198         virtual void accept( Visitor & v ) { v.visit( this ); }
    199         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    200         virtual void print( std::ostream & os, int indent = 0 ) const;
     194        virtual unsigned size() const override { return 0; };
     195        virtual bool isComplete() const override { return false; }
     196
     197        virtual VoidType *clone() const override { return new VoidType( *this ); }
     198        virtual void accept( Visitor & v ) override { v.visit( this ); }
     199        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     200        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    201201};
    202202
     
    225225                DoubleImaginary,
    226226                LongDoubleImaginary,
     227                SignedInt128,
     228                UnsignedInt128,
    227229                NUMBER_OF_BASIC_TYPES
    228230        } kind;
     
    235237        void set_kind( Kind newValue ) { kind = newValue; }
    236238
    237         virtual BasicType *clone() const { return new BasicType( *this ); }
    238         virtual void accept( Visitor & v ) { v.visit( this ); }
    239         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    240         virtual void print( std::ostream & os, int indent = 0 ) const;
     239        virtual BasicType *clone() const override { return new BasicType( *this ); }
     240        virtual void accept( Visitor & v ) override { v.visit( this ); }
     241        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     242        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    241243
    242244        bool isInteger() const;
     
    268270        bool is_array() const { return isStatic || isVarLen || dimension; }
    269271
    270         virtual bool isComplete() const { return ! isVarLen; }
    271 
    272         virtual PointerType *clone() const { return new PointerType( *this ); }
    273         virtual void accept( Visitor & v ) { v.visit( this ); }
    274         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    275         virtual void print( std::ostream & os, int indent = 0 ) const;
     272        virtual bool isComplete() const override { return ! isVarLen; }
     273
     274        virtual PointerType *clone() const override { return new PointerType( *this ); }
     275        virtual void accept( Visitor & v ) override { v.visit( this ); }
     276        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     277        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    276278};
    277279
     
    296298        void set_isStatic( bool newValue ) { isStatic = newValue; }
    297299
    298         virtual bool isComplete() const { return ! isVarLen; }
    299 
    300         virtual ArrayType *clone() const { return new ArrayType( *this ); }
    301         virtual void accept( Visitor & v ) { v.visit( this ); }
    302         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    303         virtual void print( std::ostream & os, int indent = 0 ) const;
     300        // array types are complete if they have a dimension expression or are
     301        // VLAs ('*' in parameter declaration), and incomplete otherwise.
     302        // See 6.7.6.2
     303        virtual bool isComplete() const override { return dimension || isVarLen; }
     304
     305        virtual ArrayType *clone() const override { return new ArrayType( *this ); }
     306        virtual void accept( Visitor & v ) override { v.visit( this ); }
     307        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     308        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    304309};
    305310
     
    315320        void set_base( Type *newValue ) { base = newValue; }
    316321
    317         virtual int referenceDepth() const;
     322        virtual int referenceDepth() const override;
    318323
    319324        // Since reference types act like value types, their size is the size of the base.
    320325        // This makes it simple to cast the empty tuple to a reference type, since casts that increase
    321326        // the number of values are disallowed.
    322         virtual unsigned size() const { return base->size(); }
    323 
    324         virtual ReferenceType *clone() const { return new ReferenceType( *this ); }
    325         virtual void accept( Visitor & v ) { v.visit( this ); }
    326         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    327         virtual void print( std::ostream & os, int indent = 0 ) const;
     327        virtual unsigned size() const override { return base->size(); }
     328
     329        virtual ReferenceType *clone() const override { return new ReferenceType( *this ); }
     330        virtual void accept( Visitor & v ) override { v.visit( this ); }
     331        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     332        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    328333};
    329334
     
    349354        bool isTtype() const;
    350355
    351         virtual FunctionType *clone() const { return new FunctionType( *this ); }
    352         virtual void accept( Visitor & v ) { v.visit( this ); }
    353         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    354         virtual void print( std::ostream & os, int indent = 0 ) const;
     356        virtual FunctionType *clone() const override { return new FunctionType( *this ); }
     357        virtual void accept( Visitor & v ) override { v.visit( this ); }
     358        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     359        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    355360};
    356361
     
    371376        void set_hoistType( bool newValue ) { hoistType = newValue; }
    372377
    373         virtual ReferenceToType *clone() const = 0;
    374         virtual void accept( Visitor & v ) = 0;
    375         virtual Type *acceptMutator( Mutator & m ) = 0;
    376         virtual void print( std::ostream & os, int indent = 0 ) const;
     378        virtual ReferenceToType *clone() const override = 0;
     379        virtual void accept( Visitor & v ) override = 0;
     380        virtual Type *acceptMutator( Mutator & m ) override = 0;
     381        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    377382
    378383        virtual void lookup( __attribute__((unused)) const std::string & name, __attribute__((unused)) std::list< Declaration* > & foundDecls ) const {}
     
    398403        std::list<TypeDecl*> * get_baseParameters();
    399404
    400         virtual bool isComplete() const;
     405        virtual bool isComplete() const override;
    401406
    402407        /// Looks up the members of this struct named "name" and places them into "foundDecls".
    403408        /// Clones declarations into "foundDecls", caller responsible for freeing
    404         void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const;
    405 
    406         virtual StructInstType *clone() const { return new StructInstType( *this ); }
    407         virtual void accept( Visitor & v ) { v.visit( this ); }
    408         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    409 
    410         virtual void print( std::ostream & os, int indent = 0 ) const;
     409        void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const override;
     410
     411        virtual StructInstType *clone() const override { return new StructInstType( *this ); }
     412        virtual void accept( Visitor & v ) override { v.visit( this ); }
     413        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     414
     415        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    411416  private:
    412         virtual std::string typeString() const;
     417        virtual std::string typeString() const override;
    413418};
    414419
     
    430435        std::list< TypeDecl * > * get_baseParameters();
    431436
    432         virtual bool isComplete() const;
     437        virtual bool isComplete() const override;
    433438
    434439        /// looks up the members of this union named "name" and places them into "foundDecls"
    435440        /// Clones declarations into "foundDecls", caller responsible for freeing
    436         void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const;
    437 
    438         virtual UnionInstType *clone() const { return new UnionInstType( *this ); }
    439         virtual void accept( Visitor & v ) { v.visit( this ); }
    440         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    441 
    442         virtual void print( std::ostream & os, int indent = 0 ) const;
     441        void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const override;
     442
     443        virtual UnionInstType *clone() const override { return new UnionInstType( *this ); }
     444        virtual void accept( Visitor & v ) override { v.visit( this ); }
     445        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     446
     447        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    443448  private:
    444         virtual std::string typeString() const;
     449        virtual std::string typeString() const override;
    445450};
    446451
     
    459464        void set_baseEnum( EnumDecl *newValue ) { baseEnum = newValue; }
    460465
    461         virtual bool isComplete() const;
    462 
    463         virtual EnumInstType *clone() const { return new EnumInstType( *this ); }
    464         virtual void accept( Visitor & v ) { v.visit( this ); }
    465         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
     466        virtual bool isComplete() const override;
     467
     468        virtual EnumInstType *clone() const override { return new EnumInstType( *this ); }
     469        virtual void accept( Visitor & v ) override { v.visit( this ); }
     470        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     471
     472        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    466473  private:
    467         virtual std::string typeString() const;
     474        virtual std::string typeString() const override;
    468475};
    469476
     
    480487        ~TraitInstType();
    481488
    482         virtual bool isComplete() const;
    483 
    484         virtual TraitInstType *clone() const { return new TraitInstType( *this ); }
    485         virtual void accept( Visitor & v ) { v.visit( this ); }
    486         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
     489        virtual bool isComplete() const override;
     490
     491        virtual TraitInstType *clone() const override { return new TraitInstType( *this ); }
     492        virtual void accept( Visitor & v ) override { v.visit( this ); }
     493        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
    487494  private:
    488         virtual std::string typeString() const;
     495        virtual std::string typeString() const override;
    489496};
    490497
     
    507514        void set_isFtype( bool newValue ) { isFtype = newValue; }
    508515
    509         virtual bool isComplete() const;
    510 
    511         virtual TypeInstType *clone() const { return new TypeInstType( *this ); }
    512         virtual void accept( Visitor & v ) { v.visit( this ); }
    513         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    514         virtual void print( std::ostream & os, int indent = 0 ) const;
     516        virtual bool isComplete() const override;
     517
     518        virtual TypeInstType *clone() const override { return new TypeInstType( *this ); }
     519        virtual void accept( Visitor & v ) override { v.visit( this ); }
     520        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     521        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    515522  private:
    516         virtual std::string typeString() const;
     523        virtual std::string typeString() const override;
    517524};
    518525
     
    530537
    531538        std::list<Type *> & get_types() { return types; }
    532         virtual unsigned size() const { return types.size(); };
     539        virtual unsigned size() const override { return types.size(); };
    533540
    534541        // For now, this is entirely synthetic -- tuple types always have unnamed members.
     
    539546        iterator end() { return types.end(); }
    540547
    541         virtual Type * getComponent( unsigned i ) {
     548        virtual Type * getComponent( unsigned i ) override {
    542549                assertf( i < size(), "TupleType::getComponent: index %d must be less than size %d", i, size() );
    543550                return *(begin()+i);
    544551        }
    545552
    546         // virtual bool isComplete() const { return true; } // xxx - not sure if this is right, might need to recursively check complete-ness
    547 
    548         virtual TupleType *clone() const { return new TupleType( *this ); }
    549         virtual void accept( Visitor & v ) { v.visit( this ); }
    550         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    551         virtual void print( std::ostream & os, int indent = 0 ) const;
     553        // virtual bool isComplete() const override { return true; } // xxx - not sure if this is right, might need to recursively check complete-ness
     554
     555        virtual TupleType *clone() const override { return new TupleType( *this ); }
     556        virtual void accept( Visitor & v ) override { v.visit( this ); }
     557        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     558        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    552559};
    553560
     
    563570        void set_expr( Expression *newValue ) { expr = newValue; }
    564571
    565         virtual bool isComplete() const { assert( false ); return false; }
    566 
    567         virtual TypeofType *clone() const { return new TypeofType( *this ); }
    568         virtual void accept( Visitor & v ) { v.visit( this ); }
    569         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    570         virtual void print( std::ostream & os, int indent = 0 ) const;
     572        virtual bool isComplete() const override { assert( false ); return false; }
     573
     574        virtual TypeofType *clone() const override { return new TypeofType( *this ); }
     575        virtual void accept( Visitor & v ) override { v.visit( this ); }
     576        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     577        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    571578};
    572579
     
    592599        void set_isType( bool newValue ) { isType = newValue; }
    593600
    594         virtual bool isComplete() const { assert( false ); } // xxx - not sure what to do here
    595 
    596         virtual AttrType *clone() const { return new AttrType( *this ); }
    597         virtual void accept( Visitor & v ) { v.visit( this ); }
    598         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    599         virtual void print( std::ostream & os, int indent = 0 ) const;
     601        virtual bool isComplete() const override { assert( false ); } // xxx - not sure what to do here
     602
     603        virtual AttrType *clone() const override { return new AttrType( *this ); }
     604        virtual void accept( Visitor & v ) override { v.visit( this ); }
     605        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     606        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    600607};
    601608
     
    606613        VarArgsType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    607614
    608         virtual bool isComplete() const{ return true; } // xxx - is this right?
    609 
    610         virtual VarArgsType *clone() const { return new VarArgsType( *this ); }
    611         virtual void accept( Visitor & v ) { v.visit( this ); }
    612         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    613         virtual void print( std::ostream & os, int indent = 0 ) const;
     615        virtual bool isComplete() const override{ return true; } // xxx - is this right?
     616
     617        virtual VarArgsType *clone() const override { return new VarArgsType( *this ); }
     618        virtual void accept( Visitor & v ) override { v.visit( this ); }
     619        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     620        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    614621};
    615622
     
    620627        ZeroType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    621628
    622         virtual ZeroType *clone() const { return new ZeroType( *this ); }
    623         virtual void accept( Visitor & v ) { v.visit( this ); }
    624         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    625         virtual void print( std::ostream & os, int indent = 0 ) const;
     629        virtual ZeroType *clone() const override { return new ZeroType( *this ); }
     630        virtual void accept( Visitor & v ) override { v.visit( this ); }
     631        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     632        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    626633};
    627634
     
    632639        OneType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    633640
    634         virtual OneType *clone() const { return new OneType( *this ); }
    635         virtual void accept( Visitor & v ) { v.visit( this ); }
    636         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    637         virtual void print( std::ostream & os, int indent = 0 ) const;
    638 };
    639 
    640 std::ostream & operator<<( std::ostream & out, const Type * type );
     641        virtual OneType *clone() const override { return new OneType( *this ); }
     642        virtual void accept( Visitor & v ) override { v.visit( this ); }
     643        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     644        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     645};
    641646
    642647// Local Variables: //
  • src/SynTree/TypeDecl.cc

    r78315272 r3f7e12cb  
    2121#include "Type.h"            // for Type, Type::StorageClasses
    2222
    23 TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init ) : Parent( name, scs, type ), init( init ), sized( kind == Any || kind == Ttype ), kind( kind ) {
     23TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, bool sized, Type * init ) : Parent( name, scs, type ), init( init ), sized( kind == Ttype || sized ), kind( kind ) {
    2424}
    2525
     
    3232
    3333std::string TypeDecl::typeString() const {
    34         static const std::string kindNames[] = { "type", "incomplete type", "function type", "tuple type" };
    35         return (kind != Any && isComplete() ? "sized " : "") + kindNames[ kind ];
     34        static const std::string kindNames[] = { "object type", "function type", "tuple type" };
     35        assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, "typeString: kindNames is out of sync." );
     36        assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." );
     37        return (isComplete() ? "sized " : "") + kindNames[ kind ];
    3638}
    3739
    3840std::string TypeDecl::genTypeString() const {
    39         static const std::string kindNames[] = { "otype", "dtype", "ftype", "ttype" };
     41        static const std::string kindNames[] = { "dtype", "ftype", "ttype" };
     42        assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, "genTypeString: kindNames is out of sync." );
     43        assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." );
    4044        return kindNames[ kind ];
    4145}
    4246
    43 void TypeDecl::print( std::ostream &os, int indent ) const {
     47void TypeDecl::print( std::ostream &os, Indenter indent ) const {
    4448  NamedTypeDecl::print( os, indent );
    4549  if ( init ) {
    46     os << std::endl << std::string( indent, ' ' ) << "with type initializer: ";
    47     init->print( os, indent + 2 );
     50    os << std::endl << indent << "with type initializer: ";
     51    init->print( os, indent + 1 );
    4852  }
    4953}
  • src/SynTree/TypeExpr.cc

    r78315272 r3f7e12cb  
    3030}
    3131
    32 void TypeExpr::print( std::ostream &os, int indent ) const {
     32void TypeExpr::print( std::ostream &os, Indenter indent ) const {
    3333        if ( type ) type->print( os, indent );
    3434        Expression::print( os, indent );
  • src/SynTree/TypeSubstitution.cc

    r78315272 r3f7e12cb  
    148148template< typename TypeClass >
    149149Type *TypeSubstitution::handleType( TypeClass *type ) {
    150         BoundVarsType oldBoundVars( boundVars );
     150        ValueGuard<BoundVarsType> oldBoundVars( boundVars );
    151151        // bind type variables from forall-qualifiers
    152152        if ( freeOnly ) {
     
    156156        } // if
    157157        Type *ret = Mutator::mutate( type );
    158         boundVars = oldBoundVars;
    159158        return ret;
    160159}
     
    162161template< typename TypeClass >
    163162Type *TypeSubstitution::handleAggregateType( TypeClass *type ) {
    164         BoundVarsType oldBoundVars( boundVars );
     163        ValueGuard<BoundVarsType> oldBoundVars( boundVars );
    165164        // bind type variables from forall-qualifiers
    166165        if ( freeOnly ) {
     
    177176        } // if
    178177        Type *ret = Mutator::mutate( type );
    179         boundVars = oldBoundVars;
    180178        return ret;
    181179}
     
    233231}
    234232
    235 TypeSubstitution * TypeSubstitution::acceptMutator( Mutator & mutator ) {
    236         for ( auto & p : typeEnv ) {
    237                 p.second = maybeMutate( p.second, mutator );
    238         }
    239         for ( auto & p : varEnv ) {
    240                 p.second = maybeMutate( p.second, mutator );
    241         }
    242         return this;
    243 }
    244 
    245 void TypeSubstitution::print( std::ostream &os, int indent ) const {
    246         os << std::string( indent, ' ' ) << "Types:" << std::endl;
     233void TypeSubstitution::print( std::ostream &os, Indenter indent ) const {
     234        os << indent << "Types:" << std::endl;
    247235        for ( TypeEnvType::const_iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) {
    248                 os << std::string( indent+2, ' ' ) << i->first << " -> ";
    249                 i->second->print( os, indent+4 );
     236                os << indent+1 << i->first << " -> ";
     237                i->second->print( os, indent+2 );
    250238                os << std::endl;
    251239        } // for
    252         os << std::string( indent, ' ' ) << "Non-types:" << std::endl;
     240        os << indent << "Non-types:" << std::endl;
    253241        for ( VarEnvType::const_iterator i = varEnv.begin(); i != varEnv.end(); ++i ) {
    254                 os << std::string( indent+2, ' ' ) << i->first << " -> ";
    255                 i->second->print( os, indent+4 );
     242                os << indent+1 << i->first << " -> ";
     243                i->second->print( os, indent+2 );
    256244                os << std::endl;
    257245        } // for
  • src/SynTree/TypeSubstitution.h

    r78315272 r3f7e12cb  
    5959        void normalize();
    6060
    61         TypeSubstitution * acceptMutator( Mutator & mutator );
     61        TypeSubstitution * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    6262
    63         void print( std::ostream &os, int indent = 0 ) const;
     63        void print( std::ostream &os, Indenter indent = {} ) const;
    6464        TypeSubstitution *clone() const { return new TypeSubstitution( *this ); }
    6565  private:
     
    8989
    9090        void initialize( const TypeSubstitution &src, TypeSubstitution &dest );
     91
     92        friend class Mutator;
     93
     94        template<typename pass_type>
     95        friend class PassVisitor;
    9196
    9297        typedef std::map< std::string, Type* > TypeEnvType;
  • src/SynTree/TypeofType.cc

    r78315272 r3f7e12cb  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TypeofType.cc -- 
     7// TypeofType.cc --
    88//
    99// Author           : Richard C. Bilson
     
    3333}
    3434
    35 void TypeofType::print( std::ostream &os, int indent ) const {
     35void TypeofType::print( std::ostream &os, Indenter indent ) const {
    3636        Type::print( os, indent );
    3737        os << "type-of expression ";
  • src/SynTree/VarArgsType.cc

    r78315272 r3f7e12cb  
    2525VarArgsType::VarArgsType( Type::Qualifiers tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {}
    2626
    27 void VarArgsType::print( std::ostream &os, int indent ) const {
     27void VarArgsType::print( std::ostream &os, Indenter indent ) const {
    2828        Type::print( os, indent );
    2929        os << "builtin var args pack";
  • src/SynTree/VarExprReplacer.h

    r78315272 r3f7e12cb  
    2929private:
    3030        const DeclMap & declMap;
    31   bool debug;
     31        bool debug;
    3232public:
    3333        VarExprReplacer( const DeclMap & declMap, bool debug = false );
     
    3535        // replace variable with new node from decl map
    3636        virtual void visit( VariableExpr * varExpr );
     37
     38        static void replace( BaseSyntaxNode * node, const DeclMap & declMap, bool debug = false ) {
     39                VarExprReplacer replacer( declMap, debug );
     40                maybeAccept( node, replacer );
     41        }
    3742};
    3843
  • src/SynTree/Visitor.cc

    r78315272 r3f7e12cb  
    1717#include <list>           // for list
    1818
     19#include "Attribute.h"    // for Attribute
    1920#include "Constant.h"     // for Constant
    2021#include "Declaration.h"  // for DeclarationWithType, ObjectDecl, Declaration
     
    3536        maybeAccept( objectDecl->get_init(), *this );
    3637        maybeAccept( objectDecl->get_bitfieldWidth(), *this );
     38        acceptAll( objectDecl->attributes, *this );
    3739}
    3840
     
    4042        maybeAccept( functionDecl->get_functionType(), *this );
    4143        maybeAccept( functionDecl->get_statements(), *this );
     44        acceptAll( functionDecl->attributes, *this );
    4245}
    4346
     
    487490
    488491
    489 void Visitor::visit( __attribute__((unused)) Subrange *subrange ) {}
    490 
    491 
    492 void Visitor::visit( __attribute__((unused)) Constant *constant ) {}
     492void Visitor::visit( Subrange * ) {}
     493
     494
     495void Visitor::visit( Constant * ) {}
     496
     497void Visitor::visit( Attribute * attribute ) {
     498        acceptAll( attribute->parameters, *this );
     499}
     500
    493501// Local Variables: //
    494502// tab-width: 4 //
  • src/SynTree/Visitor.h

    r78315272 r3f7e12cb  
    2525  public:
    2626        // visit: Default implementation of all functions visits the children
    27     // of the given syntax node, but performs no other action.
     27        // of the given syntax node, but performs no other action.
    2828
    29         virtual void visit( ObjectDecl *objectDecl );
    30         virtual void visit( FunctionDecl *functionDecl );
    31         virtual void visit( StructDecl *aggregateDecl );
    32         virtual void visit( UnionDecl *aggregateDecl );
    33         virtual void visit( EnumDecl *aggregateDecl );
    34         virtual void visit( TraitDecl *aggregateDecl );
    35         virtual void visit( TypeDecl *typeDecl );
    36         virtual void visit( TypedefDecl *typeDecl );
    37         virtual void visit( AsmDecl *asmDecl );
     29        virtual void visit( ObjectDecl * objectDecl );
     30        virtual void visit( FunctionDecl * functionDecl );
     31        virtual void visit( StructDecl * aggregateDecl );
     32        virtual void visit( UnionDecl * aggregateDecl );
     33        virtual void visit( EnumDecl * aggregateDecl );
     34        virtual void visit( TraitDecl * aggregateDecl );
     35        virtual void visit( TypeDecl * typeDecl );
     36        virtual void visit( TypedefDecl * typeDecl );
     37        virtual void visit( AsmDecl * asmDecl );
    3838
    39         virtual void visit( CompoundStmt *compoundStmt );
    40         virtual void visit( ExprStmt *exprStmt );
    41         virtual void visit( AsmStmt *asmStmt );
    42         virtual void visit( IfStmt *ifStmt );
    43         virtual void visit( WhileStmt *whileStmt );
    44         virtual void visit( ForStmt *forStmt );
    45         virtual void visit( SwitchStmt *switchStmt );
    46         virtual void visit( CaseStmt *caseStmt );
    47         virtual void visit( BranchStmt *branchStmt );
    48         virtual void visit( ReturnStmt *returnStmt );
    49         virtual void visit( ThrowStmt *throwStmt );
    50         virtual void visit( TryStmt *tryStmt );
    51         virtual void visit( CatchStmt *catchStmt );
    52         virtual void visit( FinallyStmt *finallyStmt );
    53         virtual void visit( WaitForStmt *waitforStmt );
    54         virtual void visit( NullStmt *nullStmt );
    55         virtual void visit( DeclStmt *declStmt );
    56         virtual void visit( ImplicitCtorDtorStmt *impCtorDtorStmt );
     39        virtual void visit( CompoundStmt * compoundStmt );
     40        virtual void visit( ExprStmt * exprStmt );
     41        virtual void visit( AsmStmt * asmStmt );
     42        virtual void visit( IfStmt * ifStmt );
     43        virtual void visit( WhileStmt * whileStmt );
     44        virtual void visit( ForStmt * forStmt );
     45        virtual void visit( SwitchStmt * switchStmt );
     46        virtual void visit( CaseStmt * caseStmt );
     47        virtual void visit( BranchStmt * branchStmt );
     48        virtual void visit( ReturnStmt * returnStmt );
     49        virtual void visit( ThrowStmt * throwStmt );
     50        virtual void visit( TryStmt * tryStmt );
     51        virtual void visit( CatchStmt * catchStmt );
     52        virtual void visit( FinallyStmt * finallyStmt );
     53        virtual void visit( WaitForStmt * waitforStmt );
     54        virtual void visit( NullStmt * nullStmt );
     55        virtual void visit( DeclStmt * declStmt );
     56        virtual void visit( ImplicitCtorDtorStmt * impCtorDtorStmt );
    5757
    58         virtual void visit( ApplicationExpr *applicationExpr );
    59         virtual void visit( UntypedExpr *untypedExpr );
    60         virtual void visit( NameExpr *nameExpr );
    61         virtual void visit( CastExpr *castExpr );
    62         virtual void visit( VirtualCastExpr *castExpr );
    63         virtual void visit( AddressExpr *addressExpr );
    64         virtual void visit( LabelAddressExpr *labAddressExpr );
    65         virtual void visit( UntypedMemberExpr *memberExpr );
    66         virtual void visit( MemberExpr *memberExpr );
    67         virtual void visit( VariableExpr *variableExpr );
    68         virtual void visit( ConstantExpr *constantExpr );
    69         virtual void visit( SizeofExpr *sizeofExpr );
    70         virtual void visit( AlignofExpr *alignofExpr );
    71         virtual void visit( UntypedOffsetofExpr *offsetofExpr );
    72         virtual void visit( OffsetofExpr *offsetofExpr );
    73         virtual void visit( OffsetPackExpr *offsetPackExpr );
    74         virtual void visit( AttrExpr *attrExpr );
    75         virtual void visit( LogicalExpr *logicalExpr );
    76         virtual void visit( ConditionalExpr *conditionalExpr );
    77         virtual void visit( CommaExpr *commaExpr );
    78         virtual void visit( TypeExpr *typeExpr );
    79         virtual void visit( AsmExpr *asmExpr );
    80         virtual void visit( ImplicitCopyCtorExpr *impCpCtorExpr );
    81         virtual void visit( ConstructorExpr * ctorExpr );
    82         virtual void visit( CompoundLiteralExpr *compLitExpr );
    83         virtual void visit( RangeExpr *rangeExpr );
    84         virtual void visit( UntypedTupleExpr *tupleExpr );
    85         virtual void visit( TupleExpr *tupleExpr );
    86         virtual void visit( TupleIndexExpr *tupleExpr );
    87         virtual void visit( TupleAssignExpr *assignExpr );
    88         virtual void visit( StmtExpr * stmtExpr );
    89         virtual void visit( UniqueExpr * uniqueExpr );
    90         virtual void visit( UntypedInitExpr * initExpr );
    91         virtual void visit( InitExpr * initExpr );
     58        virtual void visit( ApplicationExpr * applicationExpr );
     59        virtual void visit( UntypedExpr * untypedExpr );
     60        virtual void visit( NameExpr * nameExpr );
     61        virtual void visit( CastExpr * castExpr );
     62        virtual void visit( VirtualCastExpr * castExpr );
     63        virtual void visit( AddressExpr * addressExpr );
     64        virtual void visit( LabelAddressExpr * labAddressExpr );
     65        virtual void visit( UntypedMemberExpr * memberExpr );
     66        virtual void visit( MemberExpr * memberExpr );
     67        virtual void visit( VariableExpr * variableExpr );
     68        virtual void visit( ConstantExpr * constantExpr );
     69        virtual void visit( SizeofExpr * sizeofExpr );
     70        virtual void visit( AlignofExpr * alignofExpr );
     71        virtual void visit( UntypedOffsetofExpr * offsetofExpr );
     72        virtual void visit( OffsetofExpr * offsetofExpr );
     73        virtual void visit( OffsetPackExpr * offsetPackExpr );
     74        virtual void visit( AttrExpr * attrExpr );
     75        virtual void visit( LogicalExpr * logicalExpr );
     76        virtual void visit( ConditionalExpr * conditionalExpr );
     77        virtual void visit( CommaExpr * commaExpr );
     78        virtual void visit( TypeExpr * typeExpr );
     79        virtual void visit( AsmExpr * asmExpr );
     80        virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr );
     81        virtual void visit( ConstructorExpr *  ctorExpr );
     82        virtual void visit( CompoundLiteralExpr * compLitExpr );
     83        virtual void visit( RangeExpr * rangeExpr );
     84        virtual void visit( UntypedTupleExpr * tupleExpr );
     85        virtual void visit( TupleExpr * tupleExpr );
     86        virtual void visit( TupleIndexExpr * tupleExpr );
     87        virtual void visit( TupleAssignExpr * assignExpr );
     88        virtual void visit( StmtExpr *  stmtExpr );
     89        virtual void visit( UniqueExpr *  uniqueExpr );
     90        virtual void visit( UntypedInitExpr *  initExpr );
     91        virtual void visit( InitExpr *  initExpr );
    9292
    93         virtual void visit( VoidType *basicType );
    94         virtual void visit( BasicType *basicType );
    95         virtual void visit( PointerType *pointerType );
    96         virtual void visit( ArrayType *arrayType );
    97         virtual void visit( ReferenceType *refType );
    98         virtual void visit( FunctionType *functionType );
    99         virtual void visit( StructInstType *aggregateUseType );
    100         virtual void visit( UnionInstType *aggregateUseType );
    101         virtual void visit( EnumInstType *aggregateUseType );
    102         virtual void visit( TraitInstType *aggregateUseType );
    103         virtual void visit( TypeInstType *aggregateUseType );
    104         virtual void visit( TupleType *tupleType );
    105         virtual void visit( TypeofType *typeofType );
    106         virtual void visit( AttrType *attrType );
    107         virtual void visit( VarArgsType *varArgsType );
    108         virtual void visit( ZeroType *zeroType );
    109         virtual void visit( OneType *oneType );
     93        virtual void visit( VoidType * basicType );
     94        virtual void visit( BasicType * basicType );
     95        virtual void visit( PointerType * pointerType );
     96        virtual void visit( ArrayType * arrayType );
     97        virtual void visit( ReferenceType * refType );
     98        virtual void visit( FunctionType * functionType );
     99        virtual void visit( StructInstType * aggregateUseType );
     100        virtual void visit( UnionInstType * aggregateUseType );
     101        virtual void visit( EnumInstType * aggregateUseType );
     102        virtual void visit( TraitInstType * aggregateUseType );
     103        virtual void visit( TypeInstType * aggregateUseType );
     104        virtual void visit( TupleType * tupleType );
     105        virtual void visit( TypeofType * typeofType );
     106        virtual void visit( AttrType * attrType );
     107        virtual void visit( VarArgsType * varArgsType );
     108        virtual void visit( ZeroType * zeroType );
     109        virtual void visit( OneType * oneType );
    110110
    111         virtual void visit( Designation *designation );
    112         virtual void visit( SingleInit *singleInit );
    113         virtual void visit( ListInit *listInit );
    114         virtual void visit( ConstructorInit *ctorInit );
     111        virtual void visit( Designation * designation );
     112        virtual void visit( SingleInit * singleInit );
     113        virtual void visit( ListInit * listInit );
     114        virtual void visit( ConstructorInit * ctorInit );
    115115
    116         virtual void visit( Subrange *subrange );
     116        virtual void visit( Subrange * subrange );
    117117
    118         virtual void visit( Constant *constant );
     118        virtual void visit( Constant * constant );
     119
     120        virtual void visit( Attribute * attribute );
    119121  private:
    120122        virtual void handleAggregateDecl( AggregateDecl *aggregateDecl );
  • src/SynTree/VoidType.cc

    r78315272 r3f7e12cb  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // VoidType.cc -- 
     7// VoidType.cc --
    88//
    99// Author           : Richard C. Bilson
     
    2424}
    2525
    26 void VoidType::print( std::ostream &os, int indent ) const {
     26void VoidType::print( std::ostream &os, Indenter indent ) const {
    2727        Type::print( os, indent );
    2828        os << "void ";
  • src/SynTree/ZeroOneType.cc

    r78315272 r3f7e12cb  
    2525ZeroType::ZeroType( Type::Qualifiers tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {}
    2626
    27 void ZeroType::print( std::ostream &os, __attribute__((unused)) int indent ) const {
     27void ZeroType::print( std::ostream &os, Indenter ) const {
    2828        os << "zero_t";
    2929}
     
    3333OneType::OneType( Type::Qualifiers tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {}
    3434
    35 void OneType::print( std::ostream &os, __attribute__((unused)) int indent ) const {
     35void OneType::print( std::ostream &os, Indenter ) const {
    3636        os << "one_t";
    3737}
  • src/SynTree/module.mk

    r78315272 r3f7e12cb  
    4848       SynTree/Visitor.cc \
    4949       SynTree/Mutator.cc \
    50        SynTree/AddStmtVisitor.cc \
    5150       SynTree/TypeSubstitution.cc \
    5251       SynTree/Attribute.cc \
  • src/Tuples/TupleAssignment.cc

    r78315272 r3f7e12cb  
    9595        bool isTuple( Expression *expr ) {
    9696                if ( ! expr ) return false;
    97                 assert( expr->has_result() );
     97                assert( expr->result );
    9898                return dynamic_cast< TupleType * >( expr->get_result()->stripReferences() );
    9999        }
     
    285285
    286286        ObjectDecl * TupleAssignSpotter::Matcher::newObject( UniqueName & namer, Expression * expr ) {
    287                 assert( expr->has_result() && ! expr->get_result()->isVoid() );
     287                assert( expr->result && ! expr->get_result()->isVoid() );
    288288                ObjectDecl * ret = new ObjectDecl( namer.newName(), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) );
    289289                // if expression type is a reference, don't need to construct anything, a simple initializer is sufficient.
     
    295295                        ctorInit->accept( rm );
    296296                }
     297                PRINT( std::cerr << "new object: " << ret << std::endl; )
    297298                return ret;
    298299        }
  • src/Tuples/TupleExpansion.cc

    r78315272 r3f7e12cb  
    2121#include "Common/ScopedMap.h"     // for ScopedMap
    2222#include "Common/utility.h"       // for CodeLocation
    23 #include "GenPoly/DeclMutator.h"  // for DeclMutator
    2423#include "InitTweak/InitTweak.h"  // for getFunction
    2524#include "Parser/LinkageSpec.h"   // for Spec, C, Intrinsic
     
    205204                        decl->set_body( true );
    206205                        for ( size_t i = 0; i < tupleSize; ++i ) {
    207                                 TypeDecl * tyParam = new TypeDecl( toString( "tuple_param_", tupleSize, "_", i ), Type::StorageClasses(), nullptr, TypeDecl::Any );
     206                                TypeDecl * tyParam = new TypeDecl( toString( "tuple_param_", tupleSize, "_", i ), Type::StorageClasses(), nullptr, TypeDecl::Dtype, true );
    208207                                decl->get_members().push_back( new ObjectDecl( toString("field_", i ), Type::StorageClasses(), LinkageSpec::C, nullptr, new TypeInstType( Type::Qualifiers(), tyParam->get_name(), tyParam ), nullptr ) );
    209208                                decl->get_parameters().push_back( tyParam );
  • src/benchmark/Makefile.am

    r78315272 r3f7e12cb  
    1919AM_CFLAGS = -g -Wall -Wno-unused-function -O2
    2020CC = @CFA_BINDIR@/@CFA_NAME@
     21TOOLSDIR = ${abs_top_srcdir}/tools/
     22REPEAT   = ${TOOLSDIR}repeat
     23STATS    = ${TOOLSDIR}stat.py
     24repeats  = 30
    2125
    22 noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) ctxswitch-thread$(EXEEXT) sched-int$(EXEEXT) monitor$(EXEEXT) csv-data$(EXEEXT)
     26.NOTPARALLEL:
     27
     28noinst_PROGRAMS =
     29
     30all : ctxswitch$(EXEEXT) mutex$(EXEEXT) signal$(EXEEXT) waitfor$(EXEEXT) creation$(EXEEXT)
    2331
    2432bench$(EXEEXT) :
     
    3038        rm -f ./a.out ;
    3139
    32 ctxswitch-coroutine$(EXEEXT):
    33         ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=50000000 CorCtxSwitch.c
    34         @rm -f .result.log
    35         @for number in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do \
    36                 ./a.out | tee -a .result.log ; \
    37         done
    38         @./stat.py .result.log
    39         @rm -f a.out .result.log
    40 
    41 ctxswitch-thread$(EXEEXT):
    42         ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=50000000 ThrdCtxSwitch.c
    43         @rm -f .result.log
    44         @for number in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do \
    45                 ./a.out | tee -a .result.log ; \
    46         done
    47         @./stat.py .result.log
    48         @rm -f a.out .result.log
    49 
    50 sched-int$(EXEEXT):
    51         ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=50000000 SchedInt.c
    52         @rm -f .result.log
    53         @for number in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do \
    54                 ./a.out | tee -a .result.log ; \
    55         done
    56         @./stat.py .result.log
    57         @rm -f a.out .result.log
    58 
    59 monitor$(EXEEXT):
    60         ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=50000000 Monitor.c
    61         @rm -f .result.log
    62         @for number in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do \
    63                 ./a.out | tee -a .result.log ; \
    64         done
    65         @./stat.py .result.log
    66         @rm -f a.out .result.log
    67 
    6840csv-data$(EXEEXT):
    6941        @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=50000000 csv-data.c
    7042        @./a.out
    7143        @rm -f ./a.out
     44
     45## =========================================================================================================
     46ctxswitch$(EXEEXT): \
     47        ctxswitch-pthread.run           \
     48        ctxswitch-cfa_coroutine.run     \
     49        ctxswitch-cfa_thread.run        \
     50        ctxswitch-upp_coroutine.run     \
     51        ctxswitch-upp_thread.run
     52
     53ctxswitch-cfa_coroutine$(EXEEXT):
     54        ${CC}        ctxswitch/cfa_cor.c   -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     55
     56ctxswitch-cfa_thread$(EXEEXT):
     57        ${CC}        ctxswitch/cfa_thrd.c  -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     58
     59ctxswitch-upp_coroutine$(EXEEXT):
     60        u++          ctxswitch/upp_cor.cc  -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     61
     62ctxswitch-upp_thread$(EXEEXT):
     63        u++          ctxswitch/upp_thrd.cc -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     64
     65ctxswitch-pthread$(EXEEXT):
     66        @BACKEND_CC@ ctxswitch/pthreads.c  -DBENCH_N=50000000  -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     67
     68## =========================================================================================================
     69mutex$(EXEEXT) :\
     70        mutex-function.run      \
     71        mutex-pthread_lock.run  \
     72        mutex-upp.run           \
     73        mutex-cfa1.run          \
     74        mutex-cfa2.run          \
     75        mutex-cfa4.run
     76
     77mutex-function$(EXEEXT):
     78        @BACKEND_CC@ mutex/function.c    -DBENCH_N=500000000   -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     79
     80mutex-pthread_lock$(EXEEXT):
     81        @BACKEND_CC@ mutex/pthreads.c    -DBENCH_N=50000000    -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     82
     83mutex-upp$(EXEEXT):
     84        u++          mutex/upp.cc        -DBENCH_N=50000000    -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     85
     86mutex-cfa1$(EXEEXT):
     87        ${CC}        mutex/cfa1.c        -DBENCH_N=5000000     -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     88
     89mutex-cfa2$(EXEEXT):
     90        ${CC}        mutex/cfa2.c        -DBENCH_N=5000000     -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     91
     92mutex-cfa4$(EXEEXT):
     93        ${CC}        mutex/cfa4.c        -DBENCH_N=5000000     -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     94
     95## =========================================================================================================
     96signal$(EXEEXT) :\
     97        signal-upp.run          \
     98        signal-cfa1.run         \
     99        signal-cfa2.run         \
     100        signal-cfa4.run
     101
     102signal-upp$(EXEEXT):
     103        u++          schedint/upp.cc     -DBENCH_N=5000000     -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     104
     105signal-cfa1$(EXEEXT):
     106        ${CC}        schedint/cfa1.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     107
     108signal-cfa2$(EXEEXT):
     109        ${CC}        schedint/cfa2.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     110
     111signal-cfa4$(EXEEXT):
     112        ${CC}        schedint/cfa4.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     113
     114## =========================================================================================================
     115waitfor$(EXEEXT) :\
     116        waitfor-upp.run         \
     117        waitfor-cfa1.run                \
     118        waitfor-cfa2.run                \
     119        waitfor-cfa4.run
     120
     121waitfor-upp$(EXEEXT):
     122        u++          schedext/upp.cc     -DBENCH_N=5000000     -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     123
     124waitfor-cfa1$(EXEEXT):
     125        ${CC}        schedext/cfa1.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     126
     127waitfor-cfa2$(EXEEXT):
     128        ${CC}        schedext/cfa2.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     129
     130waitfor-cfa4$(EXEEXT):
     131        ${CC}        schedext/cfa4.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     132
     133## =========================================================================================================
     134creation$(EXEEXT) :\
     135        creation-pthread.run            \
     136        creation-cfa_coroutine.run      \
     137        creation-cfa_thread.run         \
     138        creation-upp_coroutine.run      \
     139        creation-upp_thread.run
     140
     141creation-cfa_coroutine$(EXEEXT):
     142        ${CC}        creation/cfa_cor.c   -DBENCH_N=10000000   -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     143
     144creation-cfa_thread$(EXEEXT):
     145        ${CC}        creation/cfa_thrd.c  -DBENCH_N=10000000   -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     146
     147creation-upp_coroutine$(EXEEXT):
     148        u++          creation/upp_cor.cc  -DBENCH_N=50000000   -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     149
     150creation-upp_thread$(EXEEXT):
     151        u++          creation/upp_thrd.cc -DBENCH_N=50000000   -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     152
     153creation-pthread$(EXEEXT):
     154        @BACKEND_CC@ creation/pthreads.c  -DBENCH_N=250000     -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     155
     156## =========================================================================================================
     157
     158%.run : %$(EXEEXT) ${REPEAT}
     159        @rm -f .result.log
     160        @echo "------------------------------------------------------"
     161        @echo $<
     162        @${REPEAT} ${repeats} ./a.out | tee -a .result.log
     163        @${STATS} .result.log
     164        @echo "------------------------------------------------------"
     165        @rm -f a.out .result.log
     166
     167${REPEAT} :
     168        @+make -C ${TOOLSDIR} repeat
  • src/benchmark/Makefile.in

    r78315272 r3f7e12cb  
    9292build_triplet = @build@
    9393host_triplet = @host@
     94noinst_PROGRAMS =
    9495subdir = src/benchmark
    9596ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
     
    103104CONFIG_CLEAN_VPATH_FILES =
    104105PROGRAMS = $(noinst_PROGRAMS)
    105 bench_SOURCES = bench.c
    106 bench_OBJECTS = bench.$(OBJEXT)
    107 bench_LDADD = $(LDADD)
    108 csv_data_SOURCES = csv-data.c
    109 csv_data_OBJECTS = csv-data.$(OBJEXT)
    110 csv_data_LDADD = $(LDADD)
    111 ctxswitch_coroutine_SOURCES = ctxswitch-coroutine.c
    112 ctxswitch_coroutine_OBJECTS = ctxswitch-coroutine.$(OBJEXT)
    113 ctxswitch_coroutine_LDADD = $(LDADD)
    114 ctxswitch_thread_SOURCES = ctxswitch-thread.c
    115 ctxswitch_thread_OBJECTS = ctxswitch-thread.$(OBJEXT)
    116 ctxswitch_thread_LDADD = $(LDADD)
    117 monitor_SOURCES = monitor.c
    118 monitor_OBJECTS = monitor.$(OBJEXT)
    119 monitor_LDADD = $(LDADD)
    120 sched_int_SOURCES = sched-int.c
    121 sched_int_OBJECTS = sched-int.$(OBJEXT)
    122 sched_int_LDADD = $(LDADD)
    123106AM_V_P = $(am__v_P_@AM_V@)
    124107am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     
    133116am__v_at_0 = @
    134117am__v_at_1 =
    135 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    136 depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
    137 am__depfiles_maybe = depfiles
    138 am__mv = mv -f
    139 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    140         $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
    141 AM_V_CC = $(am__v_CC_@AM_V@)
    142 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    143 am__v_CC_0 = @echo "  CC      " $@;
    144 am__v_CC_1 =
    145 CCLD = $(CC)
    146 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    147 AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    148 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    149 am__v_CCLD_0 = @echo "  CCLD    " $@;
    150 am__v_CCLD_1 =
    151 SOURCES = bench.c csv-data.c ctxswitch-coroutine.c ctxswitch-thread.c \
    152         monitor.c sched-int.c
    153 DIST_SOURCES = bench.c csv-data.c ctxswitch-coroutine.c \
    154         ctxswitch-thread.c monitor.c sched-int.c
     118SOURCES =
     119DIST_SOURCES =
    155120am__can_run_installinfo = \
    156121  case $$AM_UPDATE_INFO_DIR in \
     
    159124  esac
    160125am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    161 # Read a list of newline-separated strings from the standard input,
    162 # and print each of them once, without duplicates.  Input order is
    163 # *not* preserved.
    164 am__uniquify_input = $(AWK) '\
    165   BEGIN { nonempty = 0; } \
    166   { items[$$0] = 1; nonempty = 1; } \
    167   END { if (nonempty) { for (i in items) print i; }; } \
    168 '
    169 # Make sure the list of sources is unique.  This is necessary because,
    170 # e.g., the same source file might be shared among _SOURCES variables
    171 # for different programs/libraries.
    172 am__define_uniq_tagged_files = \
    173   list='$(am__tagged_files)'; \
    174   unique=`for i in $$list; do \
    175     if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    176   done | $(am__uniquify_input)`
    177 ETAGS = etags
    178 CTAGS = ctags
    179 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
     126am__DIST_COMMON = $(srcdir)/Makefile.in
    180127DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    181128ACLOCAL = @ACLOCAL@
     
    302249top_srcdir = @top_srcdir@
    303250AM_CFLAGS = -g -Wall -Wno-unused-function -O2
    304 noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) ctxswitch-thread$(EXEEXT) sched-int$(EXEEXT) monitor$(EXEEXT) csv-data$(EXEEXT)
     251TOOLSDIR = ${abs_top_srcdir}/tools/
     252REPEAT = ${TOOLSDIR}repeat
     253STATS = ${TOOLSDIR}stat.py
     254repeats = 30
    305255all: all-am
    306256
    307257.SUFFIXES:
    308 .SUFFIXES: .c .o .obj
    309258$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
    310259        @for dep in $?; do \
     
    339288clean-noinstPROGRAMS:
    340289        -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
    341 
    342 mostlyclean-compile:
    343         -rm -f *.$(OBJEXT)
    344 
    345 distclean-compile:
    346         -rm -f *.tab.c
    347 
    348 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bench.Po@am__quote@
    349 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csv-data.Po@am__quote@
    350 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctxswitch-coroutine.Po@am__quote@
    351 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctxswitch-thread.Po@am__quote@
    352 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor.Po@am__quote@
    353 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched-int.Po@am__quote@
    354 
    355 .c.o:
    356 @am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
    357 @am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
    358 @am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
    359 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    360 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    361 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
    362 
    363 .c.obj:
    364 @am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
    365 @am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
    366 @am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
    367 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    368 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    369 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    370 
    371 ID: $(am__tagged_files)
    372         $(am__define_uniq_tagged_files); mkid -fID $$unique
    373 tags: tags-am
    374 TAGS: tags
    375 
    376 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    377         set x; \
    378         here=`pwd`; \
    379         $(am__define_uniq_tagged_files); \
    380         shift; \
    381         if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
    382           test -n "$$unique" || unique=$$empty_fix; \
    383           if test $$# -gt 0; then \
    384             $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    385               "$$@" $$unique; \
    386           else \
    387             $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    388               $$unique; \
    389           fi; \
    390         fi
    391 ctags: ctags-am
    392 
    393 CTAGS: ctags
    394 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    395         $(am__define_uniq_tagged_files); \
    396         test -z "$(CTAGS_ARGS)$$unique" \
    397           || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
    398              $$unique
    399 
    400 GTAGS:
    401         here=`$(am__cd) $(top_builddir) && pwd` \
    402           && $(am__cd) $(top_srcdir) \
    403           && gtags -i $(GTAGS_ARGS) "$$here"
    404 cscopelist: cscopelist-am
    405 
    406 cscopelist-am: $(am__tagged_files)
    407         list='$(am__tagged_files)'; \
    408         case "$(srcdir)" in \
    409           [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
    410           *) sdir=$(subdir)/$(srcdir) ;; \
    411         esac; \
    412         for i in $$list; do \
    413           if test -f "$$i"; then \
    414             echo "$(subdir)/$$i"; \
    415           else \
    416             echo "$$sdir/$$i"; \
    417           fi; \
    418         done >> $(top_builddir)/cscope.files
    419 
    420 distclean-tags:
    421         -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
     290tags TAGS:
     291
     292ctags CTAGS:
     293
     294cscope cscopelist:
     295
    422296
    423297distdir: $(DISTFILES)
     
    490364
    491365distclean: distclean-am
    492         -rm -rf ./$(DEPDIR)
    493366        -rm -f Makefile
    494 distclean-am: clean-am distclean-compile distclean-generic \
    495         distclean-tags
     367distclean-am: clean-am distclean-generic
    496368
    497369dvi: dvi-am
     
    536408
    537409maintainer-clean: maintainer-clean-am
    538         -rm -rf ./$(DEPDIR)
    539410        -rm -f Makefile
    540411maintainer-clean-am: distclean-am maintainer-clean-generic
     
    542413mostlyclean: mostlyclean-am
    543414
    544 mostlyclean-am: mostlyclean-compile mostlyclean-generic
     415mostlyclean-am: mostlyclean-generic
    545416
    546417pdf: pdf-am
     
    556427.MAKE: install-am install-strip
    557428
    558 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
    559         clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
    560         distclean-compile distclean-generic distclean-tags distdir dvi \
    561         dvi-am html html-am info info-am install install-am \
    562         install-data install-data-am install-dvi install-dvi-am \
    563         install-exec install-exec-am install-html install-html-am \
    564         install-info install-info-am install-man install-pdf \
    565         install-pdf-am install-ps install-ps-am install-strip \
    566         installcheck installcheck-am installdirs maintainer-clean \
    567         maintainer-clean-generic mostlyclean mostlyclean-compile \
    568         mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
     429.PHONY: all all-am check check-am clean clean-generic \
     430        clean-noinstPROGRAMS cscopelist-am ctags-am distclean \
     431        distclean-generic distdir dvi dvi-am html html-am info info-am \
     432        install install-am install-data install-data-am install-dvi \
     433        install-dvi-am install-exec install-exec-am install-html \
     434        install-html-am install-info install-info-am install-man \
     435        install-pdf install-pdf-am install-ps install-ps-am \
     436        install-strip installcheck installcheck-am installdirs \
     437        maintainer-clean maintainer-clean-generic mostlyclean \
     438        mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \
    569439        uninstall-am
    570440
    571441.PRECIOUS: Makefile
    572442
     443
     444.NOTPARALLEL:
     445
     446all : ctxswitch$(EXEEXT) mutex$(EXEEXT) signal$(EXEEXT) waitfor$(EXEEXT) creation$(EXEEXT)
    573447
    574448bench$(EXEEXT) :
     
    580454        rm -f ./a.out ;
    581455
    582 ctxswitch-coroutine$(EXEEXT):
    583         ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=50000000 CorCtxSwitch.c
    584         @rm -f .result.log
    585         @for number in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do \
    586                 ./a.out | tee -a .result.log ; \
    587         done
    588         @./stat.py .result.log
    589         @rm -f a.out .result.log
    590 
    591 ctxswitch-thread$(EXEEXT):
    592         ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=50000000 ThrdCtxSwitch.c
    593         @rm -f .result.log
    594         @for number in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do \
    595                 ./a.out | tee -a .result.log ; \
    596         done
    597         @./stat.py .result.log
    598         @rm -f a.out .result.log
    599 
    600 sched-int$(EXEEXT):
    601         ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=50000000 SchedInt.c
    602         @rm -f .result.log
    603         @for number in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do \
    604                 ./a.out | tee -a .result.log ; \
    605         done
    606         @./stat.py .result.log
    607         @rm -f a.out .result.log
    608 
    609 monitor$(EXEEXT):
    610         ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=50000000 Monitor.c
    611         @rm -f .result.log
    612         @for number in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do \
    613                 ./a.out | tee -a .result.log ; \
    614         done
    615         @./stat.py .result.log
    616         @rm -f a.out .result.log
    617 
    618456csv-data$(EXEEXT):
    619457        @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=50000000 csv-data.c
     
    621459        @rm -f ./a.out
    622460
     461ctxswitch$(EXEEXT): \
     462        ctxswitch-pthread.run           \
     463        ctxswitch-cfa_coroutine.run     \
     464        ctxswitch-cfa_thread.run        \
     465        ctxswitch-upp_coroutine.run     \
     466        ctxswitch-upp_thread.run
     467
     468ctxswitch-cfa_coroutine$(EXEEXT):
     469        ${CC}        ctxswitch/cfa_cor.c   -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     470
     471ctxswitch-cfa_thread$(EXEEXT):
     472        ${CC}        ctxswitch/cfa_thrd.c  -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     473
     474ctxswitch-upp_coroutine$(EXEEXT):
     475        u++          ctxswitch/upp_cor.cc  -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     476
     477ctxswitch-upp_thread$(EXEEXT):
     478        u++          ctxswitch/upp_thrd.cc -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     479
     480ctxswitch-pthread$(EXEEXT):
     481        @BACKEND_CC@ ctxswitch/pthreads.c  -DBENCH_N=50000000  -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     482
     483mutex$(EXEEXT) :\
     484        mutex-function.run      \
     485        mutex-pthread_lock.run  \
     486        mutex-upp.run           \
     487        mutex-cfa1.run          \
     488        mutex-cfa2.run          \
     489        mutex-cfa4.run
     490
     491mutex-function$(EXEEXT):
     492        @BACKEND_CC@ mutex/function.c    -DBENCH_N=500000000   -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     493
     494mutex-pthread_lock$(EXEEXT):
     495        @BACKEND_CC@ mutex/pthreads.c    -DBENCH_N=50000000    -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     496
     497mutex-upp$(EXEEXT):
     498        u++          mutex/upp.cc        -DBENCH_N=50000000    -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     499
     500mutex-cfa1$(EXEEXT):
     501        ${CC}        mutex/cfa1.c        -DBENCH_N=5000000     -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     502
     503mutex-cfa2$(EXEEXT):
     504        ${CC}        mutex/cfa2.c        -DBENCH_N=5000000     -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     505
     506mutex-cfa4$(EXEEXT):
     507        ${CC}        mutex/cfa4.c        -DBENCH_N=5000000     -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     508
     509signal$(EXEEXT) :\
     510        signal-upp.run          \
     511        signal-cfa1.run         \
     512        signal-cfa2.run         \
     513        signal-cfa4.run
     514
     515signal-upp$(EXEEXT):
     516        u++          schedint/upp.cc     -DBENCH_N=5000000     -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     517
     518signal-cfa1$(EXEEXT):
     519        ${CC}        schedint/cfa1.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     520
     521signal-cfa2$(EXEEXT):
     522        ${CC}        schedint/cfa2.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     523
     524signal-cfa4$(EXEEXT):
     525        ${CC}        schedint/cfa4.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     526
     527waitfor$(EXEEXT) :\
     528        waitfor-upp.run         \
     529        waitfor-cfa1.run                \
     530        waitfor-cfa2.run                \
     531        waitfor-cfa4.run
     532
     533waitfor-upp$(EXEEXT):
     534        u++          schedext/upp.cc     -DBENCH_N=5000000     -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     535
     536waitfor-cfa1$(EXEEXT):
     537        ${CC}        schedext/cfa1.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     538
     539waitfor-cfa2$(EXEEXT):
     540        ${CC}        schedext/cfa2.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     541
     542waitfor-cfa4$(EXEEXT):
     543        ${CC}        schedext/cfa4.c     -DBENCH_N=500000      -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     544
     545creation$(EXEEXT) :\
     546        creation-pthread.run            \
     547        creation-cfa_coroutine.run      \
     548        creation-cfa_thread.run         \
     549        creation-upp_coroutine.run      \
     550        creation-upp_thread.run
     551
     552creation-cfa_coroutine$(EXEEXT):
     553        ${CC}        creation/cfa_cor.c   -DBENCH_N=10000000   -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     554
     555creation-cfa_thread$(EXEEXT):
     556        ${CC}        creation/cfa_thrd.c  -DBENCH_N=10000000   -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     557
     558creation-upp_coroutine$(EXEEXT):
     559        u++          creation/upp_cor.cc  -DBENCH_N=50000000   -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     560
     561creation-upp_thread$(EXEEXT):
     562        u++          creation/upp_thrd.cc -DBENCH_N=50000000   -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     563
     564creation-pthread$(EXEEXT):
     565        @BACKEND_CC@ creation/pthreads.c  -DBENCH_N=250000     -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     566
     567%.run : %$(EXEEXT) ${REPEAT}
     568        @rm -f .result.log
     569        @echo "------------------------------------------------------"
     570        @echo $<
     571        @${REPEAT} ${repeats} ./a.out | tee -a .result.log
     572        @${STATS} .result.log
     573        @echo "------------------------------------------------------"
     574        @rm -f a.out .result.log
     575
     576${REPEAT} :
     577        @+make -C ${TOOLSDIR} repeat
     578
    623579# Tell versions [3.59,3.63) of GNU make to not export all variables.
    624580# Otherwise a system limit (for SysV at least) may be exceeded.
  • src/benchmark/bench.h

    r78315272 r3f7e12cb  
    11#pragma once
    22
     3#if defined(__CFORALL__)
    34extern "C" {
     5#endif
     6        #include <stdlib.h>
    47        #include <unistd.h>                                     // sysconf
    58        #include <sys/times.h>                                  // times
    69        #include <time.h>
     10#if defined(__CFORALL__)
    711}
     12#endif
    813
    9 inline unsigned long long int Time() {
    10     timespec ts;
     14static inline unsigned long long int Time() {
     15    struct timespec ts;
    1116    clock_gettime(
    1217#if defined( __linux__ )
     
    2328} // Time
    2429
    25 #ifndef N
    26 #define N 10000000
     30#ifndef BENCH_N
     31#define BENCH_N 500 //10000000
    2732#endif
     33
     34#define BENCH(statement, output)                \
     35        size_t n = BENCH_N;                     \
     36        if( argc > 2 ) return 1;                \
     37        if( argc == 2 ) {                               \
     38                n = atoi(argv[1]);              \
     39        }                                               \
     40        long long int StartTime, EndTime;       \
     41        StartTime = Time();                     \
     42        statement;                                      \
     43        EndTime = Time();                               \
     44        unsigned long long int output =         \
     45        ( EndTime - StartTime ) / n;
    2846
    2947unsigned int default_preemption() {
  • src/benchmark/csv-data.c

    r78315272 r3f7e12cb  
    111111        StartTime = Time();
    112112        for( int i = 0;; i++ ) {
    113                 signal(&cond1a);
    114                 if( i > N ) break;
    115                 wait(&cond1b);
     113                signal(cond1a);
     114                if( i > N ) break;
     115                wait(cond1b);
    116116        }
    117117        EndTime = Time();
     
    122122void side1B( mon_t & mutex a ) {
    123123        for( int i = 0;; i++ ) {
    124                 signal(&cond1b);
    125                 if( i > N ) break;
    126                 wait(&cond1a);
     124                signal(cond1b);
     125                if( i > N ) break;
     126                wait(cond1a);
    127127        }
    128128}
     
    159159        StartTime = Time();
    160160        for( int i = 0;; i++ ) {
    161                 signal(&cond2a);
    162                 if( i > N ) break;
    163                 wait(&cond2b);
     161                signal(cond2a);
     162                if( i > N ) break;
     163                wait(cond2b);
    164164        }
    165165        EndTime = Time();
     
    170170void side2B( mon_t & mutex a, mon_t & mutex b ) {
    171171        for( int i = 0;; i++ ) {
    172                 signal(&cond2b);
    173                 if( i > N ) break;
    174                 wait(&cond2a);
     172                signal(cond2b);
     173                if( i > N ) break;
     174                wait(cond2a);
    175175        }
    176176}
  • src/driver/cfa.cc

    r78315272 r3f7e12cb  
    99// Author           : Peter A. Buhr
    1010// Created On       : Tue Aug 20 13:44:49 2002
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 17 15:24:00 2017
    13 // Update Count     : 156
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Oct 31 11:40:44 2017
     13// Update Count     : 160
    1414//
    1515
     
    305305        } // if
    306306
     307        shuffle( args, sargs, nargs, 1 );                                       // make room at front of argument list
     308        nargs += 1;
    307309        if ( CFA_flag ) {
     310                args[sargs] = "-D__CFA_FLAG__=-N";
    308311                args[nargs] = "-D__CFA_PREPROCESS_";
    309312                nargs += 1;
    310         } // if
     313        } else {
     314                args[sargs] = "-D__CFA_FLAG__=-L";
     315        } // if
     316        sargs += 1;
    311317
    312318        if ( debug ) {
     
    345351                } // if
    346352                args[nargs] = "-fgnu89-inline";
     353                nargs += 1;
     354                args[nargs] = "-D__int8_t_defined";                             // prevent gcc type-size attributes
    347355                nargs += 1;
    348356                args[nargs] = ( *new string( string("-B") + Bprefix + "/" ) ).c_str();
  • src/include/cassert

    r78315272 r3f7e12cb  
    4141static inline T strict_dynamic_cast( const U & src ) {
    4242        T ret = dynamic_cast<T>(src);
    43         assert(ret);
     43        assertf(ret, "%s", toString(src).c_str());
    4444        return ret;
    4545}
  • src/libcfa/Makefile.am

    r78315272 r3f7e12cb  
    3131
    3232libcfa_a-libcfa-prelude.o : libcfa-prelude.c
    33          ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -O2 -c -o $@ $<
     33         ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -Wall -O2 -c -o $@ $<
    3434
    3535libcfa_d_a-libcfa-prelude.o : libcfa-prelude.c
    36          ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -D__CFA_DEBUG__ -O0 -c -o $@ $<
     36         ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -D__CFA_DEBUG__ -Wall -O0 -c -o $@ $<
    3737
    38 EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -imacros libcfa-prelude.c @CFA_FLAGS@
     38EXTRA_FLAGS = -g -Wall -Wno-unused-function -imacros libcfa-prelude.c @CFA_FLAGS@
    3939
    4040AM_CCASFLAGS = @CFA_FLAGS@
  • src/libcfa/Makefile.in

    r78315272 r3f7e12cb  
    416416ARFLAGS = cr
    417417lib_LIBRARIES = $(am__append_1) $(am__append_2)
    418 EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -imacros libcfa-prelude.c @CFA_FLAGS@
     418EXTRA_FLAGS = -g -Wall -Wno-unused-function -imacros libcfa-prelude.c @CFA_FLAGS@
    419419AM_CCASFLAGS = @CFA_FLAGS@
    420420headers = fstream iostream iterator limits rational stdlib \
     
    14981498
    14991499libcfa_a-libcfa-prelude.o : libcfa-prelude.c
    1500          ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -O2 -c -o $@ $<
     1500         ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -Wall -O2 -c -o $@ $<
    15011501
    15021502libcfa_d_a-libcfa-prelude.o : libcfa-prelude.c
    1503          ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -D__CFA_DEBUG__ -O0 -c -o $@ $<
     1503         ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -D__CFA_DEBUG__ -Wall -O0 -c -o $@ $<
    15041504
    15051505# extensionless header files are overridden by -o flag in default makerule => explicitly override default rule to silently do nothing
  • src/libcfa/concurrency/coroutine.c

    r78315272 r3f7e12cb  
    123123        if(pageSize == 0ul) pageSize = sysconf( _SC_PAGESIZE );
    124124
    125         LIB_DEBUG_PRINT_SAFE("FRED");
    126 
    127125        size_t cxtSize = libCeiling( sizeof(machine_context_t), 8 ); // minimum alignment
    128126
     
    158156                this->limit = (char *)libCeiling( (unsigned long)this->storage, 16 ); // minimum alignment
    159157        } // if
    160         assertf( this->size >= MinStackSize, "Stack size %d provides less than minimum of %d bytes for a stack.", this->size, MinStackSize );
     158        assertf( this->size >= MinStackSize, "Stack size %zd provides less than minimum of %d bytes for a stack.", this->size, MinStackSize );
    161159
    162160        this->base = (char *)this->limit + this->size;
  • src/libcfa/concurrency/invoke.h

    r78315272 r3f7e12cb  
    2525#define _INVOKE_H_
    2626
    27       #define unlikely(x)    __builtin_expect(!!(x), 0)
    28       #define thread_local _Thread_local
    29 
    30       typedef void (*fptr_t)();
    31 
    32       struct spinlock {
    33             volatile int lock;
    34             #ifdef __CFA_DEBUG__
    35                   const char * prev_name;
    36                   void* prev_thrd;
    37             #endif
    38       };
    39 
    40       struct __thread_queue_t {
    41             struct thread_desc * head;
    42             struct thread_desc ** tail;
    43       };
    44 
    45       struct __condition_stack_t {
    46             struct __condition_criterion_t * top;
    47       };
    48 
    49       #ifdef __CFORALL__
    50       extern "Cforall" {
    51             void ?{}( struct __thread_queue_t & );
    52             void append( struct __thread_queue_t *, struct thread_desc * );
    53             struct thread_desc * pop_head( struct __thread_queue_t * );
    54             struct thread_desc * remove( struct __thread_queue_t *, struct thread_desc ** );
    55 
    56             void ?{}( struct __condition_stack_t & );
    57             void push( struct __condition_stack_t *, struct __condition_criterion_t * );
    58             struct __condition_criterion_t * pop( struct __condition_stack_t * );
    59 
    60             void ?{}(spinlock & this);
    61             void ^?{}(spinlock & this);
    62       }
    63       #endif
    64 
    65       struct coStack_t {
    66             unsigned int size;                        // size of stack
    67             void *storage;                            // pointer to stack
    68             void *limit;                              // stack grows towards stack limit
    69             void *base;                               // base of stack
    70             void *context;                            // address of cfa_context_t
    71             void *top;                                // address of top of storage
    72             bool userStack;                           // whether or not the user allocated the stack
    73       };
    74 
    75       enum coroutine_state { Halted, Start, Inactive, Active, Primed };
    76 
    77       struct coroutine_desc {
    78             struct coStack_t stack;                   // stack information of the coroutine
    79             const char *name;                         // textual name for coroutine/task, initialized by uC++ generated code
    80             int errno_;                               // copy of global UNIX variable errno
    81             enum coroutine_state state;               // current execution status for coroutine
    82             struct coroutine_desc * starter;          // first coroutine to resume this one
    83             struct coroutine_desc * last;             // last coroutine to resume this one
    84       };
    85 
    86       struct monitor_desc {
    87             struct spinlock lock;                     // spinlock to protect internal data
    88             struct thread_desc * owner;               // current owner of the monitor
    89             struct __thread_queue_t entry_queue;      // queue of threads that are blocked waiting for the monitor
    90             struct __condition_stack_t signal_stack;  // stack of conditions to run next once we exit the monitor
    91             unsigned int recursion;                   // monitor routines can be called recursively, we need to keep track of that
    92 
    93             struct __acceptable_t * acceptables;      // list of acceptable functions, null if any
    94             unsigned short acceptable_count;          // number of acceptable functions
    95             short accepted_index;                     // the index of the accepted function, -1 if none
    96        };
    97 
    98       struct thread_desc {
    99             // Core threading fields
    100             struct coroutine_desc cor;                // coroutine body used to store context
    101             struct monitor_desc mon;                  // monitor body used for mutual exclusion
    102 
    103             // Link lists fields
    104             struct thread_desc * next;                // instrusive link field for threads
    105 
    106             // Current status related to monitors
    107             struct monitor_desc ** current_monitors;  // currently held monitors
    108             unsigned short current_monitor_count;     // number of currently held monitors
    109             fptr_t current_monitor_func;              // last function that acquired monitors
     27        #define unlikely(x)    __builtin_expect(!!(x), 0)
     28        #define thread_local _Thread_local
     29
     30        typedef void (*fptr_t)();
     31        typedef int_fast16_t __lock_size_t;
     32
     33        struct spinlock {
     34                volatile int lock;
     35                #ifdef __CFA_DEBUG__
     36                        const char * prev_name;
     37                        void* prev_thrd;
     38                #endif
     39        };
     40
     41        struct __thread_queue_t {
     42                struct thread_desc * head;
     43                struct thread_desc ** tail;
     44        };
     45
     46        struct __condition_stack_t {
     47                struct __condition_criterion_t * top;
     48        };
     49
     50        #ifdef __CFORALL__
     51        extern "Cforall" {
     52                void ?{}( struct __thread_queue_t & );
     53                void append( struct __thread_queue_t &, struct thread_desc * );
     54                struct thread_desc * pop_head( struct __thread_queue_t & );
     55                struct thread_desc * remove( struct __thread_queue_t &, struct thread_desc ** );
     56
     57                void ?{}( struct __condition_stack_t & );
     58                void push( struct __condition_stack_t &, struct __condition_criterion_t * );
     59                struct __condition_criterion_t * pop( struct __condition_stack_t & );
     60
     61                void  ?{}(spinlock & this);
     62                void ^?{}(spinlock & this);
     63        }
     64        #endif
     65
     66        struct coStack_t {
     67                // size of stack
     68                size_t size;
     69
     70                // pointer to stack
     71                void *storage;
     72
     73                // stack grows towards stack limit
     74                void *limit;
     75
     76                // base of stack
     77                void *base;
     78
     79                // address of cfa_context_t
     80                void *context;
     81
     82                // address of top of storage
     83                void *top;
     84
     85                // whether or not the user allocated the stack
     86                bool userStack;
     87        };
     88
     89        enum coroutine_state { Halted, Start, Inactive, Active, Primed };
     90
     91        struct coroutine_desc {
     92                // stack information of the coroutine
     93                struct coStack_t stack;
     94
     95                // textual name for coroutine/task, initialized by uC++ generated code
     96                const char *name;
     97
     98                // copy of global UNIX variable errno
     99                int errno_;
     100
     101                // current execution status for coroutine
     102                enum coroutine_state state;
     103
     104                // first coroutine to resume this one
     105                struct coroutine_desc * starter;
     106
     107                // last coroutine to resume this one
     108                struct coroutine_desc * last;
     109        };
     110
     111        struct __waitfor_mask_t {
     112                // the index of the accepted function, -1 if none
     113                short * accepted;
     114
     115                // list of acceptable functions, null if any
     116                struct __acceptable_t * clauses;
     117
     118                // number of acceptable functions
     119                __lock_size_t size;
     120        };
     121
     122        struct monitor_desc {
     123                // spinlock to protect internal data
     124                struct spinlock lock;
     125
     126                // current owner of the monitor
     127                struct thread_desc * owner;
     128
     129                // queue of threads that are blocked waiting for the monitor
     130                struct __thread_queue_t entry_queue;
     131
     132                // stack of conditions to run next once we exit the monitor
     133                struct __condition_stack_t signal_stack;
     134
     135                // monitor routines can be called recursively, we need to keep track of that
     136                unsigned int recursion;
     137
     138                // mask used to know if some thread is waiting for something while holding the monitor
     139                struct __waitfor_mask_t mask;
     140
     141                // node used to signal the dtor in a waitfor dtor
     142                struct __condition_node_t * dtor_node;
     143        };
     144
     145        struct __monitor_group_t {
     146                // currently held monitors
     147                struct monitor_desc ** list;
     148
     149                // number of currently held monitors
     150                __lock_size_t size;
     151
     152                // last function that acquired monitors
     153                fptr_t func;
     154        };
     155
     156        struct thread_desc {
     157                // Core threading fields
     158                // coroutine body used to store context
     159                struct coroutine_desc  self_cor;
     160
     161                // monitor body used for mutual exclusion
     162                struct monitor_desc    self_mon;
     163
     164                // pointer to monitor with sufficient lifetime for current monitors
     165                struct monitor_desc *  self_mon_p;
     166
     167                // monitors currently held by this thread
     168                struct __monitor_group_t monitors;
     169
     170                // Link lists fields
     171                // instrusive link field for threads
     172                struct thread_desc * next;
    110173     };
     174
     175     #ifdef __CFORALL__
     176     extern "Cforall" {
     177                static inline monitor_desc * ?[?]( const __monitor_group_t & this, ptrdiff_t index ) {
     178                        return this.list[index];
     179                }
     180
     181                static inline bool ?==?( const __monitor_group_t & lhs, const __monitor_group_t & rhs ) {
     182                        if( (lhs.list != 0) != (rhs.list != 0) ) return false;
     183                        if( lhs.size != rhs.size ) return false;
     184                        if( lhs.func != rhs.func ) return false;
     185
     186                        // Check that all the monitors match
     187                        for( int i = 0; i < lhs.size; i++ ) {
     188                                // If not a match, check next function
     189                                if( lhs[i] != rhs[i] ) return false;
     190                        }
     191
     192                        return true;
     193                }
     194        }
     195        #endif
    111196
    112197#endif //_INVOKE_H_
     
    115200#define _INVOKE_PRIVATE_H_
    116201
    117       struct machine_context_t {
    118             void *SP;
    119             void *FP;
    120             void *PC;
    121       };
    122 
    123       // assembler routines that performs the context switch
    124       extern void CtxInvokeStub( void );
    125       void CtxSwitch( void * from, void * to ) asm ("CtxSwitch");
    126 
    127       #if   defined( __x86_64__ )
    128       #define CtxGet( ctx ) __asm__ ( \
    129                   "movq %%rsp,%0\n"   \
    130                   "movq %%rbp,%1\n"   \
    131             : "=rm" (ctx.SP), "=rm" (ctx.FP) )
    132       #elif defined( __i386__ )
    133       #define CtxGet( ctx ) __asm__ ( \
    134                   "movl %%esp,%0\n"   \
    135                   "movl %%ebp,%1\n"   \
    136             : "=rm" (ctx.SP), "=rm" (ctx.FP) )
    137       #endif
     202        struct machine_context_t {
     203                void *SP;
     204                void *FP;
     205                void *PC;
     206        };
     207
     208        // assembler routines that performs the context switch
     209        extern void CtxInvokeStub( void );
     210        void CtxSwitch( void * from, void * to ) asm ("CtxSwitch");
     211
     212        #if   defined( __x86_64__ )
     213        #define CtxGet( ctx ) __asm__ ( \
     214                        "movq %%rsp,%0\n"   \
     215                        "movq %%rbp,%1\n"   \
     216                : "=rm" (ctx.SP), "=rm" (ctx.FP) )
     217        #elif defined( __i386__ )
     218        #define CtxGet( ctx ) __asm__ ( \
     219                        "movl %%esp,%0\n"   \
     220                        "movl %%ebp,%1\n"   \
     221                : "=rm" (ctx.SP), "=rm" (ctx.FP) )
     222        #endif
    138223
    139224#endif //_INVOKE_PRIVATE_H_
  • src/libcfa/concurrency/kernel

    r78315272 r3f7e12cb  
    2626//-----------------------------------------------------------------------------
    2727// Locks
    28 void lock      ( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, spin if already acquired
    29 void lock_yield( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, yield repeatedly if already acquired
    30 bool try_lock  ( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, return false if already acquired
    31 void unlock    ( spinlock * );                        // Unlock the spinlock
     28// Lock the spinlock, spin if already acquired
     29void lock      ( spinlock * DEBUG_CTX_PARAM2 );
     30
     31// Lock the spinlock, yield repeatedly if already acquired
     32void lock_yield( spinlock * DEBUG_CTX_PARAM2 );
     33
     34// Lock the spinlock, return false if already acquired
     35bool try_lock  ( spinlock * DEBUG_CTX_PARAM2 );
     36
     37// Unlock the spinlock
     38void unlock    ( spinlock * );
    3239
    3340struct semaphore {
     
    3946void  ?{}(semaphore & this, int count = 1);
    4047void ^?{}(semaphore & this);
    41 void P(semaphore * this);
    42 void V(semaphore * this);
     48void   P (semaphore & this);
     49void   V (semaphore & this);
    4350
    4451
     
    4653// Cluster
    4754struct cluster {
    48         spinlock ready_queue_lock;                      // Ready queue locks
    49         __thread_queue_t ready_queue;                   // Ready queue for threads
    50         unsigned long long int preemption;              // Preemption rate on this cluster
     55        // Ready queue locks
     56        spinlock ready_queue_lock;
     57
     58        // Ready queue for threads
     59        __thread_queue_t ready_queue;
     60
     61        // Preemption rate on this cluster
     62        unsigned long long int preemption;
    5163};
    5264
    53 void ?{}(cluster & this);
     65void ?{} (cluster & this);
    5466void ^?{}(cluster & this);
    5567
     
    7991struct processor {
    8092        // Main state
    81         struct processorCtx_t * runner;                 // Coroutine ctx who does keeps the state of the processor
    82         cluster * cltr;                                 // Cluster from which to get threads
    83         pthread_t kernel_thread;                        // Handle to pthreads
     93        // Coroutine ctx who does keeps the state of the processor
     94        struct processorCtx_t * runner;
     95
     96        // Cluster from which to get threads
     97        cluster * cltr;
     98
     99        // Handle to pthreads
     100        pthread_t kernel_thread;
    84101
    85102        // Termination
    86         volatile bool do_terminate;                     // Set to true to notify the processor should terminate
    87         semaphore terminated;                           // Termination synchronisation
     103        // Set to true to notify the processor should terminate
     104        volatile bool do_terminate;
     105
     106        // Termination synchronisation
     107        semaphore terminated;
    88108
    89109        // RunThread data
    90         struct FinishAction finish;                     // Action to do after a thread is ran
     110        // Action to do after a thread is ran
     111        struct FinishAction finish;
    91112
    92113        // Preemption data
    93         struct alarm_node_t * preemption_alarm;         // Node which is added in the discrete event simulaiton
    94         bool pending_preemption;                        // If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible
     114        // Node which is added in the discrete event simulaiton
     115        struct alarm_node_t * preemption_alarm;
     116
     117        // If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible
     118        bool pending_preemption;
    95119
    96120#ifdef __CFA_DEBUG__
    97         char * last_enable;                             // Last function to enable preemption on this processor
     121        // Last function to enable preemption on this processor
     122        char * last_enable;
    98123#endif
    99124};
    100125
    101 void ?{}(processor & this);
    102 void ?{}(processor & this, cluster * cltr);
     126void  ?{}(processor & this);
     127void  ?{}(processor & this, cluster * cltr);
    103128void ^?{}(processor & this);
    104129
  • src/libcfa/concurrency/kernel.c

    r78315272 r3f7e12cb  
    106106
    107107void ?{}( thread_desc & this, current_stack_info_t * info) {
    108         (this.cor){ info };
     108        (this.self_cor){ info };
    109109}
    110110
     
    158158                LIB_DEBUG_PRINT_SAFE("Kernel : core %p signaling termination\n", &this);
    159159                this.do_terminate = true;
    160                 P( &this.terminated );
     160                P( this.terminated );
    161161                pthread_join( this.kernel_thread, NULL );
    162162        }
     
    216216        }
    217217
    218         V( &this->terminated );
     218        V( this->terminated );
    219219
    220220        LIB_DEBUG_PRINT_SAFE("Kernel : core %p terminated\n", this);
     
    328328        // if( !thrd ) return;
    329329        verify( thrd );
    330         verify( thrd->cor.state != Halted );
     330        verify( thrd->self_cor.state != Halted );
    331331
    332332        verify( disable_preempt_count > 0 );
     
    335335
    336336        lock(   &this_processor->cltr->ready_queue_lock DEBUG_CTX2 );
    337         append( &this_processor->cltr->ready_queue, thrd );
     337        append( this_processor->cltr->ready_queue, thrd );
    338338        unlock( &this_processor->cltr->ready_queue_lock );
    339339
     
    344344        verify( disable_preempt_count > 0 );
    345345        lock( &this->ready_queue_lock DEBUG_CTX2 );
    346         thread_desc * head = pop_head( &this->ready_queue );
     346        thread_desc * head = pop_head( this->ready_queue );
    347347        unlock( &this->ready_queue_lock );
    348348        verify( disable_preempt_count > 0 );
     
    373373        assert(thrd);
    374374        disable_interrupts();
    375         assert( thrd->cor.state != Halted );
     375        assert( thrd->self_cor.state != Halted );
    376376        this_processor->finish.action_code = Schedule;
    377377        this_processor->finish.thrd = thrd;
     
    398398}
    399399
    400 void BlockInternal(spinlock ** locks, unsigned short count) {
     400void BlockInternal(spinlock * locks [], unsigned short count) {
    401401        disable_interrupts();
    402402        this_processor->finish.action_code = Release_Multi;
     
    411411}
    412412
    413 void BlockInternal(spinlock ** locks, unsigned short lock_count, thread_desc ** thrds, unsigned short thrd_count) {
     413void BlockInternal(spinlock * locks [], unsigned short lock_count, thread_desc * thrds [], unsigned short thrd_count) {
    414414        disable_interrupts();
    415415        this_processor->finish.action_code = Release_Multi_Schedule;
     
    466466        this_processor = mainProcessor;
    467467        this_thread = mainThread;
    468         this_coroutine = &mainThread->cor;
     468        this_coroutine = &mainThread->self_cor;
    469469
    470470        // Enable preemption
     
    547547        thread_desc * thrd = kernel_data;
    548548
    549         int len = snprintf( abort_text, abort_text_size, "Error occurred while executing task %.256s (%p)", thrd->cor.name, thrd );
    550         __lib_debug_write( STDERR_FILENO, abort_text, len );
     549        int len = snprintf( abort_text, abort_text_size, "Error occurred while executing task %.256s (%p)", thrd->self_cor.name, thrd );
     550        __lib_debug_write( abort_text, len );
    551551
    552552        if ( thrd != this_coroutine ) {
    553553                len = snprintf( abort_text, abort_text_size, " in coroutine %.256s (%p).\n", this_coroutine->name, this_coroutine );
    554                 __lib_debug_write( STDERR_FILENO, abort_text, len );
     554                __lib_debug_write( abort_text, len );
    555555        }
    556556        else {
    557                 __lib_debug_write( STDERR_FILENO, ".\n", 2 );
     557                __lib_debug_write( ".\n", 2 );
    558558        }
    559559}
     
    618618void ^?{}(semaphore & this) {}
    619619
    620 void P(semaphore * this) {
    621         lock( &this->lock DEBUG_CTX2 );
    622         this->count -= 1;
    623         if ( this->count < 0 ) {
     620void P(semaphore & this) {
     621        lock( &this.lock DEBUG_CTX2 );
     622        this.count -= 1;
     623        if ( this.count < 0 ) {
    624624                // queue current task
    625                 append( &this->waiting, (thread_desc *)this_thread );
     625                append( this.waiting, (thread_desc *)this_thread );
    626626
    627627                // atomically release spin lock and block
    628                 BlockInternal( &this->lock );
     628                BlockInternal( &this.lock );
    629629        }
    630630        else {
    631             unlock( &this->lock );
    632         }
    633 }
    634 
    635 void V(semaphore * this) {
     631            unlock( &this.lock );
     632        }
     633}
     634
     635void V(semaphore & this) {
    636636        thread_desc * thrd = NULL;
    637         lock( &this->lock DEBUG_CTX2 );
    638         this->count += 1;
    639         if ( this->count <= 0 ) {
     637        lock( &this.lock DEBUG_CTX2 );
     638        this.count += 1;
     639        if ( this.count <= 0 ) {
    640640                // remove task at head of waiting list
    641                 thrd = pop_head( &this->waiting );
    642         }
    643 
    644         unlock( &this->lock );
     641                thrd = pop_head( this.waiting );
     642        }
     643
     644        unlock( &this.lock );
    645645
    646646        // make new owner
     
    655655}
    656656
    657 void append( __thread_queue_t * this, thread_desc * t ) {
    658         verify(this->tail != NULL);
    659         *this->tail = t;
    660         this->tail = &t->next;
    661 }
    662 
    663 thread_desc * pop_head( __thread_queue_t * this ) {
    664         thread_desc * head = this->head;
     657void append( __thread_queue_t & this, thread_desc * t ) {
     658        verify(this.tail != NULL);
     659        *this.tail = t;
     660        this.tail = &t->next;
     661}
     662
     663thread_desc * pop_head( __thread_queue_t & this ) {
     664        thread_desc * head = this.head;
    665665        if( head ) {
    666                 this->head = head->next;
     666                this.head = head->next;
    667667                if( !head->next ) {
    668                         this->tail = &this->head;
     668                        this.tail = &this.head;
    669669                }
    670670                head->next = NULL;
     
    673673}
    674674
    675 thread_desc * remove( __thread_queue_t * this, thread_desc ** it ) {
     675thread_desc * remove( __thread_queue_t & this, thread_desc ** it ) {
    676676        thread_desc * thrd = *it;
    677677        verify( thrd );
     
    679679        (*it) = thrd->next;
    680680
    681         if( this->tail == &thrd->next ) {
    682                 this->tail = it;
     681        if( this.tail == &thrd->next ) {
     682                this.tail = it;
    683683        }
    684684
    685685        thrd->next = NULL;
    686686
    687         verify( (this->head == NULL) == (&this->head == this->tail) );
    688         verify( *this->tail == NULL );
     687        verify( (this.head == NULL) == (&this.head == this.tail) );
     688        verify( *this.tail == NULL );
    689689        return thrd;
    690690}
     
    694694}
    695695
    696 void push( __condition_stack_t * this, __condition_criterion_t * t ) {
     696void push( __condition_stack_t & this, __condition_criterion_t * t ) {
    697697        verify( !t->next );
    698         t->next = this->top;
    699         this->top = t;
    700 }
    701 
    702 __condition_criterion_t * pop( __condition_stack_t * this ) {
    703         __condition_criterion_t * top = this->top;
     698        t->next = this.top;
     699        this.top = t;
     700}
     701
     702__condition_criterion_t * pop( __condition_stack_t & this ) {
     703        __condition_criterion_t * top = this.top;
    704704        if( top ) {
    705                 this->top = top->next;
     705                this.top = top->next;
    706706                top->next = NULL;
    707707        }
  • src/libcfa/concurrency/kernel_private.h

    r78315272 r3f7e12cb  
    4848void BlockInternal(thread_desc * thrd);
    4949void BlockInternal(spinlock * lock, thread_desc * thrd);
    50 void BlockInternal(spinlock ** locks, unsigned short count);
    51 void BlockInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
     50void BlockInternal(spinlock * locks [], unsigned short count);
     51void BlockInternal(spinlock * locks [], unsigned short count, thread_desc * thrds [], unsigned short thrd_count);
    5252void LeaveThread(spinlock * lock, thread_desc * thrd);
    5353
  • src/libcfa/concurrency/monitor

    r78315272 r3f7e12cb  
    1010// Created On       : Thd Feb 23 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:59:01 2017
    13 // Update Count     : 3
     12// Last Modified On : Sat Oct  7 18:06:45 2017
     13// Update Count     : 10
    1414//
    1515
     
    2222#include "stdlib"
    2323
     24trait is_monitor(dtype T) {
     25        monitor_desc * get_monitor( T & );
     26        void ^?{}( T & mutex );
     27};
     28
    2429static inline void ?{}(monitor_desc & this) {
    2530        (this.lock){};
    26         this.owner = NULL;
    2731        (this.entry_queue){};
    2832        (this.signal_stack){};
    29         this.recursion = 0;
    30         this.acceptables = NULL;
    31         this.acceptable_count = 0;
    32         this.accepted_index = -1;
     33        this.owner         = NULL;
     34        this.recursion     = 0;
     35        this.mask.accepted = NULL;
     36        this.mask.clauses  = NULL;
     37        this.mask.size     = 0;
     38        this.dtor_node     = NULL;
    3339}
    3440
    3541struct monitor_guard_t {
    3642        monitor_desc ** m;
    37         int count;
     43        __lock_size_t  count;
    3844        monitor_desc ** prev_mntrs;
    39         unsigned short  prev_count;
     45        __lock_size_t   prev_count;
    4046        fptr_t          prev_func;
    4147};
    4248
    43 static inline int ?<?(monitor_desc* lhs, monitor_desc* rhs) {
    44         return ((intptr_t)lhs) < ((intptr_t)rhs);
     49void ?{}( monitor_guard_t & this, monitor_desc ** m, __lock_size_t count, void (*func)() );
     50void ^?{}( monitor_guard_t & this );
     51
     52struct monitor_dtor_guard_t {
     53        monitor_desc * m;
     54        monitor_desc ** prev_mntrs;
     55        __lock_size_t   prev_count;
     56        fptr_t          prev_func;
     57};
     58
     59void ?{}( monitor_dtor_guard_t & this, monitor_desc ** m, void (*func)() );
     60void ^?{}( monitor_dtor_guard_t & this );
     61
     62static inline forall( dtype T | sized(T) | { void ^?{}( T & mutex ); } )
     63void delete( T * th ) {
     64        ^(*th){};
     65        free( th );
    4566}
    46 
    47 void ?{}( monitor_guard_t & this, monitor_desc ** m, int count, void (*func)() );
    48 void ^?{}( monitor_guard_t & this );
    4967
    5068//-----------------------------------------------------------------------------
     
    5270
    5371struct __condition_criterion_t {
    54         bool ready;                                             //Whether or not the criterion is met (True if met)
    55         monitor_desc * target;                          //The monitor this criterion concerns
    56         struct __condition_node_t * owner;              //The parent node to which this criterion belongs
    57         __condition_criterion_t * next;         //Intrusive linked list Next field
     72        // Whether or not the criterion is met (True if met)
     73        bool ready;
     74
     75        // The monitor this criterion concerns
     76        monitor_desc * target;
     77
     78        // The parent node to which this criterion belongs
     79        struct __condition_node_t * owner;
     80
     81        // Intrusive linked list Next field
     82        __condition_criterion_t * next;
    5883};
    5984
    6085struct __condition_node_t {
    61         thread_desc * waiting_thread;                   //Thread that needs to be woken when all criteria are met
    62         __condition_criterion_t * criteria;     //Array of criteria (Criterions are contiguous in memory)
    63         unsigned short count;                           //Number of criterions in the criteria
    64         __condition_node_t * next;                      //Intrusive linked list Next field
    65         uintptr_t user_info;                            //Custom user info accessible before signalling
     86        // Thread that needs to be woken when all criteria are met
     87        thread_desc * waiting_thread;
     88
     89        // Array of criteria (Criterions are contiguous in memory)
     90        __condition_criterion_t * criteria;
     91
     92        // Number of criterions in the criteria
     93        __lock_size_t count;
     94
     95        // Intrusive linked list Next field
     96        __condition_node_t * next;
     97
     98        // Custom user info accessible before signalling
     99        uintptr_t user_info;
    66100};
    67101
     
    71105};
    72106
     107void ?{}(__condition_node_t & this, thread_desc * waiting_thread, __lock_size_t count, uintptr_t user_info );
     108void ?{}(__condition_criterion_t & this );
     109void ?{}(__condition_criterion_t & this, monitor_desc * target, __condition_node_t * owner );
     110
    73111void ?{}( __condition_blocked_queue_t & );
    74 void append( __condition_blocked_queue_t *, __condition_node_t * );
    75 __condition_node_t * pop_head( __condition_blocked_queue_t * );
     112void append( __condition_blocked_queue_t &, __condition_node_t * );
     113__condition_node_t * pop_head( __condition_blocked_queue_t & );
    76114
    77115struct condition {
    78         __condition_blocked_queue_t blocked;    //Link list which contains the blocked threads as-well as the information needed to unblock them
    79         monitor_desc ** monitors;                       //Array of monitor pointers (Monitors are NOT contiguous in memory)
    80         unsigned short monitor_count;                   //Number of monitors in the array
     116        // Link list which contains the blocked threads as-well as the information needed to unblock them
     117        __condition_blocked_queue_t blocked;
     118
     119        // Array of monitor pointers (Monitors are NOT contiguous in memory)
     120        monitor_desc ** monitors;
     121
     122        // Number of monitors in the array
     123        __lock_size_t monitor_count;
    81124};
    82125
     
    90133}
    91134
    92 void wait( condition * this, uintptr_t user_info = 0 );
    93 bool signal( condition * this );
    94 bool signal_block( condition * this );
    95 static inline bool is_empty( condition * this ) { return !this->blocked.head; }
    96 uintptr_t front( condition * this );
     135              void wait        ( condition & this, uintptr_t user_info = 0 );
     136              bool signal      ( condition & this );
     137              bool signal_block( condition & this );
     138static inline bool is_empty    ( condition & this ) { return !this.blocked.head; }
     139         uintptr_t front       ( condition & this );
    97140
    98141//-----------------------------------------------------------------------------
     
    100143
    101144struct __acceptable_t {
    102         fptr_t func;
    103         unsigned short count;
    104         monitor_desc ** monitors;
     145        __monitor_group_t;
    105146        bool is_dtor;
    106147};
    107148
    108 int __accept_internal( unsigned short count, __acceptable_t * acceptables );
     149void __waitfor_internal( const __waitfor_mask_t & mask, int duration );
    109150
    110151// Local Variables: //
  • src/libcfa/concurrency/monitor.c

    r78315272 r3f7e12cb  
    1717
    1818#include <stdlib>
     19#include <inttypes.h>
    1920
    2021#include "libhdr.h"
    2122#include "kernel_private.h"
    2223
     24#include "bits/algorithms.h"
     25
    2326//-----------------------------------------------------------------------------
    2427// Forward declarations
    25 static inline void set_owner( monitor_desc * this, thread_desc * owner );
     28static inline void set_owner ( monitor_desc * this, thread_desc * owner );
     29static inline void set_owner ( monitor_desc * storage [], __lock_size_t count, thread_desc * owner );
     30static inline void set_mask  ( monitor_desc * storage [], __lock_size_t count, const __waitfor_mask_t & mask );
     31static inline void reset_mask( monitor_desc * this );
     32
    2633static inline thread_desc * next_thread( monitor_desc * this );
    27 static inline int is_accepted( thread_desc * owner, monitor_desc * this, monitor_desc ** group, int group_cnt, void (*func)() );
    28 
    29 static inline void lock_all( spinlock ** locks, unsigned short count );
    30 static inline void lock_all( monitor_desc ** source, spinlock ** /*out*/ locks, unsigned short count );
    31 static inline void unlock_all( spinlock ** locks, unsigned short count );
    32 static inline void unlock_all( monitor_desc ** locks, unsigned short count );
    33 
    34 static inline void save_recursion   ( monitor_desc ** ctx, unsigned int * /*out*/ recursions, unsigned short count );
    35 static inline void restore_recursion( monitor_desc ** ctx, unsigned int * /*in */ recursions, unsigned short count );
    36 
    37 static inline void init     ( int count, monitor_desc ** monitors, __condition_node_t * waiter, __condition_criterion_t * criteria );
    38 static inline void init_push( int count, monitor_desc ** monitors, __condition_node_t * waiter, __condition_criterion_t * criteria );
    39 
    40 static inline thread_desc * check_condition( __condition_criterion_t * );
    41 static inline void brand_condition( condition * );
    42 static inline unsigned short insert_unique( thread_desc ** thrds, unsigned short end, thread_desc * val );
    43 
    44 static inline thread_desc * search_entry_queue( __acceptable_t * acceptables, int acc_count, monitor_desc ** monitors, int count );
     34static inline bool is_accepted( monitor_desc * this, const __monitor_group_t & monitors );
     35
     36static inline void lock_all  ( spinlock * locks [], __lock_size_t count );
     37static inline void lock_all  ( monitor_desc * source [], spinlock * /*out*/ locks [], __lock_size_t count );
     38static inline void unlock_all( spinlock * locks [], __lock_size_t count );
     39static inline void unlock_all( monitor_desc * locks [], __lock_size_t count );
     40
     41static inline void save   ( monitor_desc * ctx [], __lock_size_t count, spinlock * locks [], unsigned int /*out*/ recursions [], __waitfor_mask_t /*out*/ masks [] );
     42static inline void restore( monitor_desc * ctx [], __lock_size_t count, spinlock * locks [], unsigned int /*in */ recursions [], __waitfor_mask_t /*in */ masks [] );
     43
     44static inline void init     ( __lock_size_t count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] );
     45static inline void init_push( __lock_size_t count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] );
     46
     47static inline thread_desc *        check_condition   ( __condition_criterion_t * );
     48static inline void                 brand_condition   ( condition & );
     49static inline [thread_desc *, int] search_entry_queue( const __waitfor_mask_t &, monitor_desc * monitors [], __lock_size_t count );
     50
     51forall(dtype T | sized( T ))
     52static inline __lock_size_t insert_unique( T * array [], __lock_size_t & size, T * val );
     53static inline __lock_size_t count_max    ( const __waitfor_mask_t & mask );
     54static inline __lock_size_t aggregate    ( monitor_desc * storage [], const __waitfor_mask_t & mask );
    4555
    4656//-----------------------------------------------------------------------------
    4757// Useful defines
    48 #define wait_ctx(thrd, user_info)                               /* Create the necessary information to use the signaller stack       */ \
    49         __condition_node_t waiter = { thrd, count, user_info };   /* Create the node specific to this wait operation                   */ \
    50         __condition_criterion_t criteria[count];                  /* Create the creteria this wait operation needs to wake up          */ \
    51         init( count, monitors, &waiter, criteria );               /* Link everything together                                          */ \
    52 
    53 #define wait_ctx_primed(thrd, user_info)                        /* Create the necessary information to use the signaller stack       */ \
    54         __condition_node_t waiter = { thrd, count, user_info };   /* Create the node specific to this wait operation                   */ \
    55         __condition_criterion_t criteria[count];                  /* Create the creteria this wait operation needs to wake up          */ \
    56         init_push( count, monitors, &waiter, criteria );          /* Link everything together and push it to the AS-Stack              */ \
    57 
    58 #define monitor_ctx( mons, cnt )              /* Define that create the necessary struct for internal/external scheduling operations */ \
    59         monitor_desc ** monitors = mons;        /* Save the targeted monitors                                                          */ \
    60         unsigned short count = cnt;             /* Save the count to a local variable                                                  */ \
    61         unsigned int recursions[ count ];       /* Save the current recursion levels to restore them later                             */ \
    62         spinlock *   locks     [ count ];       /* We need to pass-in an array of locks to BlockInternal                               */ \
     58#define wait_ctx(thrd, user_info)                               /* Create the necessary information to use the signaller stack                         */ \
     59        __condition_node_t waiter = { thrd, count, user_info };   /* Create the node specific to this wait operation                                     */ \
     60        __condition_criterion_t criteria[count];                  /* Create the creteria this wait operation needs to wake up                            */ \
     61        init( count, monitors, waiter, criteria );                /* Link everything together                                                            */ \
     62
     63#define wait_ctx_primed(thrd, user_info)                        /* Create the necessary information to use the signaller stack                         */ \
     64        __condition_node_t waiter = { thrd, count, user_info };   /* Create the node specific to this wait operation                                     */ \
     65        __condition_criterion_t criteria[count];                  /* Create the creteria this wait operation needs to wake up                            */ \
     66        init_push( count, monitors, waiter, criteria );           /* Link everything together and push it to the AS-Stack                                */ \
     67
     68#define monitor_ctx( mons, cnt )                                /* Define that create the necessary struct for internal/external scheduling operations */ \
     69        monitor_desc ** monitors = mons;                          /* Save the targeted monitors                                                          */ \
     70        __lock_size_t count = cnt;                                /* Save the count to a local variable                                                  */ \
     71        unsigned int recursions[ count ];                         /* Save the current recursion levels to restore them later                             */ \
     72        __waitfor_mask_t masks [ count ];                         /* Save the current waitfor masks to restore them later                                */ \
     73        spinlock *   locks     [ count ];                         /* We need to pass-in an array of locks to BlockInternal                               */ \
     74
     75#define monitor_save    save   ( monitors, count, locks, recursions, masks )
     76#define monitor_restore restore( monitors, count, locks, recursions, masks )
     77
    6378
    6479//-----------------------------------------------------------------------------
     
    6883extern "C" {
    6984        // Enter single monitor
    70         static void __enter_monitor_desc( monitor_desc * this, monitor_desc ** group, int group_cnt, void (*func)() ) {
     85        static void __enter_monitor_desc( monitor_desc * this, const __monitor_group_t & group ) {
    7186                // Lock the monitor spinlock, lock_yield to reduce contention
    7287                lock_yield( &this->lock DEBUG_CTX2 );
     
    7590                LIB_DEBUG_PRINT_SAFE("Kernel : %10p Entering mon %p (%p)\n", thrd, this, this->owner);
    7691
    77                 this->accepted_index = -1;
    7892                if( !this->owner ) {
    7993                        // No one has the monitor, just take it
     
    8397                }
    8498                else if( this->owner == thrd) {
    85                         // We already have the monitor, just not how many times we took it
    86                         verify( this->recursion > 0 );
     99                        // We already have the monitor, just note how many times we took it
    87100                        this->recursion += 1;
    88101
    89102                        LIB_DEBUG_PRINT_SAFE("Kernel :  mon already owned \n");
    90103                }
    91                 else if( (this->accepted_index = is_accepted( thrd, this, group, group_cnt, func)) >= 0 ) {
     104                else if( is_accepted( this, group) ) {
    92105                        // Some one was waiting for us, enter
    93106                        set_owner( this, thrd );
    94107
     108                        // Reset mask
     109                        reset_mask( this );
     110
    95111                        LIB_DEBUG_PRINT_SAFE("Kernel :  mon accepts \n");
    96112                }
     
    99115
    100116                        // Some one else has the monitor, wait in line for it
    101                         append( &this->entry_queue, thrd );
     117                        append( this->entry_queue, thrd );
    102118                        BlockInternal( &this->lock );
    103119
     
    113129                unlock( &this->lock );
    114130                return;
     131        }
     132
     133        static void __enter_monitor_dtor( monitor_desc * this, fptr_t func ) {
     134                // Lock the monitor spinlock, lock_yield to reduce contention
     135                lock_yield( &this->lock DEBUG_CTX2 );
     136                thread_desc * thrd = this_thread;
     137
     138                LIB_DEBUG_PRINT_SAFE("Kernel : %10p Entering dtor for mon %p (%p)\n", thrd, this, this->owner);
     139
     140
     141                if( !this->owner ) {
     142                        LIB_DEBUG_PRINT_SAFE("Kernel : Destroying free mon %p\n", this);
     143
     144                        // No one has the monitor, just take it
     145                        set_owner( this, thrd );
     146
     147                        unlock( &this->lock );
     148                        return;
     149                }
     150                else if( this->owner == thrd) {
     151                        // We already have the monitor... but where about to destroy it so the nesting will fail
     152                        // Abort!
     153                        abortf("Attempt to destroy monitor %p by thread \"%.256s\" (%p) in nested mutex.");
     154                }
     155
     156                __lock_size_t count = 1;
     157                monitor_desc ** monitors = &this;
     158                __monitor_group_t group = { &this, 1, func };
     159                if( is_accepted( this, group) ) {
     160                        LIB_DEBUG_PRINT_SAFE("Kernel :  mon accepts dtor, block and signal it \n");
     161
     162                        // Wake the thread that is waiting for this
     163                        __condition_criterion_t * urgent = pop( this->signal_stack );
     164                        verify( urgent );
     165
     166                        // Reset mask
     167                        reset_mask( this );
     168
     169                        // Create the node specific to this wait operation
     170                        wait_ctx_primed( this_thread, 0 )
     171
     172                        // Some one else has the monitor, wait for him to finish and then run
     173                        BlockInternal( &this->lock, urgent->owner->waiting_thread );
     174
     175                        // Some one was waiting for us, enter
     176                        set_owner( this, thrd );
     177                }
     178                else {
     179                        LIB_DEBUG_PRINT_SAFE("Kernel :  blocking \n");
     180
     181                        wait_ctx( this_thread, 0 )
     182                        this->dtor_node = &waiter;
     183
     184                        // Some one else has the monitor, wait in line for it
     185                        append( this->entry_queue, thrd );
     186                        BlockInternal( &this->lock );
     187
     188                        // BlockInternal will unlock spinlock, no need to unlock ourselves
     189                        return;
     190                }
     191
     192                LIB_DEBUG_PRINT_SAFE("Kernel : Destroying %p\n", this);
     193
    115194        }
    116195
     
    120199                lock_yield( &this->lock DEBUG_CTX2 );
    121200
    122                 verifyf( this_thread == this->owner, "Expected owner to be %p, got %p (r: %i)", this_thread, this->owner, this->recursion );
     201                LIB_DEBUG_PRINT_SAFE("Kernel : %10p Leaving mon %p (%p)\n", this_thread, this, this->owner);
     202
     203                verifyf( this_thread == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", this_thread, this->owner, this->recursion, this );
    123204
    124205                // Leaving a recursion level, decrement the counter
     
    128209                // it means we don't need to do anything
    129210                if( this->recursion != 0) {
     211                        LIB_DEBUG_PRINT_SAFE("Kernel :  recursion still %d\n", this->recursion);
    130212                        unlock( &this->lock );
    131213                        return;
     
    140222                //We need to wake-up the thread
    141223                WakeThread( new_owner );
     224        }
     225
     226        // Leave single monitor for the last time
     227        void __leave_dtor_monitor_desc( monitor_desc * this ) {
     228                LIB_DEBUG_DO(
     229                        if( this_thread != this->owner ) {
     230                                abortf("Destroyed monitor %p has inconsistent owner, expected %p got %p.\n", this, this_thread, this->owner);
     231                        }
     232                        if( this->recursion != 1 ) {
     233                                abortf("Destroyed monitor %p has %d outstanding nested calls.\n", this, this->recursion - 1);
     234                        }
     235                )
    142236        }
    143237
     
    146240        // Should never return
    147241        void __leave_thread_monitor( thread_desc * thrd ) {
    148                 monitor_desc * this = &thrd->mon;
     242                monitor_desc * this = &thrd->self_mon;
    149243
    150244                // Lock the monitor now
     
    153247                disable_interrupts();
    154248
    155                 thrd->cor.state = Halted;
    156 
    157                 verifyf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i)", thrd, this->owner, this->recursion );
     249                thrd->self_cor.state = Halted;
     250
     251                verifyf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", thrd, this->owner, this->recursion, this );
    158252
    159253                // Leaving a recursion level, decrement the counter
     
    178272// Enter multiple monitor
    179273// relies on the monitor array being sorted
    180 static inline void enter(monitor_desc ** monitors, int count, void (*func)() ) {
    181         for(int i = 0; i < count; i++) {
    182                 __enter_monitor_desc( monitors[i], monitors, count, func );
     274static inline void enter( __monitor_group_t monitors ) {
     275        for( __lock_size_t i = 0; i < monitors.size; i++) {
     276                __enter_monitor_desc( monitors.list[i], monitors );
    183277        }
    184278}
     
    186280// Leave multiple monitor
    187281// relies on the monitor array being sorted
    188 static inline void leave(monitor_desc ** monitors, int count) {
    189         for(int i = count - 1; i >= 0; i--) {
     282static inline void leave(monitor_desc * monitors [], __lock_size_t count) {
     283        for( __lock_size_t i = count - 1; i >= 0; i--) {
    190284                __leave_monitor_desc( monitors[i] );
    191285        }
     
    194288// Ctor for monitor guard
    195289// Sorts monitors before entering
    196 void ?{}( monitor_guard_t & this, monitor_desc ** m, int count, void (*func)() ) {
     290void ?{}( monitor_guard_t & this, monitor_desc * m [], __lock_size_t count, fptr_t func ) {
    197291        // Store current array
    198292        this.m = m;
     
    200294
    201295        // Sort monitors based on address -> TODO use a sort specialized for small numbers
    202         qsort(this.m, count);
     296        __libcfa_small_sort(this.m, count);
    203297
    204298        // Save previous thread context
    205         this.prev_mntrs = this_thread->current_monitors;
    206         this.prev_count = this_thread->current_monitor_count;
    207         this.prev_func  = this_thread->current_monitor_func;
     299        this.[prev_mntrs, prev_count, prev_func] = this_thread->monitors.[list, size, func];
    208300
    209301        // Update thread context (needed for conditions)
    210         this_thread->current_monitors      = m;
    211         this_thread->current_monitor_count = count;
    212         this_thread->current_monitor_func  = func;
     302        this_thread->monitors.[list, size, func] = [m, count, func];
     303
     304        // LIB_DEBUG_PRINT_SAFE("MGUARD : enter %d\n", count);
    213305
    214306        // Enter the monitors in order
    215         enter( this.m, this.count, func );
     307        __monitor_group_t group = {this.m, this.count, func};
     308        enter( group );
     309
     310        // LIB_DEBUG_PRINT_SAFE("MGUARD : entered\n");
    216311}
    217312
     
    219314// Dtor for monitor guard
    220315void ^?{}( monitor_guard_t & this ) {
     316        // LIB_DEBUG_PRINT_SAFE("MGUARD : leaving %d\n", this.count);
     317
    221318        // Leave the monitors in order
    222319        leave( this.m, this.count );
    223320
     321        // LIB_DEBUG_PRINT_SAFE("MGUARD : left\n");
     322
    224323        // Restore thread context
    225         this_thread->current_monitors      = this.prev_mntrs;
    226         this_thread->current_monitor_count = this.prev_count;
    227         this_thread->current_monitor_func  = this.prev_func;
     324        this_thread->monitors.[list, size, func] = this.[prev_mntrs, prev_count, prev_func];
     325}
     326
     327// Ctor for monitor guard
     328// Sorts monitors before entering
     329void ?{}( monitor_dtor_guard_t & this, monitor_desc * m [], fptr_t func ) {
     330        // Store current array
     331        this.m = *m;
     332
     333        // Save previous thread context
     334        this.[prev_mntrs, prev_count, prev_func] = this_thread->monitors.[list, size, func];
     335
     336        // Update thread context (needed for conditions)
     337        this_thread->monitors.[list, size, func] = [m, 1, func];
     338
     339        __enter_monitor_dtor( this.m, func );
     340}
     341
     342// Dtor for monitor guard
     343void ^?{}( monitor_dtor_guard_t & this ) {
     344        // Leave the monitors in order
     345        __leave_dtor_monitor_desc( this.m );
     346
     347        // Restore thread context
     348        this_thread->monitors.[list, size, func] = this.[prev_mntrs, prev_count, prev_func];
    228349}
    229350
    230351//-----------------------------------------------------------------------------
    231352// Internal scheduling types
    232 void ?{}(__condition_node_t & this, thread_desc * waiting_thread, unsigned short count, uintptr_t user_info ) {
     353void ?{}(__condition_node_t & this, thread_desc * waiting_thread, __lock_size_t count, uintptr_t user_info ) {
    233354        this.waiting_thread = waiting_thread;
    234355        this.count = count;
     
    244365}
    245366
    246 void ?{}(__condition_criterion_t & this, monitor_desc * target, __condition_node_t * owner ) {
     367void ?{}(__condition_criterion_t & this, monitor_desc * target, __condition_node_t & owner ) {
    247368        this.ready  = false;
    248369        this.target = target;
    249         this.owner  = owner;
     370        this.owner  = &owner;
    250371        this.next   = NULL;
    251372}
     
    253374//-----------------------------------------------------------------------------
    254375// Internal scheduling
    255 void wait( condition * this, uintptr_t user_info = 0 ) {
     376void wait( condition & this, uintptr_t user_info = 0 ) {
    256377        brand_condition( this );
    257378
    258379        // Check that everything is as expected
    259         assertf( this->monitors != NULL, "Waiting with no monitors (%p)", this->monitors );
    260         verifyf( this->monitor_count != 0, "Waiting with 0 monitors (%i)", this->monitor_count );
    261         verifyf( this->monitor_count < 32u, "Excessive monitor count (%i)", this->monitor_count );
     380        assertf( this.monitors != NULL, "Waiting with no monitors (%p)", this.monitors );
     381        verifyf( this.monitor_count != 0, "Waiting with 0 monitors (%"PRIiFAST16")", this.monitor_count );
     382        verifyf( this.monitor_count < 32u, "Excessive monitor count (%"PRIiFAST16")", this.monitor_count );
    262383
    263384        // Create storage for monitor context
    264         monitor_ctx( this->monitors, this->monitor_count );
     385        monitor_ctx( this.monitors, this.monitor_count );
    265386
    266387        // Create the node specific to this wait operation
     
    269390        // Append the current wait operation to the ones already queued on the condition
    270391        // We don't need locks for that since conditions must always be waited on inside monitor mutual exclusion
    271         append( &this->blocked, &waiter );
    272 
    273         // Lock all monitors (aggregates the lock them as well)
     392        append( this.blocked, &waiter );
     393
     394        // Lock all monitors (aggregates the locks as well)
    274395        lock_all( monitors, locks, count );
    275396
    276         // DON'T unlock, ask the kernel to do it
    277 
    278         // Save monitor state
    279         save_recursion( monitors, recursions, count );
    280 
    281397        // Find the next thread(s) to run
    282         unsigned short thread_count = 0;
     398        __lock_size_t thread_count = 0;
    283399        thread_desc * threads[ count ];
    284         for(int i = 0; i < count; i++) {
    285                 threads[i] = 0;
    286         }
     400        __builtin_memset( threads, 0, sizeof( threads ) );
     401
     402        // Save monitor states
     403        monitor_save;
    287404
    288405        // Remove any duplicate threads
    289         for( int i = 0; i < count; i++) {
     406        for( __lock_size_t i = 0; i < count; i++) {
    290407                thread_desc * new_owner = next_thread( monitors[i] );
    291                 thread_count = insert_unique( threads, thread_count, new_owner );
     408                insert_unique( threads, thread_count, new_owner );
    292409        }
    293410
     
    295412        BlockInternal( locks, count, threads, thread_count );
    296413
    297 
    298         // WE WOKE UP
    299 
    300 
    301414        // We are back, restore the owners and recursions
    302         lock_all( locks, count );
    303         restore_recursion( monitors, recursions, count );
    304         unlock_all( locks, count );
    305 }
    306 
    307 bool signal( condition * this ) {
     415        monitor_restore;
     416}
     417
     418bool signal( condition & this ) {
    308419        if( is_empty( this ) ) { return false; }
    309420
    310421        //Check that everything is as expected
    311         verify( this->monitors );
    312         verify( this->monitor_count != 0 );
     422        verify( this.monitors );
     423        verify( this.monitor_count != 0 );
    313424
    314425        //Some more checking in debug
    315426        LIB_DEBUG_DO(
    316427                thread_desc * this_thrd = this_thread;
    317                 if ( this->monitor_count != this_thrd->current_monitor_count ) {
    318                         abortf( "Signal on condition %p made with different number of monitor(s), expected %i got %i", this, this->monitor_count, this_thrd->current_monitor_count );
    319                 }
    320 
    321                 for(int i = 0; i < this->monitor_count; i++) {
    322                         if ( this->monitors[i] != this_thrd->current_monitors[i] ) {
    323                                 abortf( "Signal on condition %p made with different monitor, expected %p got %i", this, this->monitors[i], this_thrd->current_monitors[i] );
     428                if ( this.monitor_count != this_thrd->monitors.size ) {
     429                        abortf( "Signal on condition %p made with different number of monitor(s), expected %i got %i", &this, this.monitor_count, this_thrd->monitors.size );
     430                }
     431
     432                for(int i = 0; i < this.monitor_count; i++) {
     433                        if ( this.monitors[i] != this_thrd->monitors.list[i] ) {
     434                                abortf( "Signal on condition %p made with different monitor, expected %p got %i", &this, this.monitors[i], this_thrd->monitors.list[i] );
    324435                        }
    325436                }
    326437        );
    327438
    328         unsigned short count = this->monitor_count;
     439        __lock_size_t count = this.monitor_count;
    329440
    330441        // Lock all monitors
    331         lock_all( this->monitors, NULL, count );
     442        lock_all( this.monitors, NULL, count );
    332443
    333444        //Pop the head of the waiting queue
    334         __condition_node_t * node = pop_head( &this->blocked );
     445        __condition_node_t * node = pop_head( this.blocked );
    335446
    336447        //Add the thread to the proper AS stack
     
    338449                __condition_criterion_t * crit = &node->criteria[i];
    339450                assert( !crit->ready );
    340                 push( &crit->target->signal_stack, crit );
     451                push( crit->target->signal_stack, crit );
    341452        }
    342453
    343454        //Release
    344         unlock_all( this->monitors, count );
     455        unlock_all( this.monitors, count );
    345456
    346457        return true;
    347458}
    348459
    349 bool signal_block( condition * this ) {
    350         if( !this->blocked.head ) { return false; }
     460bool signal_block( condition & this ) {
     461        if( !this.blocked.head ) { return false; }
    351462
    352463        //Check that everything is as expected
    353         verifyf( this->monitors != NULL, "Waiting with no monitors (%p)", this->monitors );
    354         verifyf( this->monitor_count != 0, "Waiting with 0 monitors (%i)", this->monitor_count );
     464        verifyf( this.monitors != NULL, "Waiting with no monitors (%p)", this.monitors );
     465        verifyf( this.monitor_count != 0, "Waiting with 0 monitors (%"PRIiFAST16")", this.monitor_count );
    355466
    356467        // Create storage for monitor context
    357         monitor_ctx( this->monitors, this->monitor_count );
     468        monitor_ctx( this.monitors, this.monitor_count );
    358469
    359470        // Lock all monitors (aggregates the locks them as well)
     
    364475
    365476        //save contexts
    366         save_recursion( monitors, recursions, count );
     477        monitor_save;
    367478
    368479        //Find the thread to run
    369         thread_desc * signallee = pop_head( &this->blocked )->waiting_thread;
    370         for(int i = 0; i < count; i++) {
    371                 set_owner( monitors[i], signallee );
    372         }
     480        thread_desc * signallee = pop_head( this.blocked )->waiting_thread;
     481        set_owner( monitors, count, signallee );
     482
     483        LIB_DEBUG_PRINT_BUFFER_DECL( "Kernel : signal_block condition %p (s: %p)\n", &this, signallee );
    373484
    374485        //Everything is ready to go to sleep
     
    379490
    380491
    381         //We are back, restore the owners and recursions
    382         lock_all( locks, count );
    383         restore_recursion( monitors, recursions, count );
    384         unlock_all( locks, count );
     492        LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel :   signal_block returned\n" );
     493
     494        //We are back, restore the masks and recursions
     495        monitor_restore;
    385496
    386497        return true;
     
    388499
    389500// Access the user_info of the thread waiting at the front of the queue
    390 uintptr_t front( condition * this ) {
     501uintptr_t front( condition & this ) {
    391502        verifyf( !is_empty(this),
    392503                "Attempt to access user data on an empty condition.\n"
    393504                "Possible cause is not checking if the condition is empty before reading stored data."
    394505        );
    395         return this->blocked.head->user_info;
     506        return this.blocked.head->user_info;
    396507}
    397508
    398509//-----------------------------------------------------------------------------
    399 // Internal scheduling
    400 int __accept_internal( unsigned short acc_count, __acceptable_t * acceptables ) {
    401         thread_desc * thrd = this_thread;
     510// External scheduling
     511// cases to handle :
     512//      - target already there :
     513//              block and wake
     514//      - dtor already there
     515//              put thread on signaller stack
     516//      - non-blocking
     517//              return else
     518//      - timeout
     519//              return timeout
     520//      - block
     521//              setup mask
     522//              block
     523void __waitfor_internal( const __waitfor_mask_t & mask, int duration ) {
     524        // This statment doesn't have a contiguous list of monitors...
     525        // Create one!
     526        __lock_size_t max = count_max( mask );
     527        monitor_desc * mon_storage[max];
     528        __builtin_memset( mon_storage, 0, sizeof( mon_storage ) );
     529        __lock_size_t actual_count = aggregate( mon_storage, mask );
     530
     531        LIB_DEBUG_PRINT_BUFFER_DECL( "Kernel : waitfor %d (s: %d, m: %d)\n", actual_count, mask.size, (__lock_size_t)max);
     532
     533        if(actual_count == 0) return;
     534
     535        LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : waitfor internal proceeding\n");
    402536
    403537        // Create storage for monitor context
    404         monitor_ctx( acceptables->monitors, acceptables->count );
    405 
    406         // Lock all monitors (aggregates the lock them as well)
     538        monitor_ctx( mon_storage, actual_count );
     539
     540        // Lock all monitors (aggregates the locks as well)
    407541        lock_all( monitors, locks, count );
    408542
     543        {
     544                // Check if the entry queue
     545                thread_desc * next; int index;
     546                [next, index] = search_entry_queue( mask, monitors, count );
     547
     548                if( next ) {
     549                        *mask.accepted = index;
     550                        if( mask.clauses[index].is_dtor ) {
     551                                LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : dtor already there\n");
     552                                verifyf( mask.clauses[index].size == 1        , "ERROR: Accepted dtor has more than 1 mutex parameter." );
     553
     554                                monitor_desc * mon2dtor = mask.clauses[index].list[0];
     555                                verifyf( mon2dtor->dtor_node, "ERROR: Accepted monitor has no dtor_node." );
     556
     557                                __condition_criterion_t * dtor_crit = mon2dtor->dtor_node->criteria;
     558                                push( mon2dtor->signal_stack, dtor_crit );
     559
     560                                unlock_all( locks, count );
     561                        }
     562                        else {
     563                                LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : thread present, baton-passing\n");
     564
     565                                // Create the node specific to this wait operation
     566                                wait_ctx_primed( this_thread, 0 );
     567
     568                                // Save monitor states
     569                                monitor_save;
     570
     571                                LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel :  baton of %d monitors : ", count );
     572                                #ifdef __CFA_DEBUG_PRINT__
     573                                        for( int i = 0; i < count; i++) {
     574                                                LIB_DEBUG_PRINT_BUFFER_LOCAL( "%p %p ", monitors[i], monitors[i]->signal_stack.top );
     575                                        }
     576                                #endif
     577                                LIB_DEBUG_PRINT_BUFFER_LOCAL( "\n");
     578
     579                                // Set the owners to be the next thread
     580                                set_owner( monitors, count, next );
     581
     582                                // Everything is ready to go to sleep
     583                                BlockInternal( locks, count, &next, 1 );
     584
     585                                // We are back, restore the owners and recursions
     586                                monitor_restore;
     587
     588                                LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : thread present, returned\n");
     589                        }
     590
     591                        LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : accepted %d\n", *mask.accepted);
     592
     593                        return;
     594                }
     595        }
     596
     597
     598        if( duration == 0 ) {
     599                LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : non-blocking, exiting\n");
     600
     601                unlock_all( locks, count );
     602
     603                LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : accepted %d\n", *mask.accepted);
     604                return;
     605        }
     606
     607
     608        verifyf( duration < 0, "Timeout on waitfor statments not supported yet.");
     609
     610        LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : blocking waitfor\n");
     611
    409612        // Create the node specific to this wait operation
    410         wait_ctx_primed( thrd, 0 );
    411 
    412         // Check if the entry queue
    413         thread_desc * next = search_entry_queue( acceptables, acc_count, monitors, count );
    414 
    415         LIB_DEBUG_PRINT_SAFE("Owner(s) :");
    416         for(int i = 0; i < count; i++) {
    417                 LIB_DEBUG_PRINT_SAFE(" %p", monitors[i]->owner );
    418         }
    419         LIB_DEBUG_PRINT_SAFE("\n");
    420 
    421         LIB_DEBUG_PRINT_SAFE("Passing mon to %p\n", next);
    422 
    423         if( !next ) {
    424                 // Update acceptables on the current monitors
    425                 for(int i = 0; i < count; i++) {
    426                         monitors[i]->acceptables = acceptables;
    427                         monitors[i]->acceptable_count = acc_count;
    428                 }
    429         }
    430         else {
    431                 for(int i = 0; i < count; i++) {
    432                         set_owner( monitors[i], next );
    433                 }
    434         }
    435 
    436 
    437         save_recursion( monitors, recursions, count );
    438 
    439 
    440         // Everything is ready to go to sleep
    441         BlockInternal( locks, count, &next, next ? 1 : 0 );
    442 
    443 
    444         //WE WOKE UP
    445 
    446 
    447         //We are back, restore the owners and recursions
    448         lock_all( locks, count );
    449         restore_recursion( monitors, recursions, count );
    450         int acc_idx = monitors[0]->accepted_index;
    451         unlock_all( locks, count );
    452 
    453         return acc_idx;
     613        wait_ctx_primed( this_thread, 0 );
     614
     615        monitor_save;
     616        set_mask( monitors, count, mask );
     617
     618        for( __lock_size_t i = 0; i < count; i++) {
     619                verify( monitors[i]->owner == this_thread );
     620        }
     621
     622        //Everything is ready to go to sleep
     623        BlockInternal( locks, count );
     624
     625
     626        // WE WOKE UP
     627
     628
     629        //We are back, restore the masks and recursions
     630        monitor_restore;
     631
     632        LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : exiting\n");
     633
     634        LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : accepted %d\n", *mask.accepted);
    454635}
    455636
     
    458639
    459640static inline void set_owner( monitor_desc * this, thread_desc * owner ) {
     641        // LIB_DEBUG_PRINT_SAFE("Kernal :   Setting owner of %p to %p ( was %p)\n", this, owner, this->owner );
     642
    460643        //Pass the monitor appropriately
    461644        this->owner = owner;
     
    465648}
    466649
     650static inline void set_owner( monitor_desc * monitors [], __lock_size_t count, thread_desc * owner ) {
     651        monitors[0]->owner     = owner;
     652        monitors[0]->recursion = 1;
     653        for( __lock_size_t i = 1; i < count; i++ ) {
     654                monitors[i]->owner     = owner;
     655                monitors[i]->recursion = 0;
     656        }
     657}
     658
     659static inline void set_mask( monitor_desc * storage [], __lock_size_t count, const __waitfor_mask_t & mask ) {
     660        for( __lock_size_t i = 0; i < count; i++) {
     661                storage[i]->mask = mask;
     662        }
     663}
     664
     665static inline void reset_mask( monitor_desc * this ) {
     666        this->mask.accepted = NULL;
     667        this->mask.clauses = NULL;
     668        this->mask.size = 0;
     669}
     670
    467671static inline thread_desc * next_thread( monitor_desc * this ) {
    468672        //Check the signaller stack
    469         __condition_criterion_t * urgent = pop( &this->signal_stack );
     673        LIB_DEBUG_PRINT_SAFE("Kernel :  mon %p AS-stack top %p\n", this, this->signal_stack.top);
     674        __condition_criterion_t * urgent = pop( this->signal_stack );
    470675        if( urgent ) {
    471676                //The signaller stack is not empty,
     
    479684        // No signaller thread
    480685        // Get the next thread in the entry_queue
    481         thread_desc * new_owner = pop_head( &this->entry_queue );
     686        thread_desc * new_owner = pop_head( this->entry_queue );
    482687        set_owner( this, new_owner );
    483688
     
    485690}
    486691
    487 static inline int is_accepted( thread_desc * owner, monitor_desc * this, monitor_desc ** group, int group_cnt, void (*func)() ) {
    488         __acceptable_t* accs = this->acceptables; // Optim
    489         int acc_cnt = this->acceptable_count;
     692static inline bool is_accepted( monitor_desc * this, const __monitor_group_t & group ) {
     693        __acceptable_t * it = this->mask.clauses; // Optim
     694        __lock_size_t count = this->mask.size;
    490695
    491696        // Check if there are any acceptable functions
    492         if( !accs ) return -1;
     697        if( !it ) return false;
    493698
    494699        // If this isn't the first monitor to test this, there is no reason to repeat the test.
    495         if( this != group[0] ) return group[0]->accepted_index;
     700        if( this != group[0] ) return group[0]->mask.accepted >= 0;
    496701
    497702        // For all acceptable functions check if this is the current function.
    498         OUT_LOOP:
    499         for( int i = 0; i < acc_cnt; i++ ) {
    500                 __acceptable_t * acc = &accs[i];
    501 
    502                 // if function matches, check the monitors
    503                 if( acc->func == func ) {
    504 
    505                         // If the group count is different then it can't be a match
    506                         if( acc->count != group_cnt ) return -1;
    507 
    508                         // Check that all the monitors match
    509                         for( int j = 0; j < group_cnt; j++ ) {
    510                                 // If not a match, check next function
    511                                 if( acc->monitors[j] != group[j] ) continue OUT_LOOP;
    512                         }
    513 
    514                         // It's a complete match, accept the call
    515                         return i;
     703        for( __lock_size_t i = 0; i < count; i++, it++ ) {
     704                if( *it == group ) {
     705                        *this->mask.accepted = i;
     706                        return true;
    516707                }
    517708        }
    518709
    519710        // No function matched
    520         return -1;
    521 }
    522 
    523 static inline void init( int count, monitor_desc ** monitors, __condition_node_t * waiter, __condition_criterion_t * criteria ) {
    524         for(int i = 0; i < count; i++) {
     711        return false;
     712}
     713
     714static inline void init( __lock_size_t count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ) {
     715        for( __lock_size_t i = 0; i < count; i++) {
    525716                (criteria[i]){ monitors[i], waiter };
    526717        }
    527718
    528         waiter->criteria = criteria;
    529 }
    530 
    531 static inline void init_push( int count, monitor_desc ** monitors, __condition_node_t * waiter, __condition_criterion_t * criteria ) {
    532         for(int i = 0; i < count; i++) {
     719        waiter.criteria = criteria;
     720}
     721
     722static inline void init_push( __lock_size_t count, monitor_desc * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ) {
     723        for( __lock_size_t i = 0; i < count; i++) {
    533724                (criteria[i]){ monitors[i], waiter };
    534                 push( &criteria[i].target->signal_stack, &criteria[i] );
    535         }
    536 
    537         waiter->criteria = criteria;
    538 }
    539 
    540 static inline void lock_all( spinlock ** locks, unsigned short count ) {
    541         for( int i = 0; i < count; i++ ) {
     725                LIB_DEBUG_PRINT_SAFE( "Kernel :  target %p = %p\n", criteria[i].target, &criteria[i] );
     726                push( criteria[i].target->signal_stack, &criteria[i] );
     727        }
     728
     729        waiter.criteria = criteria;
     730}
     731
     732static inline void lock_all( spinlock * locks [], __lock_size_t count ) {
     733        for( __lock_size_t i = 0; i < count; i++ ) {
    542734                lock_yield( locks[i] DEBUG_CTX2 );
    543735        }
    544736}
    545737
    546 static inline void lock_all( monitor_desc ** source, spinlock ** /*out*/ locks, unsigned short count ) {
    547         for( int i = 0; i < count; i++ ) {
     738static inline void lock_all( monitor_desc * source [], spinlock * /*out*/ locks [], __lock_size_t count ) {
     739        for( __lock_size_t i = 0; i < count; i++ ) {
    548740                spinlock * l = &source[i]->lock;
    549741                lock_yield( l DEBUG_CTX2 );
     
    552744}
    553745
    554 static inline void unlock_all( spinlock ** locks, unsigned short count ) {
    555         for( int i = 0; i < count; i++ ) {
     746static inline void unlock_all( spinlock * locks [], __lock_size_t count ) {
     747        for( __lock_size_t i = 0; i < count; i++ ) {
    556748                unlock( locks[i] );
    557749        }
    558750}
    559751
    560 static inline void unlock_all( monitor_desc ** locks, unsigned short count ) {
    561         for( int i = 0; i < count; i++ ) {
     752static inline void unlock_all( monitor_desc * locks [], __lock_size_t count ) {
     753        for( __lock_size_t i = 0; i < count; i++ ) {
    562754                unlock( &locks[i]->lock );
    563755        }
    564756}
    565757
    566 
    567 static inline void save_recursion   ( monitor_desc ** ctx, unsigned int * /*out*/ recursions, unsigned short count ) {
    568         for( int i = 0; i < count; i++ ) {
     758static inline void save(
     759        monitor_desc * ctx [],
     760        __lock_size_t count,
     761        __attribute((unused)) spinlock * locks [],
     762        unsigned int /*out*/ recursions [],
     763        __waitfor_mask_t /*out*/ masks []
     764) {
     765        for( __lock_size_t i = 0; i < count; i++ ) {
    569766                recursions[i] = ctx[i]->recursion;
    570         }
    571 }
    572 
    573 static inline void restore_recursion( monitor_desc ** ctx, unsigned int * /*in */ recursions, unsigned short count ) {
    574         for( int i = 0; i < count; i++ ) {
     767                masks[i]      = ctx[i]->mask;
     768        }
     769}
     770
     771static inline void restore(
     772        monitor_desc * ctx [],
     773        __lock_size_t count,
     774        spinlock * locks [],
     775        unsigned int /*out*/ recursions [],
     776        __waitfor_mask_t /*out*/ masks []
     777) {
     778        lock_all( locks, count );
     779        for( __lock_size_t i = 0; i < count; i++ ) {
    575780                ctx[i]->recursion = recursions[i];
    576         }
     781                ctx[i]->mask      = masks[i];
     782        }
     783        unlock_all( locks, count );
    577784}
    578785
     
    599806        }
    600807
    601         // LIB_DEBUG_PRINT_SAFE( "Runing %i\n", ready2run );
     808        LIB_DEBUG_PRINT_SAFE( "Kernel :  Runing %i (%p)\n", ready2run, ready2run ? node->waiting_thread : NULL );
    602809        return ready2run ? node->waiting_thread : NULL;
    603810}
    604811
    605 static inline void brand_condition( condition * this ) {
     812static inline void brand_condition( condition & this ) {
    606813        thread_desc * thrd = this_thread;
    607         if( !this->monitors ) {
     814        if( !this.monitors ) {
    608815                // LIB_DEBUG_PRINT_SAFE("Branding\n");
    609                 assertf( thrd->current_monitors != NULL, "No current monitor to brand condition %p", thrd->current_monitors );
    610                 this->monitor_count = thrd->current_monitor_count;
    611 
    612                 this->monitors = malloc( this->monitor_count * sizeof( *this->monitors ) );
    613                 for( int i = 0; i < this->monitor_count; i++ ) {
    614                         this->monitors[i] = thrd->current_monitors[i];
    615                 }
    616         }
    617 }
    618 
    619 static inline unsigned short insert_unique( thread_desc ** thrds, unsigned short end, thread_desc * val ) {
    620         if( !val ) return end;
    621 
    622         for(int i = 0; i <= end; i++) {
    623                 if( thrds[i] == val ) return end;
    624         }
    625 
    626         thrds[end] = val;
    627         return end + 1;
    628 }
    629 
    630 
    631 static inline bool match( __acceptable_t * acc, thread_desc * thrd ) {
    632         verify( thrd );
    633         verify( acc );
    634         if( acc->func != thrd->current_monitor_func ) return false;
    635 
    636         return true;
    637 }
    638 
    639 static inline thread_desc * search_entry_queue( __acceptable_t * acceptables, int acc_count, monitor_desc ** monitors, int count ) {
    640 
    641         __thread_queue_t * entry_queue = &monitors[0]->entry_queue;
     816                assertf( thrd->monitors.list != NULL, "No current monitor to brand condition %p", thrd->monitors.list );
     817                this.monitor_count = thrd->monitors.size;
     818
     819                this.monitors = malloc( this.monitor_count * sizeof( *this.monitors ) );
     820                for( int i = 0; i < this.monitor_count; i++ ) {
     821                        this.monitors[i] = thrd->monitors.list[i];
     822                }
     823        }
     824}
     825
     826static inline [thread_desc *, int] search_entry_queue( const __waitfor_mask_t & mask, monitor_desc * monitors [], __lock_size_t count ) {
     827
     828        __thread_queue_t & entry_queue = monitors[0]->entry_queue;
    642829
    643830        // For each thread in the entry-queue
    644         for(    thread_desc ** thrd_it = &entry_queue->head;
     831        for(    thread_desc ** thrd_it = &entry_queue.head;
    645832                *thrd_it;
    646                 thrd_it = &(*thrd_it)->next)
    647         {
     833                thrd_it = &(*thrd_it)->next
     834        ) {
    648835                // For each acceptable check if it matches
    649                 __acceptable_t * acc_end = acceptables + acc_count;
    650                 for( __acceptable_t * acc_it = acceptables; acc_it != acc_end; acc_it++ ) {
     836                int i = 0;
     837                __acceptable_t * end = mask.clauses + mask.size;
     838                for( __acceptable_t * it = mask.clauses; it != end; it++, i++ ) {
    651839                        // Check if we have a match
    652                         if( match( acc_it, *thrd_it ) ) {
     840                        if( *it == (*thrd_it)->monitors ) {
    653841
    654842                                // If we have a match return it
    655843                                // after removeing it from the entry queue
    656                                 return remove( entry_queue, thrd_it );
     844                                return [remove( entry_queue, thrd_it ), i];
    657845                        }
    658846                }
    659847        }
    660848
    661         return NULL;
    662 }
     849        return [0, -1];
     850}
     851
     852forall(dtype T | sized( T ))
     853static inline __lock_size_t insert_unique( T * array [], __lock_size_t & size, T * val ) {
     854        if( !val ) return size;
     855
     856        for( __lock_size_t i = 0; i <= size; i++) {
     857                if( array[i] == val ) return size;
     858        }
     859
     860        array[size] = val;
     861        size = size + 1;
     862        return size;
     863}
     864
     865static inline __lock_size_t count_max( const __waitfor_mask_t & mask ) {
     866        __lock_size_t max = 0;
     867        for( __lock_size_t i = 0; i < mask.size; i++ ) {
     868                max += mask.clauses[i].size;
     869        }
     870        return max;
     871}
     872
     873static inline __lock_size_t aggregate( monitor_desc * storage [], const __waitfor_mask_t & mask ) {
     874        __lock_size_t size = 0;
     875        for( __lock_size_t i = 0; i < mask.size; i++ ) {
     876                __libcfa_small_sort( mask.clauses[i].list, mask.clauses[i].size );
     877                for( __lock_size_t j = 0; j < mask.clauses[i].size; j++) {
     878                        insert_unique( storage, size, mask.clauses[i].list[j] );
     879                }
     880        }
     881        // TODO insertion sort instead of this
     882        __libcfa_small_sort( storage, size );
     883        return size;
     884}
     885
    663886void ?{}( __condition_blocked_queue_t & this ) {
    664887        this.head = NULL;
     
    666889}
    667890
    668 void append( __condition_blocked_queue_t * this, __condition_node_t * c ) {
    669         verify(this->tail != NULL);
    670         *this->tail = c;
    671         this->tail = &c->next;
    672 }
    673 
    674 __condition_node_t * pop_head( __condition_blocked_queue_t * this ) {
    675         __condition_node_t * head = this->head;
     891void append( __condition_blocked_queue_t & this, __condition_node_t * c ) {
     892        verify(this.tail != NULL);
     893        *this.tail = c;
     894        this.tail = &c->next;
     895}
     896
     897__condition_node_t * pop_head( __condition_blocked_queue_t & this ) {
     898        __condition_node_t * head = this.head;
    676899        if( head ) {
    677                 this->head = head->next;
     900                this.head = head->next;
    678901                if( !head->next ) {
    679                         this->tail = &this->head;
     902                        this.tail = &this.head;
    680903                }
    681904                head->next = NULL;
  • src/libcfa/concurrency/preemption.c

    r78315272 r3f7e12cb  
    328328                siginfo_t info;
    329329                int sig = sigwaitinfo( &mask, &info );
     330
     331                if( sig < 0 ) {
     332                        //Error!
     333                        int err = errno;
     334                        switch( err ) {
     335                                case EAGAIN :
     336                                case EINTR :
     337                                        continue;
     338                        case EINVAL :
     339                                        abortf("Timeout was invalid.");
     340                                default:
     341                                        abortf("Unhandled error %d", err);
     342                        }
     343                }
    330344
    331345                // If another signal arrived something went wrong
     
    366380
    367381        if ( sigaction( sig, &act, NULL ) == -1 ) {
    368                 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO,
     382                LIB_DEBUG_PRINT_BUFFER_DECL(
    369383                        " __kernel_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
    370384                        sig, handler, flags, errno, strerror( errno )
     
    383397
    384398        if ( sigaction( sig, &act, NULL ) == -1 ) {
    385                 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO,
     399                LIB_DEBUG_PRINT_BUFFER_DECL(
    386400                        " __kernel_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
    387401                        sig, errno, strerror( errno )
  • src/libcfa/concurrency/thread

    r78315272 r3f7e12cb  
    3636forall( dtype T | is_thread(T) )
    3737static inline coroutine_desc* get_coroutine(T & this) {
    38         return &get_thread(this)->cor;
     38        return &get_thread(this)->self_cor;
    3939}
    4040
    4141forall( dtype T | is_thread(T) )
    4242static inline monitor_desc* get_monitor(T & this) {
    43         return &get_thread(this)->mon;
     43        return &get_thread(this)->self_mon;
    4444}
    4545
    4646static inline coroutine_desc* get_coroutine(thread_desc * this) {
    47         return &this->cor;
     47        return &this->self_cor;
    4848}
    4949
    5050static inline monitor_desc* get_monitor(thread_desc * this) {
    51         return &this->mon;
     51        return &this->self_mon;
    5252}
    5353
  • src/libcfa/concurrency/thread.c

    r78315272 r3f7e12cb  
    3333
    3434void ?{}(thread_desc& this) {
    35         (this.cor){};
    36         this.cor.name = "Anonymous Coroutine";
    37         this.mon.owner = &this;
    38         this.mon.recursion = 1;
     35        (this.self_cor){};
     36        this.self_cor.name = "Anonymous Coroutine";
     37        this.self_mon.owner = &this;
     38        this.self_mon.recursion = 1;
     39        this.self_mon_p = &this.self_mon;
    3940        this.next = NULL;
    4041
    41         this.current_monitors      = &this.mon;
    42         this.current_monitor_count = 1;
     42        (this.monitors){ &this.self_mon_p, 1, (fptr_t)0 };
    4343}
    4444
    4545void ^?{}(thread_desc& this) {
    46         ^(this.cor){};
     46        ^(this.self_cor){};
    4747}
    4848
  • src/libcfa/interpose.c

    r78315272 r3f7e12cb  
    127127                        va_end( args );
    128128
    129                         __lib_debug_write( STDERR_FILENO, abort_text, len );
    130                         __lib_debug_write( STDERR_FILENO, "\n", 1 );
     129                        __lib_debug_write( abort_text, len );
     130                        __lib_debug_write( "\n", 1 );
    131131                }
    132132
    133133                len = snprintf( abort_text, abort_text_size, "Cforall Runtime error (UNIX pid:%ld)\n", (long int)getpid() ); // use UNIX pid (versus getPid)
    134                 __lib_debug_write( STDERR_FILENO, abort_text, len );
     134                __lib_debug_write( abort_text, len );
    135135
    136136
  • src/libcfa/iostream

    r78315272 r3f7e12cb  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 13 12:53:46 2017
    13 // Update Count     : 138
     12// Last Modified On : Tue Oct 10 14:51:10 2017
     13// Update Count     : 140
    1414//
    1515
     
    7979forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, const char * );
    8080forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, const char16_t * );
     81#if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous
    8182forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, const char32_t * );
     83#endif // ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 )
    8284forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, const wchar_t * );
    8385forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, const void * );
  • src/libcfa/iostream.c

    r78315272 r3f7e12cb  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 17 23:24:25 2017
    13 // Update Count     : 422
     12// Last Modified On : Tue Oct 10 14:51:09 2017
     13// Update Count     : 424
    1414//
    1515
     
    191191} // ?|?
    192192
     193#if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous
    193194forall( dtype ostype | ostream( ostype ) )
    194195ostype * ?|?( ostype * os, const char32_t * str ) {
     
    197198        return os;
    198199} // ?|?
     200#endif // ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 )
    199201
    200202forall( dtype ostype | ostream( ostype ) )
  • src/libcfa/libhdr/libdebug.c

    r78315272 r3f7e12cb  
    99// Author           : Thierry Delisle
    1010// Created On       : Thu Mar 30 12:30:01 2017
    11 // Last Modified By : 
    12 // Last Modified On : 
     11// Last Modified By :
     12// Last Modified On :
    1313// Update Count     : 0
    1414//
     
    2828extern "C" {
    2929
    30         void __lib_debug_write( int fd, const char *in_buffer, int len ) {
     30        void __lib_debug_write( const char *in_buffer, int len ) {
    3131                // ensure all data is written
    32                 for ( int count = 0, retcode; count < len; count += retcode ) { 
     32                for ( int count = 0, retcode; count < len; count += retcode ) {
    3333                        in_buffer += count;
    3434
    3535                        for ( ;; ) {
    36                                 retcode = write( fd, in_buffer, len - count );
     36                                retcode = write( STDERR_FILENO, in_buffer, len - count );
    3737
    3838                                // not a timer interrupt ?
    39                                 if ( retcode != -1 || errno != EINTR ) break; 
     39                                if ( retcode != -1 || errno != EINTR ) break;
    4040                        }
    4141
     
    5252                va_start( args, fmt );
    5353                __lib_debug_acquire();
    54                
     54
    5555                int len = vsnprintf( buffer, buffer_size, fmt, args );
    56                 __lib_debug_write( STDERR_FILENO, buffer, len );
     56                __lib_debug_write( buffer, len );
    5757
    5858                __lib_debug_release();
     
    6464
    6565                va_start( args, fmt );
    66                
     66
    6767                int len = vsnprintf( buffer, buffer_size, fmt, args );
    68                 __lib_debug_write( STDERR_FILENO, buffer, len );
     68                __lib_debug_write( buffer, len );
    6969
    7070                va_end( args );
     
    7373        void __lib_debug_print_vararg( const char fmt[], va_list args ) {
    7474                int len = vsnprintf( buffer, buffer_size, fmt, args );
    75                 __lib_debug_write( STDERR_FILENO, buffer, len );
     75                __lib_debug_write( buffer, len );
    7676        }
    7777
     
    8080
    8181                va_start( args, fmt );
    82                
     82
    8383                int len = vsnprintf( in_buffer, in_buffer_size, fmt, args );
    84                 __lib_debug_write( STDERR_FILENO, in_buffer, len );
     84                __lib_debug_write( in_buffer, len );
    8585
    8686                va_end( args );
  • src/libcfa/libhdr/libdebug.h

    r78315272 r3f7e12cb  
    4444extern "C" {
    4545#endif
    46       #include <stdarg.h>
     46        #include <stdarg.h>
     47        #include <stdio.h>
    4748
    48       extern void __lib_debug_write( int fd, const char *buffer, int len );
     49      extern void __lib_debug_write( const char *buffer, int len );
    4950      extern void __lib_debug_acquire();
    5051      extern void __lib_debug_release();
     
    5859
    5960#ifdef __CFA_DEBUG_PRINT__
    60         #define LIB_DEBUG_WRITE( fd, buffer, len )     __lib_debug_write( fd, buffer, len )
     61        #define LIB_DEBUG_WRITE( buffer, len )         __lib_debug_write( buffer, len )
    6162        #define LIB_DEBUG_ACQUIRE()                    __lib_debug_acquire()
    6263        #define LIB_DEBUG_RELEASE()                    __lib_debug_release()
     
    6465        #define LIB_DEBUG_PRINT_NOLOCK(...)            __lib_debug_print_nolock (__VA_ARGS__)
    6566        #define LIB_DEBUG_PRINT_BUFFER(...)            __lib_debug_print_buffer (__VA_ARGS__)
    66         #define LIB_DEBUG_PRINT_BUFFER_DECL(fd, ...)   char text[256]; int len = snprintf( text, 256, __VA_ARGS__ ); __lib_debug_write( fd, text, len );
    67         #define LIB_DEBUG_PRINT_BUFFER_LOCAL(fd, ...)  len = snprintf( text, 256, __VA_ARGS__ ); __lib_debug_write( fd, text, len );
     67        #define LIB_DEBUG_PRINT_BUFFER_DECL(...)       char __dbg_text[256]; int __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __lib_debug_write( __dbg_text, __dbg_len );
     68        #define LIB_DEBUG_PRINT_BUFFER_LOCAL(...)      __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __lib_debug_write( __dbg_text, __dbg_len );
    6869#else
    6970        #define LIB_DEBUG_WRITE(...)               ((void)0)
  • src/libcfa/stdlib

    r78315272 r3f7e12cb  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 23 20:29:47 2017
    13 // Update Count     : 224
     12// Last Modified On : Tue Oct 31 13:47:24 2017
     13// Update Count     : 245
    1414//
    1515
     
    2727// allocation, non-array types
    2828static inline forall( dtype T | sized(T) ) T * malloc( void ) {
    29         //printf( "X1\n" );
     29        // printf( "* malloc\n" );
    3030        return (T *)(void *)malloc( (size_t)sizeof(T) );        // C malloc
    3131} // malloc
     32
     33// static inline forall( dtype T | sized(T) ) T & malloc( void ) {
     34//      int & p = *(T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
     35//      printf( "& malloc %p\n", &p );
     36//      return p;
     37// //   return (T &)*(T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
     38// } // malloc
    3239
    3340extern "C" { void * calloc( size_t dim, size_t size ); } // default C routine
     
    206213//---------------------------------------
    207214
    208 void rand48seed( long int s );
    209 char rand48( void );
    210 int rand48( void );
    211 unsigned int rand48( void );
    212 long int rand48( void );
    213 unsigned long int rand48( void );
    214 float rand48( void );
    215 double rand48( void );
    216 float _Complex rand48( void );
    217 double _Complex rand48( void );
    218 long double _Complex rand48( void );
     215void random_seed( long int s );
     216char random( void );
     217char random( char l, char u );
     218int random( void );
     219unsigned int random( void );
     220unsigned int random( unsigned int u );
     221unsigned int random( unsigned int l, unsigned int u );
     222//long int random( void );
     223unsigned long int random( void );
     224unsigned long int random( unsigned long int u );
     225unsigned long int random( unsigned long int l, unsigned long int u );
     226float random( void );
     227double random( void );
     228float _Complex random( void );
     229double _Complex random( void );
     230long double _Complex random( void );
    219231
    220232//---------------------------------------
  • src/libcfa/stdlib.c

    r78315272 r3f7e12cb  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 23 20:30:44 2017
    13 // Update Count     : 292
     12// Last Modified On : Mon Oct 30 22:43:02 2017
     13// Update Count     : 297
    1414//
    1515
     
    275275//---------------------------------------
    276276
    277 void rand48seed( long int s ) { srand48( s ); }
    278 char rand48( void ) { return mrand48(); }
    279 int rand48( void ) { return mrand48(); }
    280 unsigned int rand48( void ) { return lrand48(); }
    281 long int rand48( void ) { return mrand48(); }
    282 unsigned long int rand48( void ) { return lrand48(); }
    283 float rand48( void ) { return (float)drand48(); }               // otherwise float uses lrand48
    284 double rand48( void ) { return drand48(); }
    285 float _Complex rand48( void ) { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); }
    286 double _Complex rand48( void ) { return drand48() + (double _Complex)(drand48() * _Complex_I); }
    287 long double _Complex rand48( void) { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }
     277void random_seed( long int s ) { srand48( s ); }
     278char random( void ) { return mrand48(); }
     279char random( char l, char u ) { return lrand48() % (u - l) + l; }
     280int random( void ) { return mrand48(); }
     281unsigned int random( void ) { return lrand48(); }
     282unsigned int random( unsigned int u ) { return lrand48() % u; }
     283unsigned int random( unsigned int l, unsigned int u ) { return lrand48() % (u - l) + l; }
     284//long int random( void ) { return mrand48(); }
     285unsigned long int random( void ) { return lrand48(); }
     286unsigned long int random( unsigned long int u ) { return lrand48() % u; }
     287unsigned long int random( unsigned long int l, unsigned long int u ) { return lrand48() % (u - l) + l; }
     288float random( void ) { return (float)drand48(); }               // otherwise float uses lrand48
     289double random( void ) { return drand48(); }
     290float _Complex random( void ) { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); }
     291double _Complex random( void ) { return drand48() + (double _Complex)(drand48() * _Complex_I); }
     292long double _Complex random( void) { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }
    288293
    289294//---------------------------------------
  • src/main.cc

    r78315272 r3f7e12cb  
    1010// Author           : Richard C. Bilson
    1111// Created On       : Fri May 15 23:12:02 2015
    12 // Last Modified By : Andrew Beach
    13 // Last Modified On : Wed Jul 26 14:38:00 2017
    14 // Update Count     : 443
     12// Last Modified By : Peter A. Buhr
     13// Last Modified On : Tue Oct 31 12:22:40 2017
     14// Update Count     : 445
    1515//
    1616
     
    4444#include "ControlStruct/Mutate.h"           // for mutate
    4545#include "GenPoly/Box.h"                    // for box
    46 #include "GenPoly/CopyParams.h"             // for copyParams
    4746#include "GenPoly/InstantiateGeneric.h"     // for instantiateGeneric
    4847#include "GenPoly/Lvalue.h"                 // for convertLvalue
     
    9493        codegenp = false,
    9594        prettycodegenp = false,
    96         nolinemarks = false;
     95        linemarks = false;
    9796
    9897static void parse_cmdline( int argc, char *argv[], const char *& filename );
     
    239238                } // if
    240239
    241                 // OPTPRINT( "Concurrency" )
    242                 // Concurrency::applyKeywords( translationUnit );
    243 
    244240                // add the assignment statement after the initialization of a type parameter
    245241                OPTPRINT( "validate" )
     
    324320                OPTPRINT("instantiateGenerics")
    325321                GenPoly::instantiateGeneric( translationUnit );
    326                 OPTPRINT( "copyParams" );
    327                 GenPoly::copyParams( translationUnit );
    328322                OPTPRINT( "convertLvalue" )
    329323                GenPoly::convertLvalue( translationUnit );
     
    346340
    347341                CodeTools::fillLocations( translationUnit );
    348                 CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, ! nolinemarks );
     342                CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks );
    349343
    350344                CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c" );
     
    384378
    385379void parse_cmdline( int argc, char * argv[], const char *& filename ) {
    386         enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Nopreamble, Parse, Prototypes, Resolver, Symbol, Tree, TupleExpansion, Validate, };
     380        enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, Prototypes, Resolver, Symbol, Tree, TupleExpansion, Validate, };
    387381
    388382        static struct option long_opts[] = {
     
    396390                { "grammar", no_argument, 0, Grammar },
    397391                { "libcfa", no_argument, 0, LibCFA },
     392                { "line-marks", no_argument, 0, Linemarks },
     393                { "no-line-marks", no_argument, 0, Nolinemarks },
    398394                { "no-preamble", no_argument, 0, Nopreamble },
    399395                { "parse", no_argument, 0, Parse },
     
    411407
    412408        int c;
    413         while ( (c = getopt_long( argc, argv, "abBcCdefglLmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
     409        while ( (c = getopt_long( argc, argv, "abBcCdefglLmnNpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
    414410                switch ( c ) {
    415411                  case Ast:
     
    451447                        libcfap = true;
    452448                        break;
    453                   case 'L':                                                                             // surpress lines marks
    454                         nolinemarks = true;
     449                  case Linemarks:
     450                  case 'L':                                                                             // print lines marks
     451                        linemarks = true;
    455452                        break;
    456453                  case Nopreamble:
    457454                  case 'n':                                                                             // do not read preamble
    458455                        nopreludep = true;
     456                        break;
     457                  case Nolinemarks:
     458                  case 'N':                                                                             // suppress line marks
     459                        linemarks = false;
    459460                        break;
    460461                  case Prototypes:
     
    508509                                assertf( false, "Unknown option: %s\n", argv[optind - 1] );
    509510                        } // if
     511                        #if __GNUC__ < 7
     512                        #else
     513                                __attribute__((fallthrough));
     514                        #endif
    510515                  default:
    511516                        abort();
  • src/prelude/Makefile.am

    r78315272 r3f7e12cb  
    5757
    5858bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
    59         ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
     59        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpm bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    6060
    6161maintainer-clean-local :
  • src/prelude/Makefile.in

    r78315272 r3f7e12cb  
    526526
    527527bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
    528         ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
     528        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpm bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    529529
    530530maintainer-clean-local :
  • src/prelude/extras.c

    r78315272 r3f7e12cb  
    11#include <stddef.h>                                     // size_t, ptrdiff_t
     2#include <stdint.h>                                     // intX_t, uintX_t, where X is 8, 16, 32, 64
    23#include <uchar.h>                                      // char16_t, char32_t
    34#include <wchar.h>                                      // wchar_t
  • src/prelude/extras.regx

    r78315272 r3f7e12cb  
    11typedef.* size_t;
    22typedef.* ptrdiff_t;
     3typedef.* int8_t;
     4typedef.* int16_t;
     5typedef.* int32_t;
     6typedef.* int64_t;
     7typedef.* uint8_t;
     8typedef.* uint16_t;
     9typedef.* uint32_t;
     10typedef.* uint64_t;
    311typedef.* char16_t;
    412typedef.* char32_t;
  • src/prelude/prelude.cf

    r78315272 r3f7e12cb  
    77// Created On       : Sat Nov 29 07:23:41 2014
    88// Last Modified By : Peter A. Buhr
    9 // Last Modified On : Wed Aug 30 07:56:07 2017
    10 // Update Count     : 93
     9// Last Modified On : Sat Oct 28 16:33:09 2017
     10// Update Count     : 102
    1111//
    1212
     
    4141_Bool                   ?++( _Bool & ),                         ?++( volatile _Bool & );
    4242_Bool                   ?--( _Bool & ),                         ?--( volatile _Bool & );
    43 unsigned char           ?++( unsigned char & ),                 ?++( volatile unsigned char & );
     43signed short            ?++( signed short & ),                  ?++( volatile signed short & );
     44signed short            ?--( signed short & ),                  ?--( volatile signed short & );
     45unsigned short          ?++( unsigned short & ),                ?++( volatile unsigned short & );
     46unsigned short          ?--( unsigned short & ),                ?--( volatile unsigned short & );
    4447signed int              ?++( signed int & ),                    ?++( volatile signed int & );
    4548signed int              ?--( signed int & ),                    ?--( volatile signed int & );
     
    9295
    9396_Bool                   ++?( _Bool & ),                         --?( _Bool & );
     97signed short    ++?( signed short & ),                  --?( signed short & );
    9498signed int              ++?( signed int & ),                    --?( signed int & );
    95 unsigned int            ++?( unsigned int & ),                  --?( unsigned int & );
     99unsigned short          ++?( unsigned int & ),                  --?( unsigned int & );
     100unsigned int            ++?( unsigned short & ),                --?( unsigned short & );
    96101signed long int         ++?( signed long int & ),               --?( signed long int & );
    97102unsigned long int       ++?( unsigned long int & ),             --?( unsigned long int & );
     
    190195long double _Complex    ?+?( long double _Complex, long double _Complex ),      ?-?( long double _Complex, long double _Complex );
    191196
    192 forall( dtype T | sized(T) ) T *                        ?+?(                T *,          ptrdiff_t );
    193 forall( dtype T | sized(T) ) T *                        ?+?(          ptrdiff_t,                T * );
     197forall( dtype T | sized(T) ) T *                ?+?(                T *,          ptrdiff_t );
     198forall( dtype T | sized(T) ) T *                ?+?(          ptrdiff_t,                T * );
    194199forall( dtype T | sized(T) ) const T *          ?+?( const          T *,          ptrdiff_t );
    195200forall( dtype T | sized(T) ) const T *          ?+?(          ptrdiff_t, const          T * );
    196 forall( dtype T | sized(T) ) volatile T *               ?+?(       volatile T *,          ptrdiff_t );
    197 forall( dtype T | sized(T) ) volatile T *               ?+?(          ptrdiff_t,       volatile T * );
     201forall( dtype T | sized(T) ) volatile T *       ?+?(       volatile T *,          ptrdiff_t );
     202forall( dtype T | sized(T) ) volatile T *       ?+?(          ptrdiff_t,       volatile T * );
    198203forall( dtype T | sized(T) ) const volatile T * ?+?( const volatile T *,          ptrdiff_t );
    199204forall( dtype T | sized(T) ) const volatile T * ?+?(          ptrdiff_t, const volatile T * );
    200 forall( dtype T | sized(T) ) T *                        ?-?(                T *,          ptrdiff_t );
     205forall( dtype T | sized(T) ) T *                ?-?(                T *,          ptrdiff_t );
    201206forall( dtype T | sized(T) ) const T *          ?-?( const          T *,          ptrdiff_t );
    202 forall( dtype T | sized(T) ) volatile T *               ?-?(       volatile T *,          ptrdiff_t );
     207forall( dtype T | sized(T) ) volatile T *       ?-?(       volatile T *,          ptrdiff_t );
    203208forall( dtype T | sized(T) ) const volatile T * ?-?( const volatile T *,          ptrdiff_t );
    204209forall( dtype T | sized(T) ) ptrdiff_t          ?-?( const volatile T *, const volatile T * );
     
    226231signed int ?<?( _Bool, _Bool ),                                         ?<=?( _Bool, _Bool ),
    227232           ?>?( _Bool, _Bool ),                                         ?>=?( _Bool, _Bool );
    228 signed int ?<?( char, char ),                           ?<=?( char, char ),
    229            ?>?( char, char ),                           ?>=?( char, char );
     233signed int ?<?( char, char ),                                           ?<=?( char, char ),
     234           ?>?( char, char ),                                           ?>=?( char, char );
    230235signed int ?<?( signed char, signed char ),                             ?<=?( signed char, signed char ),
    231236           ?>?( signed char, signed char ),                             ?>=?( signed char, signed char );
     
    235240           ?>?( signed short, signed short ),                           ?>=?( signed short, signed short );
    236241signed int ?<?( unsigned short, unsigned short ),                       ?<=?( unsigned short, unsigned short ),
    237            ?>?( unsigned short, unsigned short ),                               ?>=?( unsigned short, unsigned short );
     242           ?>?( unsigned short, unsigned short ),                       ?>=?( unsigned short, unsigned short );
    238243signed int ?<?( signed int, signed int ),                               ?<=?( signed int, signed int ),
    239244           ?>?( signed int, signed int ),                               ?>=?( signed int, signed int );
     
    468473forall( ftype FT ) FT *                 ?=?( FT * volatile &, zero_t );
    469474
    470 forall( dtype T | sized(T) ) T *                        ?+=?(                T *          &, ptrdiff_t );
    471 forall( dtype T | sized(T) ) T *                        ?+=?(                T * volatile &, ptrdiff_t );
     475forall( dtype T | sized(T) ) T *                ?+=?(                T *          &, ptrdiff_t );
     476forall( dtype T | sized(T) ) T *                ?+=?(                T * volatile &, ptrdiff_t );
    472477forall( dtype T | sized(T) ) const T *          ?+=?( const          T *          &, ptrdiff_t );
    473478forall( dtype T | sized(T) ) const T *          ?+=?( const          T * volatile &, ptrdiff_t );
    474 forall( dtype T | sized(T) ) volatile T *               ?+=?(       volatile T *          &, ptrdiff_t );
    475 forall( dtype T | sized(T) ) volatile T *               ?+=?(       volatile T * volatile &, ptrdiff_t );
     479forall( dtype T | sized(T) ) volatile T *       ?+=?(       volatile T *          &, ptrdiff_t );
     480forall( dtype T | sized(T) ) volatile T *       ?+=?(       volatile T * volatile &, ptrdiff_t );
    476481forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T *          &, ptrdiff_t );
    477482forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T * volatile &, ptrdiff_t );
    478 forall( dtype T | sized(T) ) T *                        ?-=?(                T *          &, ptrdiff_t );
    479 forall( dtype T | sized(T) ) T *                        ?-=?(                T * volatile &, ptrdiff_t );
     483forall( dtype T | sized(T) ) T *                ?-=?(                T *          &, ptrdiff_t );
     484forall( dtype T | sized(T) ) T *                ?-=?(                T * volatile &, ptrdiff_t );
    480485forall( dtype T | sized(T) ) const T *          ?-=?( const          T *          &, ptrdiff_t );
    481486forall( dtype T | sized(T) ) const T *          ?-=?( const          T * volatile &, ptrdiff_t );
    482 forall( dtype T | sized(T) ) volatile T *               ?-=?(       volatile T *          &, ptrdiff_t );
    483 forall( dtype T | sized(T) ) volatile T *               ?-=?(       volatile T * volatile &, ptrdiff_t );
     487forall( dtype T | sized(T) ) volatile T *       ?-=?(       volatile T *          &, ptrdiff_t );
     488forall( dtype T | sized(T) ) volatile T *       ?-=?(       volatile T * volatile &, ptrdiff_t );
    484489forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T *          &, ptrdiff_t );
    485490forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T * volatile &, ptrdiff_t );
     
    497502signed long long int    ?=?( signed long long int &, signed long long int ),    ?=?( volatile signed long long int &, signed long long int );
    498503unsigned long long int  ?=?( unsigned long long int &, unsigned long long int ), ?=?( volatile unsigned long long int &, unsigned long long int );
    499 zero_t          ?=?( zero_t &, zero_t );
     504zero_t                  ?=?( zero_t &, zero_t );
    500505one_t                   ?=?( one_t &, one_t );
    501506
     
    552557signed long long int    ?+=?( signed long long int &, signed long long int ),   ?+=?( volatile signed long long int &, signed long long int );
    553558unsigned long long int  ?+=?( unsigned long long int &, unsigned long long int ), ?+=?( volatile unsigned long long int &, unsigned long long int );
     559//signed int128         ?+=?( signed int128 &, signed int128 ),                 ?+=?( volatile signed int128 &, signed int128 );
     560//unsigned int128               ?+=?( unsigned int128 &, unsigned int128 ),             ?+=?( volatile unsigned int128 &, unsigned int128 );
    554561
    555562_Bool                   ?-=?( _Bool &, _Bool ),                                 ?-=?( volatile _Bool &, _Bool );
     
    666673                        ?+=?( long double _Complex &, long double _Complex ), ?+=?( volatile long double _Complex &, long double _Complex ),
    667674                        ?-=?( long double _Complex &, long double _Complex ), ?-=?( volatile long double _Complex &, long double _Complex );
    668 
    669 
    670 
    671675
    672676
     
    838842forall( dtype DT ) void ^?{}( const volatile  DT *         &);
    839843
    840 void    ^?{}(               void *          &);
    841 void    ^?{}( const         void *          &);
    842 void    ^?{}(      volatile void *          &);
    843 void    ^?{}( const volatile void *         &);
     844void ^?{}(                  void *          &);
     845void ^?{}( const            void *          &);
     846void ^?{}(         volatile void *          &);
     847void ^?{}( const  volatile void *          &);
    844848
    845849// Local Variables: //
  • src/tests/.expect/32/KRfunctions.txt

    r78315272 r3f7e12cb  
    2121static inline void ___destructor__F_R2sS_autogen___1(struct S *___dst__R2sS_1);
    2222static inline struct S ___operator_assign__F2sS_R2sS2sS_autogen___1(struct S *___dst__R2sS_1, struct S ___src__2sS_1);
     23static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, signed int __i__i_1);
    2324static inline void ___constructor__F_R2sS_autogen___1(struct S *___dst__R2sS_1){
    2425    ((void)((*___dst__R2sS_1).__i__i_1) /* ?{} */);
     
    3334    struct S ___ret__2sS_1;
    3435    ((void)((*___dst__R2sS_1).__i__i_1=___src__2sS_1.__i__i_1));
    35     ((void)___constructor__F_R2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1));
    36     return ((struct S )___ret__2sS_1);
     36    ((void)___constructor__F_R2sS2sS_autogen___1((&___ret__2sS_1), (*___dst__R2sS_1)));
     37    return ___ret__2sS_1;
    3738}
    3839static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, signed int __i__i_1){
     
    6566    signed int *__x__FPi_ii__2(signed int __anonymous_object2, signed int __anonymous_object3);
    6667    ((void)(___retval_f10__PFPi_ii__1=__x__FPi_ii__2) /* ?{} */);
    67     return ((signed int *(*)(signed int __x__i_1, signed int __y__i_1))___retval_f10__PFPi_ii__1);
     68    return ___retval_f10__PFPi_ii__1;
    6869}
    6970signed int (*__f11__FPA0i_iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1))[]{
  • src/tests/.expect/32/attributes.txt

    r78315272 r3f7e12cb  
    2323static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_R13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){
    2424    struct __anonymous0 ___ret__13s__anonymous0_1;
    25     ((void)___constructor__F_R13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1));
    26     return ((struct __anonymous0 )___ret__13s__anonymous0_1);
     25    ((void)___constructor__F_R13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), (*___dst__R13s__anonymous0_1)));
     26    return ___ret__13s__anonymous0_1;
    2727}
    2828__attribute__ ((unused)) struct Agn1;
     
    4141static inline struct Agn2 ___operator_assign__F5sAgn2_R5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__R5sAgn2_1, struct Agn2 ___src__5sAgn2_1){
    4242    struct Agn2 ___ret__5sAgn2_1;
    43     ((void)___constructor__F_R5sAgn25sAgn2_autogen___1((&___ret__5sAgn2_1), ___src__5sAgn2_1));
    44     return ((struct Agn2 )___ret__5sAgn2_1);
     43    ((void)___constructor__F_R5sAgn25sAgn2_autogen___1((&___ret__5sAgn2_1), (*___dst__R5sAgn2_1)));
     44    return ___ret__5sAgn2_1;
    4545}
    4646enum __attribute__ ((unused)) __anonymous1 {
     
    6969static inline void ___destructor__F_R4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1);
    7070static inline struct Fdl ___operator_assign__F4sFdl_R4sFdl4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1, struct Fdl ___src__4sFdl_1);
     71static inline void ___constructor__F_R4sFdli_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1);
     72static inline void ___constructor__F_R4sFdlii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1);
     73static inline void ___constructor__F_R4sFdliii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1);
     74static inline void ___constructor__F_R4sFdliiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1);
     75static inline void ___constructor__F_R4sFdliiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1);
     76static inline void ___constructor__F_R4sFdliiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1);
     77static inline void ___constructor__F_R4sFdliiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1);
     78static inline void ___constructor__F_R4sFdliiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1);
     79static inline void ___constructor__F_R4sFdliiiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object1);
     80static inline void ___constructor__F_R4sFdliiiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object2, signed int *__f9__Pi_1);
    7181static inline void ___constructor__F_R4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1){
    7282    ((void)((*___dst__R4sFdl_1).__f1__i_1) /* ?{} */);
     
    7888    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    7989    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     90    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    8091    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    8192}
     
    89100    ((void)((*___dst__R4sFdl_1).__f7__i_1=___src__4sFdl_1.__f7__i_1) /* ?{} */);
    90101    ((void)((*___dst__R4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1) /* ?{} */);
     102    ((void)((*___dst__R4sFdl_1).__anonymous_object0=___src__4sFdl_1.__anonymous_object0) /* ?{} */);
    91103    ((void)((*___dst__R4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1) /* ?{} */);
    92104}
    93105static inline void ___destructor__F_R4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1){
    94106    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ^?{} */);
     107    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ^?{} */);
    95108    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ^?{} */);
    96109    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ^?{} */);
     
    112125    ((void)((*___dst__R4sFdl_1).__f7__i_1=___src__4sFdl_1.__f7__i_1));
    113126    ((void)((*___dst__R4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1));
     127    ((void)((*___dst__R4sFdl_1).__anonymous_object0=___src__4sFdl_1.__anonymous_object0));
    114128    ((void)((*___dst__R4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1));
    115     ((void)___constructor__F_R4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), ___src__4sFdl_1));
    116     return ((struct Fdl )___ret__4sFdl_1);
     129    ((void)___constructor__F_R4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), (*___dst__R4sFdl_1)));
     130    return ___ret__4sFdl_1;
    117131}
    118132static inline void ___constructor__F_R4sFdli_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1){
     
    125139    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    126140    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     141    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    127142    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    128143}
     
    136151    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    137152    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     153    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    138154    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    139155}
     
    147163    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    148164    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     165    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    149166    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    150167}
     
    158175    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    159176    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     177    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    160178    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    161179}
     
    169187    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    170188    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     189    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    171190    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    172191}
     
    180199    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    181200    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     201    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    182202    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    183203}
     
    191211    ((void)((*___dst__R4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */);
    192212    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     213    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    193214    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    194215}
     
    202223    ((void)((*___dst__R4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */);
    203224    ((void)((*___dst__R4sFdl_1).__f8__i_1=__f8__i_1) /* ?{} */);
    204     ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    205 }
    206 static inline void ___constructor__F_R4sFdliiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int *__f9__Pi_1){
     225    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
     226    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
     227}
     228static inline void ___constructor__F_R4sFdliiiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object3){
    207229    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    208230    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     
    213235    ((void)((*___dst__R4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */);
    214236    ((void)((*___dst__R4sFdl_1).__f8__i_1=__f8__i_1) /* ?{} */);
     237    ((void)((*___dst__R4sFdl_1).__anonymous_object0=__anonymous_object3) /* ?{} */);
     238    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
     239}
     240static inline void ___constructor__F_R4sFdliiiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object4, signed int *__f9__Pi_1){
     241    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
     242    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     243    ((void)((*___dst__R4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */);
     244    ((void)((*___dst__R4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */);
     245    ((void)((*___dst__R4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */);
     246    ((void)((*___dst__R4sFdl_1).__f6__i_1=__f6__i_1) /* ?{} */);
     247    ((void)((*___dst__R4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */);
     248    ((void)((*___dst__R4sFdl_1).__f8__i_1=__f8__i_1) /* ?{} */);
     249    ((void)((*___dst__R4sFdl_1).__anonymous_object0=__anonymous_object4) /* ?{} */);
    215250    ((void)((*___dst__R4sFdl_1).__f9__Pi_1=__f9__Pi_1) /* ?{} */);
    216251}
     
    232267    __attribute__ ((unused)) signed int **const ___retval_f2__CPPi_1;
    233268}
    234 __attribute__ ((unused,used,unused)) signed int (*__f3__FPA0i_i__1(signed int __anonymous_object1))[];
     269__attribute__ ((unused,used,unused)) signed int (*__f3__FPA0i_i__1(signed int __anonymous_object5))[];
    235270__attribute__ ((unused,unused)) signed int (*__f3__FPA0i_i__1(signed int __p__i_1))[]{
    236271    __attribute__ ((unused)) signed int (*___retval_f3__PA0i_1)[];
    237272}
    238 __attribute__ ((unused,used,unused)) signed int (*__f4__FPFi_i____1())(signed int __anonymous_object2);
    239 __attribute__ ((unused,unused)) signed int (*__f4__FPFi_i____1())(signed int __anonymous_object3){
    240     __attribute__ ((unused)) signed int (*___retval_f4__PFi_i__1)(signed int __anonymous_object4);
     273__attribute__ ((unused,used,unused)) signed int (*__f4__FPFi_i____1())(signed int __anonymous_object6);
     274__attribute__ ((unused,unused)) signed int (*__f4__FPFi_i____1())(signed int __anonymous_object7){
     275    __attribute__ ((unused)) signed int (*___retval_f4__PFi_i__1)(signed int __anonymous_object8);
    241276}
    242277signed int __vtr__Fi___1(){
     
    268303signed int __tpr2__Fi_PPi__1(__attribute__ ((unused,unused,unused,unused,unused,unused)) signed int **__Foo__PPi_1);
    269304signed int __tpr3__Fi_Pi__1(__attribute__ ((unused,unused,unused)) signed int *__Foo__Pi_1);
    270 signed int __tpr4__Fi_PFi_Pi___1(__attribute__ ((unused,unused)) signed int (*__anonymous_object5)(__attribute__ ((unused,unused)) signed int __anonymous_object6[((unsigned int )5)]));
     305signed int __tpr4__Fi_PFi_Pi___1(__attribute__ ((unused,unused)) signed int (*__anonymous_object9)(__attribute__ ((unused,unused)) signed int __anonymous_object10[((unsigned int )5)]));
    271306signed int __tpr5__Fi_PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__Foo__PFi___1)());
    272307signed int __tpr6__Fi_PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__Foo__PFi___1)());
    273 signed int __tpr7__Fi_PFi_PFi_i____1(__attribute__ ((unused,unused)) signed int (*__anonymous_object7)(__attribute__ ((unused)) signed int (*__anonymous_object8)(__attribute__ ((unused,unused)) signed int __anonymous_object9)));
     308signed int __tpr7__Fi_PFi_PFi_i____1(__attribute__ ((unused,unused)) signed int (*__anonymous_object11)(__attribute__ ((unused)) signed int (*__anonymous_object12)(__attribute__ ((unused,unused)) signed int __anonymous_object13)));
    274309signed int __ad__Fi___1(){
    275310    __attribute__ ((unused)) signed int ___retval_ad__i_1;
     
    300335        struct __anonymous4 ___ret__13s__anonymous4_2;
    301336        ((void)((*___dst__R13s__anonymous4_2).__i__i_2=___src__13s__anonymous4_2.__i__i_2));
    302         ((void)___constructor__F_R13s__anonymous413s__anonymous4_autogen___2((&___ret__13s__anonymous4_2), ___src__13s__anonymous4_2));
    303         return ((struct __anonymous4 )___ret__13s__anonymous4_2);
     337        ((void)___constructor__F_R13s__anonymous413s__anonymous4_autogen___2((&___ret__13s__anonymous4_2), (*___dst__R13s__anonymous4_2)));
     338        return ___ret__13s__anonymous4_2;
    304339    }
    305340    inline void ___constructor__F_R13s__anonymous4i_autogen___2(struct __anonymous4 *___dst__R13s__anonymous4_2, signed int __i__i_2){
     
    313348    }
    314349    inline void ___constructor__F_R13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__R13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){
    315         ((void)((*___dst__R13e__anonymous5_2)=___src__13e__anonymous5_2));
     350        ((void)((*___dst__R13e__anonymous5_2)=___src__13e__anonymous5_2) /* ?{} */);
    316351    }
    317352    inline void ___destructor__F_R13e__anonymous5_intrinsic___2(__attribute__ ((unused)) enum __anonymous5 *___dst__R13e__anonymous5_2){
     
    319354    inline enum __anonymous5 ___operator_assign__F13e__anonymous5_R13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__R13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){
    320355        enum __anonymous5 ___ret__13e__anonymous5_2;
    321         ((void)(___ret__13e__anonymous5_2=((*___dst__R13e__anonymous5_2)=___src__13e__anonymous5_2)) /* ?{} */);
    322         return ((enum __anonymous5 )___ret__13e__anonymous5_2);
     356        ((void)((*___dst__R13e__anonymous5_2)=___src__13e__anonymous5_2));
     357        ((void)(___ret__13e__anonymous5_2=(*___dst__R13e__anonymous5_2)) /* ?{} */);
     358        return ___ret__13e__anonymous5_2;
    323359    }
    324360    ((void)sizeof(enum __anonymous5 ));
    325361}
    326 signed int __apd1__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object10, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object11);
    327 signed int __apd2__Fi_PPiPPi__1(__attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object12, __attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object13);
    328 signed int __apd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object14, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object15);
    329 signed int __apd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object16)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object17)());
    330 signed int __apd5__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object18)(__attribute__ ((unused)) signed int __anonymous_object19), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object20)(__attribute__ ((unused)) signed int __anonymous_object21));
    331 signed int __apd6__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object22)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object23)());
    332 signed int __apd7__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object24)(__attribute__ ((unused)) signed int __anonymous_object25), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object26)(__attribute__ ((unused)) signed int __anonymous_object27));
     362signed int __apd1__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object14, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object15);
     363signed int __apd2__Fi_PPiPPi__1(__attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object16, __attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object17);
     364signed int __apd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object18, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object19);
     365signed int __apd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object20)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object21)());
     366signed int __apd5__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object22)(__attribute__ ((unused)) signed int __anonymous_object23), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object24)(__attribute__ ((unused)) signed int __anonymous_object25));
     367signed int __apd6__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object26)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object27)());
     368signed int __apd7__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object28)(__attribute__ ((unused)) signed int __anonymous_object29), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object30)(__attribute__ ((unused)) signed int __anonymous_object31));
    333369struct Vad {
    334     __attribute__ ((unused)) signed int __anonymous_object28;
    335     __attribute__ ((unused,unused)) signed int *__anonymous_object29;
    336     __attribute__ ((unused,unused)) signed int __anonymous_object30[((unsigned int )10)];
    337     __attribute__ ((unused,unused)) signed int (*__anonymous_object31)();
     370    __attribute__ ((unused)) signed int __anonymous_object32;
     371    __attribute__ ((unused,unused)) signed int *__anonymous_object33;
     372    __attribute__ ((unused,unused)) signed int __anonymous_object34[((unsigned int )10)];
     373    __attribute__ ((unused,unused)) signed int (*__anonymous_object35)();
    338374};
    339375static inline void ___constructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1);
     
    341377static inline void ___destructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1);
    342378static inline struct Vad ___operator_assign__F4sVad_R4sVad4sVad_autogen___1(struct Vad *___dst__R4sVad_1, struct Vad ___src__4sVad_1);
     379static inline void ___constructor__F_R4sVadi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object36);
     380static inline void ___constructor__F_R4sVadiPi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object37, signed int *__anonymous_object38);
     381static inline void ___constructor__F_R4sVadiPiA0i_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object39, signed int *__anonymous_object40, signed int __anonymous_object41[((unsigned int )10)]);
     382static inline void ___constructor__F_R4sVadiPiA0iPFi___autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object42, signed int *__anonymous_object43, signed int __anonymous_object44[((unsigned int )10)], signed int (*__anonymous_object45)());
    343383static inline void ___constructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1){
     384    ((void)((*___dst__R4sVad_1).__anonymous_object32) /* ?{} */);
     385    ((void)((*___dst__R4sVad_1).__anonymous_object33) /* ?{} */);
     386    {
     387        signed int _index0 = 0;
     388        for (;(_index0<10);((void)(++_index0))) {
     389            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[_index0])))) /* ?{} */);
     390        }
     391
     392    }
     393
     394    ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */);
    344395}
    345396static inline void ___constructor__F_R4sVad4sVad_autogen___1(struct Vad *___dst__R4sVad_1, struct Vad ___src__4sVad_1){
     397    ((void)((*___dst__R4sVad_1).__anonymous_object32=___src__4sVad_1.__anonymous_object32) /* ?{} */);
     398    ((void)((*___dst__R4sVad_1).__anonymous_object33=___src__4sVad_1.__anonymous_object33) /* ?{} */);
     399    {
     400        signed int _index1 = 0;
     401        for (;(_index1<10);((void)(++_index1))) {
     402            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[_index1])))=___src__4sVad_1.__anonymous_object34[_index1]) /* ?{} */);
     403        }
     404
     405    }
     406
     407    ((void)((*___dst__R4sVad_1).__anonymous_object35=___src__4sVad_1.__anonymous_object35) /* ?{} */);
    346408}
    347409static inline void ___destructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1){
     410    ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ^?{} */);
     411    {
     412        signed int _index2 = (10-1);
     413        for (;(_index2>=0);((void)(--_index2))) {
     414            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[_index2])))) /* ^?{} */);
     415        }
     416
     417    }
     418
     419    ((void)((*___dst__R4sVad_1).__anonymous_object33) /* ^?{} */);
     420    ((void)((*___dst__R4sVad_1).__anonymous_object32) /* ^?{} */);
    348421}
    349422static inline struct Vad ___operator_assign__F4sVad_R4sVad4sVad_autogen___1(struct Vad *___dst__R4sVad_1, struct Vad ___src__4sVad_1){
    350423    struct Vad ___ret__4sVad_1;
    351     ((void)___constructor__F_R4sVad4sVad_autogen___1((&___ret__4sVad_1), ___src__4sVad_1));
    352     return ((struct Vad )___ret__4sVad_1);
    353 }
     424    ((void)((*___dst__R4sVad_1).__anonymous_object32=___src__4sVad_1.__anonymous_object32));
     425    ((void)((*___dst__R4sVad_1).__anonymous_object33=___src__4sVad_1.__anonymous_object33));
     426    {
     427        signed int _index3 = 0;
     428        for (;(_index3<10);((void)(++_index3))) {
     429            ((void)((*___dst__R4sVad_1).__anonymous_object34[_index3]=___src__4sVad_1.__anonymous_object34[_index3]));
     430        }
     431
     432    }
     433
     434    ((void)((*___dst__R4sVad_1).__anonymous_object35=___src__4sVad_1.__anonymous_object35));
     435    ((void)___constructor__F_R4sVad4sVad_autogen___1((&___ret__4sVad_1), (*___dst__R4sVad_1)));
     436    return ___ret__4sVad_1;
     437}
     438static inline void ___constructor__F_R4sVadi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object46){
     439    ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object46) /* ?{} */);
     440    ((void)((*___dst__R4sVad_1).__anonymous_object33) /* ?{} */);
     441    {
     442        signed int _index4 = 0;
     443        for (;(_index4<10);((void)(++_index4))) {
     444            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[_index4])))) /* ?{} */);
     445        }
     446
     447    }
     448
     449    ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */);
     450}
     451static inline void ___constructor__F_R4sVadiPi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object47, signed int *__anonymous_object48){
     452    ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object47) /* ?{} */);
     453    ((void)((*___dst__R4sVad_1).__anonymous_object33=__anonymous_object48) /* ?{} */);
     454    {
     455        signed int _index5 = 0;
     456        for (;(_index5<10);((void)(++_index5))) {
     457            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[_index5])))) /* ?{} */);
     458        }
     459
     460    }
     461
     462    ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */);
     463}
     464static inline void ___constructor__F_R4sVadiPiA0i_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object49, signed int *__anonymous_object50, signed int __anonymous_object51[((unsigned int )10)]){
     465    ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object49) /* ?{} */);
     466    ((void)((*___dst__R4sVad_1).__anonymous_object33=__anonymous_object50) /* ?{} */);
     467    {
     468        signed int _index6 = 0;
     469        for (;(_index6<10);((void)(++_index6))) {
     470            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[_index6])))=__anonymous_object51[_index6]) /* ?{} */);
     471        }
     472
     473    }
     474
     475    ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */);
     476}
     477static inline void ___constructor__F_R4sVadiPiA0iPFi___autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object52, signed int *__anonymous_object53, signed int __anonymous_object54[((unsigned int )10)], signed int (*__anonymous_object55)()){
     478    ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object52) /* ?{} */);
     479    ((void)((*___dst__R4sVad_1).__anonymous_object33=__anonymous_object53) /* ?{} */);
     480    {
     481        signed int _index7 = 0;
     482        for (;(_index7<10);((void)(++_index7))) {
     483            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[_index7])))=__anonymous_object54[_index7]) /* ?{} */);
     484        }
     485
     486    }
     487
     488    ((void)((*___dst__R4sVad_1).__anonymous_object35=__anonymous_object55) /* ?{} */);
     489}
  • src/tests/.expect/32/declarationSpecifier.txt

    r78315272 r3f7e12cb  
    2020static inline void ___destructor__F_R13s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1);
    2121static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_R13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1);
     22static inline void ___constructor__F_R13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1, signed int __i__i_1);
    2223static inline void ___constructor__F_R13s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1){
    2324    ((void)((*___dst__R13s__anonymous0_1).__i__i_1) /* ?{} */);
     
    3233    struct __anonymous0 ___ret__13s__anonymous0_1;
    3334    ((void)((*___dst__R13s__anonymous0_1).__i__i_1=___src__13s__anonymous0_1.__i__i_1));
    34     ((void)___constructor__F_R13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1));
    35     return ((struct __anonymous0 )___ret__13s__anonymous0_1);
     35    ((void)___constructor__F_R13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), (*___dst__R13s__anonymous0_1)));
     36    return ___ret__13s__anonymous0_1;
    3637}
    3738static inline void ___constructor__F_R13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1, signed int __i__i_1){
     
    4647static inline void ___destructor__F_R13s__anonymous1_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1);
    4748static inline struct __anonymous1 ___operator_assign__F13s__anonymous1_R13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1);
     49static inline void ___constructor__F_R13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1, signed int __i__i_1);
    4850static inline void ___constructor__F_R13s__anonymous1_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1){
    4951    ((void)((*___dst__R13s__anonymous1_1).__i__i_1) /* ?{} */);
     
    5860    struct __anonymous1 ___ret__13s__anonymous1_1;
    5961    ((void)((*___dst__R13s__anonymous1_1).__i__i_1=___src__13s__anonymous1_1.__i__i_1));
    60     ((void)___constructor__F_R13s__anonymous113s__anonymous1_autogen___1((&___ret__13s__anonymous1_1), ___src__13s__anonymous1_1));
    61     return ((struct __anonymous1 )___ret__13s__anonymous1_1);
     62    ((void)___constructor__F_R13s__anonymous113s__anonymous1_autogen___1((&___ret__13s__anonymous1_1), (*___dst__R13s__anonymous1_1)));
     63    return ___ret__13s__anonymous1_1;
    6264}
    6365static inline void ___constructor__F_R13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1, signed int __i__i_1){
     
    7274static inline void ___destructor__F_R13s__anonymous2_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1);
    7375static inline struct __anonymous2 ___operator_assign__F13s__anonymous2_R13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1);
     76static inline void ___constructor__F_R13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1, signed int __i__i_1);
    7477static inline void ___constructor__F_R13s__anonymous2_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1){
    7578    ((void)((*___dst__R13s__anonymous2_1).__i__i_1) /* ?{} */);
     
    8487    struct __anonymous2 ___ret__13s__anonymous2_1;
    8588    ((void)((*___dst__R13s__anonymous2_1).__i__i_1=___src__13s__anonymous2_1.__i__i_1));
    86     ((void)___constructor__F_R13s__anonymous213s__anonymous2_autogen___1((&___ret__13s__anonymous2_1), ___src__13s__anonymous2_1));
    87     return ((struct __anonymous2 )___ret__13s__anonymous2_1);
     89    ((void)___constructor__F_R13s__anonymous213s__anonymous2_autogen___1((&___ret__13s__anonymous2_1), (*___dst__R13s__anonymous2_1)));
     90    return ___ret__13s__anonymous2_1;
    8891}
    8992static inline void ___constructor__F_R13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1, signed int __i__i_1){
     
    98101static inline void ___destructor__F_R13s__anonymous3_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1);
    99102static inline struct __anonymous3 ___operator_assign__F13s__anonymous3_R13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1);
     103static inline void ___constructor__F_R13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1, signed int __i__i_1);
    100104static inline void ___constructor__F_R13s__anonymous3_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1){
    101105    ((void)((*___dst__R13s__anonymous3_1).__i__i_1) /* ?{} */);
     
    110114    struct __anonymous3 ___ret__13s__anonymous3_1;
    111115    ((void)((*___dst__R13s__anonymous3_1).__i__i_1=___src__13s__anonymous3_1.__i__i_1));
    112     ((void)___constructor__F_R13s__anonymous313s__anonymous3_autogen___1((&___ret__13s__anonymous3_1), ___src__13s__anonymous3_1));
    113     return ((struct __anonymous3 )___ret__13s__anonymous3_1);
     116    ((void)___constructor__F_R13s__anonymous313s__anonymous3_autogen___1((&___ret__13s__anonymous3_1), (*___dst__R13s__anonymous3_1)));
     117    return ___ret__13s__anonymous3_1;
    114118}
    115119static inline void ___constructor__F_R13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1, signed int __i__i_1){
     
    124128static inline void ___destructor__F_R13s__anonymous4_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1);
    125129static inline struct __anonymous4 ___operator_assign__F13s__anonymous4_R13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1);
     130static inline void ___constructor__F_R13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1, signed int __i__i_1);
    126131static inline void ___constructor__F_R13s__anonymous4_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1){
    127132    ((void)((*___dst__R13s__anonymous4_1).__i__i_1) /* ?{} */);
     
    136141    struct __anonymous4 ___ret__13s__anonymous4_1;
    137142    ((void)((*___dst__R13s__anonymous4_1).__i__i_1=___src__13s__anonymous4_1.__i__i_1));
    138     ((void)___constructor__F_R13s__anonymous413s__anonymous4_autogen___1((&___ret__13s__anonymous4_1), ___src__13s__anonymous4_1));
    139     return ((struct __anonymous4 )___ret__13s__anonymous4_1);
     143    ((void)___constructor__F_R13s__anonymous413s__anonymous4_autogen___1((&___ret__13s__anonymous4_1), (*___dst__R13s__anonymous4_1)));
     144    return ___ret__13s__anonymous4_1;
    140145}
    141146static inline void ___constructor__F_R13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1, signed int __i__i_1){
     
    150155static inline void ___destructor__F_R13s__anonymous5_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1);
    151156static inline struct __anonymous5 ___operator_assign__F13s__anonymous5_R13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1);
     157static inline void ___constructor__F_R13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1, signed int __i__i_1);
    152158static inline void ___constructor__F_R13s__anonymous5_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1){
    153159    ((void)((*___dst__R13s__anonymous5_1).__i__i_1) /* ?{} */);
     
    162168    struct __anonymous5 ___ret__13s__anonymous5_1;
    163169    ((void)((*___dst__R13s__anonymous5_1).__i__i_1=___src__13s__anonymous5_1.__i__i_1));
    164     ((void)___constructor__F_R13s__anonymous513s__anonymous5_autogen___1((&___ret__13s__anonymous5_1), ___src__13s__anonymous5_1));
    165     return ((struct __anonymous5 )___ret__13s__anonymous5_1);
     170    ((void)___constructor__F_R13s__anonymous513s__anonymous5_autogen___1((&___ret__13s__anonymous5_1), (*___dst__R13s__anonymous5_1)));
     171    return ___ret__13s__anonymous5_1;
    166172}
    167173static inline void ___constructor__F_R13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1, signed int __i__i_1){
     
    176182static inline void ___destructor__F_R13s__anonymous6_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1);
    177183static inline struct __anonymous6 ___operator_assign__F13s__anonymous6_R13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1);
     184static inline void ___constructor__F_R13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1, signed int __i__i_1);
    178185static inline void ___constructor__F_R13s__anonymous6_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1){
    179186    ((void)((*___dst__R13s__anonymous6_1).__i__i_1) /* ?{} */);
     
    188195    struct __anonymous6 ___ret__13s__anonymous6_1;
    189196    ((void)((*___dst__R13s__anonymous6_1).__i__i_1=___src__13s__anonymous6_1.__i__i_1));
    190     ((void)___constructor__F_R13s__anonymous613s__anonymous6_autogen___1((&___ret__13s__anonymous6_1), ___src__13s__anonymous6_1));
    191     return ((struct __anonymous6 )___ret__13s__anonymous6_1);
     197    ((void)___constructor__F_R13s__anonymous613s__anonymous6_autogen___1((&___ret__13s__anonymous6_1), (*___dst__R13s__anonymous6_1)));
     198    return ___ret__13s__anonymous6_1;
    192199}
    193200static inline void ___constructor__F_R13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1, signed int __i__i_1){
     
    202209static inline void ___destructor__F_R13s__anonymous7_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1);
    203210static inline struct __anonymous7 ___operator_assign__F13s__anonymous7_R13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1);
     211static inline void ___constructor__F_R13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1, signed int __i__i_1);
    204212static inline void ___constructor__F_R13s__anonymous7_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1){
    205213    ((void)((*___dst__R13s__anonymous7_1).__i__i_1) /* ?{} */);
     
    214222    struct __anonymous7 ___ret__13s__anonymous7_1;
    215223    ((void)((*___dst__R13s__anonymous7_1).__i__i_1=___src__13s__anonymous7_1.__i__i_1));
    216     ((void)___constructor__F_R13s__anonymous713s__anonymous7_autogen___1((&___ret__13s__anonymous7_1), ___src__13s__anonymous7_1));
    217     return ((struct __anonymous7 )___ret__13s__anonymous7_1);
     224    ((void)___constructor__F_R13s__anonymous713s__anonymous7_autogen___1((&___ret__13s__anonymous7_1), (*___dst__R13s__anonymous7_1)));
     225    return ___ret__13s__anonymous7_1;
    218226}
    219227static inline void ___constructor__F_R13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1, signed int __i__i_1){
     
    236244static inline void ___destructor__F_R13s__anonymous8_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1);
    237245static inline struct __anonymous8 ___operator_assign__F13s__anonymous8_R13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1);
     246static inline void ___constructor__F_R13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1, signed short int __i__s_1);
    238247static inline void ___constructor__F_R13s__anonymous8_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1){
    239248    ((void)((*___dst__R13s__anonymous8_1).__i__s_1) /* ?{} */);
     
    248257    struct __anonymous8 ___ret__13s__anonymous8_1;
    249258    ((void)((*___dst__R13s__anonymous8_1).__i__s_1=___src__13s__anonymous8_1.__i__s_1));
    250     ((void)___constructor__F_R13s__anonymous813s__anonymous8_autogen___1((&___ret__13s__anonymous8_1), ___src__13s__anonymous8_1));
    251     return ((struct __anonymous8 )___ret__13s__anonymous8_1);
     259    ((void)___constructor__F_R13s__anonymous813s__anonymous8_autogen___1((&___ret__13s__anonymous8_1), (*___dst__R13s__anonymous8_1)));
     260    return ___ret__13s__anonymous8_1;
    252261}
    253262static inline void ___constructor__F_R13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1, signed short int __i__s_1){
     
    262271static inline void ___destructor__F_R13s__anonymous9_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1);
    263272static inline struct __anonymous9 ___operator_assign__F13s__anonymous9_R13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1);
     273static inline void ___constructor__F_R13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1, signed short int __i__s_1);
    264274static inline void ___constructor__F_R13s__anonymous9_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1){
    265275    ((void)((*___dst__R13s__anonymous9_1).__i__s_1) /* ?{} */);
     
    274284    struct __anonymous9 ___ret__13s__anonymous9_1;
    275285    ((void)((*___dst__R13s__anonymous9_1).__i__s_1=___src__13s__anonymous9_1.__i__s_1));
    276     ((void)___constructor__F_R13s__anonymous913s__anonymous9_autogen___1((&___ret__13s__anonymous9_1), ___src__13s__anonymous9_1));
    277     return ((struct __anonymous9 )___ret__13s__anonymous9_1);
     286    ((void)___constructor__F_R13s__anonymous913s__anonymous9_autogen___1((&___ret__13s__anonymous9_1), (*___dst__R13s__anonymous9_1)));
     287    return ___ret__13s__anonymous9_1;
    278288}
    279289static inline void ___constructor__F_R13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1, signed short int __i__s_1){
     
    288298static inline void ___destructor__F_R14s__anonymous10_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1);
    289299static inline struct __anonymous10 ___operator_assign__F14s__anonymous10_R14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1);
     300static inline void ___constructor__F_R14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1, signed short int __i__s_1);
    290301static inline void ___constructor__F_R14s__anonymous10_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1){
    291302    ((void)((*___dst__R14s__anonymous10_1).__i__s_1) /* ?{} */);
     
    300311    struct __anonymous10 ___ret__14s__anonymous10_1;
    301312    ((void)((*___dst__R14s__anonymous10_1).__i__s_1=___src__14s__anonymous10_1.__i__s_1));
    302     ((void)___constructor__F_R14s__anonymous1014s__anonymous10_autogen___1((&___ret__14s__anonymous10_1), ___src__14s__anonymous10_1));
    303     return ((struct __anonymous10 )___ret__14s__anonymous10_1);
     313    ((void)___constructor__F_R14s__anonymous1014s__anonymous10_autogen___1((&___ret__14s__anonymous10_1), (*___dst__R14s__anonymous10_1)));
     314    return ___ret__14s__anonymous10_1;
    304315}
    305316static inline void ___constructor__F_R14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1, signed short int __i__s_1){
     
    314325static inline void ___destructor__F_R14s__anonymous11_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1);
    315326static inline struct __anonymous11 ___operator_assign__F14s__anonymous11_R14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1);
     327static inline void ___constructor__F_R14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1, signed short int __i__s_1);
    316328static inline void ___constructor__F_R14s__anonymous11_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1){
    317329    ((void)((*___dst__R14s__anonymous11_1).__i__s_1) /* ?{} */);
     
    326338    struct __anonymous11 ___ret__14s__anonymous11_1;
    327339    ((void)((*___dst__R14s__anonymous11_1).__i__s_1=___src__14s__anonymous11_1.__i__s_1));
    328     ((void)___constructor__F_R14s__anonymous1114s__anonymous11_autogen___1((&___ret__14s__anonymous11_1), ___src__14s__anonymous11_1));
    329     return ((struct __anonymous11 )___ret__14s__anonymous11_1);
     340    ((void)___constructor__F_R14s__anonymous1114s__anonymous11_autogen___1((&___ret__14s__anonymous11_1), (*___dst__R14s__anonymous11_1)));
     341    return ___ret__14s__anonymous11_1;
    330342}
    331343static inline void ___constructor__F_R14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1, signed short int __i__s_1){
     
    340352static inline void ___destructor__F_R14s__anonymous12_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1);
    341353static inline struct __anonymous12 ___operator_assign__F14s__anonymous12_R14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1);
     354static inline void ___constructor__F_R14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1, signed short int __i__s_1);
    342355static inline void ___constructor__F_R14s__anonymous12_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1){
    343356    ((void)((*___dst__R14s__anonymous12_1).__i__s_1) /* ?{} */);
     
    352365    struct __anonymous12 ___ret__14s__anonymous12_1;
    353366    ((void)((*___dst__R14s__anonymous12_1).__i__s_1=___src__14s__anonymous12_1.__i__s_1));
    354     ((void)___constructor__F_R14s__anonymous1214s__anonymous12_autogen___1((&___ret__14s__anonymous12_1), ___src__14s__anonymous12_1));
    355     return ((struct __anonymous12 )___ret__14s__anonymous12_1);
     367    ((void)___constructor__F_R14s__anonymous1214s__anonymous12_autogen___1((&___ret__14s__anonymous12_1), (*___dst__R14s__anonymous12_1)));
     368    return ___ret__14s__anonymous12_1;
    356369}
    357370static inline void ___constructor__F_R14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1, signed short int __i__s_1){
     
    366379static inline void ___destructor__F_R14s__anonymous13_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1);
    367380static inline struct __anonymous13 ___operator_assign__F14s__anonymous13_R14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1);
     381static inline void ___constructor__F_R14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1, signed short int __i__s_1);
    368382static inline void ___constructor__F_R14s__anonymous13_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1){
    369383    ((void)((*___dst__R14s__anonymous13_1).__i__s_1) /* ?{} */);
     
    378392    struct __anonymous13 ___ret__14s__anonymous13_1;
    379393    ((void)((*___dst__R14s__anonymous13_1).__i__s_1=___src__14s__anonymous13_1.__i__s_1));
    380     ((void)___constructor__F_R14s__anonymous1314s__anonymous13_autogen___1((&___ret__14s__anonymous13_1), ___src__14s__anonymous13_1));
    381     return ((struct __anonymous13 )___ret__14s__anonymous13_1);
     394    ((void)___constructor__F_R14s__anonymous1314s__anonymous13_autogen___1((&___ret__14s__anonymous13_1), (*___dst__R14s__anonymous13_1)));
     395    return ___ret__14s__anonymous13_1;
    382396}
    383397static inline void ___constructor__F_R14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1, signed short int __i__s_1){
     
    392406static inline void ___destructor__F_R14s__anonymous14_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1);
    393407static inline struct __anonymous14 ___operator_assign__F14s__anonymous14_R14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1);
     408static inline void ___constructor__F_R14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1, signed short int __i__s_1);
    394409static inline void ___constructor__F_R14s__anonymous14_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1){
    395410    ((void)((*___dst__R14s__anonymous14_1).__i__s_1) /* ?{} */);
     
    404419    struct __anonymous14 ___ret__14s__anonymous14_1;
    405420    ((void)((*___dst__R14s__anonymous14_1).__i__s_1=___src__14s__anonymous14_1.__i__s_1));
    406     ((void)___constructor__F_R14s__anonymous1414s__anonymous14_autogen___1((&___ret__14s__anonymous14_1), ___src__14s__anonymous14_1));
    407     return ((struct __anonymous14 )___ret__14s__anonymous14_1);
     421    ((void)___constructor__F_R14s__anonymous1414s__anonymous14_autogen___1((&___ret__14s__anonymous14_1), (*___dst__R14s__anonymous14_1)));
     422    return ___ret__14s__anonymous14_1;
    408423}
    409424static inline void ___constructor__F_R14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1, signed short int __i__s_1){
     
    418433static inline void ___destructor__F_R14s__anonymous15_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1);
    419434static inline struct __anonymous15 ___operator_assign__F14s__anonymous15_R14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1);
     435static inline void ___constructor__F_R14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1, signed short int __i__s_1);
    420436static inline void ___constructor__F_R14s__anonymous15_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1){
    421437    ((void)((*___dst__R14s__anonymous15_1).__i__s_1) /* ?{} */);
     
    430446    struct __anonymous15 ___ret__14s__anonymous15_1;
    431447    ((void)((*___dst__R14s__anonymous15_1).__i__s_1=___src__14s__anonymous15_1.__i__s_1));
    432     ((void)___constructor__F_R14s__anonymous1514s__anonymous15_autogen___1((&___ret__14s__anonymous15_1), ___src__14s__anonymous15_1));
    433     return ((struct __anonymous15 )___ret__14s__anonymous15_1);
     448    ((void)___constructor__F_R14s__anonymous1514s__anonymous15_autogen___1((&___ret__14s__anonymous15_1), (*___dst__R14s__anonymous15_1)));
     449    return ___ret__14s__anonymous15_1;
    434450}
    435451static inline void ___constructor__F_R14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1, signed short int __i__s_1){
     
    460476static inline void ___destructor__F_R14s__anonymous16_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1);
    461477static inline struct __anonymous16 ___operator_assign__F14s__anonymous16_R14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1);
     478static inline void ___constructor__F_R14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1, signed int __i__i_1);
    462479static inline void ___constructor__F_R14s__anonymous16_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1){
    463480    ((void)((*___dst__R14s__anonymous16_1).__i__i_1) /* ?{} */);
     
    472489    struct __anonymous16 ___ret__14s__anonymous16_1;
    473490    ((void)((*___dst__R14s__anonymous16_1).__i__i_1=___src__14s__anonymous16_1.__i__i_1));
    474     ((void)___constructor__F_R14s__anonymous1614s__anonymous16_autogen___1((&___ret__14s__anonymous16_1), ___src__14s__anonymous16_1));
    475     return ((struct __anonymous16 )___ret__14s__anonymous16_1);
     491    ((void)___constructor__F_R14s__anonymous1614s__anonymous16_autogen___1((&___ret__14s__anonymous16_1), (*___dst__R14s__anonymous16_1)));
     492    return ___ret__14s__anonymous16_1;
    476493}
    477494static inline void ___constructor__F_R14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1, signed int __i__i_1){
     
    486503static inline void ___destructor__F_R14s__anonymous17_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1);
    487504static inline struct __anonymous17 ___operator_assign__F14s__anonymous17_R14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1);
     505static inline void ___constructor__F_R14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1, signed int __i__i_1);
    488506static inline void ___constructor__F_R14s__anonymous17_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1){
    489507    ((void)((*___dst__R14s__anonymous17_1).__i__i_1) /* ?{} */);
     
    498516    struct __anonymous17 ___ret__14s__anonymous17_1;
    499517    ((void)((*___dst__R14s__anonymous17_1).__i__i_1=___src__14s__anonymous17_1.__i__i_1));
    500     ((void)___constructor__F_R14s__anonymous1714s__anonymous17_autogen___1((&___ret__14s__anonymous17_1), ___src__14s__anonymous17_1));
    501     return ((struct __anonymous17 )___ret__14s__anonymous17_1);
     518    ((void)___constructor__F_R14s__anonymous1714s__anonymous17_autogen___1((&___ret__14s__anonymous17_1), (*___dst__R14s__anonymous17_1)));
     519    return ___ret__14s__anonymous17_1;
    502520}
    503521static inline void ___constructor__F_R14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1, signed int __i__i_1){
     
    512530static inline void ___destructor__F_R14s__anonymous18_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1);
    513531static inline struct __anonymous18 ___operator_assign__F14s__anonymous18_R14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1);
     532static inline void ___constructor__F_R14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1, signed int __i__i_1);
    514533static inline void ___constructor__F_R14s__anonymous18_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1){
    515534    ((void)((*___dst__R14s__anonymous18_1).__i__i_1) /* ?{} */);
     
    524543    struct __anonymous18 ___ret__14s__anonymous18_1;
    525544    ((void)((*___dst__R14s__anonymous18_1).__i__i_1=___src__14s__anonymous18_1.__i__i_1));
    526     ((void)___constructor__F_R14s__anonymous1814s__anonymous18_autogen___1((&___ret__14s__anonymous18_1), ___src__14s__anonymous18_1));
    527     return ((struct __anonymous18 )___ret__14s__anonymous18_1);
     545    ((void)___constructor__F_R14s__anonymous1814s__anonymous18_autogen___1((&___ret__14s__anonymous18_1), (*___dst__R14s__anonymous18_1)));
     546    return ___ret__14s__anonymous18_1;
    528547}
    529548static inline void ___constructor__F_R14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1, signed int __i__i_1){
     
    538557static inline void ___destructor__F_R14s__anonymous19_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1);
    539558static inline struct __anonymous19 ___operator_assign__F14s__anonymous19_R14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1);
     559static inline void ___constructor__F_R14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1, signed int __i__i_1);
    540560static inline void ___constructor__F_R14s__anonymous19_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1){
    541561    ((void)((*___dst__R14s__anonymous19_1).__i__i_1) /* ?{} */);
     
    550570    struct __anonymous19 ___ret__14s__anonymous19_1;
    551571    ((void)((*___dst__R14s__anonymous19_1).__i__i_1=___src__14s__anonymous19_1.__i__i_1));
    552     ((void)___constructor__F_R14s__anonymous1914s__anonymous19_autogen___1((&___ret__14s__anonymous19_1), ___src__14s__anonymous19_1));
    553     return ((struct __anonymous19 )___ret__14s__anonymous19_1);
     572    ((void)___constructor__F_R14s__anonymous1914s__anonymous19_autogen___1((&___ret__14s__anonymous19_1), (*___dst__R14s__anonymous19_1)));
     573    return ___ret__14s__anonymous19_1;
    554574}
    555575static inline void ___constructor__F_R14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1, signed int __i__i_1){
     
    564584static inline void ___destructor__F_R14s__anonymous20_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1);
    565585static inline struct __anonymous20 ___operator_assign__F14s__anonymous20_R14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1);
     586static inline void ___constructor__F_R14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1, signed int __i__i_1);
    566587static inline void ___constructor__F_R14s__anonymous20_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1){
    567588    ((void)((*___dst__R14s__anonymous20_1).__i__i_1) /* ?{} */);
     
    576597    struct __anonymous20 ___ret__14s__anonymous20_1;
    577598    ((void)((*___dst__R14s__anonymous20_1).__i__i_1=___src__14s__anonymous20_1.__i__i_1));
    578     ((void)___constructor__F_R14s__anonymous2014s__anonymous20_autogen___1((&___ret__14s__anonymous20_1), ___src__14s__anonymous20_1));
    579     return ((struct __anonymous20 )___ret__14s__anonymous20_1);
     599    ((void)___constructor__F_R14s__anonymous2014s__anonymous20_autogen___1((&___ret__14s__anonymous20_1), (*___dst__R14s__anonymous20_1)));
     600    return ___ret__14s__anonymous20_1;
    580601}
    581602static inline void ___constructor__F_R14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1, signed int __i__i_1){
     
    590611static inline void ___destructor__F_R14s__anonymous21_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1);
    591612static inline struct __anonymous21 ___operator_assign__F14s__anonymous21_R14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1);
     613static inline void ___constructor__F_R14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1, signed int __i__i_1);
    592614static inline void ___constructor__F_R14s__anonymous21_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1){
    593615    ((void)((*___dst__R14s__anonymous21_1).__i__i_1) /* ?{} */);
     
    602624    struct __anonymous21 ___ret__14s__anonymous21_1;
    603625    ((void)((*___dst__R14s__anonymous21_1).__i__i_1=___src__14s__anonymous21_1.__i__i_1));
    604     ((void)___constructor__F_R14s__anonymous2114s__anonymous21_autogen___1((&___ret__14s__anonymous21_1), ___src__14s__anonymous21_1));
    605     return ((struct __anonymous21 )___ret__14s__anonymous21_1);
     626    ((void)___constructor__F_R14s__anonymous2114s__anonymous21_autogen___1((&___ret__14s__anonymous21_1), (*___dst__R14s__anonymous21_1)));
     627    return ___ret__14s__anonymous21_1;
    606628}
    607629static inline void ___constructor__F_R14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1, signed int __i__i_1){
     
    616638static inline void ___destructor__F_R14s__anonymous22_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1);
    617639static inline struct __anonymous22 ___operator_assign__F14s__anonymous22_R14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1);
     640static inline void ___constructor__F_R14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1, signed int __i__i_1);
    618641static inline void ___constructor__F_R14s__anonymous22_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1){
    619642    ((void)((*___dst__R14s__anonymous22_1).__i__i_1) /* ?{} */);
     
    628651    struct __anonymous22 ___ret__14s__anonymous22_1;
    629652    ((void)((*___dst__R14s__anonymous22_1).__i__i_1=___src__14s__anonymous22_1.__i__i_1));
    630     ((void)___constructor__F_R14s__anonymous2214s__anonymous22_autogen___1((&___ret__14s__anonymous22_1), ___src__14s__anonymous22_1));
    631     return ((struct __anonymous22 )___ret__14s__anonymous22_1);
     653    ((void)___constructor__F_R14s__anonymous2214s__anonymous22_autogen___1((&___ret__14s__anonymous22_1), (*___dst__R14s__anonymous22_1)));
     654    return ___ret__14s__anonymous22_1;
    632655}
    633656static inline void ___constructor__F_R14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1, signed int __i__i_1){
     
    642665static inline void ___destructor__F_R14s__anonymous23_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1);
    643666static inline struct __anonymous23 ___operator_assign__F14s__anonymous23_R14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1);
     667static inline void ___constructor__F_R14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1, signed int __i__i_1);
    644668static inline void ___constructor__F_R14s__anonymous23_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1){
    645669    ((void)((*___dst__R14s__anonymous23_1).__i__i_1) /* ?{} */);
     
    654678    struct __anonymous23 ___ret__14s__anonymous23_1;
    655679    ((void)((*___dst__R14s__anonymous23_1).__i__i_1=___src__14s__anonymous23_1.__i__i_1));
    656     ((void)___constructor__F_R14s__anonymous2314s__anonymous23_autogen___1((&___ret__14s__anonymous23_1), ___src__14s__anonymous23_1));
    657     return ((struct __anonymous23 )___ret__14s__anonymous23_1);
     680    ((void)___constructor__F_R14s__anonymous2314s__anonymous23_autogen___1((&___ret__14s__anonymous23_1), (*___dst__R14s__anonymous23_1)));
     681    return ___ret__14s__anonymous23_1;
    658682}
    659683static inline void ___constructor__F_R14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1, signed int __i__i_1){
     
    672696    __attribute__ ((unused)) signed int ___retval_main__i_1;
    673697    ((void)(___retval_main__i_1=((signed int )0)) /* ?{} */);
    674     return ((signed int )___retval_main__i_1);
     698    return ___retval_main__i_1;
    675699    ((void)(___retval_main__i_1=0) /* ?{} */);
    676     return ((signed int )___retval_main__i_1);
     700    return ___retval_main__i_1;
    677701}
    678702static inline int invoke_main(int argc, char* argv[], char* envp[]) { (void)argc; (void)argv; (void)envp; return __main__Fi_iPPCc__1(argc, argv); }
     
    689713    ((void)(___retval_main__i_1=(((void)(_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1))) , _tmp_cp_ret0)) /* ?{} */);
    690714    ((void)(_tmp_cp_ret0) /* ^?{} */);
    691     return ((signed int )___retval_main__i_1);
    692 }
     715    return ___retval_main__i_1;
     716}
  • src/tests/.expect/32/extension.txt

    r78315272 r3f7e12cb  
    1717static inline void ___destructor__F_R2sS_autogen___1(struct S *___dst__R2sS_1);
    1818static inline struct S ___operator_assign__F2sS_R2sS2sS_autogen___1(struct S *___dst__R2sS_1, struct S ___src__2sS_1);
     19static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1);
     20static inline void ___constructor__F_R2sSii_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1, signed int __b__i_1);
     21static inline void ___constructor__F_R2sSiii_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1, signed int __b__i_1, signed int __c__i_1);
    1922static inline void ___constructor__F_R2sS_autogen___1(struct S *___dst__R2sS_1){
    2023    ((void)((*___dst__R2sS_1).__a__i_1) /* ?{} */);
     
    3740    ((void)((*___dst__R2sS_1).__b__i_1=___src__2sS_1.__b__i_1));
    3841    ((void)((*___dst__R2sS_1).__c__i_1=___src__2sS_1.__c__i_1));
    39     ((void)___constructor__F_R2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1));
    40     return ((struct S )___ret__2sS_1);
     42    ((void)___constructor__F_R2sS2sS_autogen___1((&___ret__2sS_1), (*___dst__R2sS_1)));
     43    return ___ret__2sS_1;
    4144}
    4245static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1){
     
    6063    __extension__ signed int __c__i_1;
    6164};
     65static inline void ___constructor__F_R2uU_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1);
     66static inline void ___constructor__F_R2uU2uU_autogen___1(union U *___dst__R2uU_1, union U ___src__2uU_1);
     67static inline void ___destructor__F_R2uU_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1);
     68static inline union U ___operator_assign__F2uU_R2uU2uU_autogen___1(union U *___dst__R2uU_1, union U ___src__2uU_1);
     69static inline void ___constructor__F_R2uUi_autogen___1(union U *___dst__R2uU_1, signed int __a__i_1);
    6270static inline void ___constructor__F_R2uU_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1){
    6371}
     
    7078    union U ___ret__2uU_1;
    7179    ((void)__builtin_memcpy(((void *)___dst__R2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U )));
    72     ((void)___constructor__F_R2uU2uU_autogen___1((&___ret__2uU_1), ___src__2uU_1));
    73     return ((union U )___ret__2uU_1);
    74 }
    75 static inline void ___constructor__F_R2uUi_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1, signed int __src__i_1){
    76     ((void)__builtin_memcpy(((void *)___dst__R2uU_1), ((const void *)(&__src__i_1)), sizeof(signed int )));
     80    ((void)___constructor__F_R2uU2uU_autogen___1((&___ret__2uU_1), (*___dst__R2uU_1)));
     81    return ___ret__2uU_1;
     82}
     83static inline void ___constructor__F_R2uUi_autogen___1(union U *___dst__R2uU_1, signed int __a__i_1){
     84    ((void)__builtin_memcpy(((void *)___dst__R2uU_1), ((const void *)(&__a__i_1)), sizeof(signed int )));
    7785}
    7886__extension__ enum E {
     
    94102        __extension__ signed int *__z__Pi_2;
    95103    };
    96     signed int __i__i_2 = ((signed int )(__extension__ __a__i_1+__extension__ 3));
     104    inline void ___constructor__F_R2sS_autogen___2(struct S *___dst__R2sS_2){
     105        ((void)((*___dst__R2sS_2).__a__i_2) /* ?{} */);
     106        ((void)((*___dst__R2sS_2).__b__i_2) /* ?{} */);
     107        ((void)((*___dst__R2sS_2).__c__i_2) /* ?{} */);
     108        ((void)((*___dst__R2sS_2).__x__Pi_2) /* ?{} */);
     109        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ?{} */);
     110        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     111    }
     112    inline void ___constructor__F_R2sS2sS_autogen___2(struct S *___dst__R2sS_2, struct S ___src__2sS_2){
     113        ((void)((*___dst__R2sS_2).__a__i_2=___src__2sS_2.__a__i_2) /* ?{} */);
     114        ((void)((*___dst__R2sS_2).__b__i_2=___src__2sS_2.__b__i_2) /* ?{} */);
     115        ((void)((*___dst__R2sS_2).__c__i_2=___src__2sS_2.__c__i_2) /* ?{} */);
     116        ((void)((*___dst__R2sS_2).__x__Pi_2=___src__2sS_2.__x__Pi_2) /* ?{} */);
     117        ((void)((*___dst__R2sS_2).__y__Pi_2=___src__2sS_2.__y__Pi_2) /* ?{} */);
     118        ((void)((*___dst__R2sS_2).__z__Pi_2=___src__2sS_2.__z__Pi_2) /* ?{} */);
     119    }
     120    inline void ___destructor__F_R2sS_autogen___2(struct S *___dst__R2sS_2){
     121        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ^?{} */);
     122        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ^?{} */);
     123        ((void)((*___dst__R2sS_2).__x__Pi_2) /* ^?{} */);
     124        ((void)((*___dst__R2sS_2).__c__i_2) /* ^?{} */);
     125        ((void)((*___dst__R2sS_2).__b__i_2) /* ^?{} */);
     126        ((void)((*___dst__R2sS_2).__a__i_2) /* ^?{} */);
     127    }
     128    inline struct S ___operator_assign__F2sS_R2sS2sS_autogen___2(struct S *___dst__R2sS_2, struct S ___src__2sS_2){
     129        struct S ___ret__2sS_2;
     130        ((void)((*___dst__R2sS_2).__a__i_2=___src__2sS_2.__a__i_2));
     131        ((void)((*___dst__R2sS_2).__b__i_2=___src__2sS_2.__b__i_2));
     132        ((void)((*___dst__R2sS_2).__c__i_2=___src__2sS_2.__c__i_2));
     133        ((void)((*___dst__R2sS_2).__x__Pi_2=___src__2sS_2.__x__Pi_2));
     134        ((void)((*___dst__R2sS_2).__y__Pi_2=___src__2sS_2.__y__Pi_2));
     135        ((void)((*___dst__R2sS_2).__z__Pi_2=___src__2sS_2.__z__Pi_2));
     136        ((void)___constructor__F_R2sS2sS_autogen___2((&___ret__2sS_2), (*___dst__R2sS_2)));
     137        return ___ret__2sS_2;
     138    }
     139    inline void ___constructor__F_R2sSi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2){
     140        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     141        ((void)((*___dst__R2sS_2).__b__i_2) /* ?{} */);
     142        ((void)((*___dst__R2sS_2).__c__i_2) /* ?{} */);
     143        ((void)((*___dst__R2sS_2).__x__Pi_2) /* ?{} */);
     144        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ?{} */);
     145        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     146    }
     147    inline void ___constructor__F_R2sSii_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2){
     148        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     149        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
     150        ((void)((*___dst__R2sS_2).__c__i_2) /* ?{} */);
     151        ((void)((*___dst__R2sS_2).__x__Pi_2) /* ?{} */);
     152        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ?{} */);
     153        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     154    }
     155    inline void ___constructor__F_R2sSiii_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2, signed int __c__i_2){
     156        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     157        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
     158        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
     159        ((void)((*___dst__R2sS_2).__x__Pi_2) /* ?{} */);
     160        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ?{} */);
     161        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     162    }
     163    inline void ___constructor__F_R2sSiiiPi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2, signed int __c__i_2, signed int *__x__Pi_2){
     164        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     165        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
     166        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
     167        ((void)((*___dst__R2sS_2).__x__Pi_2=__x__Pi_2) /* ?{} */);
     168        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ?{} */);
     169        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     170    }
     171    inline void ___constructor__F_R2sSiiiPiPi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2, signed int __c__i_2, signed int *__x__Pi_2, signed int *__y__Pi_2){
     172        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     173        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
     174        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
     175        ((void)((*___dst__R2sS_2).__x__Pi_2=__x__Pi_2) /* ?{} */);
     176        ((void)((*___dst__R2sS_2).__y__Pi_2=__y__Pi_2) /* ?{} */);
     177        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     178    }
     179    inline void ___constructor__F_R2sSiiiPiPiPi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2, signed int __c__i_2, signed int *__x__Pi_2, signed int *__y__Pi_2, signed int *__z__Pi_2){
     180        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     181        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
     182        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
     183        ((void)((*___dst__R2sS_2).__x__Pi_2=__x__Pi_2) /* ?{} */);
     184        ((void)((*___dst__R2sS_2).__y__Pi_2=__y__Pi_2) /* ?{} */);
     185        ((void)((*___dst__R2sS_2).__z__Pi_2=__z__Pi_2) /* ?{} */);
     186    }
     187    signed int __i__i_2 = (__extension__ __a__i_1+__extension__ 3);
    97188    ((void)__extension__ 3);
    98189    ((void)__extension__ __a__i_1);
  • src/tests/.expect/32/gccExtensions.txt

    r78315272 r3f7e12cb  
    6363        ((void)((*___dst__R2sS_2).__b__i_2=___src__2sS_2.__b__i_2));
    6464        ((void)((*___dst__R2sS_2).__c__i_2=___src__2sS_2.__c__i_2));
    65         ((void)___constructor__F_R2sS2sS_autogen___2((&___ret__2sS_2), ___src__2sS_2));
    66         return ((struct S )___ret__2sS_2);
     65        ((void)___constructor__F_R2sS2sS_autogen___2((&___ret__2sS_2), (*___dst__R2sS_2)));
     66        return ___ret__2sS_2;
    6767    }
    6868    inline void ___constructor__F_R2sSi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2){
     
    8181        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
    8282    }
    83     signed int __i__i_2 = ((signed int )__extension__ 3);
     83    signed int __i__i_2 = __extension__ 3;
    8484    __extension__ signed int __a__i_2;
    8585    __extension__ signed int __b__i_2;
     
    113113        struct s2 ___ret__3ss2_2;
    114114        ((void)((*___dst__R3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2));
    115         ((void)___constructor__F_R3ss23ss2_autogen___2((&___ret__3ss2_2), ___src__3ss2_2));
    116         return ((struct s2 )___ret__3ss2_2);
     115        ((void)___constructor__F_R3ss23ss2_autogen___2((&___ret__3ss2_2), (*___dst__R3ss2_2)));
     116        return ___ret__3ss2_2;
    117117    }
    118118    inline void ___constructor__F_R3ss2i_autogen___2(struct s2 *___dst__R3ss2_2, signed int __i__i_2){
     
    134134        struct s3 ___ret__3ss3_2;
    135135        ((void)((*___dst__R3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2));
    136         ((void)___constructor__F_R3ss33ss3_autogen___2((&___ret__3ss3_2), ___src__3ss3_2));
    137         return ((struct s3 )___ret__3ss3_2);
     136        ((void)___constructor__F_R3ss33ss3_autogen___2((&___ret__3ss3_2), (*___dst__R3ss3_2)));
     137        return ___ret__3ss3_2;
    138138    }
    139139    inline void ___constructor__F_R3ss3i_autogen___2(struct s3 *___dst__R3ss3_2, signed int __i__i_2){
     
    157157        struct s4 ___ret__3ss4_2;
    158158        ((void)((*___dst__R3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2));
    159         ((void)___constructor__F_R3ss43ss4_autogen___2((&___ret__3ss4_2), ___src__3ss4_2));
    160         return ((struct s4 )___ret__3ss4_2);
     159        ((void)___constructor__F_R3ss43ss4_autogen___2((&___ret__3ss4_2), (*___dst__R3ss4_2)));
     160        return ___ret__3ss4_2;
    161161    }
    162162    inline void ___constructor__F_R3ss4i_autogen___2(struct s4 *___dst__R3ss4_2, signed int __i__i_2){
     
    169169    signed int __m3__A0A0i_2[((unsigned int )10)][((unsigned int )10)];
    170170    ((void)(___retval_main__i_1=((signed int )0)) /* ?{} */);
    171     return ((signed int )___retval_main__i_1);
     171    return ___retval_main__i_1;
    172172    ((void)(___retval_main__i_1=0) /* ?{} */);
    173     return ((signed int )___retval_main__i_1);
     173    return ___retval_main__i_1;
    174174}
    175175static inline int invoke_main(int argc, char* argv[], char* envp[]) { (void)argc; (void)argv; (void)envp; return __main__Fi_iPPCc__1(argc, argv); }
     
    186186    ((void)(___retval_main__i_1=(((void)(_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1))) , _tmp_cp_ret0)) /* ?{} */);
    187187    ((void)(_tmp_cp_ret0) /* ^?{} */);
    188     return ((signed int )___retval_main__i_1);
     188    return ___retval_main__i_1;
    189189}
  • src/tests/.expect/32/literals.txt

    r78315272 r3f7e12cb  
    55__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(signed int __status);
    66extern signed int printf(const char *__restrict __format, ...);
    7 void __for_each__A2_0_0_0____operator_assign__PFt0_Rt0t0____constructor__PF_Rt0____constructor__PF_Rt0t0____destructor__PF_Rt0____operator_assign__PFt1_Rt1t1____constructor__PF_Rt1____constructor__PF_Rt1t1____destructor__PF_Rt1____operator_preincr__PFt0_Rt0____operator_predecr__PFt0_Rt0____operator_equal__PFi_t0t0____operator_notequal__PFi_t0t0____operator_deref__PFRt1_t0__F_t0t0PF_t1___1(__attribute__ ((unused)) void (*_adapterF_9telt_type__P)(void (*__anonymous_object0)(), void *__anonymous_object1), __attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object2)(), void *__anonymous_object3), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object4)(), void *__anonymous_object5, void *__anonymous_object6), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object7)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object8), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object9)(), void *__anonymous_object10, void *__anonymous_object11), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object12)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object13, void *__anonymous_object14), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object15)(), void *__anonymous_object16, void *__anonymous_object17), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object18)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object19, void *__anonymous_object20), __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object21, void *__anonymous_object22), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object23), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object24, void *__anonymous_object25), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object26), __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object27, void *__anonymous_object28), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object29), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object30, void *__anonymous_object31), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object32), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object33), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object34), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object35, void *__anonymous_object36), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object37, void *__anonymous_object38), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object39), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void (*__func__PF_9telt_type__1)(void *__anonymous_object40));
    8 void __for_each_reverse__A2_0_0_0____operator_assign__PFt0_Rt0t0____constructor__PF_Rt0____constructor__PF_Rt0t0____destructor__PF_Rt0____operator_assign__PFt1_Rt1t1____constructor__PF_Rt1____constructor__PF_Rt1t1____destructor__PF_Rt1____operator_preincr__PFt0_Rt0____operator_predecr__PFt0_Rt0____operator_equal__PFi_t0t0____operator_notequal__PFi_t0t0____operator_deref__PFRt1_t0__F_t0t0PF_t1___1(__attribute__ ((unused)) void (*_adapterF_9telt_type__P)(void (*__anonymous_object41)(), void *__anonymous_object42), __attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object43)(), void *__anonymous_object44), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object45)(), void *__anonymous_object46, void *__anonymous_object47), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object48)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object49), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object50)(), void *__anonymous_object51, void *__anonymous_object52), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object53)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object54, void *__anonymous_object55), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object56)(), void *__anonymous_object57, void *__anonymous_object58), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object59)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object60, void *__anonymous_object61), __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object62, void *__anonymous_object63), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object64), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object65, void *__anonymous_object66), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object67), __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object68, void *__anonymous_object69), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object70), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object71, void *__anonymous_object72), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object73), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object74), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object75), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object76, void *__anonymous_object77), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object78, void *__anonymous_object79), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object80), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void (*__func__PF_9telt_type__1)(void *__anonymous_object81));
     7void __for_each__A0_2_0_0____operator_assign__PFd0_Rd0d0____constructor__PF_Rd0____constructor__PF_Rd0d0____destructor__PF_Rd0____operator_assign__PFd1_Rd1d1____constructor__PF_Rd1____constructor__PF_Rd1d1____destructor__PF_Rd1____operator_preincr__PFd0_Rd0____operator_predecr__PFd0_Rd0____operator_equal__PFi_d0d0____operator_notequal__PFi_d0d0____operator_deref__PFRd1_d0__F_d0d0PF_d1___1(__attribute__ ((unused)) void (*_adapterF_9telt_type__P)(void (*__anonymous_object0)(), void *__anonymous_object1), __attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object2)(), void *__anonymous_object3), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object4)(), void *__anonymous_object5, void *__anonymous_object6), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object7)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object8), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object9)(), void *__anonymous_object10, void *__anonymous_object11), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object12)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object13, void *__anonymous_object14), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object15)(), void *__anonymous_object16, void *__anonymous_object17), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object18)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object19, void *__anonymous_object20), __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object21, void *__anonymous_object22), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object23), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object24, void *__anonymous_object25), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object26), __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object27, void *__anonymous_object28), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object29), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object30, void *__anonymous_object31), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object32), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object33), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object34), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object35, void *__anonymous_object36), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object37, void *__anonymous_object38), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object39), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void (*__func__PF_9telt_type__1)(void *__anonymous_object40));
     8void __for_each_reverse__A0_2_0_0____operator_assign__PFd0_Rd0d0____constructor__PF_Rd0____constructor__PF_Rd0d0____destructor__PF_Rd0____operator_assign__PFd1_Rd1d1____constructor__PF_Rd1____constructor__PF_Rd1d1____destructor__PF_Rd1____operator_preincr__PFd0_Rd0____operator_predecr__PFd0_Rd0____operator_equal__PFi_d0d0____operator_notequal__PFi_d0d0____operator_deref__PFRd1_d0__F_d0d0PF_d1___1(__attribute__ ((unused)) void (*_adapterF_9telt_type__P)(void (*__anonymous_object41)(), void *__anonymous_object42), __attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object43)(), void *__anonymous_object44), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object45)(), void *__anonymous_object46, void *__anonymous_object47), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object48)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object49), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object50)(), void *__anonymous_object51, void *__anonymous_object52), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object53)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object54, void *__anonymous_object55), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object56)(), void *__anonymous_object57, void *__anonymous_object58), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object59)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object60, void *__anonymous_object61), __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object62, void *__anonymous_object63), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object64), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object65, void *__anonymous_object66), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object67), __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object68, void *__anonymous_object69), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object70), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object71, void *__anonymous_object72), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object73), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object74), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object75), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object76, void *__anonymous_object77), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object78, void *__anonymous_object79), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object80), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void (*__func__PF_9telt_type__1)(void *__anonymous_object81));
    99void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0c__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object82), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object83), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object84, _Bool __anonymous_object85), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object86), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object87, const char *__anonymous_object88), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object89), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object90, _Bool __anonymous_object91), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object92), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object93), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object94), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object95), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object96), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object97, const char *__anonymous_object98), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object99), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object100, const char *__anonymous_object101), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object102), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object103), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object104, const char *__anonymous_object105, unsigned long int __anonymous_object106), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object107, const char *__fmt__PCc_1, ...), void *__anonymous_object108, char __anonymous_object109);
    1010void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Sc__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object110), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object111), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object112, _Bool __anonymous_object113), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object114), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object115, const char *__anonymous_object116), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object117), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object118, _Bool __anonymous_object119), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object120), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object121), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object122), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object123), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object124), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object125, const char *__anonymous_object126), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object127), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object128, const char *__anonymous_object129), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object130), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object131), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object132, const char *__anonymous_object133, unsigned long int __anonymous_object134), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object135, const char *__fmt__PCc_1, ...), void *__anonymous_object136, signed char __anonymous_object137);
     
    2929void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCl__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object642), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object643), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object644, _Bool __anonymous_object645), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object646), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object647, const char *__anonymous_object648), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object649), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object650, _Bool __anonymous_object651), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object652), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object653), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object654), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object655), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object656), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object657, const char *__anonymous_object658), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object659), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object660, const char *__anonymous_object661), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object662), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object663), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object664, const char *__anonymous_object665, unsigned long int __anonymous_object666), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object667, const char *__fmt__PCc_1, ...), void *__anonymous_object668, const signed long int *__anonymous_object669);
    3030void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCv__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object670), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object671), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object672, _Bool __anonymous_object673), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object674), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object675, const char *__anonymous_object676), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object677), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object678, _Bool __anonymous_object679), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object680), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object681), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object682), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object683), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object684), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object685, const char *__anonymous_object686), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object687), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object688, const char *__anonymous_object689), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object690), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object691), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object692, const char *__anonymous_object693, unsigned long int __anonymous_object694), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object695, const char *__fmt__PCc_1, ...), void *__anonymous_object696, const void *__anonymous_object697);
    31 void *___operator_bitor__A1_1_0_1____operator_assign__PFt1_Rt1t1____constructor__PF_Rt1____constructor__PF_Rt1t1____destructor__PF_Rt1____operator_bitor__PFPd0_Pd0t1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_bitor__PFPd0_Pd0tVARGS2__FPd0_Pd0t1tVARGS2__1(__attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype7tParams_M_MP)(void (*__anonymous_object698)(), void *__anonymous_object699, void *__anonymous_object700), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype2tT_M_MP)(void (*__anonymous_object701)(), void *__anonymous_object702, void *__anonymous_object703), __attribute__ ((unused)) void (*_adapterF_P2tT2tT__MP)(void (*__anonymous_object704)(), void *__anonymous_object705, void *__anonymous_object706), __attribute__ ((unused)) void (*_adapterF2tT_P2tT2tT_P_MP)(void (*__anonymous_object707)(), __attribute__ ((unused)) void *___retval__operator_assign__2tT_1, void *__anonymous_object708, void *__anonymous_object709), __attribute__ ((unused)) unsigned long int _sizeof_2tT, __attribute__ ((unused)) unsigned long int _alignof_2tT, __attribute__ ((unused)) unsigned long int _sizeof_7tParams, __attribute__ ((unused)) unsigned long int _alignof_7tParams, __attribute__ ((unused)) void *(*___operator_assign__PF2tT_R2tT2tT__1)(void *__anonymous_object710, void *__anonymous_object711), __attribute__ ((unused)) void (*___constructor__PF_R2tT__1)(void *__anonymous_object712), __attribute__ ((unused)) void (*___constructor__PF_R2tT2tT__1)(void *__anonymous_object713, void *__anonymous_object714), __attribute__ ((unused)) void (*___destructor__PF_R2tT__1)(void *__anonymous_object715), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype2tT__1)(void *__anonymous_object716, void *__anonymous_object717), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object718), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object719), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object720, _Bool __anonymous_object721), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object722), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object723, const char *__anonymous_object724), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object725), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object726, _Bool __anonymous_object727), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object728), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object729), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object730), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object731), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object732), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object733, const char *__anonymous_object734), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object735), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object736, const char *__anonymous_object737), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object738), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object739), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object740, const char *__anonymous_object741, unsigned long int __anonymous_object742), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object743, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype7tParams__1)(void *__anonymous_object744, void *__anonymous_object745), void *__os__P7tostype_1, void *__arg__2tT_1, void *__rest__7tParams_1);
     31void *___operator_bitor__A0_2_0_1____operator_assign__PFd1_Rd1d1____constructor__PF_Rd1____constructor__PF_Rd1d1____destructor__PF_Rd1____operator_bitor__PFPd0_Pd0d1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_bitor__PFPd0_Pd0tVARGS2__FPd0_Pd0d1tVARGS2__1(__attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype7tParams_M_MP)(void (*__anonymous_object698)(), void *__anonymous_object699, void *__anonymous_object700), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype2tT_M_MP)(void (*__anonymous_object701)(), void *__anonymous_object702, void *__anonymous_object703), __attribute__ ((unused)) void (*_adapterF_P2tT2tT__MP)(void (*__anonymous_object704)(), void *__anonymous_object705, void *__anonymous_object706), __attribute__ ((unused)) void (*_adapterF2tT_P2tT2tT_P_MP)(void (*__anonymous_object707)(), __attribute__ ((unused)) void *___retval__operator_assign__2tT_1, void *__anonymous_object708, void *__anonymous_object709), __attribute__ ((unused)) unsigned long int _sizeof_2tT, __attribute__ ((unused)) unsigned long int _alignof_2tT, __attribute__ ((unused)) unsigned long int _sizeof_7tParams, __attribute__ ((unused)) unsigned long int _alignof_7tParams, __attribute__ ((unused)) void *(*___operator_assign__PF2tT_R2tT2tT__1)(void *__anonymous_object710, void *__anonymous_object711), __attribute__ ((unused)) void (*___constructor__PF_R2tT__1)(void *__anonymous_object712), __attribute__ ((unused)) void (*___constructor__PF_R2tT2tT__1)(void *__anonymous_object713, void *__anonymous_object714), __attribute__ ((unused)) void (*___destructor__PF_R2tT__1)(void *__anonymous_object715), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype2tT__1)(void *__anonymous_object716, void *__anonymous_object717), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object718), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object719), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object720, _Bool __anonymous_object721), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object722), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object723, const char *__anonymous_object724), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object725), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object726, _Bool __anonymous_object727), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object728), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object729), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object730), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object731), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object732), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object733, const char *__anonymous_object734), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object735), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object736, const char *__anonymous_object737), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object738), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object739), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object740, const char *__anonymous_object741, unsigned long int __anonymous_object742), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object743, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype7tParams__1)(void *__anonymous_object744, void *__anonymous_object745), void *__os__P7tostype_1, void *__arg__2tT_1, void *__rest__7tParams_1);
    3232void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object746), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object747), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object748, _Bool __anonymous_object749), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object750), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object751, const char *__anonymous_object752), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object753), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object754, _Bool __anonymous_object755), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object756), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object757), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object758), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object759), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object760), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object761, const char *__anonymous_object762), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object763), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object764, const char *__anonymous_object765), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object766), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object767), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object768, const char *__anonymous_object769, unsigned long int __anonymous_object770), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object771, const char *__fmt__PCc_1, ...), void *__anonymous_object772, void *(*__anonymous_object773)(void *__anonymous_object774));
    3333void *__endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object775), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object776), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object777, _Bool __anonymous_object778), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object779), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object780, const char *__anonymous_object781), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object782), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object783, _Bool __anonymous_object784), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object785), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object786), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object787), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object788), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object789), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object790, const char *__anonymous_object791), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object792), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object793, const char *__anonymous_object794), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object795), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object796), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object797, const char *__anonymous_object798, unsigned long int __anonymous_object799), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object800, const char *__fmt__PCc_1, ...), void *__anonymous_object801);
     
    3838void *__sepDisable__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object910), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object911), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object912, _Bool __anonymous_object913), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object914), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object915, const char *__anonymous_object916), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object917), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object918, _Bool __anonymous_object919), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object920), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object921), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object922), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object923), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object924), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object925, const char *__anonymous_object926), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object927), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object928, const char *__anonymous_object929), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object930), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object931), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object932, const char *__anonymous_object933, unsigned long int __anonymous_object934), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object935, const char *__fmt__PCc_1, ...), void *__anonymous_object936);
    3939void *__sepEnable__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object937), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object938), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object939, _Bool __anonymous_object940), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object941), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object942, const char *__anonymous_object943), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object944), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object945, _Bool __anonymous_object946), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object947), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object948), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object949), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object950), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object951), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object952, const char *__anonymous_object953), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object954), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object955, const char *__anonymous_object956), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object957), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object958), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object959, const char *__anonymous_object960, unsigned long int __anonymous_object961), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object962, const char *__fmt__PCc_1, ...), void *__anonymous_object963);
    40 void __write__A2_1_0_0____operator_assign__PFt1_Rt1t1____constructor__PF_Rt1____constructor__PF_Rt1t1____destructor__PF_Rt1____operator_bitor__PFPd0_Pd0t1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_assign__PFt2_Rt2t2____constructor__PF_Rt2____constructor__PF_Rt2t2____destructor__PF_Rt2____operator_preincr__PFt2_Rt2____operator_predecr__PFt2_Rt2____operator_equal__PFi_t2t2____operator_notequal__PFi_t2t2____operator_deref__PFRt1_t2__F_t2t2Pd0__1(__attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object964)(), void *__anonymous_object965), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object966)(), void *__anonymous_object967, void *__anonymous_object968), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object969)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object970), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object971)(), void *__anonymous_object972, void *__anonymous_object973), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object974)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object975, void *__anonymous_object976), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype9telt_type_M_MP)(void (*__anonymous_object977)(), void *__anonymous_object978, void *__anonymous_object979), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object980)(), void *__anonymous_object981, void *__anonymous_object982), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object983)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object984, void *__anonymous_object985), __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object986, void *__anonymous_object987), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object988), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object989, void *__anonymous_object990), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object991), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype9telt_type__1)(void *__anonymous_object992, void *__anonymous_object993), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object994), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object995), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object996, _Bool __anonymous_object997), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object998), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object999, const char *__anonymous_object1000), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object1001), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object1002, _Bool __anonymous_object1003), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object1004), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object1005), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object1006), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object1007), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object1008), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object1009, const char *__anonymous_object1010), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object1011), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object1012, const char *__anonymous_object1013), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object1014), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object1015), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object1016, const char *__anonymous_object1017, unsigned long int __anonymous_object1018), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object1019, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object1020, void *__anonymous_object1021), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object1022), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object1023, void *__anonymous_object1024), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object1025), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1026), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1027), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1028, void *__anonymous_object1029), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1030, void *__anonymous_object1031), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object1032), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void *__os__P7tostype_1);
    41 void __write_reverse__A2_1_0_0____operator_assign__PFt1_Rt1t1____constructor__PF_Rt1____constructor__PF_Rt1t1____destructor__PF_Rt1____operator_bitor__PFPd0_Pd0t1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_assign__PFt2_Rt2t2____constructor__PF_Rt2____constructor__PF_Rt2t2____destructor__PF_Rt2____operator_preincr__PFt2_Rt2____operator_predecr__PFt2_Rt2____operator_equal__PFi_t2t2____operator_notequal__PFi_t2t2____operator_deref__PFRt1_t2__F_t2t2Pd0__1(__attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object1033)(), void *__anonymous_object1034), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object1035)(), void *__anonymous_object1036, void *__anonymous_object1037), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object1038)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object1039), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object1040)(), void *__anonymous_object1041, void *__anonymous_object1042), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object1043)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object1044, void *__anonymous_object1045), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype9telt_type_M_MP)(void (*__anonymous_object1046)(), void *__anonymous_object1047, void *__anonymous_object1048), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object1049)(), void *__anonymous_object1050, void *__anonymous_object1051), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object1052)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object1053, void *__anonymous_object1054), __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object1055, void *__anonymous_object1056), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object1057), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object1058, void *__anonymous_object1059), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object1060), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype9telt_type__1)(void *__anonymous_object1061, void *__anonymous_object1062), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object1063), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object1064), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object1065, _Bool __anonymous_object1066), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object1067), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object1068, const char *__anonymous_object1069), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object1070), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object1071, _Bool __anonymous_object1072), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object1073), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object1074), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object1075), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object1076), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object1077), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object1078, const char *__anonymous_object1079), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object1080), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object1081, const char *__anonymous_object1082), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object1083), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object1084), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object1085, const char *__anonymous_object1086, unsigned long int __anonymous_object1087), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object1088, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object1089, void *__anonymous_object1090), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object1091), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object1092, void *__anonymous_object1093), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object1094), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1095), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1096), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1097, void *__anonymous_object1098), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1099, void *__anonymous_object1100), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object1101), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void *__os__P7tostype_1);
     40void __write__A0_3_0_0____operator_assign__PFd1_Rd1d1____constructor__PF_Rd1____constructor__PF_Rd1d1____destructor__PF_Rd1____operator_bitor__PFPd0_Pd0d1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_assign__PFd2_Rd2d2____constructor__PF_Rd2____constructor__PF_Rd2d2____destructor__PF_Rd2____operator_preincr__PFd2_Rd2____operator_predecr__PFd2_Rd2____operator_equal__PFi_d2d2____operator_notequal__PFi_d2d2____operator_deref__PFRd1_d2__F_d2d2Pd0__1(__attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object964)(), void *__anonymous_object965), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object966)(), void *__anonymous_object967, void *__anonymous_object968), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object969)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object970), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object971)(), void *__anonymous_object972, void *__anonymous_object973), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object974)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object975, void *__anonymous_object976), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype9telt_type_M_MP)(void (*__anonymous_object977)(), void *__anonymous_object978, void *__anonymous_object979), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object980)(), void *__anonymous_object981, void *__anonymous_object982), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object983)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object984, void *__anonymous_object985), __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object986, void *__anonymous_object987), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object988), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object989, void *__anonymous_object990), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object991), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype9telt_type__1)(void *__anonymous_object992, void *__anonymous_object993), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object994), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object995), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object996, _Bool __anonymous_object997), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object998), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object999, const char *__anonymous_object1000), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object1001), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object1002, _Bool __anonymous_object1003), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object1004), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object1005), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object1006), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object1007), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object1008), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object1009, const char *__anonymous_object1010), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object1011), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object1012, const char *__anonymous_object1013), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object1014), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object1015), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object1016, const char *__anonymous_object1017, unsigned long int __anonymous_object1018), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object1019, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object1020, void *__anonymous_object1021), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object1022), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object1023, void *__anonymous_object1024), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object1025), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1026), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1027), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1028, void *__anonymous_object1029), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1030, void *__anonymous_object1031), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object1032), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void *__os__P7tostype_1);
     41void __write_reverse__A0_3_0_0____operator_assign__PFd1_Rd1d1____constructor__PF_Rd1____constructor__PF_Rd1d1____destructor__PF_Rd1____operator_bitor__PFPd0_Pd0d1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_assign__PFd2_Rd2d2____constructor__PF_Rd2____constructor__PF_Rd2d2____destructor__PF_Rd2____operator_preincr__PFd2_Rd2____operator_predecr__PFd2_Rd2____operator_equal__PFi_d2d2____operator_notequal__PFi_d2d2____operator_deref__PFRd1_d2__F_d2d2Pd0__1(__attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object1033)(), void *__anonymous_object1034), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object1035)(), void *__anonymous_object1036, void *__anonymous_object1037), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object1038)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object1039), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object1040)(), void *__anonymous_object1041, void *__anonymous_object1042), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object1043)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object1044, void *__anonymous_object1045), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype9telt_type_M_MP)(void (*__anonymous_object1046)(), void *__anonymous_object1047, void *__anonymous_object1048), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object1049)(), void *__anonymous_object1050, void *__anonymous_object1051), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object1052)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object1053, void *__anonymous_object1054), __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object1055, void *__anonymous_object1056), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object1057), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object1058, void *__anonymous_object1059), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object1060), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype9telt_type__1)(void *__anonymous_object1061, void *__anonymous_object1062), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object1063), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object1064), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object1065, _Bool __anonymous_object1066), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object1067), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object1068, const char *__anonymous_object1069), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object1070), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object1071, _Bool __anonymous_object1072), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object1073), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object1074), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object1075), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object1076), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object1077), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object1078, const char *__anonymous_object1079), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object1080), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object1081, const char *__anonymous_object1082), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object1083), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object1084), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object1085, const char *__anonymous_object1086, unsigned long int __anonymous_object1087), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object1088, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object1089, void *__anonymous_object1090), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object1091), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object1092, void *__anonymous_object1093), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object1094), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1095), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1096), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1097, void *__anonymous_object1098), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1099, void *__anonymous_object1100), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object1101), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void *__os__P7tostype_1);
    4242void *___operator_bitor__A0_1_0_0___fail__PFi_Pd0___eof__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___read__PFPd0_Pd0PcUl___ungetc__PFPd0_Pd0c___fmt__PFi_Pd0PCc__FPd0_Pd0Rc__1(__attribute__ ((unused)) signed int (*__fail__PFi_P7tistype__1)(void *__anonymous_object1102), __attribute__ ((unused)) signed int (*__eof__PFi_P7tistype__1)(void *__anonymous_object1103), __attribute__ ((unused)) void (*__open__PF_P7tistypePCcPCc__1)(void *__is__P7tistype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tistype__1)(void *__is__P7tistype_1), __attribute__ ((unused)) void *(*__read__PFP7tistype_P7tistypePcUl__1)(void *__anonymous_object1104, char *__anonymous_object1105, unsigned long int __anonymous_object1106), __attribute__ ((unused)) void *(*__ungetc__PFP7tistype_P7tistypec__1)(void *__anonymous_object1107, char __anonymous_object1108), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tistypePCc__1)(void *__anonymous_object1109, const char *__fmt__PCc_1, ...), void *__anonymous_object1110, char *__anonymous_object1111);
    4343void *___operator_bitor__A0_1_0_0___fail__PFi_Pd0___eof__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___read__PFPd0_Pd0PcUl___ungetc__PFPd0_Pd0c___fmt__PFi_Pd0PCc__FPd0_Pd0RSc__1(__attribute__ ((unused)) signed int (*__fail__PFi_P7tistype__1)(void *__anonymous_object1112), __attribute__ ((unused)) signed int (*__eof__PFi_P7tistype__1)(void *__anonymous_object1113), __attribute__ ((unused)) void (*__open__PF_P7tistypePCcPCc__1)(void *__is__P7tistype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tistype__1)(void *__is__P7tistype_1), __attribute__ ((unused)) void *(*__read__PFP7tistype_P7tistypePcUl__1)(void *__anonymous_object1114, char *__anonymous_object1115, unsigned long int __anonymous_object1116), __attribute__ ((unused)) void *(*__ungetc__PFP7tistype_P7tistypec__1)(void *__anonymous_object1117, char __anonymous_object1118), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tistypePCc__1)(void *__anonymous_object1119, const char *__fmt__PCc_1, ...), void *__anonymous_object1120, signed char *__anonymous_object1121);
     
    6464static inline void ___destructor__F_R16s_Istream_cstrUC_autogen___1(struct _Istream_cstrUC *___dst__R16s_Istream_cstrUC_1);
    6565static inline struct _Istream_cstrUC ___operator_assign__F16s_Istream_cstrUC_R16s_Istream_cstrUC16s_Istream_cstrUC_autogen___1(struct _Istream_cstrUC *___dst__R16s_Istream_cstrUC_1, struct _Istream_cstrUC ___src__16s_Istream_cstrUC_1);
     66static inline void ___constructor__F_R16s_Istream_cstrUCPc_autogen___1(struct _Istream_cstrUC *___dst__R16s_Istream_cstrUC_1, char *__s__Pc_1);
    6667static inline void ___constructor__F_R16s_Istream_cstrUC_autogen___1(struct _Istream_cstrUC *___dst__R16s_Istream_cstrUC_1){
    6768    ((void)((*___dst__R16s_Istream_cstrUC_1).__s__Pc_1) /* ?{} */);
     
    7677    struct _Istream_cstrUC ___ret__16s_Istream_cstrUC_1;
    7778    ((void)((*___dst__R16s_Istream_cstrUC_1).__s__Pc_1=___src__16s_Istream_cstrUC_1.__s__Pc_1));
    78     ((void)___constructor__F_R16s_Istream_cstrUC16s_Istream_cstrUC_autogen___1((&___ret__16s_Istream_cstrUC_1), ___src__16s_Istream_cstrUC_1));
    79     return ((struct _Istream_cstrUC )___ret__16s_Istream_cstrUC_1);
     79    ((void)___constructor__F_R16s_Istream_cstrUC16s_Istream_cstrUC_autogen___1((&___ret__16s_Istream_cstrUC_1), (*___dst__R16s_Istream_cstrUC_1)));
     80    return ___ret__16s_Istream_cstrUC_1;
    8081}
    8182static inline void ___constructor__F_R16s_Istream_cstrUCPc_autogen___1(struct _Istream_cstrUC *___dst__R16s_Istream_cstrUC_1, char *__s__Pc_1){
     
    9293static inline void ___destructor__F_R15s_Istream_cstrC_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1);
    9394static inline struct _Istream_cstrC ___operator_assign__F15s_Istream_cstrC_R15s_Istream_cstrC15s_Istream_cstrC_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1, struct _Istream_cstrC ___src__15s_Istream_cstrC_1);
     95static inline void ___constructor__F_R15s_Istream_cstrCPc_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1, char *__s__Pc_1);
     96static inline void ___constructor__F_R15s_Istream_cstrCPci_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1, char *__s__Pc_1, signed int __size__i_1);
    9497static inline void ___constructor__F_R15s_Istream_cstrC_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1){
    9598    ((void)((*___dst__R15s_Istream_cstrC_1).__s__Pc_1) /* ?{} */);
     
    108111    ((void)((*___dst__R15s_Istream_cstrC_1).__s__Pc_1=___src__15s_Istream_cstrC_1.__s__Pc_1));
    109112    ((void)((*___dst__R15s_Istream_cstrC_1).__size__i_1=___src__15s_Istream_cstrC_1.__size__i_1));
    110     ((void)___constructor__F_R15s_Istream_cstrC15s_Istream_cstrC_autogen___1((&___ret__15s_Istream_cstrC_1), ___src__15s_Istream_cstrC_1));
    111     return ((struct _Istream_cstrC )___ret__15s_Istream_cstrC_1);
     113    ((void)___constructor__F_R15s_Istream_cstrC15s_Istream_cstrC_autogen___1((&___ret__15s_Istream_cstrC_1), (*___dst__R15s_Istream_cstrC_1)));
     114    return ___ret__15s_Istream_cstrC_1;
    112115}
    113116static inline void ___constructor__F_R15s_Istream_cstrCPc_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1, char *__s__Pc_1){
     
    122125void *___operator_bitor__A0_1_0_0___fail__PFi_Pd0___eof__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___read__PFPd0_Pd0PcUl___ungetc__PFPd0_Pd0c___fmt__PFi_Pd0PCc__FPd0_Pd015s_Istream_cstrC__1(__attribute__ ((unused)) signed int (*__fail__PFi_P7tistype__1)(void *__anonymous_object1284), __attribute__ ((unused)) signed int (*__eof__PFi_P7tistype__1)(void *__anonymous_object1285), __attribute__ ((unused)) void (*__open__PF_P7tistypePCcPCc__1)(void *__is__P7tistype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tistype__1)(void *__is__P7tistype_1), __attribute__ ((unused)) void *(*__read__PFP7tistype_P7tistypePcUl__1)(void *__anonymous_object1286, char *__anonymous_object1287, unsigned long int __anonymous_object1288), __attribute__ ((unused)) void *(*__ungetc__PFP7tistype_P7tistypec__1)(void *__anonymous_object1289, char __anonymous_object1290), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tistypePCc__1)(void *__anonymous_object1291, const char *__fmt__PCc_1, ...), void *__anonymous_object1292, struct _Istream_cstrC __anonymous_object1293);
    123126enum __anonymous0 {
    124     __sepSize__C13e__anonymous0_1 = ((signed int )16),
     127    __sepSize__C13e__anonymous0_1 = 16,
    125128};
    126129struct ofstream {
     
    137140static inline void ___destructor__F_R9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1);
    138141static inline struct ofstream ___operator_assign__F9sofstream_R9sofstream9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1, struct ofstream ___src__9sofstream_1);
     142static inline void ___constructor__F_R9sofstreamPv_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1);
     143static inline void ___constructor__F_R9sofstreamPvb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1);
     144static inline void ___constructor__F_R9sofstreamPvbb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1);
     145static inline void ___constructor__F_R9sofstreamPvbbb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1);
     146static inline void ___constructor__F_R9sofstreamPvbbbPCc_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1);
     147static inline void ___constructor__F_R9sofstreamPvbbbPCcA0c_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1, char __separator__A0c_1[((unsigned int )__sepSize__C13e__anonymous0_1)]);
     148static inline void ___constructor__F_R9sofstreamPvbbbPCcA0cA0c_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1, char __separator__A0c_1[((unsigned int )__sepSize__C13e__anonymous0_1)], char __tupleSeparator__A0c_1[((unsigned int )__sepSize__C13e__anonymous0_1)]);
    139149static inline void ___constructor__F_R9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1){
    140150    ((void)((*___dst__R9sofstream_1).__file__Pv_1) /* ?{} */);
     
    144154    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ?{} */);
    145155    {
    146         signed int _index0 = ((signed int )0);
     156        signed int _index0 = 0;
    147157        for (;(_index0<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index0))) {
    148158            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[_index0])))) /* ?{} */);
     
    150160
    151161    }
    152     {
    153         signed int _index1 = ((signed int )0);
     162
     163    {
     164        signed int _index1 = 0;
    154165        for (;(_index1<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index1))) {
    155166            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index1])))) /* ?{} */);
     
    157168
    158169    }
     170
    159171}
    160172static inline void ___constructor__F_R9sofstream9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1, struct ofstream ___src__9sofstream_1){
     
    165177    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1=___src__9sofstream_1.__sepCur__PCc_1) /* ?{} */);
    166178    {
    167         signed int _index2 = ((signed int )0);
     179        signed int _index2 = 0;
    168180        for (;(_index2<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index2))) {
    169181            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[_index2])))=___src__9sofstream_1.__separator__A0c_1[_index2]) /* ?{} */);
     
    171183
    172184    }
    173     {
    174         signed int _index3 = ((signed int )0);
     185
     186    {
     187        signed int _index3 = 0;
    175188        for (;(_index3<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index3))) {
    176189            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index3])))=___src__9sofstream_1.__tupleSeparator__A0c_1[_index3]) /* ?{} */);
     
    178191
    179192    }
     193
    180194}
    181195static inline void ___destructor__F_R9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1){
    182196    {
    183         signed int _index4 = ((signed int )(((signed int )__sepSize__C13e__anonymous0_1)-1));
     197        signed int _index4 = (((signed int )__sepSize__C13e__anonymous0_1)-1);
    184198        for (;(_index4>=0);((void)(--_index4))) {
    185199            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index4])))) /* ^?{} */);
     
    187201
    188202    }
    189     {
    190         signed int _index5 = ((signed int )(((signed int )__sepSize__C13e__anonymous0_1)-1));
     203
     204    {
     205        signed int _index5 = (((signed int )__sepSize__C13e__anonymous0_1)-1);
    191206        for (;(_index5>=0);((void)(--_index5))) {
    192207            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[_index5])))) /* ^?{} */);
     
    194209
    195210    }
     211
    196212    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ^?{} */);
    197213    ((void)((*___dst__R9sofstream_1).__sawNL__b_1) /* ^?{} */);
     
    208224    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1=___src__9sofstream_1.__sepCur__PCc_1));
    209225    {
    210         signed int _index6 = ((signed int )0);
     226        signed int _index6 = 0;
    211227        for (;(_index6<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index6))) {
    212228            ((void)((*___dst__R9sofstream_1).__separator__A0c_1[_index6]=___src__9sofstream_1.__separator__A0c_1[_index6]));
     
    216232
    217233    {
    218         signed int _index7 = ((signed int )0);
     234        signed int _index7 = 0;
    219235        for (;(_index7<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index7))) {
    220236            ((void)((*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index7]=___src__9sofstream_1.__tupleSeparator__A0c_1[_index7]));
     
    223239    }
    224240
    225     ((void)___constructor__F_R9sofstream9sofstream_autogen___1((&___ret__9sofstream_1), ___src__9sofstream_1));
    226     return ((struct ofstream )___ret__9sofstream_1);
     241    ((void)___constructor__F_R9sofstream9sofstream_autogen___1((&___ret__9sofstream_1), (*___dst__R9sofstream_1)));
     242    return ___ret__9sofstream_1;
    227243}
    228244static inline void ___constructor__F_R9sofstreamPv_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1){
     
    233249    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ?{} */);
    234250    {
    235         signed int _index8 = ((signed int )0);
     251        signed int _index8 = 0;
    236252        for (;(_index8<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index8))) {
    237253            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[_index8])))) /* ?{} */);
     
    239255
    240256    }
    241     {
    242         signed int _index9 = ((signed int )0);
     257
     258    {
     259        signed int _index9 = 0;
    243260        for (;(_index9<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index9))) {
    244261            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index9])))) /* ?{} */);
     
    246263
    247264    }
     265
    248266}
    249267static inline void ___constructor__F_R9sofstreamPvb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1){
     
    254272    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ?{} */);
    255273    {
    256         signed int _index10 = ((signed int )0);
     274        signed int _index10 = 0;
    257275        for (;(_index10<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index10))) {
    258276            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[_index10])))) /* ?{} */);
     
    260278
    261279    }
    262     {
    263         signed int _index11 = ((signed int )0);
     280
     281    {
     282        signed int _index11 = 0;
    264283        for (;(_index11<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index11))) {
    265284            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index11])))) /* ?{} */);
     
    267286
    268287    }
     288
    269289}
    270290static inline void ___constructor__F_R9sofstreamPvbb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1){
     
    275295    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ?{} */);
    276296    {
    277         signed int _index12 = ((signed int )0);
     297        signed int _index12 = 0;
    278298        for (;(_index12<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index12))) {
    279299            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[_index12])))) /* ?{} */);
     
    281301
    282302    }
    283     {
    284         signed int _index13 = ((signed int )0);
     303
     304    {
     305        signed int _index13 = 0;
    285306        for (;(_index13<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index13))) {
    286307            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index13])))) /* ?{} */);
     
    288309
    289310    }
     311
    290312}
    291313static inline void ___constructor__F_R9sofstreamPvbbb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1){
     
    296318    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ?{} */);
    297319    {
    298         signed int _index14 = ((signed int )0);
     320        signed int _index14 = 0;
    299321        for (;(_index14<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index14))) {
    300322            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[_index14])))) /* ?{} */);
     
    302324
    303325    }
    304     {
    305         signed int _index15 = ((signed int )0);
     326
     327    {
     328        signed int _index15 = 0;
    306329        for (;(_index15<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index15))) {
    307330            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index15])))) /* ?{} */);
     
    309332
    310333    }
     334
    311335}
    312336static inline void ___constructor__F_R9sofstreamPvbbbPCc_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1){
     
    317341    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1=__sepCur__PCc_1) /* ?{} */);
    318342    {
    319         signed int _index16 = ((signed int )0);
     343        signed int _index16 = 0;
    320344        for (;(_index16<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index16))) {
    321345            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[_index16])))) /* ?{} */);
     
    323347
    324348    }
    325     {
    326         signed int _index17 = ((signed int )0);
     349
     350    {
     351        signed int _index17 = 0;
    327352        for (;(_index17<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index17))) {
    328353            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index17])))) /* ?{} */);
     
    330355
    331356    }
     357
    332358}
    333359static inline void ___constructor__F_R9sofstreamPvbbbPCcA0c_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1, char __separator__A0c_1[((unsigned int )__sepSize__C13e__anonymous0_1)]){
     
    338364    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1=__sepCur__PCc_1) /* ?{} */);
    339365    {
    340         signed int _index18 = ((signed int )0);
     366        signed int _index18 = 0;
    341367        for (;(_index18<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index18))) {
    342368            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[_index18])))=__separator__A0c_1[_index18]) /* ?{} */);
     
    344370
    345371    }
    346     {
    347         signed int _index19 = ((signed int )0);
     372
     373    {
     374        signed int _index19 = 0;
    348375        for (;(_index19<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index19))) {
    349376            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index19])))) /* ?{} */);
     
    351378
    352379    }
     380
    353381}
    354382static inline void ___constructor__F_R9sofstreamPvbbbPCcA0cA0c_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1, char __separator__A0c_1[((unsigned int )__sepSize__C13e__anonymous0_1)], char __tupleSeparator__A0c_1[((unsigned int )__sepSize__C13e__anonymous0_1)]){
     
    359387    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1=__sepCur__PCc_1) /* ?{} */);
    360388    {
    361         signed int _index20 = ((signed int )0);
     389        signed int _index20 = 0;
    362390        for (;(_index20<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index20))) {
    363391            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[_index20])))=__separator__A0c_1[_index20]) /* ?{} */);
     
    365393
    366394    }
    367     {
    368         signed int _index21 = ((signed int )0);
     395
     396    {
     397        signed int _index21 = 0;
    369398        for (;(_index21<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index21))) {
    370399            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[_index21])))=__tupleSeparator__A0c_1[_index21]) /* ?{} */);
     
    372401
    373402    }
     403
    374404}
    375405_Bool __sepPrt__Fb_P9sofstream__1(struct ofstream *__anonymous_object1294);
     
    404434static inline void ___destructor__F_R9sifstream_autogen___1(struct ifstream *___dst__R9sifstream_1);
    405435static inline struct ifstream ___operator_assign__F9sifstream_R9sifstream9sifstream_autogen___1(struct ifstream *___dst__R9sifstream_1, struct ifstream ___src__9sifstream_1);
     436static inline void ___constructor__F_R9sifstreamPv_autogen___1(struct ifstream *___dst__R9sifstream_1, void *__file__Pv_1);
    406437static inline void ___constructor__F_R9sifstream_autogen___1(struct ifstream *___dst__R9sifstream_1){
    407438    ((void)((*___dst__R9sifstream_1).__file__Pv_1) /* ?{} */);
     
    416447    struct ifstream ___ret__9sifstream_1;
    417448    ((void)((*___dst__R9sifstream_1).__file__Pv_1=___src__9sifstream_1.__file__Pv_1));
    418     ((void)___constructor__F_R9sifstream9sifstream_autogen___1((&___ret__9sifstream_1), ___src__9sifstream_1));
    419     return ((struct ifstream )___ret__9sifstream_1);
     449    ((void)___constructor__F_R9sifstream9sifstream_autogen___1((&___ret__9sifstream_1), (*___dst__R9sifstream_1)));
     450    return ___ret__9sifstream_1;
    420451}
    421452static inline void ___constructor__F_R9sifstreamPv_autogen___1(struct ifstream *___dst__R9sifstream_1, void *__file__Pv_1){
     
    435466    struct ofstream *_tmp_cp_ret2;
    436467    __attribute__ ((unused)) struct ofstream *_thunk0(struct ofstream *_p0){
    437         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1322))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1323))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1324, _Bool __anonymous_object1325))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1326))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1327, const char *__anonymous_object1328))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1329))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1330, _Bool __anonymous_object1331))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1332))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1333))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1334))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1335))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1336))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1337, const char *__anonymous_object1338))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1339))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1340, const char *__anonymous_object1341))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1342))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1343))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1344, const char *__anonymous_object1345, unsigned long int __anonymous_object1346))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1347, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    438     }
    439     ((void)(((void)(_tmp_cp_ret2=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1348))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1349))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1350, _Bool __anonymous_object1351))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1352))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1353, const char *__anonymous_object1354))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1355))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1356, _Bool __anonymous_object1357))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1358))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1359))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1360))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1361))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1362))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1363, const char *__anonymous_object1364))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1365))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1366, const char *__anonymous_object1367))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1368))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1369))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1370, const char *__anonymous_object1371, unsigned long int __anonymous_object1372))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1373, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret1=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0c__1(((_Bool (*)(void *__anonymous_object1374))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1375))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1376, _Bool __anonymous_object1377))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1378))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1379, const char *__anonymous_object1380))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1381))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1382, _Bool __anonymous_object1383))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1384))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1385))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1386))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1387))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1388))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1389, const char *__anonymous_object1390))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1391))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1392, const char *__anonymous_object1393))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1394))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1395))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1396, const char *__anonymous_object1397, unsigned long int __anonymous_object1398))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1399, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret0=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1400))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1401))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1402, _Bool __anonymous_object1403))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1404))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1405, const char *__anonymous_object1406))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1407))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1408, _Bool __anonymous_object1409))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1410))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1411))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1412))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1413))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1414))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1415, const char *__anonymous_object1416))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1417))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1418, const char *__anonymous_object1419))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1420))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1421))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1422, const char *__anonymous_object1423, unsigned long int __anonymous_object1424))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1425, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "char "))) , _tmp_cp_ret0), __v__c_1))) , _tmp_cp_ret1), ((void *(*)(void *__anonymous_object1426))(&_thunk0))))) , _tmp_cp_ret2));
     468        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1322))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1323))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1324, _Bool __anonymous_object1325))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1326))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1327, const char *__anonymous_object1328))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1329))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1330, _Bool __anonymous_object1331))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1332))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1333))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1334))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1335))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1336))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1337, const char *__anonymous_object1338))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1339))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1340, const char *__anonymous_object1341))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1342))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1343))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1344, const char *__anonymous_object1345, unsigned long int __anonymous_object1346))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1347, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     469    }
     470    ((void)(((void)(_tmp_cp_ret2=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1348))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1349))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1350, _Bool __anonymous_object1351))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1352))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1353, const char *__anonymous_object1354))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1355))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1356, _Bool __anonymous_object1357))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1358))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1359))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1360))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1361))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1362))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1363, const char *__anonymous_object1364))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1365))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1366, const char *__anonymous_object1367))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1368))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1369))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1370, const char *__anonymous_object1371, unsigned long int __anonymous_object1372))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1373, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret1=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0c__1(((_Bool (*)(void *__anonymous_object1374))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1375))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1376, _Bool __anonymous_object1377))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1378))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1379, const char *__anonymous_object1380))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1381))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1382, _Bool __anonymous_object1383))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1384))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1385))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1386))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1387))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1388))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1389, const char *__anonymous_object1390))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1391))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1392, const char *__anonymous_object1393))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1394))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1395))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1396, const char *__anonymous_object1397, unsigned long int __anonymous_object1398))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1399, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret0=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1400))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1401))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1402, _Bool __anonymous_object1403))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1404))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1405, const char *__anonymous_object1406))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1407))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1408, _Bool __anonymous_object1409))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1410))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1411))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1412))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1413))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1414))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1415, const char *__anonymous_object1416))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1417))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1418, const char *__anonymous_object1419))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1420))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1421))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1422, const char *__anonymous_object1423, unsigned long int __anonymous_object1424))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1425, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "char "))) , _tmp_cp_ret0)), __v__c_1))) , _tmp_cp_ret1)), ((void *(*)(void *__anonymous_object1426))(&_thunk0))))) , _tmp_cp_ret2));
    440471    ((void)(_tmp_cp_ret0) /* ^?{} */);
    441472    ((void)(_tmp_cp_ret1) /* ^?{} */);
     
    447478    struct ofstream *_tmp_cp_ret5;
    448479    __attribute__ ((unused)) struct ofstream *_thunk1(struct ofstream *_p0){
    449         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1427))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1428))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1429, _Bool __anonymous_object1430))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1431))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1432, const char *__anonymous_object1433))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1434))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1435, _Bool __anonymous_object1436))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1437))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1438))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1439))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1440))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1441))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1442, const char *__anonymous_object1443))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1444))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1445, const char *__anonymous_object1446))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1447))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1448))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1449, const char *__anonymous_object1450, unsigned long int __anonymous_object1451))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1452, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    450     }
    451     ((void)(((void)(_tmp_cp_ret5=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1453))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1454))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1455, _Bool __anonymous_object1456))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1457))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1458, const char *__anonymous_object1459))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1460))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1461, _Bool __anonymous_object1462))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1463))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1464))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1465))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1466))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1467))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1468, const char *__anonymous_object1469))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1470))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1471, const char *__anonymous_object1472))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1473))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1474))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1475, const char *__anonymous_object1476, unsigned long int __anonymous_object1477))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1478, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret4=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Sc__1(((_Bool (*)(void *__anonymous_object1479))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1480))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1481, _Bool __anonymous_object1482))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1483))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1484, const char *__anonymous_object1485))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1486))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1487, _Bool __anonymous_object1488))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1489))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1490))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1491))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1492))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1493))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1494, const char *__anonymous_object1495))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1496))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1497, const char *__anonymous_object1498))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1499))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1500))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1501, const char *__anonymous_object1502, unsigned long int __anonymous_object1503))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1504, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret3=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1505))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1506))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1507, _Bool __anonymous_object1508))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1509))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1510, const char *__anonymous_object1511))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1512))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1513, _Bool __anonymous_object1514))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1515))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1516))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1517))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1518))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1519))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1520, const char *__anonymous_object1521))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1522))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1523, const char *__anonymous_object1524))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1525))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1526))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1527, const char *__anonymous_object1528, unsigned long int __anonymous_object1529))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1530, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "signed char "))) , _tmp_cp_ret3), __v__Sc_1))) , _tmp_cp_ret4), ((void *(*)(void *__anonymous_object1531))(&_thunk1))))) , _tmp_cp_ret5));
     480        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1427))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1428))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1429, _Bool __anonymous_object1430))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1431))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1432, const char *__anonymous_object1433))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1434))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1435, _Bool __anonymous_object1436))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1437))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1438))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1439))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1440))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1441))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1442, const char *__anonymous_object1443))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1444))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1445, const char *__anonymous_object1446))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1447))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1448))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1449, const char *__anonymous_object1450, unsigned long int __anonymous_object1451))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1452, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     481    }
     482    ((void)(((void)(_tmp_cp_ret5=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1453))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1454))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1455, _Bool __anonymous_object1456))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1457))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1458, const char *__anonymous_object1459))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1460))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1461, _Bool __anonymous_object1462))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1463))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1464))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1465))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1466))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1467))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1468, const char *__anonymous_object1469))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1470))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1471, const char *__anonymous_object1472))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1473))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1474))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1475, const char *__anonymous_object1476, unsigned long int __anonymous_object1477))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1478, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret4=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Sc__1(((_Bool (*)(void *__anonymous_object1479))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1480))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1481, _Bool __anonymous_object1482))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1483))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1484, const char *__anonymous_object1485))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1486))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1487, _Bool __anonymous_object1488))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1489))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1490))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1491))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1492))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1493))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1494, const char *__anonymous_object1495))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1496))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1497, const char *__anonymous_object1498))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1499))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1500))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1501, const char *__anonymous_object1502, unsigned long int __anonymous_object1503))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1504, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret3=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1505))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1506))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1507, _Bool __anonymous_object1508))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1509))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1510, const char *__anonymous_object1511))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1512))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1513, _Bool __anonymous_object1514))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1515))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1516))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1517))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1518))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1519))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1520, const char *__anonymous_object1521))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1522))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1523, const char *__anonymous_object1524))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1525))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1526))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1527, const char *__anonymous_object1528, unsigned long int __anonymous_object1529))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1530, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "signed char "))) , _tmp_cp_ret3)), __v__Sc_1))) , _tmp_cp_ret4)), ((void *(*)(void *__anonymous_object1531))(&_thunk1))))) , _tmp_cp_ret5));
    452483    ((void)(_tmp_cp_ret3) /* ^?{} */);
    453484    ((void)(_tmp_cp_ret4) /* ^?{} */);
     
    459490    struct ofstream *_tmp_cp_ret8;
    460491    __attribute__ ((unused)) struct ofstream *_thunk2(struct ofstream *_p0){
    461         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1532))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1533))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1534, _Bool __anonymous_object1535))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1536))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1537, const char *__anonymous_object1538))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1539))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1540, _Bool __anonymous_object1541))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1542))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1543))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1544))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1545))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1546))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1547, const char *__anonymous_object1548))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1549))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1550, const char *__anonymous_object1551))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1552))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1553))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1554, const char *__anonymous_object1555, unsigned long int __anonymous_object1556))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1557, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    462     }
    463     ((void)(((void)(_tmp_cp_ret8=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1558))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1559))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1560, _Bool __anonymous_object1561))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1562))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1563, const char *__anonymous_object1564))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1565))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1566, _Bool __anonymous_object1567))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1568))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1569))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1570))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1571))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1572))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1573, const char *__anonymous_object1574))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1575))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1576, const char *__anonymous_object1577))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1578))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1579))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1580, const char *__anonymous_object1581, unsigned long int __anonymous_object1582))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1583, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret7=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Uc__1(((_Bool (*)(void *__anonymous_object1584))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1585))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1586, _Bool __anonymous_object1587))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1588))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1589, const char *__anonymous_object1590))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1591))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1592, _Bool __anonymous_object1593))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1594))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1595))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1596))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1597))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1598))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1599, const char *__anonymous_object1600))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1601))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1602, const char *__anonymous_object1603))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1604))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1605))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1606, const char *__anonymous_object1607, unsigned long int __anonymous_object1608))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1609, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret6=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1610))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1611))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1612, _Bool __anonymous_object1613))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1614))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1615, const char *__anonymous_object1616))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1617))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1618, _Bool __anonymous_object1619))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1620))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1621))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1622))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1623))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1624))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1625, const char *__anonymous_object1626))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1627))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1628, const char *__anonymous_object1629))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1630))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1631))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1632, const char *__anonymous_object1633, unsigned long int __anonymous_object1634))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1635, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "unsigned char "))) , _tmp_cp_ret6), __v__Uc_1))) , _tmp_cp_ret7), ((void *(*)(void *__anonymous_object1636))(&_thunk2))))) , _tmp_cp_ret8));
     492        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1532))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1533))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1534, _Bool __anonymous_object1535))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1536))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1537, const char *__anonymous_object1538))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1539))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1540, _Bool __anonymous_object1541))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1542))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1543))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1544))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1545))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1546))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1547, const char *__anonymous_object1548))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1549))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1550, const char *__anonymous_object1551))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1552))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1553))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1554, const char *__anonymous_object1555, unsigned long int __anonymous_object1556))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1557, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     493    }
     494    ((void)(((void)(_tmp_cp_ret8=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1558))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1559))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1560, _Bool __anonymous_object1561))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1562))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1563, const char *__anonymous_object1564))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1565))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1566, _Bool __anonymous_object1567))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1568))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1569))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1570))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1571))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1572))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1573, const char *__anonymous_object1574))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1575))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1576, const char *__anonymous_object1577))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1578))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1579))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1580, const char *__anonymous_object1581, unsigned long int __anonymous_object1582))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1583, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret7=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Uc__1(((_Bool (*)(void *__anonymous_object1584))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1585))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1586, _Bool __anonymous_object1587))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1588))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1589, const char *__anonymous_object1590))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1591))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1592, _Bool __anonymous_object1593))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1594))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1595))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1596))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1597))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1598))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1599, const char *__anonymous_object1600))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1601))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1602, const char *__anonymous_object1603))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1604))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1605))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1606, const char *__anonymous_object1607, unsigned long int __anonymous_object1608))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1609, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret6=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1610))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1611))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1612, _Bool __anonymous_object1613))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1614))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1615, const char *__anonymous_object1616))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1617))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1618, _Bool __anonymous_object1619))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1620))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1621))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1622))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1623))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1624))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1625, const char *__anonymous_object1626))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1627))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1628, const char *__anonymous_object1629))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1630))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1631))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1632, const char *__anonymous_object1633, unsigned long int __anonymous_object1634))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1635, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "unsigned char "))) , _tmp_cp_ret6)), __v__Uc_1))) , _tmp_cp_ret7)), ((void *(*)(void *__anonymous_object1636))(&_thunk2))))) , _tmp_cp_ret8));
    464495    ((void)(_tmp_cp_ret6) /* ^?{} */);
    465496    ((void)(_tmp_cp_ret7) /* ^?{} */);
     
    471502    struct ofstream *_tmp_cp_ret11;
    472503    __attribute__ ((unused)) struct ofstream *_thunk3(struct ofstream *_p0){
    473         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1637))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1638))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1639, _Bool __anonymous_object1640))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1641))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1642, const char *__anonymous_object1643))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1644))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1645, _Bool __anonymous_object1646))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1647))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1648))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1649))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1650))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1651))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1652, const char *__anonymous_object1653))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1654))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1655, const char *__anonymous_object1656))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1657))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1658))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1659, const char *__anonymous_object1660, unsigned long int __anonymous_object1661))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1662, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    474     }
    475     ((void)(((void)(_tmp_cp_ret11=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1663))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1664))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1665, _Bool __anonymous_object1666))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1667))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1668, const char *__anonymous_object1669))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1670))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1671, _Bool __anonymous_object1672))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1673))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1674))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1675))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1676))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1677))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1678, const char *__anonymous_object1679))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1680))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1681, const char *__anonymous_object1682))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1683))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1684))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1685, const char *__anonymous_object1686, unsigned long int __anonymous_object1687))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1688, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret10=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0s__1(((_Bool (*)(void *__anonymous_object1689))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1690))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1691, _Bool __anonymous_object1692))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1693))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1694, const char *__anonymous_object1695))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1696))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1697, _Bool __anonymous_object1698))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1699))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1700))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1701))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1702))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1703))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1704, const char *__anonymous_object1705))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1706))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1707, const char *__anonymous_object1708))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1709))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1710))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1711, const char *__anonymous_object1712, unsigned long int __anonymous_object1713))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1714, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret9=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1715))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1716))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1717, _Bool __anonymous_object1718))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1719))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1720, const char *__anonymous_object1721))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1722))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1723, _Bool __anonymous_object1724))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1725))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1726))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1727))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1728))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1729))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1730, const char *__anonymous_object1731))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1732))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1733, const char *__anonymous_object1734))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1735))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1736))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1737, const char *__anonymous_object1738, unsigned long int __anonymous_object1739))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1740, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "signed short int"))) , _tmp_cp_ret9), __v__s_1))) , _tmp_cp_ret10), ((void *(*)(void *__anonymous_object1741))(&_thunk3))))) , _tmp_cp_ret11));
     504        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1637))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1638))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1639, _Bool __anonymous_object1640))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1641))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1642, const char *__anonymous_object1643))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1644))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1645, _Bool __anonymous_object1646))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1647))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1648))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1649))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1650))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1651))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1652, const char *__anonymous_object1653))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1654))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1655, const char *__anonymous_object1656))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1657))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1658))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1659, const char *__anonymous_object1660, unsigned long int __anonymous_object1661))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1662, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     505    }
     506    ((void)(((void)(_tmp_cp_ret11=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1663))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1664))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1665, _Bool __anonymous_object1666))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1667))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1668, const char *__anonymous_object1669))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1670))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1671, _Bool __anonymous_object1672))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1673))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1674))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1675))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1676))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1677))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1678, const char *__anonymous_object1679))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1680))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1681, const char *__anonymous_object1682))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1683))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1684))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1685, const char *__anonymous_object1686, unsigned long int __anonymous_object1687))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1688, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret10=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0s__1(((_Bool (*)(void *__anonymous_object1689))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1690))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1691, _Bool __anonymous_object1692))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1693))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1694, const char *__anonymous_object1695))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1696))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1697, _Bool __anonymous_object1698))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1699))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1700))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1701))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1702))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1703))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1704, const char *__anonymous_object1705))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1706))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1707, const char *__anonymous_object1708))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1709))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1710))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1711, const char *__anonymous_object1712, unsigned long int __anonymous_object1713))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1714, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret9=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1715))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1716))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1717, _Bool __anonymous_object1718))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1719))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1720, const char *__anonymous_object1721))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1722))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1723, _Bool __anonymous_object1724))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1725))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1726))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1727))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1728))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1729))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1730, const char *__anonymous_object1731))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1732))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1733, const char *__anonymous_object1734))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1735))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1736))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1737, const char *__anonymous_object1738, unsigned long int __anonymous_object1739))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1740, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "signed short int"))) , _tmp_cp_ret9)), __v__s_1))) , _tmp_cp_ret10)), ((void *(*)(void *__anonymous_object1741))(&_thunk3))))) , _tmp_cp_ret11));
    476507    ((void)(_tmp_cp_ret9) /* ^?{} */);
    477508    ((void)(_tmp_cp_ret10) /* ^?{} */);
     
    483514    struct ofstream *_tmp_cp_ret14;
    484515    __attribute__ ((unused)) struct ofstream *_thunk4(struct ofstream *_p0){
    485         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1742))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1743))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1744, _Bool __anonymous_object1745))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1746))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1747, const char *__anonymous_object1748))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1749))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1750, _Bool __anonymous_object1751))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1752))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1753))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1754))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1755))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1756))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1757, const char *__anonymous_object1758))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1759))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1760, const char *__anonymous_object1761))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1762))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1763))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1764, const char *__anonymous_object1765, unsigned long int __anonymous_object1766))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1767, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    486     }
    487     ((void)(((void)(_tmp_cp_ret14=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1768))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1769))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1770, _Bool __anonymous_object1771))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1772))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1773, const char *__anonymous_object1774))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1775))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1776, _Bool __anonymous_object1777))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1778))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1779))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1780))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1781))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1782))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1783, const char *__anonymous_object1784))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1785))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1786, const char *__anonymous_object1787))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1788))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1789))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1790, const char *__anonymous_object1791, unsigned long int __anonymous_object1792))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1793, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret13=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Us__1(((_Bool (*)(void *__anonymous_object1794))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1795))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1796, _Bool __anonymous_object1797))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1798))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1799, const char *__anonymous_object1800))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1801))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1802, _Bool __anonymous_object1803))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1804))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1805))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1806))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1807))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1808))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1809, const char *__anonymous_object1810))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1811))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1812, const char *__anonymous_object1813))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1814))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1815))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1816, const char *__anonymous_object1817, unsigned long int __anonymous_object1818))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1819, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret12=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1820))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1821))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1822, _Bool __anonymous_object1823))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1824))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1825, const char *__anonymous_object1826))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1827))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1828, _Bool __anonymous_object1829))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1830))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1831))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1832))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1833))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1834))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1835, const char *__anonymous_object1836))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1837))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1838, const char *__anonymous_object1839))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1840))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1841))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1842, const char *__anonymous_object1843, unsigned long int __anonymous_object1844))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1845, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "unsigned short int"))) , _tmp_cp_ret12), __v__Us_1))) , _tmp_cp_ret13), ((void *(*)(void *__anonymous_object1846))(&_thunk4))))) , _tmp_cp_ret14));
     516        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1742))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1743))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1744, _Bool __anonymous_object1745))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1746))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1747, const char *__anonymous_object1748))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1749))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1750, _Bool __anonymous_object1751))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1752))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1753))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1754))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1755))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1756))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1757, const char *__anonymous_object1758))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1759))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1760, const char *__anonymous_object1761))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1762))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1763))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1764, const char *__anonymous_object1765, unsigned long int __anonymous_object1766))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1767, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     517    }
     518    ((void)(((void)(_tmp_cp_ret14=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1768))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1769))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1770, _Bool __anonymous_object1771))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1772))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1773, const char *__anonymous_object1774))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1775))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1776, _Bool __anonymous_object1777))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1778))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1779))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1780))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1781))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1782))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1783, const char *__anonymous_object1784))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1785))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1786, const char *__anonymous_object1787))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1788))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1789))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1790, const char *__anonymous_object1791, unsigned long int __anonymous_object1792))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1793, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret13=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Us__1(((_Bool (*)(void *__anonymous_object1794))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1795))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1796, _Bool __anonymous_object1797))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1798))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1799, const char *__anonymous_object1800))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1801))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1802, _Bool __anonymous_object1803))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1804))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1805))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1806))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1807))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1808))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1809, const char *__anonymous_object1810))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1811))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1812, const char *__anonymous_object1813))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1814))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1815))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1816, const char *__anonymous_object1817, unsigned long int __anonymous_object1818))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1819, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret12=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1820))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1821))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1822, _Bool __anonymous_object1823))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1824))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1825, const char *__anonymous_object1826))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1827))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1828, _Bool __anonymous_object1829))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1830))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1831))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1832))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1833))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1834))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1835, const char *__anonymous_object1836))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1837))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1838, const char *__anonymous_object1839))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1840))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1841))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1842, const char *__anonymous_object1843, unsigned long int __anonymous_object1844))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1845, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "unsigned short int"))) , _tmp_cp_ret12)), __v__Us_1))) , _tmp_cp_ret13)), ((void *(*)(void *__anonymous_object1846))(&_thunk4))))) , _tmp_cp_ret14));
    488519    ((void)(_tmp_cp_ret12) /* ^?{} */);
    489520    ((void)(_tmp_cp_ret13) /* ^?{} */);
     
    495526    struct ofstream *_tmp_cp_ret17;
    496527    __attribute__ ((unused)) struct ofstream *_thunk5(struct ofstream *_p0){
    497         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1847))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1848))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1849, _Bool __anonymous_object1850))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1851))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1852, const char *__anonymous_object1853))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1854))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1855, _Bool __anonymous_object1856))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1857))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1858))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1859))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1860))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1861))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1862, const char *__anonymous_object1863))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1864))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1865, const char *__anonymous_object1866))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1867))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1868))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1869, const char *__anonymous_object1870, unsigned long int __anonymous_object1871))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1872, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    498     }
    499     ((void)(((void)(_tmp_cp_ret17=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1873))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1874))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1875, _Bool __anonymous_object1876))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1877))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1878, const char *__anonymous_object1879))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1880))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1881, _Bool __anonymous_object1882))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1883))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1884))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1885))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1886))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1887))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1888, const char *__anonymous_object1889))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1890))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1891, const char *__anonymous_object1892))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1893))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1894))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1895, const char *__anonymous_object1896, unsigned long int __anonymous_object1897))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1898, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret16=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Ui__1(((_Bool (*)(void *__anonymous_object1899))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1900))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1901, _Bool __anonymous_object1902))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1903))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1904, const char *__anonymous_object1905))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1906))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1907, _Bool __anonymous_object1908))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1909))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1910))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1911))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1912))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1913))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1914, const char *__anonymous_object1915))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1916))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1917, const char *__anonymous_object1918))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1919))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1920))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1921, const char *__anonymous_object1922, unsigned long int __anonymous_object1923))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1924, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret15=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1925))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1926))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1927, _Bool __anonymous_object1928))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1929))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1930, const char *__anonymous_object1931))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1932))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1933, _Bool __anonymous_object1934))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1935))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1936))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1937))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1938))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1939))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1940, const char *__anonymous_object1941))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1942))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1943, const char *__anonymous_object1944))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1945))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1946))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1947, const char *__anonymous_object1948, unsigned long int __anonymous_object1949))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1950, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "size_t"))) , _tmp_cp_ret15), __v__Ui_1))) , _tmp_cp_ret16), ((void *(*)(void *__anonymous_object1951))(&_thunk5))))) , _tmp_cp_ret17));
     528        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1847))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1848))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1849, _Bool __anonymous_object1850))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1851))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1852, const char *__anonymous_object1853))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1854))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1855, _Bool __anonymous_object1856))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1857))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1858))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1859))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1860))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1861))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1862, const char *__anonymous_object1863))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1864))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1865, const char *__anonymous_object1866))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1867))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1868))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1869, const char *__anonymous_object1870, unsigned long int __anonymous_object1871))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1872, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     529    }
     530    ((void)(((void)(_tmp_cp_ret17=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1873))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1874))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1875, _Bool __anonymous_object1876))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1877))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1878, const char *__anonymous_object1879))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1880))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1881, _Bool __anonymous_object1882))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1883))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1884))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1885))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1886))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1887))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1888, const char *__anonymous_object1889))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1890))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1891, const char *__anonymous_object1892))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1893))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1894))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1895, const char *__anonymous_object1896, unsigned long int __anonymous_object1897))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1898, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret16=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Ui__1(((_Bool (*)(void *__anonymous_object1899))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1900))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1901, _Bool __anonymous_object1902))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1903))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1904, const char *__anonymous_object1905))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1906))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1907, _Bool __anonymous_object1908))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1909))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1910))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1911))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1912))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1913))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1914, const char *__anonymous_object1915))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1916))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1917, const char *__anonymous_object1918))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1919))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1920))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1921, const char *__anonymous_object1922, unsigned long int __anonymous_object1923))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1924, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret15=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1925))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1926))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1927, _Bool __anonymous_object1928))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1929))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1930, const char *__anonymous_object1931))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1932))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1933, _Bool __anonymous_object1934))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1935))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1936))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1937))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1938))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1939))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1940, const char *__anonymous_object1941))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1942))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1943, const char *__anonymous_object1944))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1945))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1946))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1947, const char *__anonymous_object1948, unsigned long int __anonymous_object1949))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1950, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "size_t"))) , _tmp_cp_ret15)), __v__Ui_1))) , _tmp_cp_ret16)), ((void *(*)(void *__anonymous_object1951))(&_thunk5))))) , _tmp_cp_ret17));
    500531    ((void)(_tmp_cp_ret15) /* ^?{} */);
    501532    ((void)(_tmp_cp_ret16) /* ^?{} */);
     
    708739    ((void)0123456789.e-09L);
    709740    ((void)0123456789.e-09DL);
    710     ((void)(-0123456789.e-09));
    711     ((void)(-0123456789.e-09f));
    712     ((void)(-0123456789.e-09l));
    713     ((void)(-0123456789.e-09F));
    714     ((void)(-0123456789.e-09L));
    715     ((void)(-0123456789.e-09DL));
     741    ((void)(+0123456789.e-09));
     742    ((void)(+0123456789.e-09f));
     743    ((void)(+0123456789.e-09l));
     744    ((void)(+0123456789.e-09F));
     745    ((void)(+0123456789.e-09L));
     746    ((void)(+0123456789.e-09DL));
    716747    ((void)(-0123456789.e-09));
    717748    ((void)(-0123456789.e-09f));
     
    852883    ((void)0123456789.0123456789E-09L);
    853884    ((void)0123456789.0123456789E-09DL);
    854     ((void)(-0123456789.0123456789E-09));
    855     ((void)(-0123456789.0123456789E-09f));
    856     ((void)(-0123456789.0123456789E-09l));
    857     ((void)(-0123456789.0123456789E-09F));
    858     ((void)(-0123456789.0123456789E-09L));
    859     ((void)(-0123456789.0123456789E-09DL));
     885    ((void)(+0123456789.0123456789E-09));
     886    ((void)(+0123456789.0123456789E-09f));
     887    ((void)(+0123456789.0123456789E-09l));
     888    ((void)(+0123456789.0123456789E-09F));
     889    ((void)(+0123456789.0123456789E-09L));
     890    ((void)(+0123456789.0123456789E-09DL));
    860891    ((void)(-0123456789.0123456789E-09));
    861892    ((void)(-0123456789.0123456789E-09f));
     
    899930    ((void)0x0123456789.p-09F);
    900931    ((void)0x0123456789.p-09L);
    901     ((void)(-0x0123456789.p-09));
    902     ((void)(-0x0123456789.p-09f));
    903     ((void)(-0x0123456789.p-09l));
    904     ((void)(-0x0123456789.p-09F));
    905     ((void)(-0x0123456789.p-09L));
     932    ((void)(+0x0123456789.p-09));
     933    ((void)(+0x0123456789.p-09f));
     934    ((void)(+0x0123456789.p-09l));
     935    ((void)(+0x0123456789.p-09F));
     936    ((void)(+0x0123456789.p-09L));
    906937    ((void)(-0x0123456789.p-09));
    907938    ((void)(-0x0123456789.p-09f));
     
    944975    ((void)0x.0123456789P-09F);
    945976    ((void)0x.0123456789P-09L);
    946     ((void)(-0x.0123456789P-09));
    947     ((void)(-0x.0123456789P-09f));
    948     ((void)(-0x.0123456789P-09l));
    949     ((void)(-0x.0123456789P-09F));
    950     ((void)(-0x.0123456789P-09L));
     977    ((void)(+0x.0123456789P-09));
     978    ((void)(+0x.0123456789P-09f));
     979    ((void)(+0x.0123456789P-09l));
     980    ((void)(+0x.0123456789P-09F));
     981    ((void)(+0x.0123456789P-09L));
    951982    ((void)(-0x.0123456789P-09));
    952983    ((void)(-0x.0123456789P-09f));
     
    9891020    ((void)0X0123456789.0123456789P-09F);
    9901021    ((void)0X0123456789.0123456789P-09L);
     1022    ((void)(+0X0123456789.0123456789P-09));
     1023    ((void)(+0X0123456789.0123456789P-09f));
     1024    ((void)(+0X0123456789.0123456789P-09l));
     1025    ((void)(+0X0123456789.0123456789P-09F));
     1026    ((void)(+0X0123456789.0123456789P-09L));
    9911027    ((void)(-0X0123456789.0123456789P-09));
    9921028    ((void)(-0X0123456789.0123456789P-09f));
     
    9941030    ((void)(-0X0123456789.0123456789P-09F));
    9951031    ((void)(-0X0123456789.0123456789P-09L));
    996     ((void)(-0X0123456789.0123456789P-09));
    997     ((void)(-0X0123456789.0123456789P-09f));
    998     ((void)(-0X0123456789.0123456789P-09l));
    999     ((void)(-0X0123456789.0123456789P-09F));
    1000     ((void)(-0X0123456789.0123456789P-09L));
     1032    ((void)((signed char )01234567));
     1033    ((void)((signed short int )01234567));
     1034    ((void)((signed int )01234567));
     1035    ((void)((signed long long int )01234567));
     1036    ((void)((__int128 )01234567));
     1037    ((void)((unsigned char )01234567u));
     1038    ((void)((signed short int )01234567u));
     1039    ((void)((unsigned int )01234567u));
     1040    ((void)((signed long long int )01234567u));
     1041    ((void)((__int128 )01234567u));
     1042    ((void)(+((signed int )((signed char )01234567))));
     1043    ((void)(+((signed int )((signed short int )01234567))));
     1044    ((void)(+((signed int )01234567)));
     1045    ((void)(+((signed long long int )01234567)));
     1046    ((void)(+((float )((__int128 )01234567))));
     1047    ((void)(+((signed int )((unsigned char )01234567u))));
     1048    ((void)(+((signed int )((signed short int )01234567u))));
     1049    ((void)(+((unsigned int )01234567u)));
     1050    ((void)(+((signed long long int )01234567u)));
     1051    ((void)(+((float )((__int128 )01234567u))));
     1052    ((void)(-((signed int )((signed char )01234567))));
     1053    ((void)(-((signed int )((signed short int )01234567))));
     1054    ((void)(-((signed int )01234567)));
     1055    ((void)(-((signed long long int )01234567)));
     1056    ((void)(-((float )((__int128 )01234567))));
     1057    ((void)(-((signed int )((unsigned char )01234567u))));
     1058    ((void)(-((signed int )((signed short int )01234567u))));
     1059    ((void)(-((unsigned int )01234567u)));
     1060    ((void)(-((signed long long int )01234567u)));
     1061    ((void)(-((float )((__int128 )01234567u))));
     1062    ((void)((signed char )1234567890));
     1063    ((void)((signed short int )1234567890));
     1064    ((void)((signed int )1234567890));
     1065    ((void)((signed long long int )1234567890));
     1066    ((void)((__int128 )1234567890));
     1067    ((void)((signed char )1234567890U));
     1068    ((void)((unsigned short int )1234567890U));
     1069    ((void)((signed int )1234567890U));
     1070    ((void)((unsigned long long int )1234567890u));
     1071    ((void)((unsigned __int128 )1234567890u));
     1072    ((void)(+((signed int )((signed char )1234567890))));
     1073    ((void)(+((signed int )((signed short int )1234567890))));
     1074    ((void)(+((signed int )1234567890)));
     1075    ((void)(+((signed long long int )1234567890)));
     1076    ((void)(+((float )((__int128 )1234567890))));
     1077    ((void)(+((signed int )((signed char )1234567890U))));
     1078    ((void)(+((signed int )((unsigned short int )1234567890U))));
     1079    ((void)(+((signed int )1234567890U)));
     1080    ((void)(+((unsigned long long int )1234567890u)));
     1081    ((void)(+((float )((unsigned __int128 )1234567890u))));
     1082    ((void)(-((signed int )((signed char )1234567890))));
     1083    ((void)(-((signed int )((signed short int )1234567890))));
     1084    ((void)(-((signed int )1234567890)));
     1085    ((void)(-((signed long long int )1234567890)));
     1086    ((void)(-((float )((__int128 )1234567890))));
     1087    ((void)(-((signed int )((signed char )1234567890U))));
     1088    ((void)(-((signed int )((unsigned short int )1234567890U))));
     1089    ((void)(-((signed int )1234567890U)));
     1090    ((void)(-((unsigned long long int )1234567890u)));
     1091    ((void)(-((float )((unsigned __int128 )1234567890u))));
     1092    ((void)((signed char )0x0123456789abcdef));
     1093    ((void)((signed short int )0x0123456789abcdef));
     1094    ((void)((signed int )0x0123456789abcdef));
     1095    ((void)((signed long long int )0x0123456789abcdef));
     1096    ((void)((signed char )0x0123456789abcdefu));
     1097    ((void)((unsigned short int )0x0123456789abcdefu));
     1098    ((void)((signed int )0x0123456789abcdefu));
     1099    ((void)((unsigned long long int )0x0123456789abcdefu));
     1100    ((void)(+((signed int )((signed char )0x0123456789abcdef))));
     1101    ((void)(+((signed int )((signed short int )0x0123456789abcdef))));
     1102    ((void)(+((signed int )0x0123456789abcdef)));
     1103    ((void)(+((signed long long int )0x0123456789abcdef)));
     1104    ((void)(+((signed int )((signed char )0x0123456789abcdefu))));
     1105    ((void)(+((signed int )((unsigned short int )0x0123456789abcdefu))));
     1106    ((void)(+((signed int )0x0123456789abcdefu)));
     1107    ((void)(+((unsigned long long int )0x0123456789abcdefu)));
     1108    ((void)(-((signed int )((signed char )0x0123456789abcdef))));
     1109    ((void)(-((signed int )((signed short int )0x0123456789abcdef))));
     1110    ((void)(-((signed int )0x0123456789abcdef)));
     1111    ((void)(-((signed long long int )0x0123456789abcdef)));
     1112    ((void)(-((signed int )((signed char )0x0123456789abcdefu))));
     1113    ((void)(-((signed int )((unsigned short int )0x0123456789abcdefu))));
     1114    ((void)(-((signed int )0x0123456789abcdefu)));
     1115    ((void)(-((unsigned long long int )0x0123456789abcdefu)));
     1116    ((void)((signed char )0x0123456789ABCDEF));
     1117    ((void)((signed short int )0x0123456789ABCDEF));
     1118    ((void)((signed int )0x0123456789ABCDEF));
     1119    ((void)((signed long long int )0x0123456789ABCDEF));
     1120    ((void)((signed char )0x0123456789ABCDEFu));
     1121    ((void)((unsigned short int )0x0123456789ABCDEFu));
     1122    ((void)((signed int )0x0123456789ABCDEFu));
     1123    ((void)((unsigned long long int )0x0123456789ABCDEFu));
     1124    ((void)(+((signed int )((signed char )0x0123456789ABCDEF))));
     1125    ((void)(+((signed int )((signed short int )0x0123456789ABCDEF))));
     1126    ((void)(+((signed int )0x0123456789ABCDEF)));
     1127    ((void)(+((signed long long int )0x0123456789ABCDEF)));
     1128    ((void)(+((signed int )((signed char )0x0123456789ABCDEFu))));
     1129    ((void)(+((signed int )((unsigned short int )0x0123456789ABCDEFu))));
     1130    ((void)(+((signed int )0x0123456789ABCDEFu)));
     1131    ((void)(+((unsigned long long int )0x0123456789ABCDEFu)));
     1132    ((void)(-((signed int )((signed char )0x0123456789ABCDEF))));
     1133    ((void)(-((signed int )((signed short int )0x0123456789ABCDEF))));
     1134    ((void)(-((signed int )0x0123456789ABCDEF)));
     1135    ((void)(-((signed long long int )0x0123456789ABCDEF)));
     1136    ((void)(-((signed int )((signed char )0x0123456789ABCDEFu))));
     1137    ((void)(-((signed int )((unsigned short int )0x0123456789ABCDEFu))));
     1138    ((void)(-((signed int )0x0123456789ABCDEFu)));
     1139    ((void)(-((unsigned long long int )0x0123456789ABCDEFu)));
     1140    ((void)((signed char )0X0123456789abcdef));
     1141    ((void)((signed short int )0X0123456789abcdef));
     1142    ((void)((signed int )0X0123456789abcdef));
     1143    ((void)((signed long long int )0X0123456789abcdef));
     1144    ((void)((signed char )0X0123456789abcdefu));
     1145    ((void)((unsigned short int )0X0123456789abcdefu));
     1146    ((void)((signed int )0X0123456789abcdefu));
     1147    ((void)((unsigned long long int )0X0123456789abcdefu));
     1148    ((void)(+((signed int )((signed char )0X0123456789abcdef))));
     1149    ((void)(+((signed int )((signed short int )0X0123456789abcdef))));
     1150    ((void)(+((signed int )0X0123456789abcdef)));
     1151    ((void)(+((signed long long int )0X0123456789abcdef)));
     1152    ((void)(+((signed int )((signed char )0X0123456789abcdefu))));
     1153    ((void)(+((signed int )((unsigned short int )0X0123456789abcdefu))));
     1154    ((void)(+((signed int )0X0123456789abcdefu)));
     1155    ((void)(+((unsigned long long int )0X0123456789abcdefu)));
     1156    ((void)(-((signed int )((signed char )0X0123456789abcdef))));
     1157    ((void)(-((signed int )((signed short int )0X0123456789abcdef))));
     1158    ((void)(-((signed int )0X0123456789abcdef)));
     1159    ((void)(-((signed long long int )0X0123456789abcdef)));
     1160    ((void)(-((signed int )((signed char )0X0123456789abcdefu))));
     1161    ((void)(-((signed int )((unsigned short int )0X0123456789abcdefu))));
     1162    ((void)(-((signed int )0X0123456789abcdefu)));
     1163    ((void)(-((unsigned long long int )0X0123456789abcdefu)));
     1164    ((void)((signed char )0X0123456789ABCDEF));
     1165    ((void)((signed short int )0X0123456789ABCDEF));
     1166    ((void)((signed int )0X0123456789ABCDEF));
     1167    ((void)((signed long long int )0X0123456789ABCDEF));
     1168    ((void)((signed char )0X0123456789ABCDEFu));
     1169    ((void)((unsigned short int )0X0123456789ABCDEFu));
     1170    ((void)((signed int )0X0123456789ABCDEFu));
     1171    ((void)((unsigned long long int )0X0123456789ABCDEFu));
     1172    ((void)(+((signed int )((signed char )0X0123456789ABCDEF))));
     1173    ((void)(+((signed int )((signed short int )0X0123456789ABCDEF))));
     1174    ((void)(+((signed int )0X0123456789ABCDEF)));
     1175    ((void)(+((signed long long int )0X0123456789ABCDEF)));
     1176    ((void)(+((signed int )((signed char )0X0123456789ABCDEFu))));
     1177    ((void)(+((signed int )((unsigned short int )0X0123456789ABCDEFu))));
     1178    ((void)(+((signed int )0X0123456789ABCDEFu)));
     1179    ((void)(+((unsigned long long int )0X0123456789ABCDEFu)));
     1180    ((void)(-((signed int )((signed char )0X0123456789ABCDEF))));
     1181    ((void)(-((signed int )((signed short int )0X0123456789ABCDEF))));
     1182    ((void)(-((signed int )0X0123456789ABCDEF)));
     1183    ((void)(-((signed long long int )0X0123456789ABCDEF)));
     1184    ((void)(-((signed int )((signed char )0X0123456789ABCDEFu))));
     1185    ((void)(-((signed int )((unsigned short int )0X0123456789ABCDEFu))));
     1186    ((void)(-((signed int )0X0123456789ABCDEFu)));
     1187    ((void)(-((unsigned long long int )0X0123456789ABCDEFu)));
     1188    ((void)((float )0123456789.));
     1189    ((void)((double )0123456789.));
     1190    ((void)((long double )0123456789.));
     1191    ((void)((long double )0123456789.));
     1192    ((void)(+((float )0123456789.)));
     1193    ((void)(+((double )0123456789.)));
     1194    ((void)(+((long double )0123456789.)));
     1195    ((void)(+((long double )0123456789.)));
     1196    ((void)(-((float )0123456789.)));
     1197    ((void)(-((double )0123456789.)));
     1198    ((void)(-((long double )0123456789.)));
     1199    ((void)(-((long double )0123456789.)));
     1200    ((void)((float )0123456789.e09));
     1201    ((void)((double )0123456789.e09));
     1202    ((void)((long double )0123456789.e09));
     1203    ((void)((long double )0123456789.e09));
     1204    ((void)(+((float )0123456789.e+09)));
     1205    ((void)(+((double )0123456789.e+09)));
     1206    ((void)(+((long double )0123456789.e+09)));
     1207    ((void)(+((long double )0123456789.e+09)));
     1208    ((void)(-((float )0123456789.e-09)));
     1209    ((void)(-((double )0123456789.e-09)));
     1210    ((void)(-((long double )0123456789.e-09)));
     1211    ((void)(-((long double )0123456789.e-09)));
     1212    ((void)((float ).0123456789e09));
     1213    ((void)((double ).0123456789e09));
     1214    ((void)((long double ).0123456789e09));
     1215    ((void)((long double ).0123456789e09));
     1216    ((void)(+((float ).0123456789E+09)));
     1217    ((void)(+((double ).0123456789E+09)));
     1218    ((void)(+((long double ).0123456789E+09)));
     1219    ((void)(+((long double ).0123456789E+09)));
     1220    ((void)(-((float ).0123456789E-09)));
     1221    ((void)(-((double ).0123456789E-09)));
     1222    ((void)(-((long double ).0123456789E-09)));
     1223    ((void)(-((long double ).0123456789E-09)));
     1224    ((void)((float )0123456789.0123456789));
     1225    ((void)((double )0123456789.0123456789));
     1226    ((void)((long double )0123456789.0123456789));
     1227    ((void)((long double )0123456789.0123456789));
     1228    ((void)(+((float )0123456789.0123456789E09)));
     1229    ((void)(+((double )0123456789.0123456789E09)));
     1230    ((void)(+((long double )0123456789.0123456789E09)));
     1231    ((void)(+((long double )0123456789.0123456789E09)));
     1232    ((void)(-((float )0123456789.0123456789E+09)));
     1233    ((void)(-((double )0123456789.0123456789E+09)));
     1234    ((void)(-((long double )0123456789.0123456789E+09)));
     1235    ((void)(-((long double )0123456789.0123456789E+09)));
     1236    ((void)((float )0123456789.0123456789E-09));
     1237    ((void)((double )0123456789.0123456789E-09));
     1238    ((void)((long double )0123456789.0123456789E-09));
     1239    ((void)((long double )0123456789.0123456789E-09));
     1240    ((void)((float )0x0123456789.p09));
     1241    ((void)((double )0x0123456789.p09));
     1242    ((void)((long double )0x0123456789.p09));
     1243    ((void)((long double )0x0123456789.p09));
     1244    ((void)(+((float )0x0123456789.p09)));
     1245    ((void)(+((double )0x0123456789.p09)));
     1246    ((void)(+((long double )0x0123456789.p09)));
     1247    ((void)(+((long double )0x0123456789.p09)));
     1248    ((void)(-((float )0x0123456789.p09)));
     1249    ((void)(-((double )0x0123456789.p09)));
     1250    ((void)(-((long double )0x0123456789.p09)));
     1251    ((void)(-((long double )0x0123456789.p09)));
     1252    ((void)((float )0x0123456789.p+09));
     1253    ((void)((double )0x0123456789.p+09));
     1254    ((void)((long double )0x0123456789.p+09));
     1255    ((void)((long double )0x0123456789.p+09));
     1256    ((void)(+((float )0x0123456789.p-09)));
     1257    ((void)(+((double )0x0123456789.p-09)));
     1258    ((void)(+((long double )0x0123456789.p-09)));
     1259    ((void)(+((long double )0x0123456789.p-09)));
     1260    ((void)(-((float )0x.0123456789p09)));
     1261    ((void)(-((double )0x.0123456789p09)));
     1262    ((void)(-((long double )0x.0123456789p09)));
     1263    ((void)(-((long double )0x.0123456789p09)));
    10011264    ((void)__f__F_c__1('a'));
    10021265    ((void)__f__F_Sc__1(20));
     
    11111374    ((void)L"a" "b" "c");
    11121375    ((void)(___retval_main__i_1=0) /* ?{} */);
    1113     return ((signed int )___retval_main__i_1);
     1376    return ___retval_main__i_1;
    11141377}
    11151378static inline int invoke_main(int argc, char* argv[], char* envp[]) { (void)argc; (void)argv; (void)envp; return __main__Fi___1(); }
     
    11261389    ((void)(___retval_main__i_1=(((void)(_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1))) , _tmp_cp_ret0)) /* ?{} */);
    11271390    ((void)(_tmp_cp_ret0) /* ^?{} */);
    1128     return ((signed int )___retval_main__i_1);
    1129 }
     1391    return ___retval_main__i_1;
     1392}
  • src/tests/.expect/64/KRfunctions.txt

    r78315272 r3f7e12cb  
    2121static inline void ___destructor__F_R2sS_autogen___1(struct S *___dst__R2sS_1);
    2222static inline struct S ___operator_assign__F2sS_R2sS2sS_autogen___1(struct S *___dst__R2sS_1, struct S ___src__2sS_1);
     23static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, signed int __i__i_1);
    2324static inline void ___constructor__F_R2sS_autogen___1(struct S *___dst__R2sS_1){
    2425    ((void)((*___dst__R2sS_1).__i__i_1) /* ?{} */);
     
    3334    struct S ___ret__2sS_1;
    3435    ((void)((*___dst__R2sS_1).__i__i_1=___src__2sS_1.__i__i_1));
    35     ((void)___constructor__F_R2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1));
    36     return ((struct S )___ret__2sS_1);
     36    ((void)___constructor__F_R2sS2sS_autogen___1((&___ret__2sS_1), (*___dst__R2sS_1)));
     37    return ___ret__2sS_1;
    3738}
    3839static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, signed int __i__i_1){
     
    6566    signed int *__x__FPi_ii__2(signed int __anonymous_object2, signed int __anonymous_object3);
    6667    ((void)(___retval_f10__PFPi_ii__1=__x__FPi_ii__2) /* ?{} */);
    67     return ((signed int *(*)(signed int __x__i_1, signed int __y__i_1))___retval_f10__PFPi_ii__1);
     68    return ___retval_f10__PFPi_ii__1;
    6869}
    6970signed int (*__f11__FPA0i_iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1))[]{
  • src/tests/.expect/64/attributes.txt

    r78315272 r3f7e12cb  
    2323static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_R13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){
    2424    struct __anonymous0 ___ret__13s__anonymous0_1;
    25     ((void)___constructor__F_R13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1));
    26     return ((struct __anonymous0 )___ret__13s__anonymous0_1);
     25    ((void)___constructor__F_R13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), (*___dst__R13s__anonymous0_1)));
     26    return ___ret__13s__anonymous0_1;
    2727}
    2828__attribute__ ((unused)) struct Agn1;
     
    4141static inline struct Agn2 ___operator_assign__F5sAgn2_R5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__R5sAgn2_1, struct Agn2 ___src__5sAgn2_1){
    4242    struct Agn2 ___ret__5sAgn2_1;
    43     ((void)___constructor__F_R5sAgn25sAgn2_autogen___1((&___ret__5sAgn2_1), ___src__5sAgn2_1));
    44     return ((struct Agn2 )___ret__5sAgn2_1);
     43    ((void)___constructor__F_R5sAgn25sAgn2_autogen___1((&___ret__5sAgn2_1), (*___dst__R5sAgn2_1)));
     44    return ___ret__5sAgn2_1;
    4545}
    4646enum __attribute__ ((unused)) __anonymous1 {
     
    6969static inline void ___destructor__F_R4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1);
    7070static inline struct Fdl ___operator_assign__F4sFdl_R4sFdl4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1, struct Fdl ___src__4sFdl_1);
     71static inline void ___constructor__F_R4sFdli_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1);
     72static inline void ___constructor__F_R4sFdlii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1);
     73static inline void ___constructor__F_R4sFdliii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1);
     74static inline void ___constructor__F_R4sFdliiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1);
     75static inline void ___constructor__F_R4sFdliiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1);
     76static inline void ___constructor__F_R4sFdliiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1);
     77static inline void ___constructor__F_R4sFdliiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1);
     78static inline void ___constructor__F_R4sFdliiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1);
     79static inline void ___constructor__F_R4sFdliiiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object1);
     80static inline void ___constructor__F_R4sFdliiiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object2, signed int *__f9__Pi_1);
    7181static inline void ___constructor__F_R4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1){
    7282    ((void)((*___dst__R4sFdl_1).__f1__i_1) /* ?{} */);
     
    7888    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    7989    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     90    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    8091    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    8192}
     
    89100    ((void)((*___dst__R4sFdl_1).__f7__i_1=___src__4sFdl_1.__f7__i_1) /* ?{} */);
    90101    ((void)((*___dst__R4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1) /* ?{} */);
     102    ((void)((*___dst__R4sFdl_1).__anonymous_object0=___src__4sFdl_1.__anonymous_object0) /* ?{} */);
    91103    ((void)((*___dst__R4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1) /* ?{} */);
    92104}
    93105static inline void ___destructor__F_R4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1){
    94106    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ^?{} */);
     107    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ^?{} */);
    95108    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ^?{} */);
    96109    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ^?{} */);
     
    112125    ((void)((*___dst__R4sFdl_1).__f7__i_1=___src__4sFdl_1.__f7__i_1));
    113126    ((void)((*___dst__R4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1));
     127    ((void)((*___dst__R4sFdl_1).__anonymous_object0=___src__4sFdl_1.__anonymous_object0));
    114128    ((void)((*___dst__R4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1));
    115     ((void)___constructor__F_R4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), ___src__4sFdl_1));
    116     return ((struct Fdl )___ret__4sFdl_1);
     129    ((void)___constructor__F_R4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), (*___dst__R4sFdl_1)));
     130    return ___ret__4sFdl_1;
    117131}
    118132static inline void ___constructor__F_R4sFdli_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1){
     
    125139    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    126140    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     141    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    127142    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    128143}
     
    136151    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    137152    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     153    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    138154    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    139155}
     
    147163    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    148164    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     165    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    149166    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    150167}
     
    158175    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    159176    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     177    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    160178    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    161179}
     
    169187    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    170188    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     189    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    171190    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    172191}
     
    180199    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    181200    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     201    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    182202    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    183203}
     
    191211    ((void)((*___dst__R4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */);
    192212    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     213    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
    193214    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    194215}
     
    202223    ((void)((*___dst__R4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */);
    203224    ((void)((*___dst__R4sFdl_1).__f8__i_1=__f8__i_1) /* ?{} */);
    204     ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    205 }
    206 static inline void ___constructor__F_R4sFdliiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int *__f9__Pi_1){
     225    ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */);
     226    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
     227}
     228static inline void ___constructor__F_R4sFdliiiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object3){
    207229    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    208230    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     
    213235    ((void)((*___dst__R4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */);
    214236    ((void)((*___dst__R4sFdl_1).__f8__i_1=__f8__i_1) /* ?{} */);
     237    ((void)((*___dst__R4sFdl_1).__anonymous_object0=__anonymous_object3) /* ?{} */);
     238    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
     239}
     240static inline void ___constructor__F_R4sFdliiiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object4, signed int *__f9__Pi_1){
     241    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
     242    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     243    ((void)((*___dst__R4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */);
     244    ((void)((*___dst__R4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */);
     245    ((void)((*___dst__R4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */);
     246    ((void)((*___dst__R4sFdl_1).__f6__i_1=__f6__i_1) /* ?{} */);
     247    ((void)((*___dst__R4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */);
     248    ((void)((*___dst__R4sFdl_1).__f8__i_1=__f8__i_1) /* ?{} */);
     249    ((void)((*___dst__R4sFdl_1).__anonymous_object0=__anonymous_object4) /* ?{} */);
    215250    ((void)((*___dst__R4sFdl_1).__f9__Pi_1=__f9__Pi_1) /* ?{} */);
    216251}
     
    232267    __attribute__ ((unused)) signed int **const ___retval_f2__CPPi_1;
    233268}
    234 __attribute__ ((unused,used,unused)) signed int (*__f3__FPA0i_i__1(signed int __anonymous_object1))[];
     269__attribute__ ((unused,used,unused)) signed int (*__f3__FPA0i_i__1(signed int __anonymous_object5))[];
    235270__attribute__ ((unused,unused)) signed int (*__f3__FPA0i_i__1(signed int __p__i_1))[]{
    236271    __attribute__ ((unused)) signed int (*___retval_f3__PA0i_1)[];
    237272}
    238 __attribute__ ((unused,used,unused)) signed int (*__f4__FPFi_i____1())(signed int __anonymous_object2);
    239 __attribute__ ((unused,unused)) signed int (*__f4__FPFi_i____1())(signed int __anonymous_object3){
    240     __attribute__ ((unused)) signed int (*___retval_f4__PFi_i__1)(signed int __anonymous_object4);
     273__attribute__ ((unused,used,unused)) signed int (*__f4__FPFi_i____1())(signed int __anonymous_object6);
     274__attribute__ ((unused,unused)) signed int (*__f4__FPFi_i____1())(signed int __anonymous_object7){
     275    __attribute__ ((unused)) signed int (*___retval_f4__PFi_i__1)(signed int __anonymous_object8);
    241276}
    242277signed int __vtr__Fi___1(){
     
    268303signed int __tpr2__Fi_PPi__1(__attribute__ ((unused,unused,unused,unused,unused,unused)) signed int **__Foo__PPi_1);
    269304signed int __tpr3__Fi_Pi__1(__attribute__ ((unused,unused,unused)) signed int *__Foo__Pi_1);
    270 signed int __tpr4__Fi_PFi_Pi___1(__attribute__ ((unused,unused)) signed int (*__anonymous_object5)(__attribute__ ((unused,unused)) signed int __anonymous_object6[((unsigned long int )5)]));
     305signed int __tpr4__Fi_PFi_Pi___1(__attribute__ ((unused,unused)) signed int (*__anonymous_object9)(__attribute__ ((unused,unused)) signed int __anonymous_object10[((unsigned long int )5)]));
    271306signed int __tpr5__Fi_PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__Foo__PFi___1)());
    272307signed int __tpr6__Fi_PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__Foo__PFi___1)());
    273 signed int __tpr7__Fi_PFi_PFi_i____1(__attribute__ ((unused,unused)) signed int (*__anonymous_object7)(__attribute__ ((unused)) signed int (*__anonymous_object8)(__attribute__ ((unused,unused)) signed int __anonymous_object9)));
     308signed int __tpr7__Fi_PFi_PFi_i____1(__attribute__ ((unused,unused)) signed int (*__anonymous_object11)(__attribute__ ((unused)) signed int (*__anonymous_object12)(__attribute__ ((unused,unused)) signed int __anonymous_object13)));
    274309signed int __ad__Fi___1(){
    275310    __attribute__ ((unused)) signed int ___retval_ad__i_1;
     
    300335        struct __anonymous4 ___ret__13s__anonymous4_2;
    301336        ((void)((*___dst__R13s__anonymous4_2).__i__i_2=___src__13s__anonymous4_2.__i__i_2));
    302         ((void)___constructor__F_R13s__anonymous413s__anonymous4_autogen___2((&___ret__13s__anonymous4_2), ___src__13s__anonymous4_2));
    303         return ((struct __anonymous4 )___ret__13s__anonymous4_2);
     337        ((void)___constructor__F_R13s__anonymous413s__anonymous4_autogen___2((&___ret__13s__anonymous4_2), (*___dst__R13s__anonymous4_2)));
     338        return ___ret__13s__anonymous4_2;
    304339    }
    305340    inline void ___constructor__F_R13s__anonymous4i_autogen___2(struct __anonymous4 *___dst__R13s__anonymous4_2, signed int __i__i_2){
     
    313348    }
    314349    inline void ___constructor__F_R13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__R13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){
    315         ((void)((*___dst__R13e__anonymous5_2)=___src__13e__anonymous5_2));
     350        ((void)((*___dst__R13e__anonymous5_2)=___src__13e__anonymous5_2) /* ?{} */);
    316351    }
    317352    inline void ___destructor__F_R13e__anonymous5_intrinsic___2(__attribute__ ((unused)) enum __anonymous5 *___dst__R13e__anonymous5_2){
     
    319354    inline enum __anonymous5 ___operator_assign__F13e__anonymous5_R13e__anonymous513e__anonymous5_intrinsic___2(enum __anonymous5 *___dst__R13e__anonymous5_2, enum __anonymous5 ___src__13e__anonymous5_2){
    320355        enum __anonymous5 ___ret__13e__anonymous5_2;
    321         ((void)(___ret__13e__anonymous5_2=((*___dst__R13e__anonymous5_2)=___src__13e__anonymous5_2)) /* ?{} */);
    322         return ((enum __anonymous5 )___ret__13e__anonymous5_2);
     356        ((void)((*___dst__R13e__anonymous5_2)=___src__13e__anonymous5_2));
     357        ((void)(___ret__13e__anonymous5_2=(*___dst__R13e__anonymous5_2)) /* ?{} */);
     358        return ___ret__13e__anonymous5_2;
    323359    }
    324360    ((void)sizeof(enum __anonymous5 ));
    325361}
    326 signed int __apd1__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object10, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object11);
    327 signed int __apd2__Fi_PPiPPi__1(__attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object12, __attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object13);
    328 signed int __apd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object14, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object15);
    329 signed int __apd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object16)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object17)());
    330 signed int __apd5__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object18)(__attribute__ ((unused)) signed int __anonymous_object19), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object20)(__attribute__ ((unused)) signed int __anonymous_object21));
    331 signed int __apd6__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object22)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object23)());
    332 signed int __apd7__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object24)(__attribute__ ((unused)) signed int __anonymous_object25), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object26)(__attribute__ ((unused)) signed int __anonymous_object27));
     362signed int __apd1__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object14, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object15);
     363signed int __apd2__Fi_PPiPPi__1(__attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object16, __attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object17);
     364signed int __apd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object18, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object19);
     365signed int __apd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object20)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object21)());
     366signed int __apd5__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object22)(__attribute__ ((unused)) signed int __anonymous_object23), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object24)(__attribute__ ((unused)) signed int __anonymous_object25));
     367signed int __apd6__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object26)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object27)());
     368signed int __apd7__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object28)(__attribute__ ((unused)) signed int __anonymous_object29), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object30)(__attribute__ ((unused)) signed int __anonymous_object31));
    333369struct Vad {
    334     __attribute__ ((unused)) signed int __anonymous_object28;
    335     __attribute__ ((unused,unused)) signed int *__anonymous_object29;
    336     __attribute__ ((unused,unused)) signed int __anonymous_object30[((unsigned long int )10)];
    337     __attribute__ ((unused,unused)) signed int (*__anonymous_object31)();
     370    __attribute__ ((unused)) signed int __anonymous_object32;
     371    __attribute__ ((unused,unused)) signed int *__anonymous_object33;
     372    __attribute__ ((unused,unused)) signed int __anonymous_object34[((unsigned long int )10)];
     373    __attribute__ ((unused,unused)) signed int (*__anonymous_object35)();
    338374};
    339375static inline void ___constructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1);
     
    341377static inline void ___destructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1);
    342378static inline struct Vad ___operator_assign__F4sVad_R4sVad4sVad_autogen___1(struct Vad *___dst__R4sVad_1, struct Vad ___src__4sVad_1);
     379static inline void ___constructor__F_R4sVadi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object36);
     380static inline void ___constructor__F_R4sVadiPi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object37, signed int *__anonymous_object38);
     381static inline void ___constructor__F_R4sVadiPiA0i_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object39, signed int *__anonymous_object40, signed int __anonymous_object41[((unsigned long int )10)]);
     382static inline void ___constructor__F_R4sVadiPiA0iPFi___autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object42, signed int *__anonymous_object43, signed int __anonymous_object44[((unsigned long int )10)], signed int (*__anonymous_object45)());
    343383static inline void ___constructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1){
     384    ((void)((*___dst__R4sVad_1).__anonymous_object32) /* ?{} */);
     385    ((void)((*___dst__R4sVad_1).__anonymous_object33) /* ?{} */);
     386    {
     387        signed int _index0 = 0;
     388        for (;(_index0<10);((void)(++_index0))) {
     389            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[((signed long int )_index0)])))) /* ?{} */);
     390        }
     391
     392    }
     393
     394    ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */);
    344395}
    345396static inline void ___constructor__F_R4sVad4sVad_autogen___1(struct Vad *___dst__R4sVad_1, struct Vad ___src__4sVad_1){
     397    ((void)((*___dst__R4sVad_1).__anonymous_object32=___src__4sVad_1.__anonymous_object32) /* ?{} */);
     398    ((void)((*___dst__R4sVad_1).__anonymous_object33=___src__4sVad_1.__anonymous_object33) /* ?{} */);
     399    {
     400        signed int _index1 = 0;
     401        for (;(_index1<10);((void)(++_index1))) {
     402            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[((signed long int )_index1)])))=___src__4sVad_1.__anonymous_object34[((signed long int )_index1)]) /* ?{} */);
     403        }
     404
     405    }
     406
     407    ((void)((*___dst__R4sVad_1).__anonymous_object35=___src__4sVad_1.__anonymous_object35) /* ?{} */);
    346408}
    347409static inline void ___destructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1){
     410    ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ^?{} */);
     411    {
     412        signed int _index2 = (10-1);
     413        for (;(_index2>=0);((void)(--_index2))) {
     414            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[((signed long int )_index2)])))) /* ^?{} */);
     415        }
     416
     417    }
     418
     419    ((void)((*___dst__R4sVad_1).__anonymous_object33) /* ^?{} */);
     420    ((void)((*___dst__R4sVad_1).__anonymous_object32) /* ^?{} */);
    348421}
    349422static inline struct Vad ___operator_assign__F4sVad_R4sVad4sVad_autogen___1(struct Vad *___dst__R4sVad_1, struct Vad ___src__4sVad_1){
    350423    struct Vad ___ret__4sVad_1;
    351     ((void)___constructor__F_R4sVad4sVad_autogen___1((&___ret__4sVad_1), ___src__4sVad_1));
    352     return ((struct Vad )___ret__4sVad_1);
    353 }
     424    ((void)((*___dst__R4sVad_1).__anonymous_object32=___src__4sVad_1.__anonymous_object32));
     425    ((void)((*___dst__R4sVad_1).__anonymous_object33=___src__4sVad_1.__anonymous_object33));
     426    {
     427        signed int _index3 = 0;
     428        for (;(_index3<10);((void)(++_index3))) {
     429            ((void)((*___dst__R4sVad_1).__anonymous_object34[((signed long int )_index3)]=___src__4sVad_1.__anonymous_object34[((signed long int )_index3)]));
     430        }
     431
     432    }
     433
     434    ((void)((*___dst__R4sVad_1).__anonymous_object35=___src__4sVad_1.__anonymous_object35));
     435    ((void)___constructor__F_R4sVad4sVad_autogen___1((&___ret__4sVad_1), (*___dst__R4sVad_1)));
     436    return ___ret__4sVad_1;
     437}
     438static inline void ___constructor__F_R4sVadi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object46){
     439    ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object46) /* ?{} */);
     440    ((void)((*___dst__R4sVad_1).__anonymous_object33) /* ?{} */);
     441    {
     442        signed int _index4 = 0;
     443        for (;(_index4<10);((void)(++_index4))) {
     444            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[((signed long int )_index4)])))) /* ?{} */);
     445        }
     446
     447    }
     448
     449    ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */);
     450}
     451static inline void ___constructor__F_R4sVadiPi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object47, signed int *__anonymous_object48){
     452    ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object47) /* ?{} */);
     453    ((void)((*___dst__R4sVad_1).__anonymous_object33=__anonymous_object48) /* ?{} */);
     454    {
     455        signed int _index5 = 0;
     456        for (;(_index5<10);((void)(++_index5))) {
     457            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[((signed long int )_index5)])))) /* ?{} */);
     458        }
     459
     460    }
     461
     462    ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */);
     463}
     464static inline void ___constructor__F_R4sVadiPiA0i_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object49, signed int *__anonymous_object50, signed int __anonymous_object51[((unsigned long int )10)]){
     465    ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object49) /* ?{} */);
     466    ((void)((*___dst__R4sVad_1).__anonymous_object33=__anonymous_object50) /* ?{} */);
     467    {
     468        signed int _index6 = 0;
     469        for (;(_index6<10);((void)(++_index6))) {
     470            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[((signed long int )_index6)])))=__anonymous_object51[((signed long int )_index6)]) /* ?{} */);
     471        }
     472
     473    }
     474
     475    ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */);
     476}
     477static inline void ___constructor__F_R4sVadiPiA0iPFi___autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object52, signed int *__anonymous_object53, signed int __anonymous_object54[((unsigned long int )10)], signed int (*__anonymous_object55)()){
     478    ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object52) /* ?{} */);
     479    ((void)((*___dst__R4sVad_1).__anonymous_object33=__anonymous_object53) /* ?{} */);
     480    {
     481        signed int _index7 = 0;
     482        for (;(_index7<10);((void)(++_index7))) {
     483            ((void)((*((signed int *)(&(*___dst__R4sVad_1).__anonymous_object34[((signed long int )_index7)])))=__anonymous_object54[((signed long int )_index7)]) /* ?{} */);
     484        }
     485
     486    }
     487
     488    ((void)((*___dst__R4sVad_1).__anonymous_object35=__anonymous_object55) /* ?{} */);
     489}
  • src/tests/.expect/64/declarationSpecifier.txt

    r78315272 r3f7e12cb  
    2020static inline void ___destructor__F_R13s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1);
    2121static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_R13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1);
     22static inline void ___constructor__F_R13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1, signed int __i__i_1);
    2223static inline void ___constructor__F_R13s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1){
    2324    ((void)((*___dst__R13s__anonymous0_1).__i__i_1) /* ?{} */);
     
    3233    struct __anonymous0 ___ret__13s__anonymous0_1;
    3334    ((void)((*___dst__R13s__anonymous0_1).__i__i_1=___src__13s__anonymous0_1.__i__i_1));
    34     ((void)___constructor__F_R13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), ___src__13s__anonymous0_1));
    35     return ((struct __anonymous0 )___ret__13s__anonymous0_1);
     35    ((void)___constructor__F_R13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), (*___dst__R13s__anonymous0_1)));
     36    return ___ret__13s__anonymous0_1;
    3637}
    3738static inline void ___constructor__F_R13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1, signed int __i__i_1){
     
    4647static inline void ___destructor__F_R13s__anonymous1_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1);
    4748static inline struct __anonymous1 ___operator_assign__F13s__anonymous1_R13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1);
     49static inline void ___constructor__F_R13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1, signed int __i__i_1);
    4850static inline void ___constructor__F_R13s__anonymous1_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1){
    4951    ((void)((*___dst__R13s__anonymous1_1).__i__i_1) /* ?{} */);
     
    5860    struct __anonymous1 ___ret__13s__anonymous1_1;
    5961    ((void)((*___dst__R13s__anonymous1_1).__i__i_1=___src__13s__anonymous1_1.__i__i_1));
    60     ((void)___constructor__F_R13s__anonymous113s__anonymous1_autogen___1((&___ret__13s__anonymous1_1), ___src__13s__anonymous1_1));
    61     return ((struct __anonymous1 )___ret__13s__anonymous1_1);
     62    ((void)___constructor__F_R13s__anonymous113s__anonymous1_autogen___1((&___ret__13s__anonymous1_1), (*___dst__R13s__anonymous1_1)));
     63    return ___ret__13s__anonymous1_1;
    6264}
    6365static inline void ___constructor__F_R13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1, signed int __i__i_1){
     
    7274static inline void ___destructor__F_R13s__anonymous2_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1);
    7375static inline struct __anonymous2 ___operator_assign__F13s__anonymous2_R13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1);
     76static inline void ___constructor__F_R13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1, signed int __i__i_1);
    7477static inline void ___constructor__F_R13s__anonymous2_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1){
    7578    ((void)((*___dst__R13s__anonymous2_1).__i__i_1) /* ?{} */);
     
    8487    struct __anonymous2 ___ret__13s__anonymous2_1;
    8588    ((void)((*___dst__R13s__anonymous2_1).__i__i_1=___src__13s__anonymous2_1.__i__i_1));
    86     ((void)___constructor__F_R13s__anonymous213s__anonymous2_autogen___1((&___ret__13s__anonymous2_1), ___src__13s__anonymous2_1));
    87     return ((struct __anonymous2 )___ret__13s__anonymous2_1);
     89    ((void)___constructor__F_R13s__anonymous213s__anonymous2_autogen___1((&___ret__13s__anonymous2_1), (*___dst__R13s__anonymous2_1)));
     90    return ___ret__13s__anonymous2_1;
    8891}
    8992static inline void ___constructor__F_R13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1, signed int __i__i_1){
     
    98101static inline void ___destructor__F_R13s__anonymous3_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1);
    99102static inline struct __anonymous3 ___operator_assign__F13s__anonymous3_R13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1);
     103static inline void ___constructor__F_R13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1, signed int __i__i_1);
    100104static inline void ___constructor__F_R13s__anonymous3_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1){
    101105    ((void)((*___dst__R13s__anonymous3_1).__i__i_1) /* ?{} */);
     
    110114    struct __anonymous3 ___ret__13s__anonymous3_1;
    111115    ((void)((*___dst__R13s__anonymous3_1).__i__i_1=___src__13s__anonymous3_1.__i__i_1));
    112     ((void)___constructor__F_R13s__anonymous313s__anonymous3_autogen___1((&___ret__13s__anonymous3_1), ___src__13s__anonymous3_1));
    113     return ((struct __anonymous3 )___ret__13s__anonymous3_1);
     116    ((void)___constructor__F_R13s__anonymous313s__anonymous3_autogen___1((&___ret__13s__anonymous3_1), (*___dst__R13s__anonymous3_1)));
     117    return ___ret__13s__anonymous3_1;
    114118}
    115119static inline void ___constructor__F_R13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1, signed int __i__i_1){
     
    124128static inline void ___destructor__F_R13s__anonymous4_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1);
    125129static inline struct __anonymous4 ___operator_assign__F13s__anonymous4_R13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1);
     130static inline void ___constructor__F_R13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1, signed int __i__i_1);
    126131static inline void ___constructor__F_R13s__anonymous4_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1){
    127132    ((void)((*___dst__R13s__anonymous4_1).__i__i_1) /* ?{} */);
     
    136141    struct __anonymous4 ___ret__13s__anonymous4_1;
    137142    ((void)((*___dst__R13s__anonymous4_1).__i__i_1=___src__13s__anonymous4_1.__i__i_1));
    138     ((void)___constructor__F_R13s__anonymous413s__anonymous4_autogen___1((&___ret__13s__anonymous4_1), ___src__13s__anonymous4_1));
    139     return ((struct __anonymous4 )___ret__13s__anonymous4_1);
     143    ((void)___constructor__F_R13s__anonymous413s__anonymous4_autogen___1((&___ret__13s__anonymous4_1), (*___dst__R13s__anonymous4_1)));
     144    return ___ret__13s__anonymous4_1;
    140145}
    141146static inline void ___constructor__F_R13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1, signed int __i__i_1){
     
    150155static inline void ___destructor__F_R13s__anonymous5_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1);
    151156static inline struct __anonymous5 ___operator_assign__F13s__anonymous5_R13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1);
     157static inline void ___constructor__F_R13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1, signed int __i__i_1);
    152158static inline void ___constructor__F_R13s__anonymous5_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1){
    153159    ((void)((*___dst__R13s__anonymous5_1).__i__i_1) /* ?{} */);
     
    162168    struct __anonymous5 ___ret__13s__anonymous5_1;
    163169    ((void)((*___dst__R13s__anonymous5_1).__i__i_1=___src__13s__anonymous5_1.__i__i_1));
    164     ((void)___constructor__F_R13s__anonymous513s__anonymous5_autogen___1((&___ret__13s__anonymous5_1), ___src__13s__anonymous5_1));
    165     return ((struct __anonymous5 )___ret__13s__anonymous5_1);
     170    ((void)___constructor__F_R13s__anonymous513s__anonymous5_autogen___1((&___ret__13s__anonymous5_1), (*___dst__R13s__anonymous5_1)));
     171    return ___ret__13s__anonymous5_1;
    166172}
    167173static inline void ___constructor__F_R13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1, signed int __i__i_1){
     
    176182static inline void ___destructor__F_R13s__anonymous6_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1);
    177183static inline struct __anonymous6 ___operator_assign__F13s__anonymous6_R13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1);
     184static inline void ___constructor__F_R13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1, signed int __i__i_1);
    178185static inline void ___constructor__F_R13s__anonymous6_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1){
    179186    ((void)((*___dst__R13s__anonymous6_1).__i__i_1) /* ?{} */);
     
    188195    struct __anonymous6 ___ret__13s__anonymous6_1;
    189196    ((void)((*___dst__R13s__anonymous6_1).__i__i_1=___src__13s__anonymous6_1.__i__i_1));
    190     ((void)___constructor__F_R13s__anonymous613s__anonymous6_autogen___1((&___ret__13s__anonymous6_1), ___src__13s__anonymous6_1));
    191     return ((struct __anonymous6 )___ret__13s__anonymous6_1);
     197    ((void)___constructor__F_R13s__anonymous613s__anonymous6_autogen___1((&___ret__13s__anonymous6_1), (*___dst__R13s__anonymous6_1)));
     198    return ___ret__13s__anonymous6_1;
    192199}
    193200static inline void ___constructor__F_R13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1, signed int __i__i_1){
     
    202209static inline void ___destructor__F_R13s__anonymous7_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1);
    203210static inline struct __anonymous7 ___operator_assign__F13s__anonymous7_R13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1);
     211static inline void ___constructor__F_R13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1, signed int __i__i_1);
    204212static inline void ___constructor__F_R13s__anonymous7_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1){
    205213    ((void)((*___dst__R13s__anonymous7_1).__i__i_1) /* ?{} */);
     
    214222    struct __anonymous7 ___ret__13s__anonymous7_1;
    215223    ((void)((*___dst__R13s__anonymous7_1).__i__i_1=___src__13s__anonymous7_1.__i__i_1));
    216     ((void)___constructor__F_R13s__anonymous713s__anonymous7_autogen___1((&___ret__13s__anonymous7_1), ___src__13s__anonymous7_1));
    217     return ((struct __anonymous7 )___ret__13s__anonymous7_1);
     224    ((void)___constructor__F_R13s__anonymous713s__anonymous7_autogen___1((&___ret__13s__anonymous7_1), (*___dst__R13s__anonymous7_1)));
     225    return ___ret__13s__anonymous7_1;
    218226}
    219227static inline void ___constructor__F_R13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1, signed int __i__i_1){
     
    236244static inline void ___destructor__F_R13s__anonymous8_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1);
    237245static inline struct __anonymous8 ___operator_assign__F13s__anonymous8_R13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1);
     246static inline void ___constructor__F_R13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1, signed short int __i__s_1);
    238247static inline void ___constructor__F_R13s__anonymous8_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1){
    239248    ((void)((*___dst__R13s__anonymous8_1).__i__s_1) /* ?{} */);
     
    248257    struct __anonymous8 ___ret__13s__anonymous8_1;
    249258    ((void)((*___dst__R13s__anonymous8_1).__i__s_1=___src__13s__anonymous8_1.__i__s_1));
    250     ((void)___constructor__F_R13s__anonymous813s__anonymous8_autogen___1((&___ret__13s__anonymous8_1), ___src__13s__anonymous8_1));
    251     return ((struct __anonymous8 )___ret__13s__anonymous8_1);
     259    ((void)___constructor__F_R13s__anonymous813s__anonymous8_autogen___1((&___ret__13s__anonymous8_1), (*___dst__R13s__anonymous8_1)));
     260    return ___ret__13s__anonymous8_1;
    252261}
    253262static inline void ___constructor__F_R13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1, signed short int __i__s_1){
     
    262271static inline void ___destructor__F_R13s__anonymous9_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1);
    263272static inline struct __anonymous9 ___operator_assign__F13s__anonymous9_R13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1);
     273static inline void ___constructor__F_R13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1, signed short int __i__s_1);
    264274static inline void ___constructor__F_R13s__anonymous9_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1){
    265275    ((void)((*___dst__R13s__anonymous9_1).__i__s_1) /* ?{} */);
     
    274284    struct __anonymous9 ___ret__13s__anonymous9_1;
    275285    ((void)((*___dst__R13s__anonymous9_1).__i__s_1=___src__13s__anonymous9_1.__i__s_1));
    276     ((void)___constructor__F_R13s__anonymous913s__anonymous9_autogen___1((&___ret__13s__anonymous9_1), ___src__13s__anonymous9_1));
    277     return ((struct __anonymous9 )___ret__13s__anonymous9_1);
     286    ((void)___constructor__F_R13s__anonymous913s__anonymous9_autogen___1((&___ret__13s__anonymous9_1), (*___dst__R13s__anonymous9_1)));
     287    return ___ret__13s__anonymous9_1;
    278288}
    279289static inline void ___constructor__F_R13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1, signed short int __i__s_1){
     
    288298static inline void ___destructor__F_R14s__anonymous10_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1);
    289299static inline struct __anonymous10 ___operator_assign__F14s__anonymous10_R14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1);
     300static inline void ___constructor__F_R14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1, signed short int __i__s_1);
    290301static inline void ___constructor__F_R14s__anonymous10_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1){
    291302    ((void)((*___dst__R14s__anonymous10_1).__i__s_1) /* ?{} */);
     
    300311    struct __anonymous10 ___ret__14s__anonymous10_1;
    301312    ((void)((*___dst__R14s__anonymous10_1).__i__s_1=___src__14s__anonymous10_1.__i__s_1));
    302     ((void)___constructor__F_R14s__anonymous1014s__anonymous10_autogen___1((&___ret__14s__anonymous10_1), ___src__14s__anonymous10_1));
    303     return ((struct __anonymous10 )___ret__14s__anonymous10_1);
     313    ((void)___constructor__F_R14s__anonymous1014s__anonymous10_autogen___1((&___ret__14s__anonymous10_1), (*___dst__R14s__anonymous10_1)));
     314    return ___ret__14s__anonymous10_1;
    304315}
    305316static inline void ___constructor__F_R14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1, signed short int __i__s_1){
     
    314325static inline void ___destructor__F_R14s__anonymous11_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1);
    315326static inline struct __anonymous11 ___operator_assign__F14s__anonymous11_R14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1);
     327static inline void ___constructor__F_R14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1, signed short int __i__s_1);
    316328static inline void ___constructor__F_R14s__anonymous11_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1){
    317329    ((void)((*___dst__R14s__anonymous11_1).__i__s_1) /* ?{} */);
     
    326338    struct __anonymous11 ___ret__14s__anonymous11_1;
    327339    ((void)((*___dst__R14s__anonymous11_1).__i__s_1=___src__14s__anonymous11_1.__i__s_1));
    328     ((void)___constructor__F_R14s__anonymous1114s__anonymous11_autogen___1((&___ret__14s__anonymous11_1), ___src__14s__anonymous11_1));
    329     return ((struct __anonymous11 )___ret__14s__anonymous11_1);
     340    ((void)___constructor__F_R14s__anonymous1114s__anonymous11_autogen___1((&___ret__14s__anonymous11_1), (*___dst__R14s__anonymous11_1)));
     341    return ___ret__14s__anonymous11_1;
    330342}
    331343static inline void ___constructor__F_R14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1, signed short int __i__s_1){
     
    340352static inline void ___destructor__F_R14s__anonymous12_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1);
    341353static inline struct __anonymous12 ___operator_assign__F14s__anonymous12_R14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1);
     354static inline void ___constructor__F_R14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1, signed short int __i__s_1);
    342355static inline void ___constructor__F_R14s__anonymous12_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1){
    343356    ((void)((*___dst__R14s__anonymous12_1).__i__s_1) /* ?{} */);
     
    352365    struct __anonymous12 ___ret__14s__anonymous12_1;
    353366    ((void)((*___dst__R14s__anonymous12_1).__i__s_1=___src__14s__anonymous12_1.__i__s_1));
    354     ((void)___constructor__F_R14s__anonymous1214s__anonymous12_autogen___1((&___ret__14s__anonymous12_1), ___src__14s__anonymous12_1));
    355     return ((struct __anonymous12 )___ret__14s__anonymous12_1);
     367    ((void)___constructor__F_R14s__anonymous1214s__anonymous12_autogen___1((&___ret__14s__anonymous12_1), (*___dst__R14s__anonymous12_1)));
     368    return ___ret__14s__anonymous12_1;
    356369}
    357370static inline void ___constructor__F_R14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1, signed short int __i__s_1){
     
    366379static inline void ___destructor__F_R14s__anonymous13_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1);
    367380static inline struct __anonymous13 ___operator_assign__F14s__anonymous13_R14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1);
     381static inline void ___constructor__F_R14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1, signed short int __i__s_1);
    368382static inline void ___constructor__F_R14s__anonymous13_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1){
    369383    ((void)((*___dst__R14s__anonymous13_1).__i__s_1) /* ?{} */);
     
    378392    struct __anonymous13 ___ret__14s__anonymous13_1;
    379393    ((void)((*___dst__R14s__anonymous13_1).__i__s_1=___src__14s__anonymous13_1.__i__s_1));
    380     ((void)___constructor__F_R14s__anonymous1314s__anonymous13_autogen___1((&___ret__14s__anonymous13_1), ___src__14s__anonymous13_1));
    381     return ((struct __anonymous13 )___ret__14s__anonymous13_1);
     394    ((void)___constructor__F_R14s__anonymous1314s__anonymous13_autogen___1((&___ret__14s__anonymous13_1), (*___dst__R14s__anonymous13_1)));
     395    return ___ret__14s__anonymous13_1;
    382396}
    383397static inline void ___constructor__F_R14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1, signed short int __i__s_1){
     
    392406static inline void ___destructor__F_R14s__anonymous14_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1);
    393407static inline struct __anonymous14 ___operator_assign__F14s__anonymous14_R14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1);
     408static inline void ___constructor__F_R14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1, signed short int __i__s_1);
    394409static inline void ___constructor__F_R14s__anonymous14_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1){
    395410    ((void)((*___dst__R14s__anonymous14_1).__i__s_1) /* ?{} */);
     
    404419    struct __anonymous14 ___ret__14s__anonymous14_1;
    405420    ((void)((*___dst__R14s__anonymous14_1).__i__s_1=___src__14s__anonymous14_1.__i__s_1));
    406     ((void)___constructor__F_R14s__anonymous1414s__anonymous14_autogen___1((&___ret__14s__anonymous14_1), ___src__14s__anonymous14_1));
    407     return ((struct __anonymous14 )___ret__14s__anonymous14_1);
     421    ((void)___constructor__F_R14s__anonymous1414s__anonymous14_autogen___1((&___ret__14s__anonymous14_1), (*___dst__R14s__anonymous14_1)));
     422    return ___ret__14s__anonymous14_1;
    408423}
    409424static inline void ___constructor__F_R14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1, signed short int __i__s_1){
     
    418433static inline void ___destructor__F_R14s__anonymous15_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1);
    419434static inline struct __anonymous15 ___operator_assign__F14s__anonymous15_R14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1);
     435static inline void ___constructor__F_R14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1, signed short int __i__s_1);
    420436static inline void ___constructor__F_R14s__anonymous15_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1){
    421437    ((void)((*___dst__R14s__anonymous15_1).__i__s_1) /* ?{} */);
     
    430446    struct __anonymous15 ___ret__14s__anonymous15_1;
    431447    ((void)((*___dst__R14s__anonymous15_1).__i__s_1=___src__14s__anonymous15_1.__i__s_1));
    432     ((void)___constructor__F_R14s__anonymous1514s__anonymous15_autogen___1((&___ret__14s__anonymous15_1), ___src__14s__anonymous15_1));
    433     return ((struct __anonymous15 )___ret__14s__anonymous15_1);
     448    ((void)___constructor__F_R14s__anonymous1514s__anonymous15_autogen___1((&___ret__14s__anonymous15_1), (*___dst__R14s__anonymous15_1)));
     449    return ___ret__14s__anonymous15_1;
    434450}
    435451static inline void ___constructor__F_R14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1, signed short int __i__s_1){
     
    460476static inline void ___destructor__F_R14s__anonymous16_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1);
    461477static inline struct __anonymous16 ___operator_assign__F14s__anonymous16_R14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1);
     478static inline void ___constructor__F_R14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1, signed int __i__i_1);
    462479static inline void ___constructor__F_R14s__anonymous16_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1){
    463480    ((void)((*___dst__R14s__anonymous16_1).__i__i_1) /* ?{} */);
     
    472489    struct __anonymous16 ___ret__14s__anonymous16_1;
    473490    ((void)((*___dst__R14s__anonymous16_1).__i__i_1=___src__14s__anonymous16_1.__i__i_1));
    474     ((void)___constructor__F_R14s__anonymous1614s__anonymous16_autogen___1((&___ret__14s__anonymous16_1), ___src__14s__anonymous16_1));
    475     return ((struct __anonymous16 )___ret__14s__anonymous16_1);
     491    ((void)___constructor__F_R14s__anonymous1614s__anonymous16_autogen___1((&___ret__14s__anonymous16_1), (*___dst__R14s__anonymous16_1)));
     492    return ___ret__14s__anonymous16_1;
    476493}
    477494static inline void ___constructor__F_R14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1, signed int __i__i_1){
     
    486503static inline void ___destructor__F_R14s__anonymous17_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1);
    487504static inline struct __anonymous17 ___operator_assign__F14s__anonymous17_R14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1);
     505static inline void ___constructor__F_R14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1, signed int __i__i_1);
    488506static inline void ___constructor__F_R14s__anonymous17_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1){
    489507    ((void)((*___dst__R14s__anonymous17_1).__i__i_1) /* ?{} */);
     
    498516    struct __anonymous17 ___ret__14s__anonymous17_1;
    499517    ((void)((*___dst__R14s__anonymous17_1).__i__i_1=___src__14s__anonymous17_1.__i__i_1));
    500     ((void)___constructor__F_R14s__anonymous1714s__anonymous17_autogen___1((&___ret__14s__anonymous17_1), ___src__14s__anonymous17_1));
    501     return ((struct __anonymous17 )___ret__14s__anonymous17_1);
     518    ((void)___constructor__F_R14s__anonymous1714s__anonymous17_autogen___1((&___ret__14s__anonymous17_1), (*___dst__R14s__anonymous17_1)));
     519    return ___ret__14s__anonymous17_1;
    502520}
    503521static inline void ___constructor__F_R14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1, signed int __i__i_1){
     
    512530static inline void ___destructor__F_R14s__anonymous18_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1);
    513531static inline struct __anonymous18 ___operator_assign__F14s__anonymous18_R14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1);
     532static inline void ___constructor__F_R14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1, signed int __i__i_1);
    514533static inline void ___constructor__F_R14s__anonymous18_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1){
    515534    ((void)((*___dst__R14s__anonymous18_1).__i__i_1) /* ?{} */);
     
    524543    struct __anonymous18 ___ret__14s__anonymous18_1;
    525544    ((void)((*___dst__R14s__anonymous18_1).__i__i_1=___src__14s__anonymous18_1.__i__i_1));
    526     ((void)___constructor__F_R14s__anonymous1814s__anonymous18_autogen___1((&___ret__14s__anonymous18_1), ___src__14s__anonymous18_1));
    527     return ((struct __anonymous18 )___ret__14s__anonymous18_1);
     545    ((void)___constructor__F_R14s__anonymous1814s__anonymous18_autogen___1((&___ret__14s__anonymous18_1), (*___dst__R14s__anonymous18_1)));
     546    return ___ret__14s__anonymous18_1;
    528547}
    529548static inline void ___constructor__F_R14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1, signed int __i__i_1){
     
    538557static inline void ___destructor__F_R14s__anonymous19_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1);
    539558static inline struct __anonymous19 ___operator_assign__F14s__anonymous19_R14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1);
     559static inline void ___constructor__F_R14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1, signed int __i__i_1);
    540560static inline void ___constructor__F_R14s__anonymous19_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1){
    541561    ((void)((*___dst__R14s__anonymous19_1).__i__i_1) /* ?{} */);
     
    550570    struct __anonymous19 ___ret__14s__anonymous19_1;
    551571    ((void)((*___dst__R14s__anonymous19_1).__i__i_1=___src__14s__anonymous19_1.__i__i_1));
    552     ((void)___constructor__F_R14s__anonymous1914s__anonymous19_autogen___1((&___ret__14s__anonymous19_1), ___src__14s__anonymous19_1));
    553     return ((struct __anonymous19 )___ret__14s__anonymous19_1);
     572    ((void)___constructor__F_R14s__anonymous1914s__anonymous19_autogen___1((&___ret__14s__anonymous19_1), (*___dst__R14s__anonymous19_1)));
     573    return ___ret__14s__anonymous19_1;
    554574}
    555575static inline void ___constructor__F_R14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1, signed int __i__i_1){
     
    564584static inline void ___destructor__F_R14s__anonymous20_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1);
    565585static inline struct __anonymous20 ___operator_assign__F14s__anonymous20_R14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1);
     586static inline void ___constructor__F_R14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1, signed int __i__i_1);
    566587static inline void ___constructor__F_R14s__anonymous20_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1){
    567588    ((void)((*___dst__R14s__anonymous20_1).__i__i_1) /* ?{} */);
     
    576597    struct __anonymous20 ___ret__14s__anonymous20_1;
    577598    ((void)((*___dst__R14s__anonymous20_1).__i__i_1=___src__14s__anonymous20_1.__i__i_1));
    578     ((void)___constructor__F_R14s__anonymous2014s__anonymous20_autogen___1((&___ret__14s__anonymous20_1), ___src__14s__anonymous20_1));
    579     return ((struct __anonymous20 )___ret__14s__anonymous20_1);
     599    ((void)___constructor__F_R14s__anonymous2014s__anonymous20_autogen___1((&___ret__14s__anonymous20_1), (*___dst__R14s__anonymous20_1)));
     600    return ___ret__14s__anonymous20_1;
    580601}
    581602static inline void ___constructor__F_R14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1, signed int __i__i_1){
     
    590611static inline void ___destructor__F_R14s__anonymous21_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1);
    591612static inline struct __anonymous21 ___operator_assign__F14s__anonymous21_R14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1);
     613static inline void ___constructor__F_R14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1, signed int __i__i_1);
    592614static inline void ___constructor__F_R14s__anonymous21_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1){
    593615    ((void)((*___dst__R14s__anonymous21_1).__i__i_1) /* ?{} */);
     
    602624    struct __anonymous21 ___ret__14s__anonymous21_1;
    603625    ((void)((*___dst__R14s__anonymous21_1).__i__i_1=___src__14s__anonymous21_1.__i__i_1));
    604     ((void)___constructor__F_R14s__anonymous2114s__anonymous21_autogen___1((&___ret__14s__anonymous21_1), ___src__14s__anonymous21_1));
    605     return ((struct __anonymous21 )___ret__14s__anonymous21_1);
     626    ((void)___constructor__F_R14s__anonymous2114s__anonymous21_autogen___1((&___ret__14s__anonymous21_1), (*___dst__R14s__anonymous21_1)));
     627    return ___ret__14s__anonymous21_1;
    606628}
    607629static inline void ___constructor__F_R14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1, signed int __i__i_1){
     
    616638static inline void ___destructor__F_R14s__anonymous22_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1);
    617639static inline struct __anonymous22 ___operator_assign__F14s__anonymous22_R14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1);
     640static inline void ___constructor__F_R14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1, signed int __i__i_1);
    618641static inline void ___constructor__F_R14s__anonymous22_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1){
    619642    ((void)((*___dst__R14s__anonymous22_1).__i__i_1) /* ?{} */);
     
    628651    struct __anonymous22 ___ret__14s__anonymous22_1;
    629652    ((void)((*___dst__R14s__anonymous22_1).__i__i_1=___src__14s__anonymous22_1.__i__i_1));
    630     ((void)___constructor__F_R14s__anonymous2214s__anonymous22_autogen___1((&___ret__14s__anonymous22_1), ___src__14s__anonymous22_1));
    631     return ((struct __anonymous22 )___ret__14s__anonymous22_1);
     653    ((void)___constructor__F_R14s__anonymous2214s__anonymous22_autogen___1((&___ret__14s__anonymous22_1), (*___dst__R14s__anonymous22_1)));
     654    return ___ret__14s__anonymous22_1;
    632655}
    633656static inline void ___constructor__F_R14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1, signed int __i__i_1){
     
    642665static inline void ___destructor__F_R14s__anonymous23_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1);
    643666static inline struct __anonymous23 ___operator_assign__F14s__anonymous23_R14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1);
     667static inline void ___constructor__F_R14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1, signed int __i__i_1);
    644668static inline void ___constructor__F_R14s__anonymous23_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1){
    645669    ((void)((*___dst__R14s__anonymous23_1).__i__i_1) /* ?{} */);
     
    654678    struct __anonymous23 ___ret__14s__anonymous23_1;
    655679    ((void)((*___dst__R14s__anonymous23_1).__i__i_1=___src__14s__anonymous23_1.__i__i_1));
    656     ((void)___constructor__F_R14s__anonymous2314s__anonymous23_autogen___1((&___ret__14s__anonymous23_1), ___src__14s__anonymous23_1));
    657     return ((struct __anonymous23 )___ret__14s__anonymous23_1);
     680    ((void)___constructor__F_R14s__anonymous2314s__anonymous23_autogen___1((&___ret__14s__anonymous23_1), (*___dst__R14s__anonymous23_1)));
     681    return ___ret__14s__anonymous23_1;
    658682}
    659683static inline void ___constructor__F_R14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1, signed int __i__i_1){
     
    672696    __attribute__ ((unused)) signed int ___retval_main__i_1;
    673697    ((void)(___retval_main__i_1=((signed int )0)) /* ?{} */);
    674     return ((signed int )___retval_main__i_1);
     698    return ___retval_main__i_1;
    675699    ((void)(___retval_main__i_1=0) /* ?{} */);
    676     return ((signed int )___retval_main__i_1);
     700    return ___retval_main__i_1;
    677701}
    678702static inline int invoke_main(int argc, char* argv[], char* envp[]) { (void)argc; (void)argv; (void)envp; return __main__Fi_iPPCc__1(argc, argv); }
     
    689713    ((void)(___retval_main__i_1=(((void)(_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1))) , _tmp_cp_ret0)) /* ?{} */);
    690714    ((void)(_tmp_cp_ret0) /* ^?{} */);
    691     return ((signed int )___retval_main__i_1);
    692 }
     715    return ___retval_main__i_1;
     716}
  • src/tests/.expect/64/extension.txt

    r78315272 r3f7e12cb  
    1717static inline void ___destructor__F_R2sS_autogen___1(struct S *___dst__R2sS_1);
    1818static inline struct S ___operator_assign__F2sS_R2sS2sS_autogen___1(struct S *___dst__R2sS_1, struct S ___src__2sS_1);
     19static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1);
     20static inline void ___constructor__F_R2sSii_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1, signed int __b__i_1);
     21static inline void ___constructor__F_R2sSiii_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1, signed int __b__i_1, signed int __c__i_1);
    1922static inline void ___constructor__F_R2sS_autogen___1(struct S *___dst__R2sS_1){
    2023    ((void)((*___dst__R2sS_1).__a__i_1) /* ?{} */);
     
    3740    ((void)((*___dst__R2sS_1).__b__i_1=___src__2sS_1.__b__i_1));
    3841    ((void)((*___dst__R2sS_1).__c__i_1=___src__2sS_1.__c__i_1));
    39     ((void)___constructor__F_R2sS2sS_autogen___1((&___ret__2sS_1), ___src__2sS_1));
    40     return ((struct S )___ret__2sS_1);
     42    ((void)___constructor__F_R2sS2sS_autogen___1((&___ret__2sS_1), (*___dst__R2sS_1)));
     43    return ___ret__2sS_1;
    4144}
    4245static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1){
     
    6063    __extension__ signed int __c__i_1;
    6164};
     65static inline void ___constructor__F_R2uU_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1);
     66static inline void ___constructor__F_R2uU2uU_autogen___1(union U *___dst__R2uU_1, union U ___src__2uU_1);
     67static inline void ___destructor__F_R2uU_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1);
     68static inline union U ___operator_assign__F2uU_R2uU2uU_autogen___1(union U *___dst__R2uU_1, union U ___src__2uU_1);
     69static inline void ___constructor__F_R2uUi_autogen___1(union U *___dst__R2uU_1, signed int __a__i_1);
    6270static inline void ___constructor__F_R2uU_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1){
    6371}
     
    7078    union U ___ret__2uU_1;
    7179    ((void)__builtin_memcpy(((void *)___dst__R2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U )));
    72     ((void)___constructor__F_R2uU2uU_autogen___1((&___ret__2uU_1), ___src__2uU_1));
    73     return ((union U )___ret__2uU_1);
    74 }
    75 static inline void ___constructor__F_R2uUi_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1, signed int __src__i_1){
    76     ((void)__builtin_memcpy(((void *)___dst__R2uU_1), ((const void *)(&__src__i_1)), sizeof(signed int )));
     80    ((void)___constructor__F_R2uU2uU_autogen___1((&___ret__2uU_1), (*___dst__R2uU_1)));
     81    return ___ret__2uU_1;
     82}
     83static inline void ___constructor__F_R2uUi_autogen___1(union U *___dst__R2uU_1, signed int __a__i_1){
     84    ((void)__builtin_memcpy(((void *)___dst__R2uU_1), ((const void *)(&__a__i_1)), sizeof(signed int )));
    7785}
    7886__extension__ enum E {
     
    94102        __extension__ signed int *__z__Pi_2;
    95103    };
    96     signed int __i__i_2 = ((signed int )(__extension__ __a__i_1+__extension__ 3));
     104    inline void ___constructor__F_R2sS_autogen___2(struct S *___dst__R2sS_2){
     105        ((void)((*___dst__R2sS_2).__a__i_2) /* ?{} */);
     106        ((void)((*___dst__R2sS_2).__b__i_2) /* ?{} */);
     107        ((void)((*___dst__R2sS_2).__c__i_2) /* ?{} */);
     108        ((void)((*___dst__R2sS_2).__x__Pi_2) /* ?{} */);
     109        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ?{} */);
     110        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     111    }
     112    inline void ___constructor__F_R2sS2sS_autogen___2(struct S *___dst__R2sS_2, struct S ___src__2sS_2){
     113        ((void)((*___dst__R2sS_2).__a__i_2=___src__2sS_2.__a__i_2) /* ?{} */);
     114        ((void)((*___dst__R2sS_2).__b__i_2=___src__2sS_2.__b__i_2) /* ?{} */);
     115        ((void)((*___dst__R2sS_2).__c__i_2=___src__2sS_2.__c__i_2) /* ?{} */);
     116        ((void)((*___dst__R2sS_2).__x__Pi_2=___src__2sS_2.__x__Pi_2) /* ?{} */);
     117        ((void)((*___dst__R2sS_2).__y__Pi_2=___src__2sS_2.__y__Pi_2) /* ?{} */);
     118        ((void)((*___dst__R2sS_2).__z__Pi_2=___src__2sS_2.__z__Pi_2) /* ?{} */);
     119    }
     120    inline void ___destructor__F_R2sS_autogen___2(struct S *___dst__R2sS_2){
     121        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ^?{} */);
     122        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ^?{} */);
     123        ((void)((*___dst__R2sS_2).__x__Pi_2) /* ^?{} */);
     124        ((void)((*___dst__R2sS_2).__c__i_2) /* ^?{} */);
     125        ((void)((*___dst__R2sS_2).__b__i_2) /* ^?{} */);
     126        ((void)((*___dst__R2sS_2).__a__i_2) /* ^?{} */);
     127    }
     128    inline struct S ___operator_assign__F2sS_R2sS2sS_autogen___2(struct S *___dst__R2sS_2, struct S ___src__2sS_2){
     129        struct S ___ret__2sS_2;
     130        ((void)((*___dst__R2sS_2).__a__i_2=___src__2sS_2.__a__i_2));
     131        ((void)((*___dst__R2sS_2).__b__i_2=___src__2sS_2.__b__i_2));
     132        ((void)((*___dst__R2sS_2).__c__i_2=___src__2sS_2.__c__i_2));
     133        ((void)((*___dst__R2sS_2).__x__Pi_2=___src__2sS_2.__x__Pi_2));
     134        ((void)((*___dst__R2sS_2).__y__Pi_2=___src__2sS_2.__y__Pi_2));
     135        ((void)((*___dst__R2sS_2).__z__Pi_2=___src__2sS_2.__z__Pi_2));
     136        ((void)___constructor__F_R2sS2sS_autogen___2((&___ret__2sS_2), (*___dst__R2sS_2)));
     137        return ___ret__2sS_2;
     138    }
     139    inline void ___constructor__F_R2sSi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2){
     140        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     141        ((void)((*___dst__R2sS_2).__b__i_2) /* ?{} */);
     142        ((void)((*___dst__R2sS_2).__c__i_2) /* ?{} */);
     143        ((void)((*___dst__R2sS_2).__x__Pi_2) /* ?{} */);
     144        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ?{} */);
     145        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     146    }
     147    inline void ___constructor__F_R2sSii_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2){
     148        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     149        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
     150        ((void)((*___dst__R2sS_2).__c__i_2) /* ?{} */);
     151        ((void)((*___dst__R2sS_2).__x__Pi_2) /* ?{} */);
     152        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ?{} */);
     153        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     154    }
     155    inline void ___constructor__F_R2sSiii_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2, signed int __c__i_2){
     156        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     157        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
     158        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
     159        ((void)((*___dst__R2sS_2).__x__Pi_2) /* ?{} */);
     160        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ?{} */);
     161        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     162    }
     163    inline void ___constructor__F_R2sSiiiPi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2, signed int __c__i_2, signed int *__x__Pi_2){
     164        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     165        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
     166        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
     167        ((void)((*___dst__R2sS_2).__x__Pi_2=__x__Pi_2) /* ?{} */);
     168        ((void)((*___dst__R2sS_2).__y__Pi_2) /* ?{} */);
     169        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     170    }
     171    inline void ___constructor__F_R2sSiiiPiPi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2, signed int __c__i_2, signed int *__x__Pi_2, signed int *__y__Pi_2){
     172        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     173        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
     174        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
     175        ((void)((*___dst__R2sS_2).__x__Pi_2=__x__Pi_2) /* ?{} */);
     176        ((void)((*___dst__R2sS_2).__y__Pi_2=__y__Pi_2) /* ?{} */);
     177        ((void)((*___dst__R2sS_2).__z__Pi_2) /* ?{} */);
     178    }
     179    inline void ___constructor__F_R2sSiiiPiPiPi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2, signed int __c__i_2, signed int *__x__Pi_2, signed int *__y__Pi_2, signed int *__z__Pi_2){
     180        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
     181        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
     182        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
     183        ((void)((*___dst__R2sS_2).__x__Pi_2=__x__Pi_2) /* ?{} */);
     184        ((void)((*___dst__R2sS_2).__y__Pi_2=__y__Pi_2) /* ?{} */);
     185        ((void)((*___dst__R2sS_2).__z__Pi_2=__z__Pi_2) /* ?{} */);
     186    }
     187    signed int __i__i_2 = (__extension__ __a__i_1+__extension__ 3);
    97188    ((void)__extension__ 3);
    98189    ((void)__extension__ __a__i_1);
  • src/tests/.expect/64/gccExtensions.txt

    r78315272 r3f7e12cb  
    6363        ((void)((*___dst__R2sS_2).__b__i_2=___src__2sS_2.__b__i_2));
    6464        ((void)((*___dst__R2sS_2).__c__i_2=___src__2sS_2.__c__i_2));
    65         ((void)___constructor__F_R2sS2sS_autogen___2((&___ret__2sS_2), ___src__2sS_2));
    66         return ((struct S )___ret__2sS_2);
     65        ((void)___constructor__F_R2sS2sS_autogen___2((&___ret__2sS_2), (*___dst__R2sS_2)));
     66        return ___ret__2sS_2;
    6767    }
    6868    inline void ___constructor__F_R2sSi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2){
     
    8181        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
    8282    }
    83     signed int __i__i_2 = ((signed int )__extension__ 3);
     83    signed int __i__i_2 = __extension__ 3;
    8484    __extension__ signed int __a__i_2;
    8585    __extension__ signed int __b__i_2;
     
    113113        struct s2 ___ret__3ss2_2;
    114114        ((void)((*___dst__R3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2));
    115         ((void)___constructor__F_R3ss23ss2_autogen___2((&___ret__3ss2_2), ___src__3ss2_2));
    116         return ((struct s2 )___ret__3ss2_2);
     115        ((void)___constructor__F_R3ss23ss2_autogen___2((&___ret__3ss2_2), (*___dst__R3ss2_2)));
     116        return ___ret__3ss2_2;
    117117    }
    118118    inline void ___constructor__F_R3ss2i_autogen___2(struct s2 *___dst__R3ss2_2, signed int __i__i_2){
     
    134134        struct s3 ___ret__3ss3_2;
    135135        ((void)((*___dst__R3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2));
    136         ((void)___constructor__F_R3ss33ss3_autogen___2((&___ret__3ss3_2), ___src__3ss3_2));
    137         return ((struct s3 )___ret__3ss3_2);
     136        ((void)___constructor__F_R3ss33ss3_autogen___2((&___ret__3ss3_2), (*___dst__R3ss3_2)));
     137        return ___ret__3ss3_2;
    138138    }
    139139    inline void ___constructor__F_R3ss3i_autogen___2(struct s3 *___dst__R3ss3_2, signed int __i__i_2){
     
    157157        struct s4 ___ret__3ss4_2;
    158158        ((void)((*___dst__R3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2));
    159         ((void)___constructor__F_R3ss43ss4_autogen___2((&___ret__3ss4_2), ___src__3ss4_2));
    160         return ((struct s4 )___ret__3ss4_2);
     159        ((void)___constructor__F_R3ss43ss4_autogen___2((&___ret__3ss4_2), (*___dst__R3ss4_2)));
     160        return ___ret__3ss4_2;
    161161    }
    162162    inline void ___constructor__F_R3ss4i_autogen___2(struct s4 *___dst__R3ss4_2, signed int __i__i_2){
     
    169169    signed int __m3__A0A0i_2[((unsigned long int )10)][((unsigned long int )10)];
    170170    ((void)(___retval_main__i_1=((signed int )0)) /* ?{} */);
    171     return ((signed int )___retval_main__i_1);
     171    return ___retval_main__i_1;
    172172    ((void)(___retval_main__i_1=0) /* ?{} */);
    173     return ((signed int )___retval_main__i_1);
     173    return ___retval_main__i_1;
    174174}
    175175static inline int invoke_main(int argc, char* argv[], char* envp[]) { (void)argc; (void)argv; (void)envp; return __main__Fi_iPPCc__1(argc, argv); }
     
    186186    ((void)(___retval_main__i_1=(((void)(_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1))) , _tmp_cp_ret0)) /* ?{} */);
    187187    ((void)(_tmp_cp_ret0) /* ^?{} */);
    188     return ((signed int )___retval_main__i_1);
     188    return ___retval_main__i_1;
    189189}
  • src/tests/.expect/64/literals.txt

    r78315272 r3f7e12cb  
    55__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(signed int __status);
    66extern signed int printf(const char *__restrict __format, ...);
    7 void __for_each__A2_0_0_0____operator_assign__PFt0_Rt0t0____constructor__PF_Rt0____constructor__PF_Rt0t0____destructor__PF_Rt0____operator_assign__PFt1_Rt1t1____constructor__PF_Rt1____constructor__PF_Rt1t1____destructor__PF_Rt1____operator_preincr__PFt0_Rt0____operator_predecr__PFt0_Rt0____operator_equal__PFi_t0t0____operator_notequal__PFi_t0t0____operator_deref__PFRt1_t0__F_t0t0PF_t1___1(__attribute__ ((unused)) void (*_adapterF_9telt_type__P)(void (*__anonymous_object0)(), void *__anonymous_object1), __attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object2)(), void *__anonymous_object3), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object4)(), void *__anonymous_object5, void *__anonymous_object6), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object7)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object8), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object9)(), void *__anonymous_object10, void *__anonymous_object11), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object12)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object13, void *__anonymous_object14), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object15)(), void *__anonymous_object16, void *__anonymous_object17), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object18)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object19, void *__anonymous_object20), __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object21, void *__anonymous_object22), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object23), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object24, void *__anonymous_object25), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object26), __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object27, void *__anonymous_object28), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object29), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object30, void *__anonymous_object31), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object32), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object33), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object34), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object35, void *__anonymous_object36), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object37, void *__anonymous_object38), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object39), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void (*__func__PF_9telt_type__1)(void *__anonymous_object40));
    8 void __for_each_reverse__A2_0_0_0____operator_assign__PFt0_Rt0t0____constructor__PF_Rt0____constructor__PF_Rt0t0____destructor__PF_Rt0____operator_assign__PFt1_Rt1t1____constructor__PF_Rt1____constructor__PF_Rt1t1____destructor__PF_Rt1____operator_preincr__PFt0_Rt0____operator_predecr__PFt0_Rt0____operator_equal__PFi_t0t0____operator_notequal__PFi_t0t0____operator_deref__PFRt1_t0__F_t0t0PF_t1___1(__attribute__ ((unused)) void (*_adapterF_9telt_type__P)(void (*__anonymous_object41)(), void *__anonymous_object42), __attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object43)(), void *__anonymous_object44), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object45)(), void *__anonymous_object46, void *__anonymous_object47), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object48)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object49), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object50)(), void *__anonymous_object51, void *__anonymous_object52), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object53)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object54, void *__anonymous_object55), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object56)(), void *__anonymous_object57, void *__anonymous_object58), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object59)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object60, void *__anonymous_object61), __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object62, void *__anonymous_object63), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object64), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object65, void *__anonymous_object66), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object67), __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object68, void *__anonymous_object69), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object70), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object71, void *__anonymous_object72), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object73), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object74), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object75), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object76, void *__anonymous_object77), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object78, void *__anonymous_object79), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object80), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void (*__func__PF_9telt_type__1)(void *__anonymous_object81));
     7void __for_each__A0_2_0_0____operator_assign__PFd0_Rd0d0____constructor__PF_Rd0____constructor__PF_Rd0d0____destructor__PF_Rd0____operator_assign__PFd1_Rd1d1____constructor__PF_Rd1____constructor__PF_Rd1d1____destructor__PF_Rd1____operator_preincr__PFd0_Rd0____operator_predecr__PFd0_Rd0____operator_equal__PFi_d0d0____operator_notequal__PFi_d0d0____operator_deref__PFRd1_d0__F_d0d0PF_d1___1(__attribute__ ((unused)) void (*_adapterF_9telt_type__P)(void (*__anonymous_object0)(), void *__anonymous_object1), __attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object2)(), void *__anonymous_object3), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object4)(), void *__anonymous_object5, void *__anonymous_object6), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object7)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object8), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object9)(), void *__anonymous_object10, void *__anonymous_object11), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object12)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object13, void *__anonymous_object14), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object15)(), void *__anonymous_object16, void *__anonymous_object17), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object18)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object19, void *__anonymous_object20), __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object21, void *__anonymous_object22), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object23), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object24, void *__anonymous_object25), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object26), __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object27, void *__anonymous_object28), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object29), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object30, void *__anonymous_object31), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object32), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object33), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object34), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object35, void *__anonymous_object36), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object37, void *__anonymous_object38), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object39), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void (*__func__PF_9telt_type__1)(void *__anonymous_object40));
     8void __for_each_reverse__A0_2_0_0____operator_assign__PFd0_Rd0d0____constructor__PF_Rd0____constructor__PF_Rd0d0____destructor__PF_Rd0____operator_assign__PFd1_Rd1d1____constructor__PF_Rd1____constructor__PF_Rd1d1____destructor__PF_Rd1____operator_preincr__PFd0_Rd0____operator_predecr__PFd0_Rd0____operator_equal__PFi_d0d0____operator_notequal__PFi_d0d0____operator_deref__PFRd1_d0__F_d0d0PF_d1___1(__attribute__ ((unused)) void (*_adapterF_9telt_type__P)(void (*__anonymous_object41)(), void *__anonymous_object42), __attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object43)(), void *__anonymous_object44), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object45)(), void *__anonymous_object46, void *__anonymous_object47), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object48)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object49), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object50)(), void *__anonymous_object51, void *__anonymous_object52), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object53)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object54, void *__anonymous_object55), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object56)(), void *__anonymous_object57, void *__anonymous_object58), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object59)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object60, void *__anonymous_object61), __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object62, void *__anonymous_object63), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object64), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object65, void *__anonymous_object66), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object67), __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object68, void *__anonymous_object69), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object70), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object71, void *__anonymous_object72), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object73), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object74), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object75), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object76, void *__anonymous_object77), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object78, void *__anonymous_object79), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object80), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void (*__func__PF_9telt_type__1)(void *__anonymous_object81));
    99void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0c__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object82), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object83), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object84, _Bool __anonymous_object85), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object86), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object87, const char *__anonymous_object88), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object89), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object90, _Bool __anonymous_object91), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object92), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object93), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object94), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object95), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object96), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object97, const char *__anonymous_object98), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object99), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object100, const char *__anonymous_object101), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object102), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object103), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object104, const char *__anonymous_object105, unsigned long int __anonymous_object106), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object107, const char *__fmt__PCc_1, ...), void *__anonymous_object108, char __anonymous_object109);
    1010void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Sc__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object110), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object111), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object112, _Bool __anonymous_object113), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object114), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object115, const char *__anonymous_object116), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object117), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object118, _Bool __anonymous_object119), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object120), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object121), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object122), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object123), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object124), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object125, const char *__anonymous_object126), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object127), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object128, const char *__anonymous_object129), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object130), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object131), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object132, const char *__anonymous_object133, unsigned long int __anonymous_object134), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object135, const char *__fmt__PCc_1, ...), void *__anonymous_object136, signed char __anonymous_object137);
     
    2929void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCi__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object642), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object643), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object644, _Bool __anonymous_object645), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object646), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object647, const char *__anonymous_object648), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object649), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object650, _Bool __anonymous_object651), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object652), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object653), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object654), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object655), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object656), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object657, const char *__anonymous_object658), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object659), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object660, const char *__anonymous_object661), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object662), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object663), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object664, const char *__anonymous_object665, unsigned long int __anonymous_object666), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object667, const char *__fmt__PCc_1, ...), void *__anonymous_object668, const signed int *__anonymous_object669);
    3030void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCv__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object670), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object671), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object672, _Bool __anonymous_object673), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object674), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object675, const char *__anonymous_object676), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object677), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object678, _Bool __anonymous_object679), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object680), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object681), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object682), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object683), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object684), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object685, const char *__anonymous_object686), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object687), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object688, const char *__anonymous_object689), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object690), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object691), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object692, const char *__anonymous_object693, unsigned long int __anonymous_object694), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object695, const char *__fmt__PCc_1, ...), void *__anonymous_object696, const void *__anonymous_object697);
    31 void *___operator_bitor__A1_1_0_1____operator_assign__PFt1_Rt1t1____constructor__PF_Rt1____constructor__PF_Rt1t1____destructor__PF_Rt1____operator_bitor__PFPd0_Pd0t1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_bitor__PFPd0_Pd0tVARGS2__FPd0_Pd0t1tVARGS2__1(__attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype7tParams_M_MP)(void (*__anonymous_object698)(), void *__anonymous_object699, void *__anonymous_object700), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype2tT_M_MP)(void (*__anonymous_object701)(), void *__anonymous_object702, void *__anonymous_object703), __attribute__ ((unused)) void (*_adapterF_P2tT2tT__MP)(void (*__anonymous_object704)(), void *__anonymous_object705, void *__anonymous_object706), __attribute__ ((unused)) void (*_adapterF2tT_P2tT2tT_P_MP)(void (*__anonymous_object707)(), __attribute__ ((unused)) void *___retval__operator_assign__2tT_1, void *__anonymous_object708, void *__anonymous_object709), __attribute__ ((unused)) unsigned long int _sizeof_2tT, __attribute__ ((unused)) unsigned long int _alignof_2tT, __attribute__ ((unused)) unsigned long int _sizeof_7tParams, __attribute__ ((unused)) unsigned long int _alignof_7tParams, __attribute__ ((unused)) void *(*___operator_assign__PF2tT_R2tT2tT__1)(void *__anonymous_object710, void *__anonymous_object711), __attribute__ ((unused)) void (*___constructor__PF_R2tT__1)(void *__anonymous_object712), __attribute__ ((unused)) void (*___constructor__PF_R2tT2tT__1)(void *__anonymous_object713, void *__anonymous_object714), __attribute__ ((unused)) void (*___destructor__PF_R2tT__1)(void *__anonymous_object715), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype2tT__1)(void *__anonymous_object716, void *__anonymous_object717), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object718), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object719), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object720, _Bool __anonymous_object721), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object722), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object723, const char *__anonymous_object724), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object725), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object726, _Bool __anonymous_object727), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object728), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object729), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object730), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object731), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object732), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object733, const char *__anonymous_object734), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object735), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object736, const char *__anonymous_object737), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object738), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object739), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object740, const char *__anonymous_object741, unsigned long int __anonymous_object742), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object743, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype7tParams__1)(void *__anonymous_object744, void *__anonymous_object745), void *__os__P7tostype_1, void *__arg__2tT_1, void *__rest__7tParams_1);
     31void *___operator_bitor__A0_2_0_1____operator_assign__PFd1_Rd1d1____constructor__PF_Rd1____constructor__PF_Rd1d1____destructor__PF_Rd1____operator_bitor__PFPd0_Pd0d1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_bitor__PFPd0_Pd0tVARGS2__FPd0_Pd0d1tVARGS2__1(__attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype7tParams_M_MP)(void (*__anonymous_object698)(), void *__anonymous_object699, void *__anonymous_object700), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype2tT_M_MP)(void (*__anonymous_object701)(), void *__anonymous_object702, void *__anonymous_object703), __attribute__ ((unused)) void (*_adapterF_P2tT2tT__MP)(void (*__anonymous_object704)(), void *__anonymous_object705, void *__anonymous_object706), __attribute__ ((unused)) void (*_adapterF2tT_P2tT2tT_P_MP)(void (*__anonymous_object707)(), __attribute__ ((unused)) void *___retval__operator_assign__2tT_1, void *__anonymous_object708, void *__anonymous_object709), __attribute__ ((unused)) unsigned long int _sizeof_2tT, __attribute__ ((unused)) unsigned long int _alignof_2tT, __attribute__ ((unused)) unsigned long int _sizeof_7tParams, __attribute__ ((unused)) unsigned long int _alignof_7tParams, __attribute__ ((unused)) void *(*___operator_assign__PF2tT_R2tT2tT__1)(void *__anonymous_object710, void *__anonymous_object711), __attribute__ ((unused)) void (*___constructor__PF_R2tT__1)(void *__anonymous_object712), __attribute__ ((unused)) void (*___constructor__PF_R2tT2tT__1)(void *__anonymous_object713, void *__anonymous_object714), __attribute__ ((unused)) void (*___destructor__PF_R2tT__1)(void *__anonymous_object715), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype2tT__1)(void *__anonymous_object716, void *__anonymous_object717), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object718), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object719), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object720, _Bool __anonymous_object721), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object722), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object723, const char *__anonymous_object724), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object725), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object726, _Bool __anonymous_object727), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object728), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object729), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object730), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object731), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object732), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object733, const char *__anonymous_object734), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object735), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object736, const char *__anonymous_object737), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object738), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object739), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object740, const char *__anonymous_object741, unsigned long int __anonymous_object742), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object743, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype7tParams__1)(void *__anonymous_object744, void *__anonymous_object745), void *__os__P7tostype_1, void *__arg__2tT_1, void *__rest__7tParams_1);
    3232void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object746), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object747), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object748, _Bool __anonymous_object749), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object750), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object751, const char *__anonymous_object752), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object753), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object754, _Bool __anonymous_object755), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object756), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object757), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object758), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object759), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object760), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object761, const char *__anonymous_object762), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object763), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object764, const char *__anonymous_object765), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object766), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object767), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object768, const char *__anonymous_object769, unsigned long int __anonymous_object770), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object771, const char *__fmt__PCc_1, ...), void *__anonymous_object772, void *(*__anonymous_object773)(void *__anonymous_object774));
    3333void *__endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object775), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object776), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object777, _Bool __anonymous_object778), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object779), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object780, const char *__anonymous_object781), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object782), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object783, _Bool __anonymous_object784), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object785), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object786), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object787), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object788), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object789), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object790, const char *__anonymous_object791), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object792), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object793, const char *__anonymous_object794), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object795), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object796), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object797, const char *__anonymous_object798, unsigned long int __anonymous_object799), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object800, const char *__fmt__PCc_1, ...), void *__anonymous_object801);
     
    3838void *__sepDisable__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object910), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object911), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object912, _Bool __anonymous_object913), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object914), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object915, const char *__anonymous_object916), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object917), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object918, _Bool __anonymous_object919), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object920), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object921), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object922), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object923), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object924), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object925, const char *__anonymous_object926), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object927), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object928, const char *__anonymous_object929), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object930), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object931), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object932, const char *__anonymous_object933, unsigned long int __anonymous_object934), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object935, const char *__fmt__PCc_1, ...), void *__anonymous_object936);
    3939void *__sepEnable__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object937), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object938), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object939, _Bool __anonymous_object940), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object941), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object942, const char *__anonymous_object943), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object944), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object945, _Bool __anonymous_object946), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object947), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object948), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object949), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object950), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object951), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object952, const char *__anonymous_object953), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object954), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object955, const char *__anonymous_object956), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object957), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object958), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object959, const char *__anonymous_object960, unsigned long int __anonymous_object961), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object962, const char *__fmt__PCc_1, ...), void *__anonymous_object963);
    40 void __write__A2_1_0_0____operator_assign__PFt1_Rt1t1____constructor__PF_Rt1____constructor__PF_Rt1t1____destructor__PF_Rt1____operator_bitor__PFPd0_Pd0t1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_assign__PFt2_Rt2t2____constructor__PF_Rt2____constructor__PF_Rt2t2____destructor__PF_Rt2____operator_preincr__PFt2_Rt2____operator_predecr__PFt2_Rt2____operator_equal__PFi_t2t2____operator_notequal__PFi_t2t2____operator_deref__PFRt1_t2__F_t2t2Pd0__1(__attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object964)(), void *__anonymous_object965), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object966)(), void *__anonymous_object967, void *__anonymous_object968), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object969)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object970), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object971)(), void *__anonymous_object972, void *__anonymous_object973), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object974)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object975, void *__anonymous_object976), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype9telt_type_M_MP)(void (*__anonymous_object977)(), void *__anonymous_object978, void *__anonymous_object979), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object980)(), void *__anonymous_object981, void *__anonymous_object982), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object983)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object984, void *__anonymous_object985), __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object986, void *__anonymous_object987), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object988), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object989, void *__anonymous_object990), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object991), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype9telt_type__1)(void *__anonymous_object992, void *__anonymous_object993), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object994), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object995), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object996, _Bool __anonymous_object997), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object998), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object999, const char *__anonymous_object1000), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object1001), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object1002, _Bool __anonymous_object1003), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object1004), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object1005), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object1006), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object1007), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object1008), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object1009, const char *__anonymous_object1010), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object1011), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object1012, const char *__anonymous_object1013), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object1014), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object1015), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object1016, const char *__anonymous_object1017, unsigned long int __anonymous_object1018), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object1019, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object1020, void *__anonymous_object1021), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object1022), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object1023, void *__anonymous_object1024), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object1025), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1026), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1027), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1028, void *__anonymous_object1029), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1030, void *__anonymous_object1031), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object1032), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void *__os__P7tostype_1);
    41 void __write_reverse__A2_1_0_0____operator_assign__PFt1_Rt1t1____constructor__PF_Rt1____constructor__PF_Rt1t1____destructor__PF_Rt1____operator_bitor__PFPd0_Pd0t1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_assign__PFt2_Rt2t2____constructor__PF_Rt2____constructor__PF_Rt2t2____destructor__PF_Rt2____operator_preincr__PFt2_Rt2____operator_predecr__PFt2_Rt2____operator_equal__PFi_t2t2____operator_notequal__PFi_t2t2____operator_deref__PFRt1_t2__F_t2t2Pd0__1(__attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object1033)(), void *__anonymous_object1034), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object1035)(), void *__anonymous_object1036, void *__anonymous_object1037), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object1038)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object1039), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object1040)(), void *__anonymous_object1041, void *__anonymous_object1042), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object1043)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object1044, void *__anonymous_object1045), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype9telt_type_M_MP)(void (*__anonymous_object1046)(), void *__anonymous_object1047, void *__anonymous_object1048), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object1049)(), void *__anonymous_object1050, void *__anonymous_object1051), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object1052)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object1053, void *__anonymous_object1054), __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object1055, void *__anonymous_object1056), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object1057), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object1058, void *__anonymous_object1059), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object1060), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype9telt_type__1)(void *__anonymous_object1061, void *__anonymous_object1062), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object1063), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object1064), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object1065, _Bool __anonymous_object1066), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object1067), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object1068, const char *__anonymous_object1069), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object1070), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object1071, _Bool __anonymous_object1072), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object1073), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object1074), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object1075), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object1076), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object1077), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object1078, const char *__anonymous_object1079), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object1080), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object1081, const char *__anonymous_object1082), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object1083), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object1084), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object1085, const char *__anonymous_object1086, unsigned long int __anonymous_object1087), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object1088, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object1089, void *__anonymous_object1090), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object1091), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object1092, void *__anonymous_object1093), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object1094), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1095), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1096), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1097, void *__anonymous_object1098), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1099, void *__anonymous_object1100), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object1101), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void *__os__P7tostype_1);
     40void __write__A0_3_0_0____operator_assign__PFd1_Rd1d1____constructor__PF_Rd1____constructor__PF_Rd1d1____destructor__PF_Rd1____operator_bitor__PFPd0_Pd0d1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_assign__PFd2_Rd2d2____constructor__PF_Rd2____constructor__PF_Rd2d2____destructor__PF_Rd2____operator_preincr__PFd2_Rd2____operator_predecr__PFd2_Rd2____operator_equal__PFi_d2d2____operator_notequal__PFi_d2d2____operator_deref__PFRd1_d2__F_d2d2Pd0__1(__attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object964)(), void *__anonymous_object965), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object966)(), void *__anonymous_object967, void *__anonymous_object968), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object969)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object970), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object971)(), void *__anonymous_object972, void *__anonymous_object973), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object974)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object975, void *__anonymous_object976), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype9telt_type_M_MP)(void (*__anonymous_object977)(), void *__anonymous_object978, void *__anonymous_object979), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object980)(), void *__anonymous_object981, void *__anonymous_object982), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object983)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object984, void *__anonymous_object985), __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object986, void *__anonymous_object987), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object988), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object989, void *__anonymous_object990), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object991), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype9telt_type__1)(void *__anonymous_object992, void *__anonymous_object993), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object994), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object995), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object996, _Bool __anonymous_object997), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object998), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object999, const char *__anonymous_object1000), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object1001), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object1002, _Bool __anonymous_object1003), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object1004), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object1005), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object1006), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object1007), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object1008), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object1009, const char *__anonymous_object1010), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object1011), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object1012, const char *__anonymous_object1013), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object1014), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object1015), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object1016, const char *__anonymous_object1017, unsigned long int __anonymous_object1018), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object1019, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object1020, void *__anonymous_object1021), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object1022), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object1023, void *__anonymous_object1024), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object1025), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1026), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1027), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1028, void *__anonymous_object1029), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1030, void *__anonymous_object1031), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object1032), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void *__os__P7tostype_1);
     41void __write_reverse__A0_3_0_0____operator_assign__PFd1_Rd1d1____constructor__PF_Rd1____constructor__PF_Rd1d1____destructor__PF_Rd1____operator_bitor__PFPd0_Pd0d1___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc____operator_assign__PFd2_Rd2d2____constructor__PF_Rd2____constructor__PF_Rd2d2____destructor__PF_Rd2____operator_preincr__PFd2_Rd2____operator_predecr__PFd2_Rd2____operator_equal__PFi_d2d2____operator_notequal__PFi_d2d2____operator_deref__PFRd1_d2__F_d2d2Pd0__1(__attribute__ ((unused)) void *(*_adapterFP9telt_type_14titerator_type_M_P)(void (*__anonymous_object1033)(), void *__anonymous_object1034), __attribute__ ((unused)) signed int (*_adapterFi_14titerator_type14titerator_type_M_PP)(void (*__anonymous_object1035)(), void *__anonymous_object1036, void *__anonymous_object1037), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type_P_M)(void (*__anonymous_object1038)(), __attribute__ ((unused)) void *___retval__operator_preincr__14titerator_type_1, void *__anonymous_object1039), __attribute__ ((unused)) void (*_adapterF_P14titerator_type14titerator_type__MP)(void (*__anonymous_object1040)(), void *__anonymous_object1041, void *__anonymous_object1042), __attribute__ ((unused)) void (*_adapterF14titerator_type_P14titerator_type14titerator_type_P_MP)(void (*__anonymous_object1043)(), __attribute__ ((unused)) void *___retval__operator_assign__14titerator_type_1, void *__anonymous_object1044, void *__anonymous_object1045), __attribute__ ((unused)) void *(*_adapterFP7tostype_P7tostype9telt_type_M_MP)(void (*__anonymous_object1046)(), void *__anonymous_object1047, void *__anonymous_object1048), __attribute__ ((unused)) void (*_adapterF_P9telt_type9telt_type__MP)(void (*__anonymous_object1049)(), void *__anonymous_object1050, void *__anonymous_object1051), __attribute__ ((unused)) void (*_adapterF9telt_type_P9telt_type9telt_type_P_MP)(void (*__anonymous_object1052)(), __attribute__ ((unused)) void *___retval__operator_assign__9telt_type_1, void *__anonymous_object1053, void *__anonymous_object1054), __attribute__ ((unused)) unsigned long int _sizeof_9telt_type, __attribute__ ((unused)) unsigned long int _alignof_9telt_type, __attribute__ ((unused)) unsigned long int _sizeof_14titerator_type, __attribute__ ((unused)) unsigned long int _alignof_14titerator_type, __attribute__ ((unused)) void *(*___operator_assign__PF9telt_type_R9telt_type9telt_type__1)(void *__anonymous_object1055, void *__anonymous_object1056), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type__1)(void *__anonymous_object1057), __attribute__ ((unused)) void (*___constructor__PF_R9telt_type9telt_type__1)(void *__anonymous_object1058, void *__anonymous_object1059), __attribute__ ((unused)) void (*___destructor__PF_R9telt_type__1)(void *__anonymous_object1060), __attribute__ ((unused)) void *(*___operator_bitor__PFP7tostype_P7tostype9telt_type__1)(void *__anonymous_object1061, void *__anonymous_object1062), __attribute__ ((unused)) _Bool (*__sepPrt__PFb_P7tostype__1)(void *__anonymous_object1063), __attribute__ ((unused)) void (*__sepReset__PF_P7tostype__1)(void *__anonymous_object1064), __attribute__ ((unused)) void (*__sepReset__PF_P7tostypeb__1)(void *__anonymous_object1065, _Bool __anonymous_object1066), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_P7tostype__1)(void *__anonymous_object1067), __attribute__ ((unused)) void (*__sepSetCur__PF_P7tostypePCc__1)(void *__anonymous_object1068, const char *__anonymous_object1069), __attribute__ ((unused)) _Bool (*__getNL__PFb_P7tostype__1)(void *__anonymous_object1070), __attribute__ ((unused)) void (*__setNL__PF_P7tostypeb__1)(void *__anonymous_object1071, _Bool __anonymous_object1072), __attribute__ ((unused)) void (*__sepOn__PF_P7tostype__1)(void *__anonymous_object1073), __attribute__ ((unused)) void (*__sepOff__PF_P7tostype__1)(void *__anonymous_object1074), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_P7tostype__1)(void *__anonymous_object1075), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_P7tostype__1)(void *__anonymous_object1076), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_P7tostype__1)(void *__anonymous_object1077), __attribute__ ((unused)) void (*__sepSet__PF_P7tostypePCc__1)(void *__anonymous_object1078, const char *__anonymous_object1079), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_P7tostype__1)(void *__anonymous_object1080), __attribute__ ((unused)) void (*__sepSetTuple__PF_P7tostypePCc__1)(void *__anonymous_object1081, const char *__anonymous_object1082), __attribute__ ((unused)) signed int (*__fail__PFi_P7tostype__1)(void *__anonymous_object1083), __attribute__ ((unused)) signed int (*__flush__PFi_P7tostype__1)(void *__anonymous_object1084), __attribute__ ((unused)) void (*__open__PF_P7tostypePCcPCc__1)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tostype__1)(void *__os__P7tostype_1), __attribute__ ((unused)) void *(*__write__PFP7tostype_P7tostypePCcUl__1)(void *__anonymous_object1085, const char *__anonymous_object1086, unsigned long int __anonymous_object1087), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tostypePCc__1)(void *__anonymous_object1088, const char *__fmt__PCc_1, ...), __attribute__ ((unused)) void *(*___operator_assign__PF14titerator_type_R14titerator_type14titerator_type__1)(void *__anonymous_object1089, void *__anonymous_object1090), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type__1)(void *__anonymous_object1091), __attribute__ ((unused)) void (*___constructor__PF_R14titerator_type14titerator_type__1)(void *__anonymous_object1092, void *__anonymous_object1093), __attribute__ ((unused)) void (*___destructor__PF_R14titerator_type__1)(void *__anonymous_object1094), __attribute__ ((unused)) void *(*___operator_preincr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1095), __attribute__ ((unused)) void *(*___operator_predecr__PF14titerator_type_R14titerator_type__1)(void *__anonymous_object1096), __attribute__ ((unused)) signed int (*___operator_equal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1097, void *__anonymous_object1098), __attribute__ ((unused)) signed int (*___operator_notequal__PFi_14titerator_type14titerator_type__1)(void *__anonymous_object1099, void *__anonymous_object1100), __attribute__ ((unused)) void *(*___operator_deref__PFR9telt_type_14titerator_type__1)(void *__anonymous_object1101), void *__begin__14titerator_type_1, void *__end__14titerator_type_1, void *__os__P7tostype_1);
    4242void *___operator_bitor__A0_1_0_0___fail__PFi_Pd0___eof__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___read__PFPd0_Pd0PcUl___ungetc__PFPd0_Pd0c___fmt__PFi_Pd0PCc__FPd0_Pd0Rc__1(__attribute__ ((unused)) signed int (*__fail__PFi_P7tistype__1)(void *__anonymous_object1102), __attribute__ ((unused)) signed int (*__eof__PFi_P7tistype__1)(void *__anonymous_object1103), __attribute__ ((unused)) void (*__open__PF_P7tistypePCcPCc__1)(void *__is__P7tistype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tistype__1)(void *__is__P7tistype_1), __attribute__ ((unused)) void *(*__read__PFP7tistype_P7tistypePcUl__1)(void *__anonymous_object1104, char *__anonymous_object1105, unsigned long int __anonymous_object1106), __attribute__ ((unused)) void *(*__ungetc__PFP7tistype_P7tistypec__1)(void *__anonymous_object1107, char __anonymous_object1108), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tistypePCc__1)(void *__anonymous_object1109, const char *__fmt__PCc_1, ...), void *__anonymous_object1110, char *__anonymous_object1111);
    4343void *___operator_bitor__A0_1_0_0___fail__PFi_Pd0___eof__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___read__PFPd0_Pd0PcUl___ungetc__PFPd0_Pd0c___fmt__PFi_Pd0PCc__FPd0_Pd0RSc__1(__attribute__ ((unused)) signed int (*__fail__PFi_P7tistype__1)(void *__anonymous_object1112), __attribute__ ((unused)) signed int (*__eof__PFi_P7tistype__1)(void *__anonymous_object1113), __attribute__ ((unused)) void (*__open__PF_P7tistypePCcPCc__1)(void *__is__P7tistype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tistype__1)(void *__is__P7tistype_1), __attribute__ ((unused)) void *(*__read__PFP7tistype_P7tistypePcUl__1)(void *__anonymous_object1114, char *__anonymous_object1115, unsigned long int __anonymous_object1116), __attribute__ ((unused)) void *(*__ungetc__PFP7tistype_P7tistypec__1)(void *__anonymous_object1117, char __anonymous_object1118), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tistypePCc__1)(void *__anonymous_object1119, const char *__fmt__PCc_1, ...), void *__anonymous_object1120, signed char *__anonymous_object1121);
     
    6464static inline void ___destructor__F_R16s_Istream_cstrUC_autogen___1(struct _Istream_cstrUC *___dst__R16s_Istream_cstrUC_1);
    6565static inline struct _Istream_cstrUC ___operator_assign__F16s_Istream_cstrUC_R16s_Istream_cstrUC16s_Istream_cstrUC_autogen___1(struct _Istream_cstrUC *___dst__R16s_Istream_cstrUC_1, struct _Istream_cstrUC ___src__16s_Istream_cstrUC_1);
     66static inline void ___constructor__F_R16s_Istream_cstrUCPc_autogen___1(struct _Istream_cstrUC *___dst__R16s_Istream_cstrUC_1, char *__s__Pc_1);
    6667static inline void ___constructor__F_R16s_Istream_cstrUC_autogen___1(struct _Istream_cstrUC *___dst__R16s_Istream_cstrUC_1){
    6768    ((void)((*___dst__R16s_Istream_cstrUC_1).__s__Pc_1) /* ?{} */);
     
    7677    struct _Istream_cstrUC ___ret__16s_Istream_cstrUC_1;
    7778    ((void)((*___dst__R16s_Istream_cstrUC_1).__s__Pc_1=___src__16s_Istream_cstrUC_1.__s__Pc_1));
    78     ((void)___constructor__F_R16s_Istream_cstrUC16s_Istream_cstrUC_autogen___1((&___ret__16s_Istream_cstrUC_1), ___src__16s_Istream_cstrUC_1));
    79     return ((struct _Istream_cstrUC )___ret__16s_Istream_cstrUC_1);
     79    ((void)___constructor__F_R16s_Istream_cstrUC16s_Istream_cstrUC_autogen___1((&___ret__16s_Istream_cstrUC_1), (*___dst__R16s_Istream_cstrUC_1)));
     80    return ___ret__16s_Istream_cstrUC_1;
    8081}
    8182static inline void ___constructor__F_R16s_Istream_cstrUCPc_autogen___1(struct _Istream_cstrUC *___dst__R16s_Istream_cstrUC_1, char *__s__Pc_1){
     
    9293static inline void ___destructor__F_R15s_Istream_cstrC_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1);
    9394static inline struct _Istream_cstrC ___operator_assign__F15s_Istream_cstrC_R15s_Istream_cstrC15s_Istream_cstrC_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1, struct _Istream_cstrC ___src__15s_Istream_cstrC_1);
     95static inline void ___constructor__F_R15s_Istream_cstrCPc_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1, char *__s__Pc_1);
     96static inline void ___constructor__F_R15s_Istream_cstrCPci_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1, char *__s__Pc_1, signed int __size__i_1);
    9497static inline void ___constructor__F_R15s_Istream_cstrC_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1){
    9598    ((void)((*___dst__R15s_Istream_cstrC_1).__s__Pc_1) /* ?{} */);
     
    108111    ((void)((*___dst__R15s_Istream_cstrC_1).__s__Pc_1=___src__15s_Istream_cstrC_1.__s__Pc_1));
    109112    ((void)((*___dst__R15s_Istream_cstrC_1).__size__i_1=___src__15s_Istream_cstrC_1.__size__i_1));
    110     ((void)___constructor__F_R15s_Istream_cstrC15s_Istream_cstrC_autogen___1((&___ret__15s_Istream_cstrC_1), ___src__15s_Istream_cstrC_1));
    111     return ((struct _Istream_cstrC )___ret__15s_Istream_cstrC_1);
     113    ((void)___constructor__F_R15s_Istream_cstrC15s_Istream_cstrC_autogen___1((&___ret__15s_Istream_cstrC_1), (*___dst__R15s_Istream_cstrC_1)));
     114    return ___ret__15s_Istream_cstrC_1;
    112115}
    113116static inline void ___constructor__F_R15s_Istream_cstrCPc_autogen___1(struct _Istream_cstrC *___dst__R15s_Istream_cstrC_1, char *__s__Pc_1){
     
    122125void *___operator_bitor__A0_1_0_0___fail__PFi_Pd0___eof__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___read__PFPd0_Pd0PcUl___ungetc__PFPd0_Pd0c___fmt__PFi_Pd0PCc__FPd0_Pd015s_Istream_cstrC__1(__attribute__ ((unused)) signed int (*__fail__PFi_P7tistype__1)(void *__anonymous_object1284), __attribute__ ((unused)) signed int (*__eof__PFi_P7tistype__1)(void *__anonymous_object1285), __attribute__ ((unused)) void (*__open__PF_P7tistypePCcPCc__1)(void *__is__P7tistype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_P7tistype__1)(void *__is__P7tistype_1), __attribute__ ((unused)) void *(*__read__PFP7tistype_P7tistypePcUl__1)(void *__anonymous_object1286, char *__anonymous_object1287, unsigned long int __anonymous_object1288), __attribute__ ((unused)) void *(*__ungetc__PFP7tistype_P7tistypec__1)(void *__anonymous_object1289, char __anonymous_object1290), __attribute__ ((unused)) signed int (*__fmt__PFi_P7tistypePCc__1)(void *__anonymous_object1291, const char *__fmt__PCc_1, ...), void *__anonymous_object1292, struct _Istream_cstrC __anonymous_object1293);
    123126enum __anonymous0 {
    124     __sepSize__C13e__anonymous0_1 = ((signed int )16),
     127    __sepSize__C13e__anonymous0_1 = 16,
    125128};
    126129struct ofstream {
     
    137140static inline void ___destructor__F_R9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1);
    138141static inline struct ofstream ___operator_assign__F9sofstream_R9sofstream9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1, struct ofstream ___src__9sofstream_1);
     142static inline void ___constructor__F_R9sofstreamPv_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1);
     143static inline void ___constructor__F_R9sofstreamPvb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1);
     144static inline void ___constructor__F_R9sofstreamPvbb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1);
     145static inline void ___constructor__F_R9sofstreamPvbbb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1);
     146static inline void ___constructor__F_R9sofstreamPvbbbPCc_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1);
     147static inline void ___constructor__F_R9sofstreamPvbbbPCcA0c_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1, char __separator__A0c_1[((unsigned long int )__sepSize__C13e__anonymous0_1)]);
     148static inline void ___constructor__F_R9sofstreamPvbbbPCcA0cA0c_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1, char __separator__A0c_1[((unsigned long int )__sepSize__C13e__anonymous0_1)], char __tupleSeparator__A0c_1[((unsigned long int )__sepSize__C13e__anonymous0_1)]);
    139149static inline void ___constructor__F_R9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1){
    140150    ((void)((*___dst__R9sofstream_1).__file__Pv_1) /* ?{} */);
     
    144154    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ?{} */);
    145155    {
    146         signed int _index0 = ((signed int )0);
     156        signed int _index0 = 0;
    147157        for (;(_index0<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index0))) {
    148158            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index0)])))) /* ?{} */);
     
    150160
    151161    }
    152     {
    153         signed int _index1 = ((signed int )0);
     162
     163    {
     164        signed int _index1 = 0;
    154165        for (;(_index1<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index1))) {
    155166            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index1)])))) /* ?{} */);
     
    157168
    158169    }
     170
    159171}
    160172static inline void ___constructor__F_R9sofstream9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1, struct ofstream ___src__9sofstream_1){
     
    165177    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1=___src__9sofstream_1.__sepCur__PCc_1) /* ?{} */);
    166178    {
    167         signed int _index2 = ((signed int )0);
     179        signed int _index2 = 0;
    168180        for (;(_index2<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index2))) {
    169181            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index2)])))=___src__9sofstream_1.__separator__A0c_1[((signed long int )_index2)]) /* ?{} */);
     
    171183
    172184    }
    173     {
    174         signed int _index3 = ((signed int )0);
     185
     186    {
     187        signed int _index3 = 0;
    175188        for (;(_index3<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index3))) {
    176189            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index3)])))=___src__9sofstream_1.__tupleSeparator__A0c_1[((signed long int )_index3)]) /* ?{} */);
     
    178191
    179192    }
     193
    180194}
    181195static inline void ___destructor__F_R9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1){
    182196    {
    183         signed int _index4 = ((signed int )(((signed int )__sepSize__C13e__anonymous0_1)-1));
     197        signed int _index4 = (((signed int )__sepSize__C13e__anonymous0_1)-1);
    184198        for (;(_index4>=0);((void)(--_index4))) {
    185199            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index4)])))) /* ^?{} */);
     
    187201
    188202    }
    189     {
    190         signed int _index5 = ((signed int )(((signed int )__sepSize__C13e__anonymous0_1)-1));
     203
     204    {
     205        signed int _index5 = (((signed int )__sepSize__C13e__anonymous0_1)-1);
    191206        for (;(_index5>=0);((void)(--_index5))) {
    192207            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index5)])))) /* ^?{} */);
     
    194209
    195210    }
     211
    196212    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ^?{} */);
    197213    ((void)((*___dst__R9sofstream_1).__sawNL__b_1) /* ^?{} */);
     
    208224    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1=___src__9sofstream_1.__sepCur__PCc_1));
    209225    {
    210         signed int _index6 = ((signed int )0);
     226        signed int _index6 = 0;
    211227        for (;(_index6<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index6))) {
    212228            ((void)((*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index6)]=___src__9sofstream_1.__separator__A0c_1[((signed long int )_index6)]));
     
    216232
    217233    {
    218         signed int _index7 = ((signed int )0);
     234        signed int _index7 = 0;
    219235        for (;(_index7<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index7))) {
    220236            ((void)((*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index7)]=___src__9sofstream_1.__tupleSeparator__A0c_1[((signed long int )_index7)]));
     
    223239    }
    224240
    225     ((void)___constructor__F_R9sofstream9sofstream_autogen___1((&___ret__9sofstream_1), ___src__9sofstream_1));
    226     return ((struct ofstream )___ret__9sofstream_1);
     241    ((void)___constructor__F_R9sofstream9sofstream_autogen___1((&___ret__9sofstream_1), (*___dst__R9sofstream_1)));
     242    return ___ret__9sofstream_1;
    227243}
    228244static inline void ___constructor__F_R9sofstreamPv_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1){
     
    233249    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ?{} */);
    234250    {
    235         signed int _index8 = ((signed int )0);
     251        signed int _index8 = 0;
    236252        for (;(_index8<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index8))) {
    237253            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index8)])))) /* ?{} */);
     
    239255
    240256    }
    241     {
    242         signed int _index9 = ((signed int )0);
     257
     258    {
     259        signed int _index9 = 0;
    243260        for (;(_index9<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index9))) {
    244261            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index9)])))) /* ?{} */);
     
    246263
    247264    }
     265
    248266}
    249267static inline void ___constructor__F_R9sofstreamPvb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1){
     
    254272    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ?{} */);
    255273    {
    256         signed int _index10 = ((signed int )0);
     274        signed int _index10 = 0;
    257275        for (;(_index10<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index10))) {
    258276            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index10)])))) /* ?{} */);
     
    260278
    261279    }
    262     {
    263         signed int _index11 = ((signed int )0);
     280
     281    {
     282        signed int _index11 = 0;
    264283        for (;(_index11<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index11))) {
    265284            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index11)])))) /* ?{} */);
     
    267286
    268287    }
     288
    269289}
    270290static inline void ___constructor__F_R9sofstreamPvbb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1){
     
    275295    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ?{} */);
    276296    {
    277         signed int _index12 = ((signed int )0);
     297        signed int _index12 = 0;
    278298        for (;(_index12<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index12))) {
    279299            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index12)])))) /* ?{} */);
     
    281301
    282302    }
    283     {
    284         signed int _index13 = ((signed int )0);
     303
     304    {
     305        signed int _index13 = 0;
    285306        for (;(_index13<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index13))) {
    286307            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index13)])))) /* ?{} */);
     
    288309
    289310    }
     311
    290312}
    291313static inline void ___constructor__F_R9sofstreamPvbbb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1){
     
    296318    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ?{} */);
    297319    {
    298         signed int _index14 = ((signed int )0);
     320        signed int _index14 = 0;
    299321        for (;(_index14<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index14))) {
    300322            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index14)])))) /* ?{} */);
     
    302324
    303325    }
    304     {
    305         signed int _index15 = ((signed int )0);
     326
     327    {
     328        signed int _index15 = 0;
    306329        for (;(_index15<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index15))) {
    307330            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index15)])))) /* ?{} */);
     
    309332
    310333    }
     334
    311335}
    312336static inline void ___constructor__F_R9sofstreamPvbbbPCc_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1){
     
    317341    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1=__sepCur__PCc_1) /* ?{} */);
    318342    {
    319         signed int _index16 = ((signed int )0);
     343        signed int _index16 = 0;
    320344        for (;(_index16<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index16))) {
    321345            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index16)])))) /* ?{} */);
     
    323347
    324348    }
    325     {
    326         signed int _index17 = ((signed int )0);
     349
     350    {
     351        signed int _index17 = 0;
    327352        for (;(_index17<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index17))) {
    328353            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index17)])))) /* ?{} */);
     
    330355
    331356    }
     357
    332358}
    333359static inline void ___constructor__F_R9sofstreamPvbbbPCcA0c_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1, char __separator__A0c_1[((unsigned long int )__sepSize__C13e__anonymous0_1)]){
     
    338364    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1=__sepCur__PCc_1) /* ?{} */);
    339365    {
    340         signed int _index18 = ((signed int )0);
     366        signed int _index18 = 0;
    341367        for (;(_index18<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index18))) {
    342368            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index18)])))=__separator__A0c_1[((signed long int )_index18)]) /* ?{} */);
     
    344370
    345371    }
    346     {
    347         signed int _index19 = ((signed int )0);
     372
     373    {
     374        signed int _index19 = 0;
    348375        for (;(_index19<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index19))) {
    349376            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index19)])))) /* ?{} */);
     
    351378
    352379    }
     380
    353381}
    354382static inline void ___constructor__F_R9sofstreamPvbbbPCcA0cA0c_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1, char __separator__A0c_1[((unsigned long int )__sepSize__C13e__anonymous0_1)], char __tupleSeparator__A0c_1[((unsigned long int )__sepSize__C13e__anonymous0_1)]){
     
    359387    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1=__sepCur__PCc_1) /* ?{} */);
    360388    {
    361         signed int _index20 = ((signed int )0);
     389        signed int _index20 = 0;
    362390        for (;(_index20<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index20))) {
    363391            ((void)((*((char *)(&(*___dst__R9sofstream_1).__separator__A0c_1[((signed long int )_index20)])))=__separator__A0c_1[((signed long int )_index20)]) /* ?{} */);
     
    365393
    366394    }
    367     {
    368         signed int _index21 = ((signed int )0);
     395
     396    {
     397        signed int _index21 = 0;
    369398        for (;(_index21<((signed int )__sepSize__C13e__anonymous0_1));((void)(++_index21))) {
    370399            ((void)((*((char *)(&(*___dst__R9sofstream_1).__tupleSeparator__A0c_1[((signed long int )_index21)])))=__tupleSeparator__A0c_1[((signed long int )_index21)]) /* ?{} */);
     
    372401
    373402    }
     403
    374404}
    375405_Bool __sepPrt__Fb_P9sofstream__1(struct ofstream *__anonymous_object1294);
     
    404434static inline void ___destructor__F_R9sifstream_autogen___1(struct ifstream *___dst__R9sifstream_1);
    405435static inline struct ifstream ___operator_assign__F9sifstream_R9sifstream9sifstream_autogen___1(struct ifstream *___dst__R9sifstream_1, struct ifstream ___src__9sifstream_1);
     436static inline void ___constructor__F_R9sifstreamPv_autogen___1(struct ifstream *___dst__R9sifstream_1, void *__file__Pv_1);
    406437static inline void ___constructor__F_R9sifstream_autogen___1(struct ifstream *___dst__R9sifstream_1){
    407438    ((void)((*___dst__R9sifstream_1).__file__Pv_1) /* ?{} */);
     
    416447    struct ifstream ___ret__9sifstream_1;
    417448    ((void)((*___dst__R9sifstream_1).__file__Pv_1=___src__9sifstream_1.__file__Pv_1));
    418     ((void)___constructor__F_R9sifstream9sifstream_autogen___1((&___ret__9sifstream_1), ___src__9sifstream_1));
    419     return ((struct ifstream )___ret__9sifstream_1);
     449    ((void)___constructor__F_R9sifstream9sifstream_autogen___1((&___ret__9sifstream_1), (*___dst__R9sifstream_1)));
     450    return ___ret__9sifstream_1;
    420451}
    421452static inline void ___constructor__F_R9sifstreamPv_autogen___1(struct ifstream *___dst__R9sifstream_1, void *__file__Pv_1){
     
    435466    struct ofstream *_tmp_cp_ret2;
    436467    __attribute__ ((unused)) struct ofstream *_thunk0(struct ofstream *_p0){
    437         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1322))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1323))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1324, _Bool __anonymous_object1325))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1326))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1327, const char *__anonymous_object1328))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1329))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1330, _Bool __anonymous_object1331))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1332))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1333))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1334))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1335))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1336))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1337, const char *__anonymous_object1338))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1339))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1340, const char *__anonymous_object1341))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1342))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1343))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1344, const char *__anonymous_object1345, unsigned long int __anonymous_object1346))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1347, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    438     }
    439     ((void)(((void)(_tmp_cp_ret2=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1348))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1349))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1350, _Bool __anonymous_object1351))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1352))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1353, const char *__anonymous_object1354))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1355))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1356, _Bool __anonymous_object1357))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1358))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1359))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1360))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1361))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1362))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1363, const char *__anonymous_object1364))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1365))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1366, const char *__anonymous_object1367))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1368))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1369))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1370, const char *__anonymous_object1371, unsigned long int __anonymous_object1372))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1373, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret1=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0c__1(((_Bool (*)(void *__anonymous_object1374))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1375))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1376, _Bool __anonymous_object1377))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1378))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1379, const char *__anonymous_object1380))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1381))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1382, _Bool __anonymous_object1383))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1384))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1385))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1386))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1387))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1388))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1389, const char *__anonymous_object1390))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1391))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1392, const char *__anonymous_object1393))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1394))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1395))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1396, const char *__anonymous_object1397, unsigned long int __anonymous_object1398))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1399, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret0=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1400))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1401))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1402, _Bool __anonymous_object1403))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1404))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1405, const char *__anonymous_object1406))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1407))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1408, _Bool __anonymous_object1409))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1410))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1411))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1412))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1413))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1414))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1415, const char *__anonymous_object1416))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1417))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1418, const char *__anonymous_object1419))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1420))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1421))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1422, const char *__anonymous_object1423, unsigned long int __anonymous_object1424))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1425, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "char "))) , _tmp_cp_ret0), __v__c_1))) , _tmp_cp_ret1), ((void *(*)(void *__anonymous_object1426))(&_thunk0))))) , _tmp_cp_ret2));
     468        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1322))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1323))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1324, _Bool __anonymous_object1325))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1326))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1327, const char *__anonymous_object1328))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1329))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1330, _Bool __anonymous_object1331))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1332))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1333))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1334))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1335))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1336))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1337, const char *__anonymous_object1338))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1339))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1340, const char *__anonymous_object1341))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1342))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1343))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1344, const char *__anonymous_object1345, unsigned long int __anonymous_object1346))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1347, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     469    }
     470    ((void)(((void)(_tmp_cp_ret2=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1348))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1349))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1350, _Bool __anonymous_object1351))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1352))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1353, const char *__anonymous_object1354))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1355))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1356, _Bool __anonymous_object1357))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1358))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1359))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1360))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1361))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1362))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1363, const char *__anonymous_object1364))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1365))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1366, const char *__anonymous_object1367))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1368))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1369))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1370, const char *__anonymous_object1371, unsigned long int __anonymous_object1372))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1373, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret1=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0c__1(((_Bool (*)(void *__anonymous_object1374))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1375))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1376, _Bool __anonymous_object1377))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1378))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1379, const char *__anonymous_object1380))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1381))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1382, _Bool __anonymous_object1383))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1384))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1385))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1386))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1387))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1388))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1389, const char *__anonymous_object1390))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1391))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1392, const char *__anonymous_object1393))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1394))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1395))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1396, const char *__anonymous_object1397, unsigned long int __anonymous_object1398))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1399, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret0=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1400))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1401))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1402, _Bool __anonymous_object1403))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1404))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1405, const char *__anonymous_object1406))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1407))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1408, _Bool __anonymous_object1409))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1410))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1411))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1412))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1413))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1414))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1415, const char *__anonymous_object1416))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1417))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1418, const char *__anonymous_object1419))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1420))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1421))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1422, const char *__anonymous_object1423, unsigned long int __anonymous_object1424))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1425, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "char "))) , _tmp_cp_ret0)), __v__c_1))) , _tmp_cp_ret1)), ((void *(*)(void *__anonymous_object1426))(&_thunk0))))) , _tmp_cp_ret2));
    440471    ((void)(_tmp_cp_ret0) /* ^?{} */);
    441472    ((void)(_tmp_cp_ret1) /* ^?{} */);
     
    447478    struct ofstream *_tmp_cp_ret5;
    448479    __attribute__ ((unused)) struct ofstream *_thunk1(struct ofstream *_p0){
    449         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1427))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1428))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1429, _Bool __anonymous_object1430))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1431))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1432, const char *__anonymous_object1433))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1434))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1435, _Bool __anonymous_object1436))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1437))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1438))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1439))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1440))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1441))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1442, const char *__anonymous_object1443))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1444))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1445, const char *__anonymous_object1446))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1447))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1448))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1449, const char *__anonymous_object1450, unsigned long int __anonymous_object1451))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1452, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    450     }
    451     ((void)(((void)(_tmp_cp_ret5=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1453))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1454))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1455, _Bool __anonymous_object1456))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1457))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1458, const char *__anonymous_object1459))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1460))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1461, _Bool __anonymous_object1462))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1463))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1464))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1465))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1466))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1467))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1468, const char *__anonymous_object1469))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1470))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1471, const char *__anonymous_object1472))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1473))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1474))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1475, const char *__anonymous_object1476, unsigned long int __anonymous_object1477))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1478, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret4=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Sc__1(((_Bool (*)(void *__anonymous_object1479))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1480))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1481, _Bool __anonymous_object1482))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1483))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1484, const char *__anonymous_object1485))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1486))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1487, _Bool __anonymous_object1488))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1489))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1490))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1491))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1492))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1493))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1494, const char *__anonymous_object1495))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1496))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1497, const char *__anonymous_object1498))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1499))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1500))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1501, const char *__anonymous_object1502, unsigned long int __anonymous_object1503))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1504, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret3=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1505))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1506))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1507, _Bool __anonymous_object1508))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1509))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1510, const char *__anonymous_object1511))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1512))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1513, _Bool __anonymous_object1514))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1515))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1516))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1517))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1518))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1519))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1520, const char *__anonymous_object1521))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1522))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1523, const char *__anonymous_object1524))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1525))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1526))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1527, const char *__anonymous_object1528, unsigned long int __anonymous_object1529))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1530, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "signed char "))) , _tmp_cp_ret3), __v__Sc_1))) , _tmp_cp_ret4), ((void *(*)(void *__anonymous_object1531))(&_thunk1))))) , _tmp_cp_ret5));
     480        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1427))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1428))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1429, _Bool __anonymous_object1430))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1431))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1432, const char *__anonymous_object1433))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1434))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1435, _Bool __anonymous_object1436))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1437))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1438))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1439))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1440))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1441))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1442, const char *__anonymous_object1443))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1444))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1445, const char *__anonymous_object1446))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1447))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1448))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1449, const char *__anonymous_object1450, unsigned long int __anonymous_object1451))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1452, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     481    }
     482    ((void)(((void)(_tmp_cp_ret5=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1453))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1454))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1455, _Bool __anonymous_object1456))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1457))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1458, const char *__anonymous_object1459))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1460))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1461, _Bool __anonymous_object1462))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1463))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1464))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1465))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1466))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1467))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1468, const char *__anonymous_object1469))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1470))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1471, const char *__anonymous_object1472))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1473))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1474))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1475, const char *__anonymous_object1476, unsigned long int __anonymous_object1477))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1478, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret4=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Sc__1(((_Bool (*)(void *__anonymous_object1479))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1480))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1481, _Bool __anonymous_object1482))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1483))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1484, const char *__anonymous_object1485))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1486))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1487, _Bool __anonymous_object1488))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1489))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1490))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1491))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1492))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1493))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1494, const char *__anonymous_object1495))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1496))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1497, const char *__anonymous_object1498))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1499))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1500))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1501, const char *__anonymous_object1502, unsigned long int __anonymous_object1503))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1504, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret3=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1505))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1506))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1507, _Bool __anonymous_object1508))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1509))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1510, const char *__anonymous_object1511))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1512))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1513, _Bool __anonymous_object1514))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1515))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1516))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1517))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1518))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1519))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1520, const char *__anonymous_object1521))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1522))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1523, const char *__anonymous_object1524))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1525))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1526))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1527, const char *__anonymous_object1528, unsigned long int __anonymous_object1529))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1530, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "signed char "))) , _tmp_cp_ret3)), __v__Sc_1))) , _tmp_cp_ret4)), ((void *(*)(void *__anonymous_object1531))(&_thunk1))))) , _tmp_cp_ret5));
    452483    ((void)(_tmp_cp_ret3) /* ^?{} */);
    453484    ((void)(_tmp_cp_ret4) /* ^?{} */);
     
    459490    struct ofstream *_tmp_cp_ret8;
    460491    __attribute__ ((unused)) struct ofstream *_thunk2(struct ofstream *_p0){
    461         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1532))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1533))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1534, _Bool __anonymous_object1535))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1536))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1537, const char *__anonymous_object1538))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1539))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1540, _Bool __anonymous_object1541))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1542))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1543))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1544))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1545))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1546))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1547, const char *__anonymous_object1548))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1549))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1550, const char *__anonymous_object1551))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1552))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1553))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1554, const char *__anonymous_object1555, unsigned long int __anonymous_object1556))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1557, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    462     }
    463     ((void)(((void)(_tmp_cp_ret8=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1558))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1559))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1560, _Bool __anonymous_object1561))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1562))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1563, const char *__anonymous_object1564))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1565))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1566, _Bool __anonymous_object1567))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1568))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1569))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1570))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1571))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1572))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1573, const char *__anonymous_object1574))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1575))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1576, const char *__anonymous_object1577))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1578))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1579))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1580, const char *__anonymous_object1581, unsigned long int __anonymous_object1582))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1583, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret7=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Uc__1(((_Bool (*)(void *__anonymous_object1584))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1585))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1586, _Bool __anonymous_object1587))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1588))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1589, const char *__anonymous_object1590))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1591))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1592, _Bool __anonymous_object1593))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1594))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1595))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1596))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1597))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1598))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1599, const char *__anonymous_object1600))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1601))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1602, const char *__anonymous_object1603))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1604))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1605))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1606, const char *__anonymous_object1607, unsigned long int __anonymous_object1608))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1609, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret6=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1610))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1611))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1612, _Bool __anonymous_object1613))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1614))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1615, const char *__anonymous_object1616))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1617))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1618, _Bool __anonymous_object1619))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1620))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1621))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1622))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1623))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1624))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1625, const char *__anonymous_object1626))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1627))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1628, const char *__anonymous_object1629))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1630))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1631))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1632, const char *__anonymous_object1633, unsigned long int __anonymous_object1634))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1635, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "unsigned char "))) , _tmp_cp_ret6), __v__Uc_1))) , _tmp_cp_ret7), ((void *(*)(void *__anonymous_object1636))(&_thunk2))))) , _tmp_cp_ret8));
     492        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1532))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1533))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1534, _Bool __anonymous_object1535))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1536))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1537, const char *__anonymous_object1538))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1539))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1540, _Bool __anonymous_object1541))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1542))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1543))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1544))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1545))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1546))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1547, const char *__anonymous_object1548))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1549))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1550, const char *__anonymous_object1551))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1552))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1553))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1554, const char *__anonymous_object1555, unsigned long int __anonymous_object1556))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1557, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     493    }
     494    ((void)(((void)(_tmp_cp_ret8=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1558))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1559))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1560, _Bool __anonymous_object1561))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1562))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1563, const char *__anonymous_object1564))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1565))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1566, _Bool __anonymous_object1567))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1568))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1569))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1570))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1571))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1572))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1573, const char *__anonymous_object1574))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1575))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1576, const char *__anonymous_object1577))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1578))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1579))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1580, const char *__anonymous_object1581, unsigned long int __anonymous_object1582))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1583, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret7=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Uc__1(((_Bool (*)(void *__anonymous_object1584))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1585))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1586, _Bool __anonymous_object1587))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1588))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1589, const char *__anonymous_object1590))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1591))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1592, _Bool __anonymous_object1593))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1594))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1595))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1596))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1597))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1598))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1599, const char *__anonymous_object1600))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1601))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1602, const char *__anonymous_object1603))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1604))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1605))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1606, const char *__anonymous_object1607, unsigned long int __anonymous_object1608))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1609, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret6=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1610))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1611))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1612, _Bool __anonymous_object1613))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1614))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1615, const char *__anonymous_object1616))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1617))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1618, _Bool __anonymous_object1619))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1620))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1621))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1622))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1623))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1624))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1625, const char *__anonymous_object1626))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1627))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1628, const char *__anonymous_object1629))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1630))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1631))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1632, const char *__anonymous_object1633, unsigned long int __anonymous_object1634))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1635, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "unsigned char "))) , _tmp_cp_ret6)), __v__Uc_1))) , _tmp_cp_ret7)), ((void *(*)(void *__anonymous_object1636))(&_thunk2))))) , _tmp_cp_ret8));
    464495    ((void)(_tmp_cp_ret6) /* ^?{} */);
    465496    ((void)(_tmp_cp_ret7) /* ^?{} */);
     
    471502    struct ofstream *_tmp_cp_ret11;
    472503    __attribute__ ((unused)) struct ofstream *_thunk3(struct ofstream *_p0){
    473         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1637))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1638))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1639, _Bool __anonymous_object1640))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1641))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1642, const char *__anonymous_object1643))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1644))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1645, _Bool __anonymous_object1646))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1647))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1648))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1649))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1650))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1651))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1652, const char *__anonymous_object1653))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1654))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1655, const char *__anonymous_object1656))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1657))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1658))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1659, const char *__anonymous_object1660, unsigned long int __anonymous_object1661))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1662, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    474     }
    475     ((void)(((void)(_tmp_cp_ret11=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1663))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1664))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1665, _Bool __anonymous_object1666))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1667))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1668, const char *__anonymous_object1669))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1670))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1671, _Bool __anonymous_object1672))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1673))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1674))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1675))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1676))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1677))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1678, const char *__anonymous_object1679))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1680))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1681, const char *__anonymous_object1682))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1683))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1684))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1685, const char *__anonymous_object1686, unsigned long int __anonymous_object1687))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1688, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret10=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0s__1(((_Bool (*)(void *__anonymous_object1689))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1690))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1691, _Bool __anonymous_object1692))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1693))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1694, const char *__anonymous_object1695))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1696))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1697, _Bool __anonymous_object1698))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1699))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1700))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1701))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1702))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1703))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1704, const char *__anonymous_object1705))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1706))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1707, const char *__anonymous_object1708))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1709))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1710))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1711, const char *__anonymous_object1712, unsigned long int __anonymous_object1713))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1714, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret9=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1715))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1716))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1717, _Bool __anonymous_object1718))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1719))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1720, const char *__anonymous_object1721))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1722))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1723, _Bool __anonymous_object1724))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1725))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1726))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1727))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1728))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1729))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1730, const char *__anonymous_object1731))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1732))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1733, const char *__anonymous_object1734))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1735))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1736))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1737, const char *__anonymous_object1738, unsigned long int __anonymous_object1739))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1740, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "signed short int"))) , _tmp_cp_ret9), __v__s_1))) , _tmp_cp_ret10), ((void *(*)(void *__anonymous_object1741))(&_thunk3))))) , _tmp_cp_ret11));
     504        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1637))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1638))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1639, _Bool __anonymous_object1640))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1641))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1642, const char *__anonymous_object1643))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1644))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1645, _Bool __anonymous_object1646))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1647))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1648))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1649))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1650))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1651))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1652, const char *__anonymous_object1653))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1654))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1655, const char *__anonymous_object1656))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1657))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1658))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1659, const char *__anonymous_object1660, unsigned long int __anonymous_object1661))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1662, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     505    }
     506    ((void)(((void)(_tmp_cp_ret11=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1663))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1664))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1665, _Bool __anonymous_object1666))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1667))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1668, const char *__anonymous_object1669))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1670))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1671, _Bool __anonymous_object1672))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1673))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1674))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1675))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1676))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1677))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1678, const char *__anonymous_object1679))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1680))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1681, const char *__anonymous_object1682))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1683))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1684))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1685, const char *__anonymous_object1686, unsigned long int __anonymous_object1687))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1688, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret10=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0s__1(((_Bool (*)(void *__anonymous_object1689))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1690))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1691, _Bool __anonymous_object1692))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1693))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1694, const char *__anonymous_object1695))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1696))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1697, _Bool __anonymous_object1698))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1699))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1700))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1701))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1702))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1703))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1704, const char *__anonymous_object1705))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1706))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1707, const char *__anonymous_object1708))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1709))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1710))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1711, const char *__anonymous_object1712, unsigned long int __anonymous_object1713))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1714, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret9=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1715))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1716))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1717, _Bool __anonymous_object1718))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1719))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1720, const char *__anonymous_object1721))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1722))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1723, _Bool __anonymous_object1724))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1725))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1726))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1727))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1728))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1729))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1730, const char *__anonymous_object1731))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1732))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1733, const char *__anonymous_object1734))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1735))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1736))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1737, const char *__anonymous_object1738, unsigned long int __anonymous_object1739))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1740, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "signed short int"))) , _tmp_cp_ret9)), __v__s_1))) , _tmp_cp_ret10)), ((void *(*)(void *__anonymous_object1741))(&_thunk3))))) , _tmp_cp_ret11));
    476507    ((void)(_tmp_cp_ret9) /* ^?{} */);
    477508    ((void)(_tmp_cp_ret10) /* ^?{} */);
     
    483514    struct ofstream *_tmp_cp_ret14;
    484515    __attribute__ ((unused)) struct ofstream *_thunk4(struct ofstream *_p0){
    485         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1742))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1743))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1744, _Bool __anonymous_object1745))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1746))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1747, const char *__anonymous_object1748))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1749))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1750, _Bool __anonymous_object1751))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1752))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1753))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1754))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1755))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1756))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1757, const char *__anonymous_object1758))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1759))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1760, const char *__anonymous_object1761))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1762))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1763))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1764, const char *__anonymous_object1765, unsigned long int __anonymous_object1766))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1767, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    486     }
    487     ((void)(((void)(_tmp_cp_ret14=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1768))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1769))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1770, _Bool __anonymous_object1771))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1772))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1773, const char *__anonymous_object1774))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1775))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1776, _Bool __anonymous_object1777))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1778))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1779))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1780))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1781))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1782))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1783, const char *__anonymous_object1784))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1785))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1786, const char *__anonymous_object1787))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1788))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1789))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1790, const char *__anonymous_object1791, unsigned long int __anonymous_object1792))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1793, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret13=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Us__1(((_Bool (*)(void *__anonymous_object1794))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1795))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1796, _Bool __anonymous_object1797))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1798))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1799, const char *__anonymous_object1800))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1801))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1802, _Bool __anonymous_object1803))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1804))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1805))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1806))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1807))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1808))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1809, const char *__anonymous_object1810))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1811))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1812, const char *__anonymous_object1813))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1814))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1815))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1816, const char *__anonymous_object1817, unsigned long int __anonymous_object1818))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1819, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret12=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1820))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1821))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1822, _Bool __anonymous_object1823))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1824))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1825, const char *__anonymous_object1826))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1827))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1828, _Bool __anonymous_object1829))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1830))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1831))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1832))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1833))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1834))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1835, const char *__anonymous_object1836))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1837))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1838, const char *__anonymous_object1839))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1840))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1841))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1842, const char *__anonymous_object1843, unsigned long int __anonymous_object1844))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1845, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "unsigned short int"))) , _tmp_cp_ret12), __v__Us_1))) , _tmp_cp_ret13), ((void *(*)(void *__anonymous_object1846))(&_thunk4))))) , _tmp_cp_ret14));
     516        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1742))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1743))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1744, _Bool __anonymous_object1745))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1746))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1747, const char *__anonymous_object1748))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1749))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1750, _Bool __anonymous_object1751))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1752))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1753))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1754))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1755))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1756))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1757, const char *__anonymous_object1758))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1759))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1760, const char *__anonymous_object1761))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1762))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1763))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1764, const char *__anonymous_object1765, unsigned long int __anonymous_object1766))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1767, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     517    }
     518    ((void)(((void)(_tmp_cp_ret14=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1768))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1769))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1770, _Bool __anonymous_object1771))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1772))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1773, const char *__anonymous_object1774))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1775))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1776, _Bool __anonymous_object1777))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1778))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1779))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1780))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1781))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1782))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1783, const char *__anonymous_object1784))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1785))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1786, const char *__anonymous_object1787))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1788))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1789))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1790, const char *__anonymous_object1791, unsigned long int __anonymous_object1792))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1793, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret13=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Us__1(((_Bool (*)(void *__anonymous_object1794))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1795))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1796, _Bool __anonymous_object1797))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1798))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1799, const char *__anonymous_object1800))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1801))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1802, _Bool __anonymous_object1803))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1804))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1805))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1806))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1807))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1808))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1809, const char *__anonymous_object1810))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1811))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1812, const char *__anonymous_object1813))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1814))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1815))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1816, const char *__anonymous_object1817, unsigned long int __anonymous_object1818))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1819, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret12=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1820))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1821))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1822, _Bool __anonymous_object1823))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1824))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1825, const char *__anonymous_object1826))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1827))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1828, _Bool __anonymous_object1829))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1830))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1831))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1832))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1833))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1834))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1835, const char *__anonymous_object1836))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1837))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1838, const char *__anonymous_object1839))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1840))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1841))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1842, const char *__anonymous_object1843, unsigned long int __anonymous_object1844))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1845, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "unsigned short int"))) , _tmp_cp_ret12)), __v__Us_1))) , _tmp_cp_ret13)), ((void *(*)(void *__anonymous_object1846))(&_thunk4))))) , _tmp_cp_ret14));
    488519    ((void)(_tmp_cp_ret12) /* ^?{} */);
    489520    ((void)(_tmp_cp_ret13) /* ^?{} */);
     
    495526    struct ofstream *_tmp_cp_ret17;
    496527    __attribute__ ((unused)) struct ofstream *_thunk5(struct ofstream *_p0){
    497         return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1847))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1848))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1849, _Bool __anonymous_object1850))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1851))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1852, const char *__anonymous_object1853))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1854))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1855, _Bool __anonymous_object1856))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1857))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1858))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1859))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1860))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1861))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1862, const char *__anonymous_object1863))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1864))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1865, const char *__anonymous_object1866))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1867))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1868))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1869, const char *__anonymous_object1870, unsigned long int __anonymous_object1871))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1872, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), _p0);
    498     }
    499     ((void)(((void)(_tmp_cp_ret17=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1873))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1874))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1875, _Bool __anonymous_object1876))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1877))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1878, const char *__anonymous_object1879))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1880))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1881, _Bool __anonymous_object1882))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1883))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1884))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1885))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1886))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1887))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1888, const char *__anonymous_object1889))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1890))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1891, const char *__anonymous_object1892))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1893))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1894))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1895, const char *__anonymous_object1896, unsigned long int __anonymous_object1897))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1898, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret16=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Ul__1(((_Bool (*)(void *__anonymous_object1899))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1900))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1901, _Bool __anonymous_object1902))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1903))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1904, const char *__anonymous_object1905))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1906))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1907, _Bool __anonymous_object1908))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1909))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1910))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1911))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1912))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1913))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1914, const char *__anonymous_object1915))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1916))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1917, const char *__anonymous_object1918))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1919))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1920))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1921, const char *__anonymous_object1922, unsigned long int __anonymous_object1923))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1924, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), (((void)(_tmp_cp_ret15=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1925))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1926))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1927, _Bool __anonymous_object1928))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1929))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1930, const char *__anonymous_object1931))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1932))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1933, _Bool __anonymous_object1934))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1935))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1936))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1937))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1938))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1939))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1940, const char *__anonymous_object1941))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1942))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1943, const char *__anonymous_object1944))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1945))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1946))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1947, const char *__anonymous_object1948, unsigned long int __anonymous_object1949))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1950, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), __sout__P9sofstream_1, "size_t"))) , _tmp_cp_ret15), __v__Ul_1))) , _tmp_cp_ret16), ((void *(*)(void *__anonymous_object1951))(&_thunk5))))) , _tmp_cp_ret17));
     528        return __endl__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0__1(((_Bool (*)(void *__anonymous_object1847))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1848))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1849, _Bool __anonymous_object1850))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1851))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1852, const char *__anonymous_object1853))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1854))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1855, _Bool __anonymous_object1856))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1857))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1858))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1859))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1860))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1861))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1862, const char *__anonymous_object1863))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1864))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1865, const char *__anonymous_object1866))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1867))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1868))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1869, const char *__anonymous_object1870, unsigned long int __anonymous_object1871))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1872, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)_p0));
     529    }
     530    ((void)(((void)(_tmp_cp_ret17=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PFPd0_Pd0___1(((_Bool (*)(void *__anonymous_object1873))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1874))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1875, _Bool __anonymous_object1876))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1877))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1878, const char *__anonymous_object1879))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1880))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1881, _Bool __anonymous_object1882))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1883))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1884))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1885))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1886))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1887))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1888, const char *__anonymous_object1889))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1890))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1891, const char *__anonymous_object1892))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1893))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1894))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1895, const char *__anonymous_object1896, unsigned long int __anonymous_object1897))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1898, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret16=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0Ul__1(((_Bool (*)(void *__anonymous_object1899))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1900))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1901, _Bool __anonymous_object1902))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1903))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1904, const char *__anonymous_object1905))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1906))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1907, _Bool __anonymous_object1908))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1909))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1910))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1911))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1912))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1913))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1914, const char *__anonymous_object1915))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1916))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1917, const char *__anonymous_object1918))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1919))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1920))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1921, const char *__anonymous_object1922, unsigned long int __anonymous_object1923))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1924, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret15=___operator_bitor__A0_1_0_0___sepPrt__PFb_Pd0___sepReset__PF_Pd0___sepReset__PF_Pd0b___sepGetCur__PFPCc_Pd0___sepSetCur__PF_Pd0PCc___getNL__PFb_Pd0___setNL__PF_Pd0b___sepOn__PF_Pd0___sepOff__PF_Pd0___sepDisable__PFb_Pd0___sepEnable__PFb_Pd0___sepGet__PFPCc_Pd0___sepSet__PF_Pd0PCc___sepGetTuple__PFPCc_Pd0___sepSetTuple__PF_Pd0PCc___fail__PFi_Pd0___flush__PFi_Pd0___open__PF_Pd0PCcPCc___close__PF_Pd0___write__PFPd0_Pd0PCcUl___fmt__PFi_Pd0PCc__FPd0_Pd0PCc__1(((_Bool (*)(void *__anonymous_object1925))__sepPrt__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1926))__sepReset__F_P9sofstream__1), ((void (*)(void *__anonymous_object1927, _Bool __anonymous_object1928))__sepReset__F_P9sofstreamb__1), ((const char *(*)(void *__anonymous_object1929))__sepGetCur__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1930, const char *__anonymous_object1931))__sepSetCur__F_P9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1932))__getNL__Fb_P9sofstream__1), ((void (*)(void *__anonymous_object1933, _Bool __anonymous_object1934))__setNL__F_P9sofstreamb__1), ((void (*)(void *__anonymous_object1935))__sepOn__F_P9sofstream__1), ((void (*)(void *__anonymous_object1936))__sepOff__F_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1937))__sepDisable__Fb_P9sofstream__1), ((_Bool (*)(void *__anonymous_object1938))__sepEnable__Fb_P9sofstream__1), ((const char *(*)(void *__anonymous_object1939))__sepGet__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1940, const char *__anonymous_object1941))__sepSet__F_P9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1942))__sepGetTuple__FPCc_P9sofstream__1), ((void (*)(void *__anonymous_object1943, const char *__anonymous_object1944))__sepSetTuple__F_P9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1945))__fail__Fi_P9sofstream__1), ((signed int (*)(void *__anonymous_object1946))__flush__Fi_P9sofstream__1), ((void (*)(void *__os__P7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_P9sofstreamPCcPCc__1), ((void (*)(void *__os__P7tostype_1))__close__F_P9sofstream__1), ((void *(*)(void *__anonymous_object1947, const char *__anonymous_object1948, unsigned long int __anonymous_object1949))__write__FP9sofstream_P9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1950, const char *__fmt__PCc_1, ...))__fmt__Fi_P9sofstreamPCc__1), ((void *)__sout__P9sofstream_1), "size_t"))) , _tmp_cp_ret15)), __v__Ul_1))) , _tmp_cp_ret16)), ((void *(*)(void *__anonymous_object1951))(&_thunk5))))) , _tmp_cp_ret17));
    500531    ((void)(_tmp_cp_ret15) /* ^?{} */);
    501532    ((void)(_tmp_cp_ret16) /* ^?{} */);
     
    708739    ((void)0123456789.e-09L);
    709740    ((void)0123456789.e-09DL);
    710     ((void)(-0123456789.e-09));
    711     ((void)(-0123456789.e-09f));
    712     ((void)(-0123456789.e-09l));
    713     ((void)(-0123456789.e-09F));
    714     ((void)(-0123456789.e-09L));
    715     ((void)(-0123456789.e-09DL));
     741    ((void)(+0123456789.e-09));
     742    ((void)(+0123456789.e-09f));
     743    ((void)(+0123456789.e-09l));
     744    ((void)(+0123456789.e-09F));
     745    ((void)(+0123456789.e-09L));
     746    ((void)(+0123456789.e-09DL));
    716747    ((void)(-0123456789.e-09));
    717748    ((void)(-0123456789.e-09f));
     
    852883    ((void)0123456789.0123456789E-09L);
    853884    ((void)0123456789.0123456789E-09DL);
    854     ((void)(-0123456789.0123456789E-09));
    855     ((void)(-0123456789.0123456789E-09f));
    856     ((void)(-0123456789.0123456789E-09l));
    857     ((void)(-0123456789.0123456789E-09F));
    858     ((void)(-0123456789.0123456789E-09L));
    859     ((void)(-0123456789.0123456789E-09DL));
     885    ((void)(+0123456789.0123456789E-09));
     886    ((void)(+0123456789.0123456789E-09f));
     887    ((void)(+0123456789.0123456789E-09l));
     888    ((void)(+0123456789.0123456789E-09F));
     889    ((void)(+0123456789.0123456789E-09L));
     890    ((void)(+0123456789.0123456789E-09DL));
    860891    ((void)(-0123456789.0123456789E-09));
    861892    ((void)(-0123456789.0123456789E-09f));
     
    899930    ((void)0x0123456789.p-09F);
    900931    ((void)0x0123456789.p-09L);
    901     ((void)(-0x0123456789.p-09));
    902     ((void)(-0x0123456789.p-09f));
    903     ((void)(-0x0123456789.p-09l));
    904     ((void)(-0x0123456789.p-09F));
    905     ((void)(-0x0123456789.p-09L));
     932    ((void)(+0x0123456789.p-09));
     933    ((void)(+0x0123456789.p-09f));
     934    ((void)(+0x0123456789.p-09l));
     935    ((void)(+0x0123456789.p-09F));
     936    ((void)(+0x0123456789.p-09L));
    906937    ((void)(-0x0123456789.p-09));
    907938    ((void)(-0x0123456789.p-09f));
     
    944975    ((void)0x.0123456789P-09F);
    945976    ((void)0x.0123456789P-09L);
    946     ((void)(-0x.0123456789P-09));
    947     ((void)(-0x.0123456789P-09f));
    948     ((void)(-0x.0123456789P-09l));
    949     ((void)(-0x.0123456789P-09F));
    950     ((void)(-0x.0123456789P-09L));
     977    ((void)(+0x.0123456789P-09));
     978    ((void)(+0x.0123456789P-09f));
     979    ((void)(+0x.0123456789P-09l));
     980    ((void)(+0x.0123456789P-09F));
     981    ((void)(+0x.0123456789P-09L));
    951982    ((void)(-0x.0123456789P-09));
    952983    ((void)(-0x.0123456789P-09f));
     
    9891020    ((void)0X0123456789.0123456789P-09F);
    9901021    ((void)0X0123456789.0123456789P-09L);
     1022    ((void)(+0X0123456789.0123456789P-09));
     1023    ((void)(+0X0123456789.0123456789P-09f));
     1024    ((void)(+0X0123456789.0123456789P-09l));
     1025    ((void)(+0X0123456789.0123456789P-09F));
     1026    ((void)(+0X0123456789.0123456789P-09L));
    9911027    ((void)(-0X0123456789.0123456789P-09));
    9921028    ((void)(-0X0123456789.0123456789P-09f));
     
    9941030    ((void)(-0X0123456789.0123456789P-09F));
    9951031    ((void)(-0X0123456789.0123456789P-09L));
    996     ((void)(-0X0123456789.0123456789P-09));
    997     ((void)(-0X0123456789.0123456789P-09f));
    998     ((void)(-0X0123456789.0123456789P-09l));
    999     ((void)(-0X0123456789.0123456789P-09F));
    1000     ((void)(-0X0123456789.0123456789P-09L));
     1032    ((void)((signed char )01234567));
     1033    ((void)((signed short int )01234567));
     1034    ((void)((signed int )01234567));
     1035    ((void)((signed long int )01234567));
     1036    ((void)((__int128 )01234567));
     1037    ((void)((unsigned char )01234567u));
     1038    ((void)((signed short int )01234567u));
     1039    ((void)((unsigned int )01234567u));
     1040    ((void)((signed long int )01234567u));
     1041    ((void)((__int128 )01234567u));
     1042    ((void)(+((signed int )((signed char )01234567))));
     1043    ((void)(+((signed int )((signed short int )01234567))));
     1044    ((void)(+((signed int )01234567)));
     1045    ((void)(+((signed long int )01234567)));
     1046    ((void)(+((float )((__int128 )01234567))));
     1047    ((void)(+((signed int )((unsigned char )01234567u))));
     1048    ((void)(+((signed int )((signed short int )01234567u))));
     1049    ((void)(+((unsigned int )01234567u)));
     1050    ((void)(+((signed long int )01234567u)));
     1051    ((void)(+((float )((__int128 )01234567u))));
     1052    ((void)(-((signed int )((signed char )01234567))));
     1053    ((void)(-((signed int )((signed short int )01234567))));
     1054    ((void)(-((signed int )01234567)));
     1055    ((void)(-((signed long int )01234567)));
     1056    ((void)(-((float )((__int128 )01234567))));
     1057    ((void)(-((signed int )((unsigned char )01234567u))));
     1058    ((void)(-((signed int )((signed short int )01234567u))));
     1059    ((void)(-((unsigned int )01234567u)));
     1060    ((void)(-((signed long int )01234567u)));
     1061    ((void)(-((float )((__int128 )01234567u))));
     1062    ((void)((signed char )1234567890));
     1063    ((void)((signed short int )1234567890));
     1064    ((void)((signed int )1234567890));
     1065    ((void)((signed long int )1234567890));
     1066    ((void)((__int128 )1234567890));
     1067    ((void)((signed char )1234567890U));
     1068    ((void)((unsigned short int )1234567890U));
     1069    ((void)((signed int )1234567890U));
     1070    ((void)((unsigned long int )1234567890u));
     1071    ((void)((unsigned __int128 )1234567890u));
     1072    ((void)(+((signed int )((signed char )1234567890))));
     1073    ((void)(+((signed int )((signed short int )1234567890))));
     1074    ((void)(+((signed int )1234567890)));
     1075    ((void)(+((signed long int )1234567890)));
     1076    ((void)(+((float )((__int128 )1234567890))));
     1077    ((void)(+((signed int )((signed char )1234567890U))));
     1078    ((void)(+((signed int )((unsigned short int )1234567890U))));
     1079    ((void)(+((signed int )1234567890U)));
     1080    ((void)(+((unsigned long int )1234567890u)));
     1081    ((void)(+((float )((unsigned __int128 )1234567890u))));
     1082    ((void)(-((signed int )((signed char )1234567890))));
     1083    ((void)(-((signed int )((signed short int )1234567890))));
     1084    ((void)(-((signed int )1234567890)));
     1085    ((void)(-((signed long int )1234567890)));
     1086    ((void)(-((float )((__int128 )1234567890))));
     1087    ((void)(-((signed int )((signed char )1234567890U))));
     1088    ((void)(-((signed int )((unsigned short int )1234567890U))));
     1089    ((void)(-((signed int )1234567890U)));
     1090    ((void)(-((unsigned long int )1234567890u)));
     1091    ((void)(-((float )((unsigned __int128 )1234567890u))));
     1092    ((void)((signed char )0x0123456789abcdef));
     1093    ((void)((signed short int )0x0123456789abcdef));
     1094    ((void)((signed int )0x0123456789abcdef));
     1095    ((void)((signed long int )0x0123456789abcdef));
     1096    ((void)((signed char )0x0123456789abcdefu));
     1097    ((void)((unsigned short int )0x0123456789abcdefu));
     1098    ((void)((signed int )0x0123456789abcdefu));
     1099    ((void)((unsigned long int )0x0123456789abcdefu));
     1100    ((void)(+((signed int )((signed char )0x0123456789abcdef))));
     1101    ((void)(+((signed int )((signed short int )0x0123456789abcdef))));
     1102    ((void)(+((signed int )0x0123456789abcdef)));
     1103    ((void)(+((signed long int )0x0123456789abcdef)));
     1104    ((void)(+((signed int )((signed char )0x0123456789abcdefu))));
     1105    ((void)(+((signed int )((unsigned short int )0x0123456789abcdefu))));
     1106    ((void)(+((signed int )0x0123456789abcdefu)));
     1107    ((void)(+((unsigned long int )0x0123456789abcdefu)));
     1108    ((void)(-((signed int )((signed char )0x0123456789abcdef))));
     1109    ((void)(-((signed int )((signed short int )0x0123456789abcdef))));
     1110    ((void)(-((signed int )0x0123456789abcdef)));
     1111    ((void)(-((signed long int )0x0123456789abcdef)));
     1112    ((void)(-((signed int )((signed char )0x0123456789abcdefu))));
     1113    ((void)(-((signed int )((unsigned short int )0x0123456789abcdefu))));
     1114    ((void)(-((signed int )0x0123456789abcdefu)));
     1115    ((void)(-((unsigned long int )0x0123456789abcdefu)));
     1116    ((void)((signed char )0x0123456789ABCDEF));
     1117    ((void)((signed short int )0x0123456789ABCDEF));
     1118    ((void)((signed int )0x0123456789ABCDEF));
     1119    ((void)((signed long int )0x0123456789ABCDEF));
     1120    ((void)((signed char )0x0123456789ABCDEFu));
     1121    ((void)((unsigned short int )0x0123456789ABCDEFu));
     1122    ((void)((signed int )0x0123456789ABCDEFu));
     1123    ((void)((unsigned long int )0x0123456789ABCDEFu));
     1124    ((void)(+((signed int )((signed char )0x0123456789ABCDEF))));
     1125    ((void)(+((signed int )((signed short int )0x0123456789ABCDEF))));
     1126    ((void)(+((signed int )0x0123456789ABCDEF)));
     1127    ((void)(+((signed long int )0x0123456789ABCDEF)));
     1128    ((void)(+((signed int )((signed char )0x0123456789ABCDEFu))));
     1129    ((void)(+((signed int )((unsigned short int )0x0123456789ABCDEFu))));
     1130    ((void)(+((signed int )0x0123456789ABCDEFu)));
     1131    ((void)(+((unsigned long int )0x0123456789ABCDEFu)));
     1132    ((void)(-((signed int )((signed char )0x0123456789ABCDEF))));
     1133    ((void)(-((signed int )((signed short int )0x0123456789ABCDEF))));
     1134    ((void)(-((signed int )0x0123456789ABCDEF)));
     1135    ((void)(-((signed long int )0x0123456789ABCDEF)));
     1136    ((void)(-((signed int )((signed char )0x0123456789ABCDEFu))));
     1137    ((void)(-((signed int )((unsigned short int )0x0123456789ABCDEFu))));
     1138    ((void)(-((signed int )0x0123456789ABCDEFu)));
     1139    ((void)(-((unsigned long int )0x0123456789ABCDEFu)));
     1140    ((void)((signed char )0X0123456789abcdef));
     1141    ((void)((signed short int )0X0123456789abcdef));
     1142    ((void)((signed int )0X0123456789abcdef));
     1143    ((void)((signed long int )0X0123456789abcdef));
     1144    ((void)((signed char )0X0123456789abcdefu));
     1145    ((void)((unsigned short int )0X0123456789abcdefu));
     1146    ((void)((signed int )0X0123456789abcdefu));
     1147    ((void)((unsigned long int )0X0123456789abcdefu));
     1148    ((void)(+((signed int )((signed char )0X0123456789abcdef))));
     1149    ((void)(+((signed int )((signed short int )0X0123456789abcdef))));
     1150    ((void)(+((signed int )0X0123456789abcdef)));
     1151    ((void)(+((signed long int )0X0123456789abcdef)));
     1152    ((void)(+((signed int )((signed char )0X0123456789abcdefu))));
     1153    ((void)(+((signed int )((unsigned short int )0X0123456789abcdefu))));
     1154    ((void)(+((signed int )0X0123456789abcdefu)));
     1155    ((void)(+((unsigned long int )0X0123456789abcdefu)));
     1156    ((void)(-((signed int )((signed char )0X0123456789abcdef))));
     1157    ((void)(-((signed int )((signed short int )0X0123456789abcdef))));
     1158    ((void)(-((signed int )0X0123456789abcdef)));
     1159    ((void)(-((signed long int )0X0123456789abcdef)));
     1160    ((void)(-((signed int )((signed char )0X0123456789abcdefu))));
     1161    ((void)(-((signed int )((unsigned short int )0X0123456789abcdefu))));
     1162    ((void)(-((signed int )0X0123456789abcdefu)));
     1163    ((void)(-((unsigned long int )0X0123456789abcdefu)));
     1164    ((void)((signed char )0X0123456789ABCDEF));
     1165    ((void)((signed short int )0X0123456789ABCDEF));
     1166    ((void)((signed int )0X0123456789ABCDEF));
     1167    ((void)((signed long int )0X0123456789ABCDEF));
     1168    ((void)((signed char )0X0123456789ABCDEFu));
     1169    ((void)((unsigned short int )0X0123456789ABCDEFu));
     1170    ((void)((signed int )0X0123456789ABCDEFu));
     1171    ((void)((unsigned long int )0X0123456789ABCDEFu));
     1172    ((void)(+((signed int )((signed char )0X0123456789ABCDEF))));
     1173    ((void)(+((signed int )((signed short int )0X0123456789ABCDEF))));
     1174    ((void)(+((signed int )0X0123456789ABCDEF)));
     1175    ((void)(+((signed long int )0X0123456789ABCDEF)));
     1176    ((void)(+((signed int )((signed char )0X0123456789ABCDEFu))));
     1177    ((void)(+((signed int )((unsigned short int )0X0123456789ABCDEFu))));
     1178    ((void)(+((signed int )0X0123456789ABCDEFu)));
     1179    ((void)(+((unsigned long int )0X0123456789ABCDEFu)));
     1180    ((void)(-((signed int )((signed char )0X0123456789ABCDEF))));
     1181    ((void)(-((signed int )((signed short int )0X0123456789ABCDEF))));
     1182    ((void)(-((signed int )0X0123456789ABCDEF)));
     1183    ((void)(-((signed long int )0X0123456789ABCDEF)));
     1184    ((void)(-((signed int )((signed char )0X0123456789ABCDEFu))));
     1185    ((void)(-((signed int )((unsigned short int )0X0123456789ABCDEFu))));
     1186    ((void)(-((signed int )0X0123456789ABCDEFu)));
     1187    ((void)(-((unsigned long int )0X0123456789ABCDEFu)));
     1188    ((void)((float )0123456789.));
     1189    ((void)((double )0123456789.));
     1190    ((void)((long double )0123456789.));
     1191    ((void)((long double )0123456789.));
     1192    ((void)(+((float )0123456789.)));
     1193    ((void)(+((double )0123456789.)));
     1194    ((void)(+((long double )0123456789.)));
     1195    ((void)(+((long double )0123456789.)));
     1196    ((void)(-((float )0123456789.)));
     1197    ((void)(-((double )0123456789.)));
     1198    ((void)(-((long double )0123456789.)));
     1199    ((void)(-((long double )0123456789.)));
     1200    ((void)((float )0123456789.e09));
     1201    ((void)((double )0123456789.e09));
     1202    ((void)((long double )0123456789.e09));
     1203    ((void)((long double )0123456789.e09));
     1204    ((void)(+((float )0123456789.e+09)));
     1205    ((void)(+((double )0123456789.e+09)));
     1206    ((void)(+((long double )0123456789.e+09)));
     1207    ((void)(+((long double )0123456789.e+09)));
     1208    ((void)(-((float )0123456789.e-09)));
     1209    ((void)(-((double )0123456789.e-09)));
     1210    ((void)(-((long double )0123456789.e-09)));
     1211    ((void)(-((long double )0123456789.e-09)));
     1212    ((void)((float ).0123456789e09));
     1213    ((void)((double ).0123456789e09));
     1214    ((void)((long double ).0123456789e09));
     1215    ((void)((long double ).0123456789e09));
     1216    ((void)(+((float ).0123456789E+09)));
     1217    ((void)(+((double ).0123456789E+09)));
     1218    ((void)(+((long double ).0123456789E+09)));
     1219    ((void)(+((long double ).0123456789E+09)));
     1220    ((void)(-((float ).0123456789E-09)));
     1221    ((void)(-((double ).0123456789E-09)));
     1222    ((void)(-((long double ).0123456789E-09)));
     1223    ((void)(-((long double ).0123456789E-09)));
     1224    ((void)((float )0123456789.0123456789));
     1225    ((void)((double )0123456789.0123456789));
     1226    ((void)((long double )0123456789.0123456789));
     1227    ((void)((long double )0123456789.0123456789));
     1228    ((void)(+((float )0123456789.0123456789E09)));
     1229    ((void)(+((double )0123456789.0123456789E09)));
     1230    ((void)(+((long double )0123456789.0123456789E09)));
     1231    ((void)(+((long double )0123456789.0123456789E09)));
     1232    ((void)(-((float )0123456789.0123456789E+09)));
     1233    ((void)(-((double )0123456789.0123456789E+09)));
     1234    ((void)(-((long double )0123456789.0123456789E+09)));
     1235    ((void)(-((long double )0123456789.0123456789E+09)));
     1236    ((void)((float )0123456789.0123456789E-09));
     1237    ((void)((double )0123456789.0123456789E-09));
     1238    ((void)((long double )0123456789.0123456789E-09));
     1239    ((void)((long double )0123456789.0123456789E-09));
     1240    ((void)((float )0x0123456789.p09));
     1241    ((void)((double )0x0123456789.p09));
     1242    ((void)((long double )0x0123456789.p09));
     1243    ((void)((long double )0x0123456789.p09));
     1244    ((void)(+((float )0x0123456789.p09)));
     1245    ((void)(+((double )0x0123456789.p09)));
     1246    ((void)(+((long double )0x0123456789.p09)));
     1247    ((void)(+((long double )0x0123456789.p09)));
     1248    ((void)(-((float )0x0123456789.p09)));
     1249    ((void)(-((double )0x0123456789.p09)));
     1250    ((void)(-((long double )0x0123456789.p09)));
     1251    ((void)(-((long double )0x0123456789.p09)));
     1252    ((void)((float )0x0123456789.p+09));
     1253    ((void)((double )0x0123456789.p+09));
     1254    ((void)((long double )0x0123456789.p+09));
     1255    ((void)((long double )0x0123456789.p+09));
     1256    ((void)(+((float )0x0123456789.p-09)));
     1257    ((void)(+((double )0x0123456789.p-09)));
     1258    ((void)(+((long double )0x0123456789.p-09)));
     1259    ((void)(+((long double )0x0123456789.p-09)));
     1260    ((void)(-((float )0x.0123456789p09)));
     1261    ((void)(-((double )0x.0123456789p09)));
     1262    ((void)(-((long double )0x.0123456789p09)));
     1263    ((void)(-((long double )0x.0123456789p09)));
    10011264    ((void)__f__F_c__1('a'));
    10021265    ((void)__f__F_Sc__1(20));
     
    11111374    ((void)L"a" "b" "c");
    11121375    ((void)(___retval_main__i_1=0) /* ?{} */);
    1113     return ((signed int )___retval_main__i_1);
     1376    return ___retval_main__i_1;
    11141377}
    11151378static inline int invoke_main(int argc, char* argv[], char* envp[]) { (void)argc; (void)argv; (void)envp; return __main__Fi___1(); }
     
    11261389    ((void)(___retval_main__i_1=(((void)(_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1))) , _tmp_cp_ret0)) /* ?{} */);
    11271390    ((void)(_tmp_cp_ret0) /* ^?{} */);
    1128     return ((signed int )___retval_main__i_1);
    1129 }
     1391    return ___retval_main__i_1;
     1392}
  • src/tests/.expect/castError.txt

    r78315272 r3f7e12cb  
    1 castError.c:7:1 error: Cannot choose between 3 alternatives for expression Cast of:
     1castError.c:7:1 error: Cannot choose between 3 alternatives for expression
     2Cast of:
    23  Name: f
     4... to:
     5  charAlternatives are:
     6Cost ( 1, 0, 0, 0 ): Cast of:
     7     Variable Expression: f: signed int
     8   ... to:
     9     char
     10 (types:
     11   char
     12 )
     13 Environment:
    314
    4 to:
    5   char
    6 Alternatives are:        Cost ( 1, 0, 0, 0 ): Cast of:
    7           Variable Expression: f: function
    8                 accepting unspecified arguments
    9               returning
    10                 nothing
     15Cost ( 1, 0, 0, 0 ): Cast of:
     16     Variable Expression: f: double
     17   ... to:
     18     char
     19 (types:
     20   char
     21 )
     22 Environment:
     23
     24Cost ( 1, 0, 0, 0 ): Cast of:
     25     Variable Expression: f: function
     26       accepting unspecified arguments
     27     ... returning nothing
     28
     29   ... to:
     30     char
     31 (types:
     32   char
     33 )
     34 Environment:
    1135
    1236
    13         to:
    14           char
    15 (types:
    16             char
    17 )
    18         Environment:
    19 
    20         Cost ( 1, 0, 0, 0 ): Cast of:
    21           Variable Expression: f: signed int
    22 
    23         to:
    24           char
    25 (types:
    26             char
    27 )
    28         Environment:
    29 
    30         Cost ( 1, 0, 0, 0 ): Cast of:
    31           Variable Expression: f: double
    32 
    33         to:
    34           char
    35 (types:
    36             char
    37 )
    38         Environment:
    39 
    40 
  • src/tests/.expect/scopeErrors.txt

    r78315272 r3f7e12cb  
    11scopeErrors.c:2:1 error: duplicate object definition for thisIsAnError: signed int
    22scopeErrors.c:20:1 error: duplicate function definition for butThisIsAnError: function
    3   with parameters
    4     double
    5   returning
    6     _retval_butThisIsAnError:       Attribute with name: unused
    7 double
    8   with body
    9     CompoundStmt
     3... with parameters
     4  double
     5... returning
     6  _retval_butThisIsAnError: double
     7  ... with attributes:
     8    Attribute with name: unused
    109
     10... with body
     11  CompoundStmt
     12
  • src/tests/Makefile.am

    r78315272 r3f7e12cb  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon Sep 11 16:17:16 2017
    14 ## Update Count     : 45
     13## Last Modified On : Tue Oct 10 14:04:40 2017
     14## Update Count     : 47
    1515###############################################################################
    1616
     
    2222concurrent = yes
    2323quick_test += coroutine thread monitor
    24 concurrent_test = coroutine thread monitor multi-monitor sched-int-barge sched-int-block sched-int-disjoint sched-int-wait sched-ext sched-ext-multi preempt
     24concurrent_test =               \
     25        coroutine               \
     26        fmtLines                \
     27        pingpong                \
     28        prodcons                \
     29        thread                  \
     30        matrixSum               \
     31        monitor                 \
     32        multi-monitor           \
     33        boundedBuffer           \
     34        preempt                 \
     35        sched-int-block         \
     36        sched-int-disjoint      \
     37        sched-int-wait          \
     38        sched-ext-barge         \
     39        sched-ext-dtor          \
     40        sched-ext-else          \
     41        sched-ext-parse         \
     42        sched-ext-recurse       \
     43        sched-ext-statment      \
     44        sched-ext-when
    2545else
    2646concurrent=no
     
    87107
    88108declarationSpecifier: declarationSpecifier.c @CFA_BINDIR@/@CFA_NAME@
    89         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     109        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    90110
    91111gccExtensions : gccExtensions.c @CFA_BINDIR@/@CFA_NAME@
    92         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     112        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    93113
    94114extension : extension.c @CFA_BINDIR@/@CFA_NAME@
    95         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     115        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    96116
    97117attributes : attributes.c @CFA_BINDIR@/@CFA_NAME@
    98         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     118        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    99119
    100120KRfunctions : KRfunctions.c @CFA_BINDIR@/@CFA_NAME@
    101         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     121        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    102122
    103123literals : literals.c @CFA_BINDIR@/@CFA_NAME@
    104         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     124        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     125
     126sched-ext-parse : sched-ext-parse.c @CFA_BINDIR@/@CFA_NAME@
     127        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    105128
    106129gmp : gmp.c @CFA_BINDIR@/@CFA_NAME@
     
    110133        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    111134
     135ctor-autogen-ERR1: ctor-autogen.c @CFA_BINDIR@/@CFA_NAME@
     136        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     137
    112138completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
    113139        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     140
     141typedefRedef-ERR1: typedefRedef.c @CFA_BINDIR@/@CFA_NAME@
     142        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
  • src/tests/Makefile.in

    r78315272 r3f7e12cb  
    320320@BUILD_CONCURRENCY_TRUE@concurrent = yes
    321321@BUILD_CONCURRENCY_FALSE@concurrent_test =
    322 @BUILD_CONCURRENCY_TRUE@concurrent_test = coroutine thread monitor multi-monitor sched-int-barge sched-int-block sched-int-disjoint sched-int-wait sched-ext sched-ext-multi preempt
     322@BUILD_CONCURRENCY_TRUE@concurrent_test = \
     323@BUILD_CONCURRENCY_TRUE@        coroutine               \
     324@BUILD_CONCURRENCY_TRUE@        fmtLines                \
     325@BUILD_CONCURRENCY_TRUE@        pingpong                \
     326@BUILD_CONCURRENCY_TRUE@        prodcons                \
     327@BUILD_CONCURRENCY_TRUE@        thread                  \
     328@BUILD_CONCURRENCY_TRUE@        matrixSum               \
     329@BUILD_CONCURRENCY_TRUE@        monitor                 \
     330@BUILD_CONCURRENCY_TRUE@        multi-monitor           \
     331@BUILD_CONCURRENCY_TRUE@        boundedBuffer           \
     332@BUILD_CONCURRENCY_TRUE@        preempt                 \
     333@BUILD_CONCURRENCY_TRUE@        sched-int-block         \
     334@BUILD_CONCURRENCY_TRUE@        sched-int-disjoint      \
     335@BUILD_CONCURRENCY_TRUE@        sched-int-wait          \
     336@BUILD_CONCURRENCY_TRUE@        sched-ext-barge         \
     337@BUILD_CONCURRENCY_TRUE@        sched-ext-dtor          \
     338@BUILD_CONCURRENCY_TRUE@        sched-ext-else          \
     339@BUILD_CONCURRENCY_TRUE@        sched-ext-parse         \
     340@BUILD_CONCURRENCY_TRUE@        sched-ext-recurse       \
     341@BUILD_CONCURRENCY_TRUE@        sched-ext-statment      \
     342@BUILD_CONCURRENCY_TRUE@        sched-ext-when
     343
    323344
    324345# applies to both programs
     
    839860
    840861declarationSpecifier: declarationSpecifier.c @CFA_BINDIR@/@CFA_NAME@
    841         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     862        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    842863
    843864gccExtensions : gccExtensions.c @CFA_BINDIR@/@CFA_NAME@
    844         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     865        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    845866
    846867extension : extension.c @CFA_BINDIR@/@CFA_NAME@
    847         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     868        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    848869
    849870attributes : attributes.c @CFA_BINDIR@/@CFA_NAME@
    850         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     871        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    851872
    852873KRfunctions : KRfunctions.c @CFA_BINDIR@/@CFA_NAME@
    853         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     874        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    854875
    855876literals : literals.c @CFA_BINDIR@/@CFA_NAME@
    856         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     877        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
     878
     879sched-ext-parse : sched-ext-parse.c @CFA_BINDIR@/@CFA_NAME@
     880        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    857881
    858882gmp : gmp.c @CFA_BINDIR@/@CFA_NAME@
     
    862886        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    863887
     888ctor-autogen-ERR1: ctor-autogen.c @CFA_BINDIR@/@CFA_NAME@
     889        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     890
    864891completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
     892        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     893
     894typedefRedef-ERR1: typedefRedef.c @CFA_BINDIR@/@CFA_NAME@
    865895        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    866896
  • src/tests/coroutine.c

    r78315272 r3f7e12cb  
    1010// Created On       : Thu Jun  8 07:29:37 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun  8 07:37:12 2017
    13 // Update Count     : 5
     12// Last Modified On : Sun Sep 17 21:38:15 2017
     13// Update Count     : 7
    1414//
    1515
     
    1818
    1919coroutine Fibonacci {
    20         int fn;                                         // used for communication
     20        int fn;                                                                                         // used for communication
    2121};
    2222
     
    2626
    2727void main( Fibonacci & this ) {
    28         int fn1, fn2;                                   // retained between resumes
    29         this.fn = 0;                                    // case 0
     28        int fn1, fn2;                                                                           // retained between resumes
     29        this.fn = 0;                                                                            // case 0
    3030        fn1 = this.fn;
    31         suspend();                                              // return to last resume
     31        suspend();                                                                                      // restart last resume
    3232
    33         this.fn = 1;                                    // case 1
    34         fn2 = fn1;
    35         fn1 = this.fn;
    36         suspend();                                              // return to last resume
     33        this.fn = 1;                                                                            // case 1
     34        fn2 = fn1;  fn1 = this.fn;
     35        suspend();                                                                                      // restart last resume
    3736
    38         for ( ;; ) {                                    // general case
     37        for ( ;; ) {                                                                            // general case
    3938                this.fn = fn1 + fn2;
    40                 fn2 = fn1;
    41                 fn1 = this.fn;
    42                 suspend();                                      // return to last resume
     39                fn2 = fn1;  fn1 = this.fn;
     40                suspend();                                                                              // restart last resume
    4341        } // for
    4442}
    4543
    4644int next( Fibonacci & this ) {
    47         resume( this );                                 // transfer to last suspend
     45        resume( this );                                                                         // restart last suspend
    4846        return this.fn;
    4947}
     
    5250        Fibonacci f1, f2;
    5351        for ( int i = 1; i <= 10; i += 1 ) {
    54                 sout | next( f1 ) | ' ' | next( f2 ) | endl;
     52                sout | next( f1 ) | next( f2 ) | endl;
    5553        } // for
    5654}
  • src/tests/fmtLines.c

    r78315272 r3f7e12cb  
    1010// Created On       : Sun Sep 17 21:56:15 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 18 11:35:57 2017
    13 // Update Count     : 31
     12// Last Modified On : Sun Oct  1 11:57:19 2017
     13// Update Count     : 34
    1414//
    1515
     
    2323
    2424void ?{}( Format & fmt ) {
    25     resume( fmt );                                                                              // start coroutine
     25        resume( fmt );                                                                          // prime (start) coroutine
    2626}
    2727
    2828void ^?{}( Format & fmt ) {
    29     if ( fmt.g != 0 || fmt.b != 0 ) sout | endl;
     29        if ( fmt.g != 0 || fmt.b != 0 ) sout | endl;
    3030}
    3131
     
    4747
    4848void prt( Format & fmt, char ch ) {
    49     fmt.ch = ch;
    50     resume( fmt );
     49        fmt.ch = ch;
     50        resume( fmt );
    5151} // prt
    5252
    5353int main() {
    54         Format fmt;
     54        Format fmt;                                                                                     // format characters into blocks of 4 and groups of 5 blocks per line
    5555        char ch;
    5656
    57         for ( ;; ) {
     57        Eof: for ( ;; ) {                                                                       // read until end of file
    5858                sin | ch;                                                                               // read one character
    59           if ( eof( sin ) ) break;                                                      // eof ?
    60                 prt( fmt, ch );
     59          if ( eof( sin ) ) break Eof;                                          // eof ?
     60                prt( fmt, ch );                                                                 // push character for formatting
    6161        } // for
    6262} // main
  • src/tests/gmp.c

    r78315272 r3f7e12cb  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep  4 09:51:18 2017
    13 // Update Count     : 550
     12// Last Modified On : Thu Sep 28 18:33:51 2017
     13// Update Count     : 555
    1414//
    1515
     
    9797
    9898        sout | "Factorial Numbers" | endl;
    99         Int fact;
    100         fact = 1;                                                                                       // 1st case
     99        Int fact = 1;                                                                           // 1st case
    101100        sout | (int)0 | fact | endl;
    102101        for ( unsigned int i = 1; i <= 40; i += 1 ) {
  • src/tests/literals.c

    r78315272 r3f7e12cb  
    1010// Created On       : Sat Sep  9 16:34:38 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Sep 12 07:45:46 2017
    13 // Update Count     : 88
     12// Last Modified On : Mon Sep 25 20:26:00 2017
     13// Update Count     : 132
    1414//
    1515
    1616#ifdef __CFA__
     17#include <stdint.h>
    1718#include <fstream>
    1819
     
    7273
    7374         0123456789.e-09;   0123456789.e-09f;   0123456789.e-09l;   0123456789.e-09F;   0123456789.e-09L;   0123456789.e-09DL;
    74         -0123456789.e-09;  -0123456789.e-09f;  -0123456789.e-09l;  -0123456789.e-09F;  -0123456789.e-09L;  -0123456789.e-09DL;
     75        +0123456789.e-09;  +0123456789.e-09f;  +0123456789.e-09l;  +0123456789.e-09F;  +0123456789.e-09L;  +0123456789.e-09DL;
    7576        -0123456789.e-09;  -0123456789.e-09f;  -0123456789.e-09l;  -0123456789.e-09F;  -0123456789.e-09L;  -0123456789.e-09DL;
    7677
     
    104105
    105106         0123456789.0123456789E-09;   0123456789.0123456789E-09f;   0123456789.0123456789E-09l;   0123456789.0123456789E-09F;   0123456789.0123456789E-09L;   0123456789.0123456789E-09DL;
    106         -0123456789.0123456789E-09;  -0123456789.0123456789E-09f;  -0123456789.0123456789E-09l;  -0123456789.0123456789E-09F;  -0123456789.0123456789E-09L;  -0123456789.0123456789E-09DL;
     107        +0123456789.0123456789E-09;  +0123456789.0123456789E-09f;  +0123456789.0123456789E-09l;  +0123456789.0123456789E-09F;  +0123456789.0123456789E-09L;  +0123456789.0123456789E-09DL;
    107108        -0123456789.0123456789E-09;  -0123456789.0123456789E-09f;  -0123456789.0123456789E-09l;  -0123456789.0123456789E-09F;  -0123456789.0123456789E-09L;  -0123456789.0123456789E-09DL;
    108109
     
    118119
    119120         0x0123456789.p-09;   0x0123456789.p-09f;   0x0123456789.p-09l;   0x0123456789.p-09F;   0x0123456789.p-09L;
    120         -0x0123456789.p-09;  -0x0123456789.p-09f;  -0x0123456789.p-09l;  -0x0123456789.p-09F;  -0x0123456789.p-09L;
     121        +0x0123456789.p-09;  +0x0123456789.p-09f;  +0x0123456789.p-09l;  +0x0123456789.p-09F;  +0x0123456789.p-09L;
    121122        -0x0123456789.p-09;  -0x0123456789.p-09f;  -0x0123456789.p-09l;  -0x0123456789.p-09F;  -0x0123456789.p-09L;
    122123
     
    130131
    131132         0x.0123456789P-09;   0x.0123456789P-09f;   0x.0123456789P-09l;   0x.0123456789P-09F;   0x.0123456789P-09L;
    132         -0x.0123456789P-09;  -0x.0123456789P-09f;  -0x.0123456789P-09l;  -0x.0123456789P-09F;  -0x.0123456789P-09L;
     133        +0x.0123456789P-09;  +0x.0123456789P-09f;  +0x.0123456789P-09l;  +0x.0123456789P-09F;  +0x.0123456789P-09L;
    133134        -0x.0123456789P-09;  -0x.0123456789P-09f;  -0x.0123456789P-09l;  -0x.0123456789P-09F;  -0x.0123456789P-09L;
    134135
     
    142143
    143144         0X0123456789.0123456789P-09;   0X0123456789.0123456789P-09f;   0X0123456789.0123456789P-09l;   0X0123456789.0123456789P-09F;   0X0123456789.0123456789P-09L;
     145        +0X0123456789.0123456789P-09;  +0X0123456789.0123456789P-09f;  +0X0123456789.0123456789P-09l;  +0X0123456789.0123456789P-09F;  +0X0123456789.0123456789P-09L;
    144146        -0X0123456789.0123456789P-09;  -0X0123456789.0123456789P-09f;  -0X0123456789.0123456789P-09l;  -0X0123456789.0123456789P-09F;  -0X0123456789.0123456789P-09L;
    145         -0X0123456789.0123456789P-09;  -0X0123456789.0123456789P-09f;  -0X0123456789.0123456789P-09l;  -0X0123456789.0123456789P-09F;  -0X0123456789.0123456789P-09L;
     147
     148#ifdef __CFA__
     149// fixed-size length
     150
     151        // octal
     152         01234567_l8;   01234567_l16;   01234567_l32;   01234567_l64;   01234567_l128;   01234567_l8u;   01234567_ul16;   01234567_l32u;   01234567_ul64;   01234567_ul128;
     153        +01234567_l8;  +01234567_l16;  +01234567_l32;  +01234567_l64;  +01234567_l128;  +01234567_l8u;  +01234567_ul16;  +01234567_l32u;  +01234567_ul64;  +01234567_ul128;
     154        -01234567_l8;  -01234567_l16;  -01234567_l32;  -01234567_l64;  -01234567_l128;  -01234567_l8u;  -01234567_ul16;  -01234567_l32u;  -01234567_ul64;  -01234567_ul128;
     155
     156        // decimal
     157         1234567890L8;   1234567890L16;   1234567890l32;   1234567890l64;   1234567890l128;   1234567890UL8;   1234567890L16U;   1234567890Ul32;   1234567890l64u;   1234567890l128u;
     158        +1234567890L8;  +1234567890L16;  +1234567890l32;  +1234567890l64;  +1234567890l128;  +1234567890UL8;  +1234567890L16U;  +1234567890Ul32;  +1234567890l64u;  +1234567890l128u;
     159        -1234567890L8;  -1234567890L16;  -1234567890l32;  -1234567890l64;  -1234567890l128;  -1234567890UL8;  -1234567890L16U;  -1234567890Ul32;  -1234567890l64u;  -1234567890l128u;
     160
     161        // hexadecimal
     162         0x0123456789abcdef_l8;   0x0123456789abcdef_l16;   0x0123456789abcdefl32;   0x0123456789abcdefl64;   0x0123456789abcdef_ul8;   0x0123456789abcdef_l16u;   0x0123456789abcdeful32;   0x0123456789abcdefl64u;
     163        +0x0123456789abcdef_l8;  +0x0123456789abcdef_l16;  +0x0123456789abcdefl32;  +0x0123456789abcdefl64;  +0x0123456789abcdef_ul8;  +0x0123456789abcdef_l16u;  +0x0123456789abcdeful32;  +0x0123456789abcdefl64u;
     164        -0x0123456789abcdef_l8;  -0x0123456789abcdef_l16;  -0x0123456789abcdefl32;  -0x0123456789abcdefl64;  -0x0123456789abcdef_ul8;  -0x0123456789abcdef_l16u;  -0x0123456789abcdeful32;  -0x0123456789abcdefl64u;
     165
     166         0x0123456789ABCDEF_l8;   0x0123456789ABCDEF_l16;   0x0123456789ABCDEFl32;   0x0123456789ABCDEFl64;   0x0123456789ABCDEF_ul8;   0x0123456789ABCDEF_l16u;   0x0123456789ABCDEFul32;   0x0123456789ABCDEFl64u;
     167        +0x0123456789ABCDEF_l8;  +0x0123456789ABCDEF_l16;  +0x0123456789ABCDEFl32;  +0x0123456789ABCDEFl64;  +0x0123456789ABCDEF_ul8;  +0x0123456789ABCDEF_l16u;  +0x0123456789ABCDEFul32;  +0x0123456789ABCDEFl64u;
     168        -0x0123456789ABCDEF_l8;  -0x0123456789ABCDEF_l16;  -0x0123456789ABCDEFl32;  -0x0123456789ABCDEFl64;  -0x0123456789ABCDEF_ul8;  -0x0123456789ABCDEF_l16u;  -0x0123456789ABCDEFul32;  -0x0123456789ABCDEFl64u;
     169
     170         0X0123456789abcdef_l8;   0X0123456789abcdef_l16;   0X0123456789abcdefl32;   0X0123456789abcdefl64;   0X0123456789abcdef_ul8;   0X0123456789abcdef_l16u;   0X0123456789abcdeful32;   0X0123456789abcdefl64u;
     171        +0X0123456789abcdef_l8;  +0X0123456789abcdef_l16;  +0X0123456789abcdefl32;  +0X0123456789abcdefl64;  +0X0123456789abcdef_ul8;  +0X0123456789abcdef_l16u;  +0X0123456789abcdeful32;  +0X0123456789abcdefl64u;
     172        -0X0123456789abcdef_l8;  -0X0123456789abcdef_l16;  -0X0123456789abcdefl32;  -0X0123456789abcdefl64;  -0X0123456789abcdef_ul8;  -0X0123456789abcdef_l16u;  -0X0123456789abcdeful32;  -0X0123456789abcdefl64u;
     173
     174         0X0123456789ABCDEF_l8;   0X0123456789ABCDEF_l16;   0X0123456789ABCDEFl32;   0X0123456789ABCDEFl64;   0X0123456789ABCDEF_ul8;   0X0123456789ABCDEF_l16u;   0X0123456789ABCDEFul32;   0X0123456789ABCDEFl64u;
     175        +0X0123456789ABCDEF_l8;  +0X0123456789ABCDEF_l16;  +0X0123456789ABCDEFl32;  +0X0123456789ABCDEFl64;  +0X0123456789ABCDEF_ul8;  +0X0123456789ABCDEF_l16u;  +0X0123456789ABCDEFul32;  +0X0123456789ABCDEFl64u;
     176        -0X0123456789ABCDEF_l8;  -0X0123456789ABCDEF_l16;  -0X0123456789ABCDEFl32;  -0X0123456789ABCDEFl64;  -0X0123456789ABCDEF_ul8;  -0X0123456789ABCDEF_l16u;  -0X0123456789ABCDEFul32;  -0X0123456789ABCDEFl64u;
     177
     178        // floating
     179         0123456789.l32;   0123456789.l64;   0123456789.l80;   0123456789.l128;
     180        +0123456789.l32;  +0123456789.l64;  +0123456789.l80;  +0123456789.l128;
     181        -0123456789.l32;  -0123456789.l64;  -0123456789.l80;  -0123456789.l128;
     182
     183         0123456789.e09L32;    0123456789.e09L64;    0123456789.e09L80;    0123456789.e09L128;
     184        +0123456789.e+09L32;  +0123456789.e+09L64;  +0123456789.e+09L80;  +0123456789.e+09L128;
     185        -0123456789.e-09L32;  -0123456789.e-09L64;  -0123456789.e-09L80;  -0123456789.e-09L128;
     186
     187         .0123456789e09L32;    .0123456789e09L64;    .0123456789e09L80;    .0123456789e09L128;
     188        +.0123456789E+09L32;  +.0123456789E+09L64;  +.0123456789E+09L80;  +.0123456789E+09L128;
     189        -.0123456789E-09L32;  -.0123456789E-09L64;  -.0123456789E-09L80;  -.0123456789E-09L128;
     190
     191         0123456789.0123456789L32;       0123456789.0123456789L64;       0123456789.0123456789L80;       0123456789.0123456789L128;
     192        +0123456789.0123456789E09L32;   +0123456789.0123456789E09L64;   +0123456789.0123456789E09L80;   +0123456789.0123456789E09L128;
     193        -0123456789.0123456789E+09L32;  -0123456789.0123456789E+09L64;  -0123456789.0123456789E+09L80;  -0123456789.0123456789E+09L128;
     194         0123456789.0123456789E-09L32;   0123456789.0123456789E-09L64;   0123456789.0123456789E-09L80;   0123456789.0123456789E-09L128;
     195       
     196         0x0123456789.p09l32;   0x0123456789.p09l64;   0x0123456789.p09l80;   0x0123456789.p09l128;
     197        +0x0123456789.p09l32;  +0x0123456789.p09l64;  +0x0123456789.p09l80;  +0x0123456789.p09l128;
     198        -0x0123456789.p09l32;  -0x0123456789.p09l64;  -0x0123456789.p09l80;  -0x0123456789.p09l128;
     199
     200         0x0123456789.p+09l32;   0x0123456789.p+09L64;   0x0123456789.p+09L80;   0x0123456789.p+09L128;
     201        +0x0123456789.p-09l32;  +0x0123456789.p-09L64;  +0x0123456789.p-09L80;  +0x0123456789.p-09L128;
     202        -0x.0123456789p09l32;   -0x.0123456789p09L64;   -0x.0123456789p09L80;   -0x.0123456789p09L128;
    146203
    147204// char, short, int suffix overloading
    148205
    149 #ifdef __CFA__
    150206        f( 'a' );
    151207        f( 20_hh );
  • src/tests/prodcons.c

    r78315272 r3f7e12cb  
    1010// Created On       : Mon Sep 18 12:23:39 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 20 17:03:28 2017
    13 // Update Count     : 40
     12// Last Modified On : Mon Oct 30 23:06:05 2017
     13// Update Count     : 42
    1414//
    1515
    1616#include <fstream>
    1717#include <coroutine>
    18 #include <stdlib>                                                                               // rand48
     18#include <stdlib>                                                                               // random
    1919#include <unistd.h>                                                                             // getpid
    2020
     
    3030        // 1st resume starts here
    3131        for ( int i = 0; i < prod.N; i += 1 ) {
    32                 int p1 = (unsigned int)rand48() % 100;                  // non-negative
    33                 int p2 = (unsigned int)rand48() % 100;
     32                int p1 = random( 100 );
     33                int p2 = random( 100 );
    3434                sout | p1 | " " | p2 | endl;
    3535                int status = delivery( *prod.c, p1, p2 );
     
    9090        Prod prod;
    9191        Cons cons = { prod };
    92         rand48seed( /* getpid() */ 103 );                                       // fixed seed for testing
     92        random_seed( /* getpid() */ 103 );                                      // fixed seed for testing
    9393        start( prod, 5, cons );
    9494        sout | "main stops" | endl;
  • src/tests/random.c

    r78315272 r3f7e12cb  
    1010// Created On       : Tue Jul  5 21:29:30 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul  6 18:00:29 2016
    13 // Update Count     : 3
     12// Last Modified On : Mon Oct 30 23:06:49 2017
     13// Update Count     : 6
    1414//
    1515
     
    1919
    2020int main() {
    21         //rand48seed( getpid() );                                                               // set random seed
    22         rand48seed( 1003 );                                                                     // fixed seed for repeatable tests
     21        //srandom( getpid() );                                                          // set random seed
     22        random_seed( 1003 );                                                            // fixed seed for repeatable tests
    2323
    2424        // test polymorphic calls to random and stream
    25         char c = rand48();
     25        char c = random();
    2626        sout | c | endl;
    27         int i = rand48();
     27        int i = random();
    2828    sout | i | endl;
    29         unsigned int ui = rand48();
     29        unsigned int ui = random();
    3030    sout | ui | endl;
    31         long int li = rand48();
     31        long int li = random();
    3232    sout | li | endl;
    33         unsigned long int uli = rand48();
     33        unsigned long int uli = random();
    3434    sout | uli | endl;
    35     float f = rand48();
     35    float f = random();
    3636    sout | f | endl;
    37     double d = rand48();
     37    double d = random();
    3838    sout | d | endl;
    39     float _Complex fc = rand48();
     39    float _Complex fc = random();
    4040    sout | fc | endl;
    41     double _Complex dc = rand48();
     41    double _Complex dc = random();
    4242    sout | dc | endl;
    43     long double _Complex ldc = rand48();
     43    long double _Complex ldc = random();
    4444    sout | ldc | endl;
    4545} // main
  • src/tests/rational.c

    r78315272 r3f7e12cb  
    1010// Created On       : Mon Mar 28 08:43:12 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 23 21:40:11 2017
    13 // Update Count     : 66
     12// Last Modified On : Tue Oct 10 23:25:04 2017
     13// Update Count     : 67
    1414//
    1515
  • src/tests/sched-ext-parse.c

    r78315272 r3f7e12cb  
     1//----------------------------------------------------------------------------------------
     2//----------------------------------------------------------------------------------------
     3//
     4//              DEPRECATED TEST
     5//              DIFFERS BETWEEN DEBUG AND RELEASE
     6//
     7//----------------------------------------------------------------------------------------
     8//----------------------------------------------------------------------------------------
     9
    110#include <monitor>
    211
     
    8089                16;
    8190        }
    82         or waitfor( f1, a, a ) {
     91        or waitfor( f2, a, a ) {
    8392                17;
    8493        }
  • src/tests/sched-ext.c

    r78315272 r3f7e12cb  
    2626volatile bool done;
    2727
    28 unsigned rand10() {
    29         return (unsigned)rand48() % 10;
    30 }
    31 
    3228//----------------------------------------------------------------------------------------------------
    3329// Acceptor
     
    3632void do_wait( global_t * mutex a ) {
    3733        sout | "Waiting to accept" | endl;
    38         yield( rand10() );
     34        yield( random( 10 ) );
    3935
    4036        sout | "Accepting" | endl;
     
    4541        acceptable.monitors      = &a;
    4642
    47         __accept_internal( 1, &acceptable );
     43        __waitfor_internal( 1, &acceptable );
    4844
    4945        sout | "Accepted" | endl;
    50         yield( rand10() );
     46        yield( random( 10 ) );
    5147}
    5248
     
    6864void main( Acceptee* this ) {
    6965        while( !done ) {
    70                 yield( rand10() );
     66                yield( random( 10 ) );
    7167                do_notify( &globalA );
    72                 yield( rand10() );
     68                yield( random( 10 ) );
    7369        }
    7470}
     
    7874int main(int argc, char* argv[]) {
    7975        done = false;
    80         rand48seed( time( NULL ) );
     76        random_seed( time( NULL ) );
    8177        printf("%p\n", &globalA);
    8278        sout | "Starting" | endl;
  • src/tests/sched-int-barge.c

    r78315272 r3f7e12cb  
     1//----------------------------------------------------------------------------------------
     2//----------------------------------------------------------------------------------------
     3//
     4//              DEPRECATED TEST
     5//
     6//----------------------------------------------------------------------------------------
     7//----------------------------------------------------------------------------------------
     8
    19#include <fstream>
    210#include <kernel>
     
    5664
    5765        if( action == 0 ) {
    58                 c.do_signal = max( ((unsigned)rand48()) % 10, 1);
    59                 c.do_wait1 = ((unsigned)rand48()) % (c.do_signal);
    60                 c.do_wait2 = ((unsigned)rand48()) % (c.do_signal);
     66                c.do_signal = max( random( 10 ), 1);
     67                c.do_wait1 = random( c.do_signal );
     68                c.do_wait2 = random( c.do_signal );
    6169
    6270                if(c.do_wait1 == c.do_wait2) sout | "Same" | endl;
     
    6573        if( action == c.do_wait1 || action == c.do_wait2 ) {
    6674                c.state = WAIT;
    67                 wait( &cond );
     75                wait( cond );
    6876
    6977                if(c.state != SIGNAL) {
     
    7583                c.state = SIGNAL;
    7684
    77                 signal( &cond );
    78                 signal( &cond );
     85                signal( cond );
     86                signal( cond );
    7987        }
    8088        else {
     
    101109
    102110int main(int argc, char* argv[]) {
    103         rand48seed(0);
     111        random_seed(0);
    104112        processor p;
    105113        {
  • src/tests/sched-int-block.c

    r78315272 r3f7e12cb  
     1//---------------------------------------------------------
     2// Barging test
     3// Ensures that no barging can occur between :
     4//   - the frontend of the signal_block and the signaled thread
     5//   - the signaled  threadand the backend of the signal_block
     6//---------------------------------------------------------
     7
     8
    19#include <fstream>
    210#include <kernel>
     
    3947//------------------------------------------------------------------------------
    4048void wait_op( global_data_t & mutex a, global_data_t & mutex b, unsigned i ) {
    41         wait( &cond, (uintptr_t)this_thread );
     49        wait( cond, (uintptr_t)this_thread );
    4250
    43         yield( ((unsigned)rand48()) % 10 );
     51        yield( random( 10 ) );
    4452
    4553        if(a.last_thread != a.last_signaller || b.last_thread != b.last_signaller ) {
     
    5058        a.last_thread = b.last_thread = this_thread;
    5159
    52         yield( ((unsigned)rand48()) % 10 );
     60        yield( random( 10 ) );
    5361}
    5462
     
    6270//------------------------------------------------------------------------------
    6371void signal_op( global_data_t & mutex a, global_data_t & mutex b ) {
    64         yield( ((unsigned)rand48()) % 10 );
     72        yield( random( 10 ) );
    6573
    6674        [a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = this_thread;
    6775
    68         if( !is_empty( &cond ) ) {
     76        if( !is_empty( cond ) ) {
    6977
    70                 thread_desc * next = front( &cond );
     78                thread_desc * next = front( cond );
    7179
    72                 if( ! signal_block( &cond ) ) {
     80                if( ! signal_block( cond ) ) {
    7381                        sout | "ERROR expected to be able to signal" | endl;
    7482                        abort();
    7583                }
    7684
    77                 yield( ((unsigned)rand48()) % 10 );
     85                yield( random( 10 ) );
    7886
    7987                if(a.last_thread != next || b.last_thread != next) {
     
    110118
    111119int main(int argc, char* argv[]) {
    112         rand48seed( time( NULL ) );
     120        random_seed( time( NULL ) );
    113121        done = false;
    114122        processor p;
  • src/tests/sched-int-disjoint.c

    r78315272 r3f7e12cb  
    5959// Waiting logic
    6060bool wait( global_t & mutex m, global_data_t & mutex d ) {
    61         wait( &cond );
     61        wait( cond );
    6262        if( d.state != SIGNAL ) {
    6363                sout | "ERROR barging!" | endl;
     
    8080//------------------------------------------------------------------------------
    8181// Signalling logic
    82 void signal( condition * cond, global_t & mutex a, global_data_t & mutex b ) {
     82void signal( condition & cond, global_t & mutex a, global_data_t & mutex b ) {
    8383        b.state = SIGNAL;
    8484        signal( cond );
     
    8686
    8787void logic( global_t & mutex a ) {
    88         signal( &cond, a, data );
     88        signal( cond, a, data );
    8989
    90         yield( (unsigned)rand48() % 10 );
     90        yield( random( 10 ) );
    9191
    9292        //This is technically a mutual exclusion violation but the mutex monitor protects us
     
    109109// Main loop
    110110int main(int argc, char* argv[]) {
    111         rand48seed( time( NULL ) );
     111        random_seed( time( NULL ) );
    112112        all_done = false;
    113113        processor p;
  • src/tests/sched-int-wait.c

    r78315272 r3f7e12cb  
     1//---------------------------------------------------------
     2// Multi wait test
     3// Ensures that no deadlock from waiting/signalling conditions
     4//---------------------------------------------------------
     5
     6
    17#include <fstream>
    28#include <kernel>
     
    3541//----------------------------------------------------------------------------------------------------
    3642// Tools
    37 void signal( condition * cond, global_t & mutex a, global_t & mutex b ) {
     43void signal( condition & cond, global_t & mutex a, global_t & mutex b ) {
    3844        signal( cond );
    3945}
    4046
    41 void signal( condition * cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {
     47void signal( condition & cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {
    4248        signal( cond );
    4349}
    4450
    45 void wait( condition * cond, global_t & mutex a, global_t & mutex b ) {
     51void wait( condition & cond, global_t & mutex a, global_t & mutex b ) {
    4652        wait( cond );
    4753}
    4854
    49 void wait( condition * cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {
     55void wait( condition & cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {
    5056        wait( cond );
    5157}
     
    5662
    5763        while( waiter_left != 0 ) {
    58                 unsigned action = (unsigned)rand48() % 4;
     64                unsigned action = random( 4 );
    5965                switch( action ) {
    6066                        case 0:
    61                                 signal( &condABC, globalA, globalB, globalC );
     67                                signal( condABC, globalA, globalB, globalC );
    6268                                break;
    6369                        case 1:
    64                                 signal( &condAB , globalA, globalB );
     70                                signal( condAB , globalA, globalB );
    6571                                break;
    6672                        case 2:
    67                                 signal( &condBC , globalB, globalC );
     73                                signal( condBC , globalB, globalC );
    6874                                break;
    6975                        case 3:
    70                                 signal( &condAC , globalA, globalC );
     76                                signal( condAC , globalA, globalC );
    7177                                break;
    7278                        default:
     
    8288void main( WaiterABC & this ) {
    8389        for( int i = 0; i < N; i++ ) {
    84                 wait( &condABC, globalA, globalB, globalC );
     90                wait( condABC, globalA, globalB, globalC );
    8591        }
    8692
     
    9298void main( WaiterAB & this ) {
    9399        for( int i = 0; i < N; i++ ) {
    94                 wait( &condAB , globalA, globalB );
     100                wait( condAB , globalA, globalB );
    95101        }
    96102
     
    102108void main( WaiterAC & this ) {
    103109        for( int i = 0; i < N; i++ ) {
    104                 wait( &condAC , globalA, globalC );
     110                wait( condAC , globalA, globalC );
    105111        }
    106112
     
    112118void main( WaiterBC & this ) {
    113119        for( int i = 0; i < N; i++ ) {
    114                 wait( &condBC , globalB, globalC );
     120                wait( condBC , globalB, globalC );
    115121        }
    116122
     
    121127// Main
    122128int main(int argc, char* argv[]) {
    123         rand48seed( time( NULL ) );
     129        random_seed( time( NULL ) );
    124130        waiter_left = 4;
    125131        processor p[2];
  • src/tests/thread.c

    r78315272 r3f7e12cb  
    1515                yield();
    1616        }
    17         V(this.lock);
     17        V(*this.lock);
    1818}
    1919
    2020void main(Second& this) {
    21         P(this.lock);
     21        P(*this.lock);
    2222        for(int i = 0; i < 10; i++) {
    2323                sout | "Second : Suspend No." | i + 1 | endl;
Note: See TracChangeset for help on using the changeset viewer.