Changes in / [85034ed:8cbe732]


Ignore:
Files:
15 added
63 edited

Legend:

Unmodified
Added
Removed
  • Jenkins/FullBuild

    r85034ed r8cbe732  
    2525                                        gcc_08_x64_new: { trigger_build( 'gcc-8',   'x64', false ) },
    2626                                        gcc_07_x64_new: { trigger_build( 'gcc-7',   'x64', false ) },
    27                                         // gcc_06_x64_new: { trigger_build( 'gcc-6',   'x64', false ) },
     27                                        gcc_11_arm64_new: { trigger_build( 'gcc-11',  'arm64', false ) },
     28                                        gcc_10_arm64_new: { trigger_build( 'gcc-10',  'arm64', false ) },
     29                                        gcc_09_arm64_new: { trigger_build( 'gcc-9',   'arm64', false ) },
     30                                        // gcc_06_arm64_new: { trigger_build( 'gcc-6',   'arm64', false ) },
    2831                                        clang_x64_new:  { trigger_build( 'clang',   'x64', true  ) },
    2932                                )
  • Jenkins/TestRegen

    r85034ed r8cbe732  
    2424                stage('Building x64') {
    2525                        regen_tests('x86_64')
     26                }
     27
     28                stage('Building arm64') {
     29                        regen_tests('arm64')
    2630                }
    2731
  • Jenkinsfile

    r85034ed r8cbe732  
    327327                        case 'x86':
    328328                                this.Architecture = new Arch_Desc('x86', '--host=i386', 'x86')
     329                        break
     330                        case 'arm64':
     331                                this.Architecture = new Arch_Desc('arm64', '--host=aarch64', 'arm64')
    329332                        break
    330333                        default :
     
    377380                                        description: 'The target architecture',                 \
    378381                                        name: 'Architecture',                                   \
    379                                         choices: 'x64\nx86',                                    \
     382                                        choices: 'x64\nx86\narm64',                             \
    380383                                        defaultValue: 'x64',                                    \
    381384                                ],                                                              \
  • doc/LaTeXmacros/common.sty

    r85034ed r8cbe732  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Sun Jul 16 08:28:52 2023
    14 %% Update Count     : 586
     13%% Last Modified On : Fri Sep 29 16:48:59 2023
     14%% Update Count     : 587
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    272272\setlength{\gcolumnposn}{2.75in}
    273273\setlength{\columnposn}{\gcolumnposn}
     274\newcommand{\setgcolumn}[1]{\global\gcolumnposn=#1\global\columnposn=\gcolumnposn}
    274275\newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}}
    275276\newcommand{\CRT}{\global\columnposn=\gcolumnposn}
     
    302303literate=
    303304  {-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1
    304   {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
     305  {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
    305306  {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1
    306307  {`}{\ttfamily\upshape\hspace*{-0.3ex}`}1
  • doc/LaTeXmacros/common.tex

    r85034ed r8cbe732  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Fri Jul 21 09:02:00 2023
    14 %% Update Count     : 576
     13%% Last Modified On : Fri Sep 29 16:49:02 2023
     14%% Update Count     : 590
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    275275\setlength{\gcolumnposn}{2.75in}
    276276\setlength{\columnposn}{\gcolumnposn}
     277\newcommand{\setgcolumn}[1]{\global\gcolumnposn=#1\global\columnposn=\gcolumnposn}
    277278\newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}}
    278279\newcommand{\CRT}{\global\columnposn=\gcolumnposn}
     
    301302showlines=true,                                                 % show blank lines at end of code
    302303aboveskip=4pt,                                                  % spacing above/below code block
    303 belowskip=0pt,
     304belowskip=2pt,
    304305numberstyle=\footnotesize\sf,                   % numbering style
    305306% replace/adjust listing characters that look bad in sanserif
    306307literate=
    307308  {-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1
    308   {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
     309  {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
    309310  {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1
    310311  {`}{\ttfamily\upshape\hspace*{-0.3ex}`}1
  • doc/LaTeXmacros/lstlang.sty

    r85034ed r8cbe732  
    88%% Created On       : Sat May 13 16:34:42 2017
    99%% Last Modified By : Peter A. Buhr
    10 %% Last Modified On : Tue May  2 08:52:35 2023
    11 %% Update Count     : 30
     10%% Last Modified On : Thu Sep 21 08:40:05 2023
     11%% Update Count     : 31
    1212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1313
     
    134134        morekeywords={
    135135                _Accept, _AcceptReturn, _AcceptWait, _Actor, _At, _Catch, _CatchResume, _CorActor, _Cormonitor, _Coroutine,
    136                 _Disable, _Else, _Enable, _Event, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
     136                _Disable, _Else, _Enable, _Event, _Exception, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
    137137                _Resume, _ResumeTop, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw},
    138138}
  • doc/bibliography/pl.bib

    r85034ed r8cbe732  
    41134113    title       = {High-Performance Extended Actors},
    41144114    journal     = spe,
    4115     year        = 2022,
    4116     note        = {submitted July 2022},
     4115    year        = 2023,
     4116    month       = sep,
     4117    note        = {\url{https://onlinelibrary.wiley.com/doi/pdf/10.1002/spe.3262}}
    41174118}
    41184119
  • doc/user/user.tex

    r85034ed r8cbe732  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Thu Aug 10 21:24:07 2023
    14 %% Update Count     : 5570
     13%% Last Modified On : Sat Sep 30 22:46:19 2023
     14%% Update Count     : 5658
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    6565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    6666
    67 \setlength{\gcolumnposn}{3in}
    6867\CFAStyle                                                                                               % use default CFA format-style
     68\setgcolumn{2.25in}
    6969%\lstset{language=CFA}                                                                  % CFA default lnaguage
    7070\lstnewenvironment{C++}[1][]                            % use C++ style
     
    224224\setlength{\tabcolsep}{10pt}
    225225\begin{tabular}{@{}rcccccccc@{}}
    226                 & 2021  & 2016  & 2011  & 2006  & 2001  & 1996  & 1991  & 1986  \\ \hline
    227 \RB{C}  & \RB{1}& \RB{2}& \RB{2}& \RB{1}& \RB{1}& \RB{1}& \RB{1}& \RB{1}\\
    228 Java    & 2             & 1             & 1             & 2             & 3             & 28    & -             & -             \\
    229 Python  & 3             & 5             & 6             & 7             & 23    & 13    & -             & -             \\
    230 \CC             & 4             & 3             & 3             & 3             & 2             & 2             & 2             & 8             \\
     226                & 2023  & 2018  & 2013  & 2008  & 2003  & 1998  & 1993  & 1988  \\ \hline
     227Python  & 1             & 4             & 8             & 7             & 12    & 25    & 18    & -             \\
     228\RB{C}  & \RB{2}& \RB{2}& \RB{1}& \RB{2}& \RB{2}& \RB{1}& \RB{1}& \RB{1}\\
     229C++             & 3             & 3             & 4             & 4             & 3             & 2             & 2             & 4             \\
     230Java    & 4             & 1             & 2             & 1             & 1             & 18    & -             & -             \\
    231231\end{tabular}
    232232\end{center}
     
    465465\Indexc{-h}\index{translator option!-h@{©-h©}}, \Indexc{--help}\index{translator option!--help@{©--help©}} \, print translator help message
    466466\item
     467\Indexc{-i}\index{translator option!-i@{©-i©}}, \Indexc{--invariant}\index{translator option!--invariant@{©--invariant©}} \, invariant checking during AST passes
     468\item
    467469\Indexc{-l}\index{translator option!-l@{©-l©}}, \Indexc{--libcfa}\index{translator option!--libcfa@{©--libcfa©}} \, generate ©libcfa.c©
    468470\item
     
    482484\begin{description}[topsep=0pt,itemsep=0pt,parsep=0pt]
    483485\item
    484 \Indexc{ascodegen}\index{translator option!-P@{©-P©}!©ascodegen©}\index{translator option!--print@{©-print©}!©ascodegen©} \, as codegen rather than AST
    485 \item
    486 \Indexc{asterr}\index{translator option!-P@{©-P©}!©asterr©}\index{translator option!--print@{©-print©}!©asterr©} \, AST on error
    487 \item
    488 \Indexc{declstats}\index{translator option!-P@{©-P©}!©declstats©}\index{translator option!--print@{©-print©}!©declstats©} \, code property statistics
    489 \item
    490 \Indexc{parse}\index{translator option!-P@{©-P©}!©parse©}\index{translator option!--print@{©-print©}!©parse©} \, yacc (parsing) debug information
     486\Indexc{ascodegen}\index{translator option!-P@{©-P©}!©ascodegen©}\index{translator option!--print@{©-print©}!©ascodegen©} \, print AST as codegen rather than AST
     487\item
     488\Indexc{asterr}\index{translator option!-P@{©-P©}!©asterr©}\index{translator option!--print@{©-print©}!©asterr©} \, print AST on error
     489\item
     490\Indexc{declstats}\index{translator option!-P@{©-P©}!©declstats©}\index{translator option!--print@{©-print©}!©declstats©} \, print code property statistics
     491\item
     492\Indexc{parse}\index{translator option!-P@{©-P©}!©parse©}\index{translator option!--print@{©-print©}!©parse©} \, print yacc (parsing) debug information
    491493\item
    492494\Indexc{pretty}\index{translator option!-P@{©-P©}!©pretty©}\index{translator option!--print@{©-print©}!©pretty©} \, prettyprint for ©ascodegen© flag
     
    494496\Indexc{rproto}\index{translator option!-P@{©-P©}!©rproto©}\index{translator option!--print@{©-print©}!©rproto©} \, resolver-proto instance
    495497\item
    496 \Indexc{rsteps}\index{translator option!-P@{©-P©}!©rsteps©}\index{translator option!--print@{©-print©}!©rsteps©} \, resolver steps
    497 \item
    498 \Indexc{tree}\index{translator option!-P@{©-P©}!©tree©}\index{translator option!--print@{©-print©}!©tree©} \, parse tree
    499 \item
    500 \Indexc{ast}\index{translator option!-P@{©-P©}!©ast©}\index{translator option!--print@{©-print©}!©ast©} \, AST after parsing
    501 \item
    502 \Indexc{symevt}\index{translator option!-P@{©-P©}!©symevt©}\index{translator option!--print@{©-print©}!©symevt©} \, symbol table events
    503 \item
    504 \Indexc{altexpr}\index{translator option!-P@{©-P©}!©altexpr©}\index{translator option!--print@{©-print©}!©altexpr©} \, alternatives for expressions
    505 \item
    506 \Indexc{astdecl}\index{translator option!-P@{©-P©}!©astdecl©}\index{translator option!--print@{©-print©}!©astdecl©} \, AST after declaration validation pass
    507 \item
    508 \Indexc{resolver}\index{translator option!-P@{©-P©}!©resolver©}\index{translator option!--print@{©-print©}!©resolver©} \, before resolver step
    509 \item
    510 \Indexc{astexpr}\index{translator option!-P@{©-P©}!©astexpr©}\index{translator option!--print@{©-print©}!©altexpr©} \, AST after expression analysis
    511 \item
    512 \Indexc{ctordtor}\index{translator option!-P@{©-P©}!©ctordtor©}\index{translator option!--print@{©-print©}!©ctordtor©} \, after ctor/dtor are replaced
    513 \item
    514 \Indexc{tuple}\index{translator option!-P@{©-P©}!©tuple©}\index{translator option!--print@{©-print©}!©tuple©} \, after tuple expansion
    515 \item
    516 \Indexc{astgen}\index{translator option!-P@{©-P©}!©astgen©}\index{translator option!--print@{©-print©}!©astgen©} \, AST after instantiate generics
    517 \item
    518 \Indexc{box}\index{translator option!-P@{©-P©}!©box©}\index{translator option!--print@{©-print©}!©box©} \, before box step
    519 \item
    520 \Indexc{codegen}\index{translator option!-P@{©-P©}!©codegen©}\index{translator option!--print@{©-print©}!©codegen©} \, before code generation
     498\Indexc{rsteps}\index{translator option!-P@{©-P©}!©rsteps©}\index{translator option!--print@{©-print©}!©rsteps©} \, print resolver steps
     499\item
     500\Indexc{ast}\index{translator option!-P@{©-P©}!©ast©}\index{translator option!--print@{©-print©}!©ast©} \, print AST after parsing
     501\item
     502\Indexc{excpdecl}\index{translator option!-P@{©-P©}!©excpdecl©}\index{translator option!--print@{©-print©}!©excpdecl©} \, print AST after translating exception decls
     503\item
     504\Indexc{symevt}\index{translator option!-P@{©-P©}!©symevt©}\index{translator option!--print@{©-print©}!©symevt©} \, print AST after symbol table events
     505\item
     506\Indexc{expralt}\index{translator option!-P@{©-P©}!©expralt©}\index{translator option!--print@{©-print©}!©expralt©} \, print AST after expressions alternatives
     507\item
     508\Indexc{valdecl}\index{translator option!-P@{©-P©}!©valdecl©}\index{translator option!--print@{©-print©}!©valdecl©} \, print AST after declaration validation pass
     509\item
     510\Indexc{bresolver}\index{translator option!-P@{©-P©}!©bresolver©}\index{translator option!--print@{©-print©}!©bresolver©} \, print AST before resolver step
     511\item
     512\Indexc{expranly}\index{translator option!-P@{©-P©}!©expranly©}\index{translator option!--print@{©-print©}!©expranly©} \, print AST after expression analysis
     513\item
     514\Indexc{ctordtor}\index{translator option!-P@{©-P©}!©ctordtor©}\index{translator option!--print@{©-print©}!©ctordtor©} \, print AST after ctor/dtor are replaced
     515\item
     516\Indexc{tuple}\index{translator option!-P@{©-P©}!©tuple©}\index{translator option!--print@{©-print©}!©tuple©} \, print AST after tuple expansion
     517\item
     518\Indexc{instgen}\index{translator option!-P@{©-P©}!©instgen©}\index{translator option!--print@{©-print©}!©instgen©} \, print AST after instantiate generics
     519\item
     520\Indexc{bbox}\index{translator option!-P@{©-P©}!©bbox©}\index{translator option!--print@{©-print©}!©bbox©} \, print AST before box pass
     521\item
     522\Indexc{bcodegen}\index{translator option!-P@{©-P©}!©bcodegen©}\index{translator option!--print@{©-print©}!©bcodegen©} \, print AST before code generation
    521523\end{description}
    522524\item
     
    535537Keyword clashes are accommodated by syntactic transformations using the \CFA backquote escape-mechanism:
    536538\begin{cfa}
    537 int ®``®coroutine = 3; $\C{// make keyword an identifier}$
     539int ®``®coroutine = 3;                                  $\C{// make keyword an identifier}$
    538540double ®``®forall = 3.5;
    539541\end{cfa}
     
    545547\begin{cfa}
    546548// include file uses the CFA keyword "with".
    547 #if ! defined( with )                                                   $\C{// nesting ?}$
    548 #define with ®``®with                                                   $\C{// make keyword an identifier}$
     549#if ! defined( with )                                   $\C{// nesting ?}$
     550#define with ®``®with                                   $\C{// make keyword an identifier}$
    549551#define __CFA_BFD_H__
    550552#endif
    551 $\R{\#include\_next} <bfdlink.h>$                               $\C{// must have internal check for multiple expansion}$
     553$\R{\#include\_next} <bfdlink.h>$               $\C{// must have internal check for multiple expansion}$
    552554#if defined( with ) && defined( __CFA_BFD_H__ ) $\C{// reset only if set}$
    553555#undef with
     
    564566Numeric constants are extended to allow \Index{underscore}s\index{constant!underscore} as a separator, \eg:
    565567\begin{cfa}
    566 2®_®147®_®483®_®648; $\C{// decimal constant}$
    567 56®_®ul; $\C{// decimal unsigned long constant}$
    568 0®_®377; $\C{// octal constant}$
    569 0x®_®ff®_®ff; $\C{// hexadecimal constant}$
    570 0x®_®ef3d®_®aa5c; $\C{// hexadecimal constant}$
    571 3.141®_®592®_®654; $\C{// floating constant}$
    572 10®_®e®_®+1®_®00; $\C{// floating constant}$
    573 0x®_®ff®_®ff®_®p®_®3; $\C{// hexadecimal floating}$
    574 0x®_®1.ffff®_®ffff®_®p®_®128®_®l; $\C{// hexadecimal floating long constant}$
     5682®_®147®_®483®_®648;                                    $\C{// decimal constant}$
     56956®_®ul;                                                                $\C{// decimal unsigned long constant}$
     5700®_®377;                                                                $\C{// octal constant}$
     5710x®_®ff®_®ff;                                                   $\C{// hexadecimal constant}$
     5720x®_®ef3d®_®aa5c;                                               $\C{// hexadecimal constant}$
     5733.141®_®592®_®654;                                              $\C{// floating constant}$
     57410®_®e®_®+1®_®00;                                               $\C{// floating constant}$
     5750x®_®ff®_®ff®_®p®_®3;                                   $\C{// hexadecimal floating}$
     5760x®_®1.ffff®_®ffff®_®p®_®128®_®l;               $\C{// hexadecimal floating long constant}$
    575577L®_®$"\texttt{\textbackslash{x}}$®_®$\texttt{ff}$®_®$\texttt{ee}"$; $\C{// wide character constant}$
    576578\end{cfa}
     
    602604
    603605There are exponentiation operators for integral and floating types, including the builtin \Index{complex} types.
    604 Integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication\footnote{The multiplication computation is $O(\log y)$.} (or shifting if the exponent is 2).
     606Integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication ($O(\log y)$ multiplies or shifting if the exponent is 2).
    605607Overflow for a large exponent or negative exponent returns zero.
    606608Floating exponentiation\index{exponentiation!floating} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the exponent cannot be negative.
    607609\begin{cfa}
    608 sout | 1 ®\® 0 | 1 ®\® 1 | 2 ®\® 8 | -4 ®\® 3 | 5 ®\® 3 | 5 ®\® 32 | 5L ®\® 32 | 5L ®\® 64 | -4 ®\® -3 | -4.0 ®\® -3 | 4.0 ®\® 2.1
    609            | (1.0f+2.0fi) ®\® (3.0f+2.0fi);
     610sout | 1 ®\® 0 | 1 ®\® 1 | 2 ®\® 8 | -4 ®\® 3 | 5 ®\® 3 | 5 ®\® 32 | 5L ®\® 32 | 5L ®\® 64 | -4 ®\® -3 | -4.0 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi);
    6106111 1 256 -64 125 ®0® 3273344365508751233 ®0® ®0® -0.015625 18.3791736799526 0.264715-1.1922i
    611612\end{cfa}
     
    620621T ?®\®?( T ep, unsigned long int y );
    621622\end{cfa}
    622 The user type ©T© must define multiplication, one (©1©), and ©*©.
     623A user type ©T© must define multiplication, one (©1©), and ©*©.
    623624
    624625
     
    634635Declarations in the \Indexc{do}-©while© condition are not useful because they appear after the loop body.}
    635636\begin{cfa}
    636 if ( ®int x = f()® ) ... $\C{// x != 0}$
    637 if ( ®int x = f(), y = g()® ) ... $\C{// x != 0 \&\& y != 0}$
     637if ( ®int x = f()® ) ...                        $\C{// x != 0}$
     638if ( ®int x = f(), y = g()® ) ...       $\C{// x != 0 \&\& y != 0}$
    638639if ( ®int x = f(), y = g(); x < y® ) ... $\C{// relational expression}$
    639640if ( ®struct S { int i; } x = { f() }; x.i < 4® ) $\C{// relational expression}$
    640641
    641 while ( ®int x = f()® ) ... $\C{// x != 0}$
     642while ( ®int x = f()® ) ...                     $\C{// x != 0}$
    642643while ( ®int x = f(), y = g()® ) ... $\C{// x != 0 \&\& y != 0}$
    643644while ( ®int x = f(), y = g(); x < y® ) ... $\C{// relational expression}$
     
    653654\label{s:caseClause}
    654655
    655 C restricts the \Indexc{case} clause of a \Indexc{switch} statement to a single value.
    656 For multiple ©case© clauses associated with the same statement, it is necessary to have multiple ©case© clauses rather than multiple values.
     656C restricts a \Indexc{case} clause in \Indexc{switch} statement to a single value.
     657For multiple ©case© clauses prefixing a statement within the ©switch© statement, it is necessary to have multiple ©case© clauses rather than multiple values.
    657658Requiring a ©case© clause for each value is not in the spirit of brevity normally associated with C.
    658659Therefore, the ©case© clause is extended with a list of values.
    659660\begin{cquote}
    660661\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
    661 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\
     662\multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}}      \\
     663\begin{cfa}
     664switch ( i ) {
     665  case 1: case 3 : case 5:
     666        ...
     667  case 2: case 4 : case 6:
     668        ...
     669}
     670\end{cfa}
     671&
    662672\begin{cfa}
    663673switch ( i ) {
     
    670680&
    671681\begin{cfa}
    672 switch ( i ) {
    673   case 1: case 3 : case 5:
    674         ...
    675   case 2: case 4 : case 6:
    676         ...
    677 }
    678 \end{cfa}
    679 &
    680 \begin{cfa}
    681682
    682683// odd values
     
    688689\end{tabular}
    689690\end{cquote}
    690 In addition, subranges are allowed to specify case values.\footnote{
    691 gcc has the same mechanism but awkward syntax, \lstinline{2 ...42}, because a space is required after a number, otherwise the period is a decimal point.}
     691In addition, subranges are allowed to specify case values.
     692\begin{cquote}
     693\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{\hspace{2em}}l@{}}
     694\multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}}      & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{©gcc©}}     \\
    692695\begin{cfa}
    693696switch ( i ) {
    694   case ®1~5:® $\C{// 1, 2, 3, 4, 5}$
     697  case 1: case 2: case 3: case 4:
    695698        ...
    696   case ®10~15:® $\C{// 10, 11, 12, 13, 14, 15}$
     699  case 10: case 11: case 12: case 13:
    697700        ...
    698701}
    699702\end{cfa}
    700 Lists of subranges are also allowed.
     703&
     704\begin{cfa}
     705switch ( i ) {
     706  case ®1~4:®
     707        ...
     708  case ®10~13:®
     709        ...
     710}
     711\end{cfa}
     712&
     713\begin{cfa}
     714switch ( i ) {
     715  case 1$\R{\textvisiblespace}$®...®4:
     716        ...
     717  case 10$\R{\textvisiblespace}$®...®13:
     718        ...
     719}
     720\end{cfa}
     721&
     722\begin{cfa}
     723
     724// 1, 2, 3, 4
     725
     726// 10, 11, 12, 13
     727
     728
     729\end{cfa}
     730\end{tabular}
     731\end{cquote}
     732While ©gcc© has the same range mechanism, it has an awkward syntax, ©2©\R{\textvisiblespace}©...42©, because a space is required after a number, otherwise the period is a decimal point.
     733
     734\CFA also allows lists of subranges.
    701735\begin{cfa}
    702736case ®1~5, 12~21, 35~42®:
     
    769803This situation is better handled by a list of case values \see{\VRef{s:caseClause}}.
    770804While fall-through itself is not a problem, the problem occurs when fall-through is the default, as this semantics is unintuitive to many programmers and is different from most programming languages with a ©switch© statement.
    771 Hence, default fall-through semantics results in a large number of programming errors as programmers often \emph{forget} the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through.
     805Hence, default fall-through semantics results in a many programming errors as programmers often \emph{forget} the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through.
    772806
    773807\item
     
    846880and there is only a medium amount of fall-through from one ©case© clause to the next, and most of these result from a list of case values executing common code, rather than a sequence of case actions that compound.
    847881\end{itemize}
    848 These observations put into perspective the \CFA changes to the ©switch©.
     882These observations put into perspective the \CFA changes to the ©switch© statement.
    849883\begin{enumerate}
    850884\item
     
    888922\begin{cfa}
    889923switch ( x ) {
    890         ®int i = 0;® $\C{// allowed only at start}$
     924        ®int i = 0;®                                            $\C{// allowed only at start}$
    891925  case 0:
    892926        ...
    893         ®int j = 0;® $\C{// disallowed}$
     927        ®int j = 0;®                                            $\C{// disallowed}$
    894928  case 1:
    895929        {
    896                 ®int k = 0;® $\C{// allowed at different nesting levels}$
     930                ®int k = 0;®                                    $\C{// allowed at different nesting levels}$
    897931                ...
    898           ®case 2:® $\C{// disallow case in nested statements}$
     932          ®case 2:®                                                     $\C{// disallow case in nested statements}$
    899933        }
    900934  ...
     
    907941
    908942The \Indexc{fallthrough} clause may be non-terminating within a \Indexc{case} clause or have a target label to common code from multiple case clauses.
    909 \begin{center}
     943\begin{cquote}
    910944\begin{tabular}{@{}lll@{}}
    911945\begin{cfa}
     
    957991\end{cfa}
    958992\end{tabular}
    959 \end{center}
     993\end{cquote}
    960994The target label must be below the \Indexc{fallthrough} and may not be nested in a control structure, and
    961995the target label must be at the same or higher level as the containing \Indexc{case} clause and located at
     
    964998
    965999\begin{figure}
    966 \begin{tabular}{@{}l@{\hspace{40pt}}|l@{}}
    967 \multicolumn{1}{@{}c@{\hspace{40pt}}|}{loop control} & \multicolumn{1}{c@{}}{output} \\
     1000\begin{tabular}{@{}l@{\hspace{50pt}}|l@{}}
     1001\multicolumn{1}{@{}c@{\hspace{50pt}}|}{loop control} & \multicolumn{1}{c@{}}{output} \\
    9681002\hline
    9691003\begin{cfa}
     
    10831117The \Indexc{for}, \Indexc{while}, and \Indexc{do} loop-control allow an empty conditional, which implies a comparison value of ©1© (true).
    10841118\begin{cfa}
    1085 while ( ®/*empty*/®  )                  $\C{// while ( true )}$
    1086 for ( ®/*empty*/®  )                    $\C{// for ( ; true; )}$
    1087 do ... while ( ®/*empty*/®  )    $\C{// do ... while ( true )}$
     1119while ( ®/* empty */®  )                                $\C{// while ( true )}$
     1120for ( ®/* empty */®  )                                  $\C{// for ( ; true; )}$
     1121do ... while ( ®/* empty */®  )                 $\C{// do ... while ( true )}$
    10881122\end{cfa}
    10891123
     
    11151149If no type is specified for the loop index, it is the type of the high value H (when the low value is implicit) or the low value L.
    11161150\begin{cfa}
    1117 for ( ®5® )                                             $\C{// typeof(5) anonymous-index; 5 is high value}$
    1118 for ( i; ®1.5® ~ 5.5 )                  $\C{// typeof(1.5) i; 1.5 is low value}$
    1119 for ( ®int i®; 0 ~ 10 ~ 2 )             $\C{// int i; type is explicit}$
     1151for ( ®5® )                                                             $\C{// typeof(5) anonymous-index; 5 is high value}$
     1152for ( i; ®1.5® ~ 5.5 )                                  $\C{// typeof(1.5) i; 1.5 is low value}$
     1153for ( ®int i®; 0 ~ 10 ~ 2 )                             $\C{// int i; type is explicit}$
    11201154\end{cfa}
    11211155
     
    11251159H is implicit up-to exclusive range [0,H\R{)}.
    11261160\begin{cfa}
    1127 for ( ®5® )                                             $\C{// for ( typeof(5) i; i < 5; i += 1 )}$
     1161for ( ®5® )                                                             $\C{// for ( typeof(5) i; i < 5; i += 1 )}$
    11281162\end{cfa}
    11291163\item
    11301164©~=© H is implicit up-to inclusive range [0,H\R{]}.
    11311165\begin{cfa}
    1132 for ( ®~=® 5 )                                  $\C{// for ( typeof(5) i; i <= 5; i += 1 )}$
     1166for ( ®~=® 5 )                                                  $\C{// for ( typeof(5) i; i <= 5; i += 1 )}$
    11331167\end{cfa}
    11341168\item
    11351169L ©~©\index{~@©~©} H is explicit up-to exclusive range [L,H\R{)}.
    11361170\begin{cfa}
    1137 for ( 1 ®~® 5 )                                 $\C{// for ( typeof(1) i = 1; i < 5; i += 1 )}$
     1171for ( 1 ®~® 5 )                                                 $\C{// for ( typeof(1) i = 1; i < 5; i += 1 )}$
    11381172\end{cfa}
    11391173\item
    11401174L ©~=©\index{~=@©~=©} H is explicit up-to inclusive range [L,H\R{]}.
    11411175\begin{cfa}
    1142 for ( 1 ®~=® 5 )                                        $\C{// for ( typeof(1) i = 1; i <= 5; i += 1 )}$
     1176for ( 1 ®~=® 5 )                                                $\C{// for ( typeof(1) i = 1; i <= 5; i += 1 )}$
    11431177\end{cfa}
    11441178\item
    11451179L ©-~©\index{-~@©-~©} H is explicit down-to exclusive range [H,L\R{)}, where L and H are implicitly interchanged to make the range down-to.
    11461180\begin{cfa}
    1147 for ( 1 ®-~® 5 )                                        $\C{// for ( typeof(1) i = 5; i > 0; i -= 1 )}$
     1181for ( 1 ®-~® 5 )                                                $\C{// for ( typeof(1) i = 5; i > 0; i -= 1 )}$
    11481182\end{cfa}
    11491183\item
    11501184L ©-~=©\index{-~=@©-~=©} H is explicit down-to inclusive range [H,L\R{]}, where L and H are implicitly interchanged to make the range down-to.
    11511185\begin{cfa}
    1152 for ( 1 ®-~=® 5 )                                       $\C{// for ( typeof(1) i = 5; i >= 0; i -= 1 )}$
     1186for ( 1 ®-~=® 5 )                                               $\C{// for ( typeof(1) i = 5; i >= 0; i -= 1 )}$
    11531187\end{cfa}
    11541188\item
    11551189©@© means put nothing in this field.
    11561190\begin{cfa}
    1157 for ( i; 1 ~ ®@® ~ 2 )                  $\C{// for ( typeof(1) i = 1; \R{/* empty */}; i += 2 )}$
    1158 for ( i; 1 ~ 10 ~ ®@® )                 $\C{// for ( typeof(1) i = 1; i < 10; \R{/* empty */} )}$
    1159 for ( i; 1 ~ ®@® ~ ®@® )                $\C{// for ( typeof(1) i = 1; /*empty*/; \R{/* empty */} )}$
     1191for ( i; 1 ~ ®@® ~ 2 )                                  $\C{// for ( typeof(1) i = 1; \R{/* empty */}; i += 2 )}$
     1192for ( i; 1 ~ 10 ~ ®@® )                                 $\C{// for ( typeof(1) i = 1; i < 10; \R{/* empty */} )}$
     1193for ( i; 1 ~ ®@® ~ ®@® )                                $\C{// for ( typeof(1) i = 1; /*empty*/; \R{/* empty */} )}$
    11601194\end{cfa}
    11611195L cannot be elided for the up-to range, \lstinline{@ ~ 5}, and H for the down-to range, \lstinline{1 -~ @}, because then the loop index is uninitialized.
     
    11641198©:© means low another index.
    11651199\begin{cfa}
    1166 for ( i; 5 ®:® j; 2 ~ 12 ~ 3 )          $\C{// for ( typeof(i) i = 1, j = 2; i < 5 \&\& j < 12; i += 1, j += 3 )}$
     1200for ( i; 5 ®:® j; 2 ~ 12 ~ 3 )                  $\C{// for ( typeof(i) i = 1, j = 2; i < 5 \&\& j < 12; i += 1, j += 3 )}$
    11671201\end{cfa}
    11681202\end{itemize}
    11691203\R{Warning}: specifying the down-to range maybe unexpected because the loop control \emph{implicitly} switches the L and H values (and toggles the increment/decrement for I):
    11701204\begin{cfa}
    1171 for ( i; 1 ~ 10 )       ${\C[1.5in]{// up range}$
    1172 for ( i; 1 -~ 10 )      ${\C{// down range}$
    1173 for ( i; ®10 -~ 1® )    ${\C{// \R{WRONG down range!}}\CRT}$
     1205for ( i; 1 ~ 10 )                                               ${\C{// up range}$
     1206for ( i; 1 -~ 10 )                                              ${\C{// down range}$
     1207for ( i; ®10 -~ 1® )                                    ${\C{// \R{WRONG down range!}}}$
    11741208\end{cfa}
    11751209The reason for this semantics is that the range direction can be toggled by adding/removing the minus, ©'-'©, versus interchanging the L and H expressions, which has a greater chance of introducing errors.
     
    11881222
    11891223\begin{figure}
    1190 \centering
    11911224\begin{lrbox}{\myboxA}
    1192 \begin{cfa}[tabsize=3]
     1225\begin{cfa}[tabsize=4]
    11931226®Compound:® {
    11941227        ®Try:® try {
     
    12201253
    12211254\begin{lrbox}{\myboxB}
    1222 \begin{cfa}[tabsize=3]
     1255\begin{cfa}[tabsize=4]
    12231256{
    12241257
     
    12491282\end{lrbox}
    12501283
    1251 \subfloat[\CFA]{\label{f:CFibonacci}\usebox\myboxA}
     1284\subfloat[C]{\label{f:CFAFibonacciGen}\usebox\myboxB}
    12521285\hspace{3pt}
    12531286\vrule
    12541287\hspace{3pt}
    1255 \subfloat[C]{\label{f:CFAFibonacciGen}\usebox\myboxB}
     1288\subfloat[\CFA]{\label{f:CFibonacci}\usebox\myboxA}
    12561289\caption{Multi-level Exit}
    12571290\label{f:MultiLevelExit}
     
    12871320int a[10];
    12881321\end{cfa}
    1289 \begin{tabular}{@{}lll@{}}
     1322\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{3em}}l@{}}
    12901323\begin{cfa}
    12911324
     
    13281361Grouping heterogeneous data into an \newterm{aggregate} (structure/union) is a common programming practice, and aggregates may be nested:
    13291362\begin{cfa}
    1330 struct Person {                                                         $\C{// aggregate}$
    1331         struct Name { char first[20], last[20]; } name $\C{// nesting}$
    1332         struct Address { ... } address                  $\C{// nesting}$
     1363struct Person {                                                 $\C{// aggregate}$
     1364        struct Name {                                           $\C{// nesting}$
     1365                char first[20], last[20];
     1366        } name;
     1367        struct Address {                                        $\C{// nesting}$
     1368                ...
     1369        } address;
    13331370        int sex;
    13341371};
     
    13371374\begin{cfa}
    13381375Person p
    1339 ®p.®name; ®p.®address; ®p.®sex; $\C{// access containing fields}$
     1376®p.®name; ®p.®address; ®p.®sex;                 $\C{// access containing fields}$
    13401377\end{cfa}
    13411378which extends to multiple levels of qualification for nested aggregates and multiple aggregates.
     
    13521389\begin{cfa}
    13531390struct S {
    1354         struct $\R{\LstCommentStyle{/* unnamed */}}$ { int g,  h; } __attribute__(( aligned(64) ));
     1391        struct $\R{\LstCommentStyle{/* unnamed */}}$  { int g,  h; } __attribute__(( aligned(64) ));
    13551392        int tag;
    1356         union $\R{\LstCommentStyle{/* unnamed */}}$ {
     1393        union $\R{\LstCommentStyle{/* unnamed */}}$  {
    13571394                struct { char c1,  c2; } __attribute__(( aligned(128) ));
    13581395                struct { int i1,  i2; };
     
    13681405struct S {
    13691406        char ®c®;   int ®i®;   double ®d®;
    1370         void f( /* S * this */ ) {                              $\C{// implicit ``this'' parameter}$
    1371                 ®c®;   ®i®;   ®d®;                                      $\C{// this->c; this->i; this->d;}$
     1407        void f( /* S * this */ ) {                      $\C{// implicit ``this'' parameter}$
     1408                ®c®;   ®i®;   ®d®;                              $\C{// this->c; this->i; this->d;}$
    13721409        }
    13731410}
     
    13771414\begin{cfa}
    13781415struct T {
    1379         char ®m®;   int ®i®;   double ®n®;              $\C{// derived class variables}$
     1416        char ®m®;   int ®i®;   double ®n®;      $\C{// derived class variables}$
    13801417};
    13811418struct S : public T {
    1382         char ®c®;   int ®i®;   double ®d®;              $\C{// class variables}$
     1419        char ®c®;   int ®i®;   double ®d®;      $\C{// class variables}$
    13831420        void g( double ®d®, T & t ) {
    1384                 d;   ®t®.m;   ®t®.i;   ®t®.n;           $\C{// function parameter}$
    1385                 c;   i;   ®this->®d;   ®S::®d;          $\C{// class S variables}$
    1386                 m;   ®T::®i;   n;                                       $\C{// class T variables}$
     1421                d;   ®t®.m;   ®t®.i;   ®t®.n;   $\C{// function parameter}$
     1422                c;   i;   ®this->®d;   ®S::®d;  $\C{// class S variables}$
     1423                m;   ®T::®i;   n;                               $\C{// class T variables}$
    13871424        }
    13881425};
     
    13941431Hence, the qualified fields become variables with the side-effect that it is simpler to write, easier to read, and optimize field references in a block.
    13951432\begin{cfa}
    1396 void f( S & this ) ®with ( this )® {            $\C{// with statement}$
    1397         ®c®;   ®i®;   ®d®;                                              $\C{// this.c, this.i, this.d}$
     1433void f( S & this ) ®with ( this )® {    $\C{// with statement}$
     1434        ®c®;   ®i®;   ®d®;                                      $\C{// this.c, this.i, this.d}$
    13981435}
    13991436\end{cfa}
    14001437with the generality of opening multiple aggregate-parameters:
    14011438\begin{cfa}
    1402 void g( S & s, T & t ) ®with ( s, t )® {        $\C{// multiple aggregate parameters}$
    1403         c;   ®s.®i;   d;                                                $\C{// s.c, s.i, s.d}$
    1404         m;   ®t.®i;   n;                                                $\C{// t.m, t.i, t.n}$
     1439void g( S & s, T & t ) ®with ( s, t )® {$\C{// multiple aggregate parameters}$
     1440        c;   ®s.®i;   d;                                        $\C{// s.c, s.i, s.d}$
     1441        m;   ®t.®i;   n;                                        $\C{// t.m, t.i, t.n}$
    14051442}
    14061443\end{cfa}
     
    14251462struct R { int ®i®; int j; double ®m®; } r, w;
    14261463with ( r, q ) {
    1427         j + k;                                                                  $\C{// unambiguous, r.j + q.k}$
    1428         m = 5.0;                                                                $\C{// unambiguous, q.m = 5.0}$
    1429         m = 1;                                                                  $\C{// unambiguous, r.m = 1}$
    1430         int a = m;                                                              $\C{// unambiguous, a = r.i }$
    1431         double b = m;                                                   $\C{// unambiguous, b = q.m}$
    1432         int c = r.i + q.i;                                              $\C{// disambiguate with qualification}$
    1433         (double)m;                                                              $\C{// disambiguate with cast}$
     1464        j + k;                                                          $\C{// unambiguous, r.j + q.k}$
     1465        m = 5.0;                                                        $\C{// unambiguous, q.m = 5.0}$
     1466        m = 1;                                                          $\C{// unambiguous, r.m = 1}$
     1467        int a = m;                                                      $\C{// unambiguous, a = r.i }$
     1468        double b = m;                                           $\C{// unambiguous, b = q.m}$
     1469        int c = r.i + q.i;                                      $\C{// disambiguate with qualification}$
     1470        (double)m;                                                      $\C{// disambiguate with cast}$
    14341471}
    14351472\end{cfa}
     
    14391476\begin{cfa}
    14401477with ( r ) {
    1441         i;                                                                              $\C{// unambiguous, r.i}$
     1478        i;                                                                      $\C{// unambiguous, r.i}$
    14421479        with ( q ) {
    1443                 i;                                                                      $\C{// unambiguous, q.i}$
     1480                i;                                                              $\C{// unambiguous, q.i}$
    14441481        }
    14451482}
     
    14481485A cast can also be used to disambiguate among overload variables in a ©with© \emph{expression}:
    14491486\begin{cfa}
    1450 with ( w ) { ... }                                                      $\C{// ambiguous, same name and no context}$
    1451 with ( (Q)w ) { ... }                                           $\C{// unambiguous, cast}$
     1487with ( w ) { ... }                                              $\C{// ambiguous, same name and no context}$
     1488with ( (Q)w ) { ... }                                   $\C{// unambiguous, cast}$
    14521489\end{cfa}
    14531490Because there is no left-side in the ©with© expression to implicitly disambiguate between the ©w© variables, it is necessary to explicitly disambiguate by casting ©w© to type ©Q© or ©R©.
     
    14561493\begin{cfa}
    14571494void f( S & s, char c ) with ( s ) {
    1458         ®s.c = c;®  i = 3;  d = 5.5;                    $\C{// initialize fields}$
     1495        ®s.c = c;®  i = 3;  d = 5.5;            $\C{// initialize fields}$
    14591496}
    14601497\end{cfa}
     
    14621499To solve this problem, parameters \emph{not} explicitly opened are treated like an initialized aggregate:
    14631500\begin{cfa}
    1464 struct Params {                                                         $\C{// s explicitly opened so S \& s elided}$
     1501struct Params {                                                 $\C{// s explicitly opened so S \& s elided}$
    14651502        char c;
    14661503} params;
     
    14811518Transfer of control can be local, within a routine, or non-local, among routines.
    14821519Non-local transfer can cause stack unwinding, \ie non-local routine termination, depending on the kind of raise.
     1520
     1521Currently, \CFA uses macros ©ExceptionDecl© and ©ExceptionInst© to declare and instantiate an exception.
     1522\begin{cfa}
     1523#include <Exception.hfa>
     1524®ExceptionDecl®( E,             // must be global scope
     1525        ... // exception fields
     1526);
     1527try {
     1528        ...
     1529        if ( ... ) ®throwResume® ®ExceptionInst®( E, /* intialization */ );
     1530        if ( ... ) ®throw® ®ExceptionInst®( E, /* intialization */ );
     1531        ...
     1532} ®catchResume®( E * ) { // must be pointer
     1533        ...
     1534} catch( E * ) {
     1535        ...
     1536}
     1537\end{cfa}
     1538
    14831539\begin{cfa}
    14841540exception_t E {}; $\C{// exception type}$
     
    14891545try {
    14901546        f(...);
    1491 } catch( E e ; $boolean-predicate$ ) {          $\C{// termination handler}$
     1547} catch( E e ; $boolean-predicate$ ) {  $\C{// termination handler}$
    14921548        // recover and continue
    14931549} catchResume( E e ; $boolean-predicate$ ) { $\C{// resumption handler}$
     
    15011557The ©catch© and ©catchResume© handlers may appear in any oder.
    15021558However, the ©finally© clause must appear at the end of the ©try© statement.
     1559
     1560
     1561\section{Non-local Exception}
     1562
     1563\begin{cfa}
     1564void main() {
     1565        try {
     1566                _Enable {
     1567                        ... resume(); ...
     1568                }
     1569        } ®catchResume®( E & ) { // should be reference
     1570                ...
     1571        } catch( E & ) {
     1572                ...
     1573        }
     1574}
     1575\end{cfa}
    15031576
    15041577
     
    15661639\begin{cquote}
    15671640\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1568 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     1641\multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c}{\textbf{\CFA}}     \\
     1642\begin{cfa}[moredelim={**[is][\color{blue}]{\#}{\#}}]
     1643®int® #*# x1 #[5]#;
     1644®int® #(*#x2#)[5]#;
     1645#int (*#f®( int p )®#)[5]#;
     1646\end{cfa}
     1647&
    15691648\begin{cfa}[moredelim={**[is][\color{blue}]{\#}{\#}}]
    15701649#[5] *# ®int® x1;
    15711650#* [5]# ®int® x2;
    15721651#[* [5] int]# f®( int p )®;
    1573 \end{cfa}
    1574 &
    1575 \begin{cfa}[moredelim={**[is][\color{blue}]{\#}{\#}}]
    1576 ®int® #*# x1 #[5]#;
    1577 ®int® #(*#x2#)[5]#;
    1578 #int (*#f®( int p )®#)[5]#;
    15791652\end{cfa}
    15801653\end{tabular}
     
    15861659\begin{cquote}
    15871660\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1588 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     1661\multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c}{\textbf{\CFA}}     \\
     1662\begin{cfa}
     1663int ®*®x, ®*®y;
     1664\end{cfa}
     1665&
    15891666\begin{cfa}
    15901667®*® int x, y;
    1591 \end{cfa}
    1592 &
    1593 \begin{cfa}
    1594 int ®*®x, ®*®y;
    15951668\end{cfa}
    15961669\end{tabular}
     
    15991672\begin{cquote}
    16001673\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1601 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     1674\multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c}{\textbf{\CFA}}     \\
     1675\begin{cfa}
     1676int ®*®x, y;
     1677
     1678\end{cfa}
     1679&
    16021680\begin{cfa}
    16031681®*® int x;
    16041682int y;
    1605 \end{cfa}
    1606 &
    1607 \begin{cfa}
    1608 int ®*®x, y;
    1609 
    16101683\end{cfa}
    16111684\end{tabular}
     
    16151688\begin{cquote}
    16161689\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
    1617 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\
     1690\multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}}      \\
     1691\begin{cfa}
     1692int z[ 5 ];
     1693char * w[ 5 ];
     1694double (* v)[ 5 ];
     1695struct s {
     1696        int f0:3;
     1697        int * f1;
     1698        int * f2[ 5 ]
     1699};
     1700\end{cfa}
     1701&
    16181702\begin{cfa}
    16191703[ 5 ] int z;
     
    16281712&
    16291713\begin{cfa}
    1630 int z[ 5 ];
    1631 char * w[ 5 ];
    1632 double (* v)[ 5 ];
    1633 struct s {
    1634         int f0:3;
    1635         int * f1;
    1636         int * f2[ 5 ]
    1637 };
    1638 \end{cfa}
    1639 &
    1640 \begin{cfa}
    16411714// array of 5 integers
    16421715// array of 5 pointers to char
     
    16541727\begin{cquote}
    16551728\begin{tabular}{@{}l@{\hspace{1em}}l@{\hspace{1em}}l@{}}
    1656 \multicolumn{1}{c@{\hspace{1em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{1em}}}{\textbf{C}} \\
     1729\multicolumn{1}{c@{\hspace{1em}}}{\textbf{C}}   & \multicolumn{1}{c@{\hspace{1em}}}{\textbf{\CFA}}      \\
     1730\begin{cfa}
     1731int const * const x;
     1732const int (* const y)[ 5 ]
     1733\end{cfa}
     1734&
    16571735\begin{cfa}
    16581736const * const int x;
    16591737const * [ 5 ] const int y;
    1660 \end{cfa}
    1661 &
    1662 \begin{cfa}
    1663 int const * const x;
    1664 const int (* const y)[ 5 ]
    16651738\end{cfa}
    16661739&
     
    16751748\begin{cquote}
    16761749\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
    1677 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\
     1750\multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}}      \\
     1751\begin{cfa}
     1752int extern x[ 5 ];
     1753const int static * y;
     1754\end{cfa}
     1755&
    16781756\begin{cfa}
    16791757extern [ 5 ] int x;
    16801758static * const int y;
    1681 \end{cfa}
    1682 &
    1683 \begin{cfa}
    1684 int extern x[ 5 ];
    1685 const int static * y;
    16861759\end{cfa}
    16871760&
     
    16961769\begin{cquote}
    16971770\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1698 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     1771\multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c}{\textbf{\CFA}}     \\
     1772\begin{cfa}
     1773y = (int *)x;
     1774i = sizeof(int * [ 5 ]);
     1775\end{cfa}
     1776&
    16991777\begin{cfa}
    17001778y = (* int)x;
    17011779i = sizeof([ 5 ] * int);
    1702 \end{cfa}
    1703 &
    1704 \begin{cfa}
    1705 y = (int *)x;
    1706 i = sizeof(int * [ 5 ]);
    17071780\end{cfa}
    17081781\end{tabular}
     
    18991972\begin{cquote}
    19001973\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1901 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     1974\multicolumn{1}{c@{\hspace{3em}}}{\textbf{Cy}}  & \multicolumn{1}{c}{\textbf{\CFA}}     \\
     1975\begin{cfa}
     1976const int * ®const® * ®const® ccp;
     1977
     1978\end{cfa}
     1979&
    19021980\begin{cfa}
    19031981®const® * ®const® * const int ccp;
    19041982®const® & ®const® & const int ccr;
    1905 \end{cfa}
    1906 &
    1907 \begin{cfa}
    1908 const int * ®const® * ®const® ccp;
    1909 
    19101983\end{cfa}
    19111984\end{tabular}
     
    20682141\begin{cfa}
    20692142int x, &r = ®x®, f( int & p ); $\C{// lvalue variable (int) convert to reference (int \&)}$
    2070 f( ®x® ); $\C{// lvalue variable (int) convert to reference (int \&)}$
     2143f( ®x® ); $\C{// lvalue variable (int) convert to reference (int \&)}\CRT$
    20712144\end{cfa}
    20722145Conversion can restrict a type, where ©cv1© $\le$ ©cv2©, \eg passing an ©int© to a ©const volatile int &©, which has low cost.
     
    44304503\end{cfa}
    44314504To match a minus, put it as the first character, ©"-0-9"©.
    4432 Note, other complex forms of regular-expression matching is not supported.
     4505Other complex forms of regular-expression matching are not supported.
    44334506
    44344507The following \Index{manipulator}s control scanning of input values (reading), and only affect the format of the argument.
     
    86288701\begin{cquote}
    86298702\begin{tabular}{@{}l@{\hspace{\parindentlnth}}|@{\hspace{\parindentlnth}}l@{}}
    8630 \multicolumn{1}{@{}c|@{\hspace{\parindentlnth}}}{\textbf{\CFA}} & \multicolumn{1}{@{\hspace{\parindentlnth}}c@{}}{\textbf{C}}   \\
     8703\multicolumn{1}{@{}c|@{\hspace{\parindentlnth}}}{\textbf{C}}    & \multicolumn{1}{@{\hspace{\parindentlnth}}c@{}}{\textbf{\CFA}}        \\
    86318704\hline
    8632 \begin{cfa}
    8633 #include <gmp.hfa>$\indexc{gmp}$
    8634 int main( void ) {
    8635         sout | "Factorial Numbers";
    8636         Int fact = 1;
    8637 
    8638         sout | 0 | fact;
    8639         for ( i; 40 ) {
    8640                 fact *= i;
    8641                 sout | i | fact;
    8642         }
    8643 }
    8644 \end{cfa}
    8645 &
    86468705\begin{cfa}
    86478706#include <gmp.h>$\indexc{gmp.h}$
     
    86548713                ®mpz_mul_ui®( fact, fact, i );
    86558714                ®gmp_printf®( "%d %Zd\n", i, fact );
     8715        }
     8716}
     8717\end{cfa}
     8718&
     8719\begin{cfa}
     8720#include <gmp.hfa>$\indexc{gmp}$
     8721int main( void ) {
     8722        sout | "Factorial Numbers";
     8723        Int fact = 1;
     8724
     8725        sout | 0 | fact;
     8726        for ( i; 40 ) {
     8727                fact *= i;
     8728                sout | i | fact;
    86568729        }
    86578730}
  • driver/cc1.cc

    r85034ed r8cbe732  
    1010// Created On       : Fri Aug 26 14:23:51 2005
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun  9 11:36:44 2023
    13 // Update Count     : 423
     12// Last Modified On : Mon Sep 25 11:07:22 2023
     13// Update Count     : 427
    1414//
    1515
    1616#include <iostream>
    17 using std::cerr;
    18 using std::endl;
    1917#include <string>
    20 using std::string;
    2118#include <algorithm>                                                                    // find
    2219#include <cstdio>                                                                               // stderr, stdout, perror, fprintf
    2320#include <cstdlib>                                                                              // getenv, exit, mkstemp
     21using namespace std;
    2422#include <unistd.h>                                                                             // execvp, fork, unlink
    2523#include <sys/wait.h>                                                                   // wait
     
    5250        if ( dot == string::npos ) return;
    5351        const string * end = suffixes + NumSuffixes;
    54         if ( std::find( suffixes, end, arg.substr( dot + 1 ) ) != end ) {
     52        if ( find( suffixes, end, arg.substr( dot + 1 ) ) != end ) {
    5553                args[nargs++] = "-x";
    5654                args[nargs++] = "c";
     
    153151
    154152        #ifdef __DEBUG_H__
    155         cerr << "Stage1" << endl;
     153        cerr << "#########" << endl << "Stage1 " << string( 100, '#' ) << endl << "#########" << endl;
    156154        #endif // __DEBUG_H__
    157155        checkEnv1();                                                                            // arguments passed via environment variables
    158156        #ifdef __DEBUG_H__
     157        cerr << string( 100, '*' ) << endl;
    159158        for ( int i = 1; i < argc; i += 1 ) {
    160159                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    161160        } // for
     161        cerr << string( 100, '*' ) << endl;
    162162        #endif // __DEBUG_H__
    163163
     
    260260                } else {
    261261                        args[nargs++] = "-x";
    262                         args[nargs++] = ( *new string( lang.c_str() ) ).c_str();
     262                        args[nargs++] = ( *new string( lang ) ).c_str();
    263263                } // if
    264264                args[nargs++] = cpp_in;
     
    275275                } // for
    276276                cerr << endl;
     277                cerr << string( 100, '*' ) << endl;
    277278                #endif // __DEBUG_H__
    278279
     
    298299                } else {
    299300                        args[nargs++] = "-x";
    300                         args[nargs++] = ( *new string( lang.c_str() ) ).c_str();
     301                        args[nargs++] = ( *new string( lang ) ).c_str();
    301302                } // if
    302303                args[nargs++] = cpp_in;                                                 // input to cpp
     
    346347
    347348        #ifdef __DEBUG_H__
    348         cerr << "Stage2" << endl;
     349        cerr << "#########" << endl << "Stage2 " << string( 100, '#' ) << endl << "#########" << endl;
    349350        #endif // __DEBUG_H__
    350351        checkEnv2( cargs, ncargs );                                                     // arguments passed via environment variables
    351352        #ifdef __DEBUG_H__
     353        cerr << string( 100, '*' ) << endl;
    352354        for ( int i = 1; i < argc; i += 1 ) {
    353355                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    354356        } // for
     357        cerr << string( 100, '*' ) << endl;
    355358        #endif // __DEBUG_H__
    356359
     
    473476                if ( CFA_flag ) {                                                               // run cfa-cpp ?
    474477                        if ( o_file.size() != 0 ) {                                     // location for output
    475                                 cargs[ncargs++] = ( *new string( o_file.c_str() ) ).c_str();
     478                                cargs[ncargs++] = ( *new string( o_file ) ).c_str();
    476479                        } // if
    477480                } else {
     
    571574int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) {
    572575        #ifdef __DEBUG_H__
    573         for ( int i = 0; env[i] != nullptr; i += 1 ) {
    574                 cerr << env[i] << endl;
    575         } // for
     576        cerr << "#########" << endl << "main cc1 " << string( 100, '#' ) << endl << "#########" << endl;
    576577        #endif // __DEBUG_H__
    577578
  • driver/cfa.cc

    r85034ed r8cbe732  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 30 21:48:48 2023
    13 // Update Count     : 480
     12// Last Modified On : Thu Sep 28 21:53:54 2023
     13// Update Count     : 484
    1414//
    1515
     
    2020#include <string>                                                                               // STL version
    2121#include <algorithm>                                                                    // find
     22using namespace std;
    2223
    2324#include <unistd.h>                                                                             // execvp
     
    2728#include "Common/SemanticError.h"
    2829#include "config.h"                                                                             // configure info
    29 
    30 using std::cerr;
    31 using std::endl;
    32 using std::string;
    33 using std::to_string;
    3430
    3531//#define __DEBUG_H__
  • libcfa/src/collections/string_res.cfa

    r85034ed r8cbe732  
    218218    // Read in chunks.  Often, one chunk is enough.  Keep the string that accumulates chunks last in the heap,
    219219    // so available room is rest of heap.  When a chunk fills the heap, force growth then take the next chunk.
    220     for (;;) {
     220    for (bool cont = true; cont; ) {
     221        cont = false;
     222
    221223        // Append dummy content to temp, forcing expansion when applicable (occurs always on subsequent loops)
    222224        // length 2 ensures room for at least one real char, plus scanf/pipe-cstr's null terminator
     
    228230        temp.Handle.ulink->EndVbyte -= 2;
    229231
    230         // rest of heap, less 1 byte for null terminator, is available to read into
    231         int lenReadable = (char*)temp.Handle.ulink->ExtVbyte - temp.Handle.ulink->EndVbyte - 1;
    232         assert (lenReadable >= 1);
     232        // rest of heap is available to read into
     233        int lenReadable = (char*)temp.Handle.ulink->ExtVbyte - temp.Handle.ulink->EndVbyte;
     234        assert (lenReadable >= 2);
    233235
    234236        // get bytes
    235         in | wdi( lenReadable + 1, lenReadable, temp.Handle.ulink->EndVbyte );
     237        try {
     238            in | wdi( lenReadable, temp.Handle.ulink->EndVbyte );
     239        } catch (cstring_length*) {
     240            cont = true;
     241        }
    236242        int lenWasRead = strlen(temp.Handle.ulink->EndVbyte);
    237243
     
    239245        temp.Handle.lnth += lenWasRead;
    240246        temp.Handle.ulink->EndVbyte += lenWasRead;
    241 
    242       if (lenWasRead < lenReadable) break;
    243247    }
    244248
  • libcfa/src/concurrency/channel.hfa

    r85034ed r8cbe732  
    130130static inline void __cons_handoff( channel(T) & chan, T & elem ) with(chan) {
    131131    memcpy( cons`first.extra, (void *)&elem, sizeof(T) ); // do waiting consumer work
     132    __atomic_thread_fence( __ATOMIC_SEQ_CST );
    132133    wake_one( cons );
    133134}
     
    136137static inline void __prods_handoff( channel(T) & chan, T & retval ) with(chan) {
    137138    memcpy( (void *)&retval, prods`first.extra, sizeof(T) );
     139    __atomic_thread_fence( __ATOMIC_SEQ_CST );
    138140    wake_one( prods );
    139141}
  • libcfa/src/concurrency/cofor.cfa

    r85034ed r8cbe732  
    44// cofor ( uC++ COFOR )
    55
    6 thread co_runner {
     6thread cofor_runner {
    77        ssize_t low, high;
    88        __cofor_body_t loop_body;
    99};
    1010
    11 static void ?{}( co_runner & this, ssize_t low, ssize_t high, __cofor_body_t loop_body ) {
     11static void ?{}( cofor_runner & this, ssize_t low, ssize_t high, __cofor_body_t loop_body ) {
    1212        this.low = low;
    1313        this.high = high;
     
    1515}
    1616
    17 void main( co_runner & this ) with( this ) {
     17void main( cofor_runner & this ) with( this ) {
    1818        for ( ssize_t i = low; i < high; i++ )
    1919                loop_body(i);
    2020}
    2121
    22 void cofor( ssize_t low, ssize_t high, __cofor_body_t loop_body ) libcfa_public {
     22void __Cofor__( ssize_t low, ssize_t high, __cofor_body_t loop_body ) libcfa_public {
    2323        ssize_t range = high - low;
    2424  if ( range <= 0 ) return;
     
    2929        ssize_t i = 0;
    3030        ssize_t stride_iter = low;
    31         co_runner * runners[ threads ];
     31        cofor_runner * runners[ threads ];
    3232        for ( i; threads ) {
    3333                runners[i] = alloc();
     
    4545}
    4646
    47 //////////////////////////////////////////////////////////////////////////////////////////
    48 // parallel (COBEGIN/COEND)
    4947
    50 thread para_runner {
    51         parallel_stmt_t body;
    52         void * arg;
    53 };
    54 
    55 static void ?{}( para_runner & this, parallel_stmt_t body, void * arg ) {
    56         this.body = body;
    57         this.arg = arg;
    58 }
    59 
    60 void main( para_runner & this ) with( this ) { body( arg ); }
    61 
    62 void parallel( parallel_stmt_t * stmts, void ** args, size_t num ) libcfa_public {
    63         para_runner * runners[ num ];
    64         for ( i; num )
    65                 (*(runners[i] = malloc())){ stmts[i], args[i] };
    66         for ( i; num )
    67                 delete( runners[i] );
    68 }
    69 
  • libcfa/src/concurrency/cofor.hfa

    r85034ed r8cbe732  
    55typedef void (*__cofor_body_t)( ssize_t );
    66
    7 void cofor( ssize_t low, ssize_t high, __cofor_body_t loop_body );
     7void __Cofor__( ssize_t low, ssize_t high, __cofor_body_t loop_body );
    88
    99#define COFOR( lidname, low, high, loopbody ) \
     
    1212                        loopbody \
    1313                } \
    14                 cofor( low, high, __CFA_loopLambda__ ); \
     14                __Cofor__( low, high, __CFA_loopLambda__ ); \
    1515        }
    1616
    1717//////////////////////////////////////////////////////////////////////////////////////////
    18 // parallel (COBEGIN/COEND)
    19 typedef void (*parallel_stmt_t)( void * );
     18// corun
    2019
    21 void parallel( parallel_stmt_t * stmts, void ** args, size_t num );
     20//
     21typedef void (*__CFA_corun_lambda_t)( void );
     22
     23// used to run a corun statement in parallel
     24thread co_runner {
     25        __CFA_corun_lambda_t body;
     26};
     27
     28// wraps a co_runner to provide RAII deallocation
     29struct runner_block {
     30    co_runner * runner;
     31};
     32static inline void ?{}( co_runner & this, __CFA_corun_lambda_t body ) { this.body = body; }
     33
     34void main( co_runner & this ) with( this ) { body(); }
     35
     36static inline void ?{}( runner_block & this ) {}
     37static inline void ?{}( runner_block & this, __CFA_corun_lambda_t body ) {
     38    (*(this.runner = malloc())){ body };
     39}
     40
     41static inline void ^?{}( runner_block & this ) {
     42    delete( this.runner );
     43}
     44
  • libcfa/src/concurrency/coroutine.cfa

    r85034ed r8cbe732  
    343343
    344344bool poll() libcfa_public { return poll( active_coroutine() ); }
     345void enable_ehm() libcfa_public { active_coroutine()->ehm_state.ehm_enabled = true; }
     346void disable_ehm() libcfa_public { active_coroutine()->ehm_state.ehm_enabled = false; }
     347bool checked_poll() libcfa_public { return active_coroutine()->ehm_state.ehm_enabled ? poll( active_coroutine() ) : false; }
    345348coroutine$ * resumer() libcfa_public { return active_coroutine()->last; }
    346349coroutine$ * first_resumer() libcfa_public { return active_coroutine()->starter; }
  • libcfa/src/concurrency/coroutine.hfa

    r85034ed r8cbe732  
    224224
    225225// non local ehm and coroutine utility routines
     226void enable_ehm();
     227void disable_ehm();
    226228bool poll( coroutine$ * cor );
    227229bool poll();
     230bool checked_poll();
    228231coroutine$ * resumer();
    229232coroutine$ * first_resumer();
    230233
    231234forall(T & | is_coroutine(T)) {
    232     void enable_ehm( T & cor );
    233     void disable_ehm( T & cor );
     235    void enable_ehm( T & cor );         // enable checking non-local exceptions for cor via checked_poll
     236    void disable_ehm( T & cor );        // disable checking non-local exceptions for cor via checked_poll
    234237    bool poll( T & cor );
    235     bool checked_poll( T & cor );
     238    bool checked_poll( T & cor );       // check for non-local exceptions while respecting enable/disable
    236239    coroutine$ * resumer( T & cor );
    237240    coroutine$ * first_resumer( T & cor );
  • libcfa/src/concurrency/kernel/fwd.hfa

    r85034ed r8cbe732  
    118118                // Yield: yield N times
    119119                static inline void yield( size_t times ) {
    120                         for( times ) {
     120                        for ( times ) {
    121121                                yield();
    122122                        }
     
    136136
    137137                        bool wait(single_sem & this) {
    138                                 for() {
     138                                for () {
    139139                                        struct thread$ * expected = this.ptr;
    140                                         if(expected == 1p) {
    141                                                 if(__atomic_compare_exchange_n(&this.ptr, &expected, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
     140                                        if (expected == 1p) {
     141                                                if (__atomic_compare_exchange_n(&this.ptr, &expected, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    142142                                                        return false;
    143143                                                }
     
    145145                                        else {
    146146                                                /* paranoid */ verify( expected == 0p );
    147                                                 if(__atomic_compare_exchange_n(&this.ptr, &expected, active_thread(), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
     147                                                if (__atomic_compare_exchange_n(&this.ptr, &expected, active_thread(), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    148148                                                        park();
    149149                                                        return true;
     
    155155
    156156                        bool post(single_sem & this) {
    157                                 for() {
     157                                for () {
    158158                                        struct thread$ * expected = this.ptr;
    159                                         if(expected == 1p) return false;
    160                                         if(expected == 0p) {
    161                                                 if(__atomic_compare_exchange_n(&this.ptr, &expected, 1p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
     159                                        if (expected == 1p) return false;
     160                                        if (expected == 0p) {
     161                                                if (__atomic_compare_exchange_n(&this.ptr, &expected, 1p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    162162                                                        return false;
    163163                                                }
    164164                                        }
    165165                                        else {
    166                                                 if(__atomic_compare_exchange_n(&this.ptr, &expected, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
     166                                                if (__atomic_compare_exchange_n(&this.ptr, &expected, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    167167                                                        unpark( expected );
    168168                                                        return true;
     
    195195                        // return true if the thread was parked
    196196                        bool wait(oneshot & this) {
    197                                 for() {
     197                                for () {
    198198                                        struct thread$ * expected = this.ptr;
    199                                         if(expected == oneshot_FULFILLED) return false;
    200                                         if(__atomic_compare_exchange_n(&this.ptr, &expected, active_thread(), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
     199                                        if (expected == oneshot_FULFILLED) return false;
     200                                        if (__atomic_compare_exchange_n(&this.ptr, &expected, active_thread(), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    201201                                                park();
    202202                                                /* paranoid */ verify( this.ptr == oneshot_FULFILLED );
     
    210210                        thread$ * post(oneshot & this, bool do_unpark = true) {
    211211                                struct thread$ * got = __atomic_exchange_n( &this.ptr, oneshot_FULFILLED, __ATOMIC_SEQ_CST);
    212                                 if( got == oneshot_ARMED || got == oneshot_FULFILLED ) return 0p;
    213                                 if(do_unpark) unpark( got );
     212                                if ( got == oneshot_ARMED || got == oneshot_FULFILLED ) return 0p;
     213                                if (do_unpark) unpark( got );
    214214                                return got;
    215215                        }
     
    255255                                /* paranoid */ verify( wait_ctx.ptr == oneshot_ARMED || wait_ctx.ptr == oneshot_FULFILLED );
    256256                                // The future needs to set the wait context
    257                                 for() {
     257                                for () {
    258258                                        struct oneshot * expected = this.ptr;
    259259                                        // Is the future already fulfilled?
    260                                         if(expected == future_FULFILLED) return false; // Yes, just return false (didn't block)
     260                                        if (expected == future_FULFILLED) return false; // Yes, just return false (didn't block)
    261261
    262262                                        // The future is not fulfilled, try to setup the wait context
    263                                         if(__atomic_compare_exchange_n(&this.ptr, &expected, &wait_ctx, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
     263                                        if (__atomic_compare_exchange_n(&this.ptr, &expected, &wait_ctx, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    264264                                                return true;
    265265                                        }
     
    276276
    277277                                // attempt to remove the context so it doesn't get consumed.
    278                                 if(__atomic_compare_exchange_n( &this.ptr, &expected, future_ARMED, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
     278                                if (__atomic_compare_exchange_n( &this.ptr, &expected, future_ARMED, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    279279                                        // we still have the original context, then no one else saw it
    280280                                        return false;
     
    282282
    283283                                // expected == ARMED: future was never actually setup, just return
    284                                 if( expected == future_ARMED ) return false;
     284                                if ( expected == future_ARMED ) return false;
    285285
    286286                                // expected == FULFILLED: the future is ready and the context was fully consumed
    287287                                // the server won't use the pointer again
    288288                                // It is safe to delete (which could happen after the return)
    289                                 if( expected == future_FULFILLED ) return true;
     289                                if ( expected == future_FULFILLED ) return true;
    290290
    291291                                // expected == PROGRESS: the future is ready but the context hasn't fully been consumed
    292292                                // spin until it is safe to move on
    293                                 if( expected == future_PROGRESS ) {
     293                                if ( expected == future_PROGRESS ) {
    294294                                        while( this.ptr != future_FULFILLED ) Pause();
    295295                                        /* paranoid */ verify( this.ptr == future_FULFILLED );
     
    310310
    311311                                // If the future isn't already fulfilled, let the server delete it
    312                                 if( got == future_ARMED ) return false;
     312                                if ( got == future_ARMED ) return false;
    313313
    314314                                // got == PROGRESS: the future is ready but the context hasn't fully been consumed
    315315                                // spin until it is safe to move on
    316                                 if( got == future_PROGRESS ) {
     316                                if ( got == future_PROGRESS ) {
    317317                                        while( this.ptr != future_FULFILLED ) Pause();
    318318                                        got = future_FULFILLED;
     
    327327                        // from the server side, mark the future as fulfilled
    328328                        // delete it if needed
     329
    329330                        thread$ * fulfil( future_t & this, bool do_unpark = true  ) {
    330                                 for() {
     331                                for () {
    331332                                        struct oneshot * expected = this.ptr;
    332                                         // was this abandoned?
     333
    333334                                        #if defined(__GNUC__) && __GNUC__ >= 7
    334                                                 #pragma GCC diagnostic push
    335                                                 #pragma GCC diagnostic ignored "-Wfree-nonheap-object"
     335                                        // SKULLDUGGERY: gcc bug does not handle push/pop for -Wfree-nonheap-object
     336                                        //#pragma GCC diagnostic push
     337                                        #pragma GCC diagnostic ignored "-Wfree-nonheap-object"
    336338                                        #endif
    337                                                 if( expected == future_ABANDONED ) { free( &this ); return 0p; }
     339
     340                                        if ( expected == future_ABANDONED ) { free( &this ); return 0p; }
     341
    338342                                        #if defined(__GNUC__) && __GNUC__ >= 7
    339                                                 #pragma GCC diagnostic pop
     343                                        //#pragma GCC diagnostic pop
    340344                                        #endif
    341345
     
    346350                                        // If there is no context then we can skip the in progress phase
    347351                                        struct oneshot * want = expected == future_ARMED ? future_FULFILLED : future_PROGRESS;
    348                                         if(__atomic_compare_exchange_n(&this.ptr, &expected, want, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    349                                                 if( expected == future_ARMED ) { return 0p; }
     352                                        if (__atomic_compare_exchange_n(&this.ptr, &expected, want, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
     353                                                if ( expected == future_ARMED ) { return 0p; }
    350354                                                thread$ * ret = post( *expected, do_unpark );
    351355                                                __atomic_store_n( &this.ptr, future_FULFILLED, __ATOMIC_SEQ_CST);
     
    359363                        bool wait( future_t & this ) {
    360364                                oneshot temp;
    361                                 if( !setup(this, temp) ) return false;
     365                                if ( !setup(this, temp) ) return false;
    362366
    363367                                // Wait context is setup, just wait on it
     
    387391                                // if any are already satisfied return
    388392                                for ( i; num_futures ) {
    389                                         if( !setup(futures[i], temp) ) return futures[i];
     393                                        if ( !setup(futures[i], temp) ) return futures[i];
    390394                                }
    391395
     
    413417
    414418                        #define __STATS__(in_kernel, ...) { \
    415                                 if( !(in_kernel) ) disable_interrupts(); \
    416                                 with( *__tls_stats() ) { \
     419                                if ( !(in_kernel) ) disable_interrupts(); \
     420                                with ( *__tls_stats() ) { \
    417421                                        __VA_ARGS__ \
    418422                                } \
    419                                 if( !(in_kernel) ) enable_interrupts(); \
     423                                if ( !(in_kernel) ) enable_interrupts(); \
    420424                        }
    421425                        #if defined(CFA_HAVE_LINUX_IO_URING_H)
    422426                                #define __IO_STATS__(in_kernel, ...) { \
    423                                         if( !(in_kernel) ) disable_interrupts(); \
    424                                         with( *__tls_stats() ) { \
     427                                        if ( !(in_kernel) ) disable_interrupts(); \
     428                                        with ( *__tls_stats() ) { \
    425429                                                __VA_ARGS__ \
    426430                                        } \
    427                                         if( !(in_kernel) ) enable_interrupts(); \
     431                                        if ( !(in_kernel) ) enable_interrupts(); \
    428432                                }
    429433                        #else
     
    436440        }
    437441}
    438 #endif
     442#endif // #endif
  • libcfa/src/heap.cfa

    r85034ed r8cbe732  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 11 11:21:10 2023
    13 // Update Count     : 1615
     12// Last Modified On : Sat Sep 30 17:31:15 2023
     13// Update Count     : 1617
    1414//
    1515
     
    5353#define TLSMODEL __attribute__(( tls_model("initial-exec") ))
    5454
    55 //#define __STATISTICS__
     55#define __STATISTICS__
    5656
    5757enum {
     
    681681
    682682static HeapStatistics & collectStats( HeapStatistics & stats ) with( heapMaster ) {
    683         lock( mgrLock );
     683        lock( heapMaster.mgrLock );
    684684
    685685        stats += heapMaster.stats;
     
    688688        } // for
    689689
    690         unlock( mgrLock );
     690        unlock( heapMaster.mgrLock );
    691691        return stats;
    692692} // collectStats
    693693
    694694static inline void clearStats() {
    695         lock( mgrLock );
     695        lock( heapMaster.mgrLock );
    696696
    697697        // Zero the heap master and all active thread heaps.
     
    701701        } // for
    702702
    703         unlock( mgrLock );
     703        unlock( heapMaster.mgrLock );
    704704} // clearStats
    705705#endif // __STATISTICS__
  • libcfa/src/iostream.cfa

    r85034ed r8cbe732  
    1111// Created On       : Wed May 27 17:56:53 2015
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Sat Sep  2 14:42:01 2023
    14 // Update Count     : 1561
     13// Last Modified On : Sun Oct  8 12:10:21 2023
     14// Update Count     : 1564
    1515//
    1616
     
    2222#include <float.h>                                                                              // DBL_DIG, LDBL_DIG
    2323#include <complex.h>                                                                    // creal, cimag
     24#include <ctype.h>                                                                              // isspace
    2425//#include <stdio.h>
    2526
     
    2930extern char *strcpy (char *__restrict __dest, const char *__restrict __src) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
    3031extern void *memcpy (void *__restrict __dest, const void *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
     32extern char *strchr(const char *str, int ch);
    3133} // extern "C"
    3234
     
    649651                exp10 = floor( exp10, 3 ); \
    650652                value *= pow( 10.0, -exp10 ); \
    651                 if ( pc <= 3 ) pc = 3; \
     653                if ( pc < 0 ) pc = 3; \
    652654        } /* eng */ \
    653655\
     
    960962        istype & ?|?( istype & is, _Istream_Cskip f ) {
    961963                // printf( "skip %s %d\n", f.scanset, f.wd );
    962                 if ( f.scanset ) fmt( is, f.scanset, "" );              // no input arguments
     964                if ( f.scanset ) {
     965                        int nscanset = strlen(f.scanset);
     966                        char fmtstr[ sizeof("%*[]") + nscanset ];
     967                        int pos = 0;
     968                        fmtstr[pos] = '%';                  pos += 1;
     969                        fmtstr[pos] = '*';                  pos += 1;
     970                        fmtstr[pos] = '[';                  pos += 1;
     971                        strcpy( &fmtstr[pos], f.scanset );  pos += nscanset;
     972                        fmtstr[pos] = ']';                  pos += 1;
     973                        fmtstr[pos] = '\0';
     974                        fmt( is, fmtstr, (void*)0 );  // last arg is dummy: suppress gcc warning
     975                }
    963976                else for ( f.wd ) fmt( is, "%*c" );
    964977                return is;
     
    980993                        // wd is buffer bytes available (for input chars + null terminator)
    981994                        // rwd is count of input chars
    982                         int rwd = f.flags.rwd ? f.wd : (f.wd - 1);
     995                        int rwd;
     996                        if (f.flags.rwd) {
     997                                verify (f.wd >= 0);
     998                                rwd = f.wd;
     999                        } else {
     1000                                verify (f.wd >= 1);
     1001                                rwd = f.wd - 1;
     1002                        } // if
    9831003                        start += sprintf( &fmtstr[start], "%d", rwd );
    9841004                }
     
    10001020
    10011021                int check = f.wd - 2;
    1002                 if ( ! f.flags.rwd ) f.s[check] = '\0';                 // insert sentinel
     1022                if (! f.flags.ignore ) {
     1023                        f.s[0] = '\0';
     1024                        if ( ! f.flags.rwd ) f.s[check] = '\0';         // insert sentinel
     1025                }
    10031026                len = fmt( is, fmtstr, f.s );
    10041027                //fprintf( stderr, "KK %s %zd %d %c %s\n", fmtstr, len, check, f.s[check], f.s );
    10051028
    1006                 if ( ! f.flags.rwd && f.s[check] != '\0' )              // sentinel overwritten ?
    1007                         throw (cstring_length){ &cstring_length_vt };
     1029                if ( ! f.flags.ignore && ! f.flags.rwd && f.s[check] != '\0' ) { // sentinel overwritten ?
     1030                        // buffer filled, but would we have kept going?
     1031                        if ( ! eof( is ) ) {
     1032                                char peek;
     1033                                fmt( is, "%c", &peek );
     1034                                ungetc( is, peek );
     1035                                bool hasMore;
     1036                                if (f.flags.delimiter) { // getline
     1037                                        hasMore = (peek != f.delimiter[0]);
     1038                                } else if (f.scanset) { // incl/excl
     1039                                        bool peekMatch = strchr(f.scanset, peek) != 0p;
     1040                                        hasMore = f.flags.inex ? (!peekMatch) : (peekMatch);
     1041                                } else { // %s
     1042                                        hasMore = !isspace(peek);
     1043                                }
     1044                                if (hasMore) throw (cstring_length){ &cstring_length_vt };
     1045                        } // if
     1046                } // if
    10081047
    10091048                if ( f.flags.delimiter ) {                                              // getline ?
  • libcfa/src/iostream.hfa

    r85034ed r8cbe732  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Sep  2 14:42:13 2023
    13 // Update Count     : 567
     12// Last Modified On : Sun Oct  8 12:02:55 2023
     13// Update Count     : 568
    1414//
    1515
     
    243243        _Ostream_Manip(T) hex( T val ) { return (_Ostream_Manip(T))@{ val, 1, 0, 'a', { .all : 0 } }; } \
    244244        _Ostream_Manip(T) sci( T val ) { return (_Ostream_Manip(T))@{ val, 1, 0, 'e', { .all : 0 } }; } \
    245         _Ostream_Manip(T) eng( T val ) { return (_Ostream_Manip(T))@{ val, 1, 0, 'g', { .flags.eng : true } }; } \
     245        _Ostream_Manip(T) eng( T val ) { return (_Ostream_Manip(T))@{ val, 1, -1, 'g', { .flags.eng : true } }; } \
    246246        _Ostream_Manip(T) wd( unsigned int w, T val ) { return (_Ostream_Manip(T))@{ val, w, 0, 'g', { .all : 0 } }; } \
    247247        _Ostream_Manip(T) wd( unsigned int w, unsigned int pc, T val ) { return (_Ostream_Manip(T))@{ val, w, pc, 'f', { .flags.pc : true } }; } \
  • libcfa/src/rational.cfa

    r85034ed r8cbe732  
    1010// Created On       : Wed Apr  6 17:54:28 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 18 11:07:10 2023
    13 // Update Count     : 197
     12// Last Modified On : Fri Oct  6 07:52:13 2023
     13// Update Count     : 198
    1414//
    1515
     
    7676        } // denominator
    7777
    78         [ T, T ] ?=?( & [ T, T ] dest, rational(T) src ) {
    79                 return dest = src.[ numerator, denominator ];
     78        [ T, T ] ?=?( & [ T, T ] dst, rational(T) src ) {
     79                return dst = src.[ numerator, denominator ];
    8080        } // ?=?
    8181
  • libcfa/src/rational.hfa

    r85034ed r8cbe732  
    1212// Created On       : Wed Apr  6 17:56:25 2016
    1313// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Tue Jul 18 11:08:24 2023
    15 // Update Count     : 121
     14// Last Modified On : Fri Oct  6 07:52:20 2023
     15// Update Count     : 122
    1616//
    1717
     
    4040        T numerator( rational(T) r );
    4141        T denominator( rational(T) r );
    42         [ T, T ] ?=?( & [ T, T ] dest, rational(T) src );
     42        [ T, T ] ?=?( & [ T, T ] dst, rational(T) src );
    4343
    4444        // numerator/denominator setter
  • libcfa/src/stdlib.hfa

    r85034ed r8cbe732  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Sep  2 18:29:35 2023
    13 // Update Count     : 780
     12// Last Modified On : Sun Oct  8 09:18:28 2023
     13// Update Count     : 789
    1414//
    1515
     
    431431        uint32_t seed;                                                                          // current seed
    432432        PRNG_STATE_32_T state;                                                          // random state
    433 }; // PRNG
     433}; // PRNG32
    434434
    435435static inline {
     
    442442        uint32_t prng( PRNG32 & prng, uint32_t l, uint32_t u ) __attribute__(( warn_unused_result )) { return prng( prng, u - l + 1 ) + l; } // [l,u]
    443443        uint32_t calls( PRNG32 & prng ) __attribute__(( warn_unused_result )) with( prng ) { return callcnt; }
    444 } // distribution
     444        void copy( PRNG32 & dst, PRNG32 & src ) { dst = src; } // checkpoint PRNG state, use autogen assignment
     445} // distribution
     446void ?{}( PRNG32 &, PRNG32 & ) = void;                                  // no copy, remove autogen copy constructor
     447PRNG32 & ?=?( PRNG32 &, const PRNG32 ) = void;                  // no assignment, remove autogen assignment
    445448
    446449struct PRNG64 {
     
    448451        uint64_t seed;                                                                          // current seed
    449452        PRNG_STATE_64_T state;                                                          // random state
    450 }; // PRNG
     453}; // PRNG64
    451454
    452455static inline {
     
    459462        uint64_t prng( PRNG64 & prng, uint64_t l, uint64_t u ) __attribute__(( warn_unused_result )) { return prng( prng, u - l + 1 ) + l; } // [l,u]
    460463        uint64_t calls( PRNG64 & prng ) __attribute__(( warn_unused_result )) with( prng ) { return callcnt; }
    461 } // distribution
     464        void copy( PRNG64 & dst, PRNG64 & src ) { dst = src; } // checkpoint PRNG state, use autogen assignment
     465} // distribution
     466void ?{}( PRNG64 &, PRNG64 & ) = void;                                  // no copy, remove autogen copy constructor
     467PRNG64 & ?=?( PRNG64 &, const PRNG64 ) = void;                  // no assignment, remove autogen assignment
    462468
    463469// Set default random-generator size.
  • src/AST/Convert.cpp

    r85034ed r8cbe732  
    269269                        node->location,
    270270                        Type::StorageClasses( node->storage.val ),
    271             get<Type>().accept1( node->base ),
     271                        get<Type>().accept1( node->base ),
    272272                        LinkageSpec::Spec( node->linkage.val )
    273273                );
     
    567567        }
    568568
    569     const ast::WhenClause * visit( const ast::WhenClause * node ) override final {
     569        const ast::WhenClause * visit( const ast::WhenClause * node ) override final {
    570570                // There is no old-AST WhenClause, so this should never be called.
    571571                assert( !node );
     
    604604        }
    605605
    606     const ast::Stmt * visit( const ast::WaitUntilStmt * node ) override final {
    607         // There is no old-AST WaitUntilStmt, so this should never be called.
     606        const ast::Stmt * visit( const ast::WaitUntilStmt * node ) override final {
     607                // There is no old-AST WaitUntilStmt, so this should never be called.
    608608                assert( !node );
    609609                return nullptr;
     
    648648                );
    649649                return stmtPostamble( stmt, node );
     650        }
     651
     652        const ast::Stmt * visit( const ast::CorunStmt * node ) override final {
     653                // There is no old-AST CorunStmt, so this should never be called.
     654                assert( !node );
     655                return nullptr;
    650656        }
    651657
     
    853859                // New workd:   one public type: node->result, plus node->underlyer only to support roundtrip conversion
    854860                //              preserving underlyer because the correct type for string literals is complicated to construct,
    855             //              and distinguishing a string from other literals using the type is hard to do accurately
     861                //              and distinguishing a string from other literals using the type is hard to do accurately
    856862                // Both worlds: the outer, expression-level type can change during resolution
    857863                //              for a string, that's char[k] before-resolve and char * after
     
    859865                //              for a string, that's char[k] always
    860866                // Both worlds: the "rep" field of a constant is the C source file fragment that compiles to the desired value
    861         //              for a string, that includes outer quotes, backslashes, et al cases from the Literals test
     867                //              for a string, that includes outer quotes, backslashes, et al cases from the Literals test
    862868                ConstantExpr *rslt = new ConstantExpr(Constant(
    863869                        get<Type>().accept1(node->underlyer),
     
    15181524                return strict_dynamic_cast< ast::Decl * >( node );
    15191525        }
    1520        
     1526
    15211527        ConverterOldToNew() = default;
    15221528        ConverterOldToNew(const ConverterOldToNew &) = delete;
     
    15811587        ast::Label make_label(const Label* old) {
    15821588                CodeLocation const & location =
    1583                     ( old->labelled ) ? old->labelled->location : CodeLocation();
     1589                        ( old->labelled ) ? old->labelled->location : CodeLocation();
    15841590                return ast::Label(
    15851591                        location,
     
    22402246        // TypeSubstitution shouldn't exist yet in old.
    22412247        ast::TypeSubstitution * convertTypeSubstitution(const TypeSubstitution * old) {
    2242                
    22432248                if (!old) return nullptr;
    22442249                if (old->empty()) return nullptr;
     
    22852290        ast::Expr * visitBaseExpr_SkipResultType( const Expression * old, ast::Expr * nw) {
    22862291
    2287                 nw->env    = convertTypeSubstitution(old->env);
     2292                nw->env = convertTypeSubstitution(old->env);
    22882293
    22892294                nw->extension = old->extension;
     
    28562861
    28572862        virtual void visit( const EnumInstType * old ) override final {
    2858                 ast::EnumInstType * ty; 
     2863                ast::EnumInstType * ty;
    28592864                if ( old->baseEnum ) {
    28602865                        ty = new ast::EnumInstType{
  • src/AST/Fwd.hpp

    r85034ed r8cbe732  
    6767class ImplicitCtorDtorStmt;
    6868class MutexStmt;
     69class CorunStmt;
    6970
    7071class Expr;
  • src/AST/Node.cpp

    r85034ed r8cbe732  
    192192template class ast::ptr_base< ast::MutexStmt, ast::Node::ref_type::weak >;
    193193template class ast::ptr_base< ast::MutexStmt, ast::Node::ref_type::strong >;
     194template class ast::ptr_base< ast::CorunStmt, ast::Node::ref_type::weak >;
     195template class ast::ptr_base< ast::CorunStmt, ast::Node::ref_type::strong >;
    194196template class ast::ptr_base< ast::Expr, ast::Node::ref_type::weak >;
    195197template class ast::ptr_base< ast::Expr, ast::Node::ref_type::strong >;
  • src/AST/Pass.hpp

    r85034ed r8cbe732  
    162162        const ast::FinallyClause *    visit( const ast::FinallyClause        * ) override final;
    163163        const ast::Stmt *             visit( const ast::SuspendStmt          * ) override final;
    164     const ast::WhenClause *       visit( const ast::WhenClause           * ) override final;
     164        const ast::WhenClause *       visit( const ast::WhenClause           * ) override final;
    165165        const ast::Stmt *             visit( const ast::WaitForStmt          * ) override final;
    166166        const ast::WaitForClause *    visit( const ast::WaitForClause        * ) override final;
    167     const ast::Stmt *             visit( const ast::WaitUntilStmt        * ) override final;
     167        const ast::Stmt *             visit( const ast::WaitUntilStmt        * ) override final;
    168168        const ast::Decl *             visit( const ast::WithStmt             * ) override final;
    169169        const ast::NullStmt *         visit( const ast::NullStmt             * ) override final;
     
    171171        const ast::Stmt *             visit( const ast::ImplicitCtorDtorStmt * ) override final;
    172172        const ast::Stmt *             visit( const ast::MutexStmt            * ) override final;
     173        const ast::Stmt *             visit( const ast::CorunStmt            * ) override final;
    173174        const ast::Expr *             visit( const ast::ApplicationExpr      * ) override final;
    174175        const ast::Expr *             visit( const ast::UntypedExpr          * ) override final;
  • src/AST/Pass.impl.hpp

    r85034ed r8cbe732  
    11211121
    11221122//--------------------------------------------------------------------------
     1123// CorunStmt
     1124template< typename core_t >
     1125const ast::Stmt * ast::Pass< core_t >::visit( const ast::CorunStmt * node ) {
     1126        VISIT_START( node );
     1127
     1128        if ( __visit_children() ) {
     1129                maybe_accept( node, &CorunStmt::stmt );
     1130        }
     1131
     1132        VISIT_END( Stmt, node );
     1133}
     1134
     1135//--------------------------------------------------------------------------
    11231136// ApplicationExpr
    11241137template< typename core_t >
  • src/AST/Print.cpp

    r85034ed r8cbe732  
    209209        }
    210210
    211     void print( const ast::WaitStmt * node ) {
     211        void print( const ast::WaitStmt * node ) {
    212212                if ( node->timeout_time ) {
    213213                        os << indent-1 << "timeout of:" << endl;
     
    860860        }
    861861
    862     virtual const ast::Stmt * visit( const ast::WaitUntilStmt * node ) override final {
     862        virtual const ast::Stmt * visit( const ast::WaitUntilStmt * node ) override final {
    863863                os << "Waituntil Statement" << endl;
    864864                indent += 2;
     
    866866                        clause->accept( *this );
    867867                }
    868         print(node);    // calls print( const ast::WaitStmt * node )
     868                // calls print( const ast::WaitStmt * node )
     869                print(node);
    869870                return node;
    870871        }
     
    913914                printAll( node->mutexObjs );
    914915                --indent;
     916                os << indent << "... with Statement: ";
     917                ++indent;
     918                safe_print( node->stmt );
     919                --indent;
     920                os << endl;
     921
     922                return node;
     923        }
     924
     925        virtual const ast::Stmt * visit( const ast::CorunStmt * node ) override final {
     926                os << "Corun Statement" << endl;
    915927                os << indent << "... with Statement: ";
    916928                ++indent;
  • src/AST/Stmt.hpp

    r85034ed r8cbe732  
    532532};
    533533
     534// Corun Statement
     535class CorunStmt final : public Stmt {
     536  public:
     537        ptr<Stmt> stmt;
     538
     539        CorunStmt( const CodeLocation & loc, const Stmt * stmt, const std::vector<Label> && labels = {} )
     540                : Stmt(loc, std::move(labels)), stmt(stmt) {}
     541
     542        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     543  private:
     544        CorunStmt * clone() const override { return new CorunStmt{ *this }; }
     545        MUTATE_FRIEND
     546};
     547
    534548} // namespace ast
    535549
  • src/AST/Visitor.hpp

    r85034ed r8cbe732  
    5959    virtual const ast::Stmt *             visit( const ast::ImplicitCtorDtorStmt * ) = 0;
    6060    virtual const ast::Stmt *             visit( const ast::MutexStmt            * ) = 0;
     61    virtual const ast::Stmt *             visit( const ast::CorunStmt            * ) = 0;
    6162    virtual const ast::Expr *             visit( const ast::ApplicationExpr      * ) = 0;
    6263    virtual const ast::Expr *             visit( const ast::UntypedExpr          * ) = 0;
  • src/CodeGen/CodeGenerator.cc

    r85034ed r8cbe732  
    11571157
    11581158        void CodeGenerator::postvisit( WithStmt * with ) {
    1159                 if ( ! options.genC ) {
    1160                         output << "with ( ";
    1161                         genCommaList( with->exprs.begin(), with->exprs.end() );
    1162                         output << " ) ";
    1163                 }
     1159                assertf( ! options.genC, "WithStmts should not reach code generation." );
     1160
     1161                output << "with ( ";
     1162                genCommaList( with->exprs.begin(), with->exprs.end() );
     1163                output << " ) ";
    11641164                with->stmt->accept( *visitor );
    11651165        }
  • src/CodeGen/LinkOnce.cc

    r85034ed r8cbe732  
    1010// Created On       : Thur May 13 10:10:00 2021
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thur May 13 14:39:00 2021
    13 // Update Count     : 0
     12// Last Modified On : Wed Oct  4 10:52:00 2023
     13// Update Count     : 1
    1414//
    1515
     
    1818#include <algorithm>
    1919
     20#include "AST/Attribute.hpp"
     21#include "AST/Decl.hpp"
     22#include "AST/Expr.hpp"
     23#include "AST/Pass.hpp"
    2024#include "Common/PassVisitor.h"       // for PassVisitor, WithShortCircuiting
    2125
    2226namespace CodeGen {
    2327
    24 static bool is_cfa_linkonce( Attribute const * attr ) {
     28namespace {
     29
     30bool is_cfa_linkonce_old( Attribute const * attr ) {
    2531        return std::string("cfa_linkonce") == attr->name;
    2632}
    2733
    28 static bool is_section_attribute( Attribute const * attr ) {
     34bool is_section_attribute_old( Attribute const * attr ) {
    2935        return std::string("section") == attr->name;
    3036}
     
    3945                std::list< Attribute * > & attributes = decl->attributes;
    4046                // See if we can find the element:
    41                 auto found = std::find_if(attributes.begin(), attributes.end(), is_cfa_linkonce );
     47                auto found = std::find_if(attributes.begin(), attributes.end(), is_cfa_linkonce_old );
    4248                if ( attributes.end() != found ) {
    4349                        // Remove any other sections:
    44                         attributes.remove_if( is_section_attribute );
     50                        attributes.remove_if( is_section_attribute_old );
    4551                        // Iterator to the cfa_linkonce attribute should still be valid.
    4652                        Attribute * attribute = *found;
     
    6369};
    6470
     71bool is_cfa_linkonce( ast::Attribute const * attr ) {
     72        return "cfa_linkonce" == attr->name;
     73}
     74
     75bool is_section_attribute( ast::Attribute const * attr ) {
     76        return "section" == attr->name;
     77}
     78
     79struct LinkOnceCore : public ast::WithShortCircuiting {
     80        void previsit( ast::Decl const * ) {
     81                visit_children = false;
     82        }
     83
     84        ast::DeclWithType const * postvisit( ast::DeclWithType const * decl ) {
     85                // Check to see if we have to mutate, because should be uncommon.
     86                {
     87                        auto & attributes = decl->attributes;
     88                        auto found = std::find_if( attributes.begin(), attributes.end(),
     89                                        is_cfa_linkonce );
     90                        if ( attributes.end() == found ) return decl;
     91                }
     92                auto mutDecl = mutate( decl );
     93                auto & attributes = mutDecl->attributes;
     94
     95                // Remove all conflicting section attributes.
     96                erase_if( attributes, is_section_attribute );
     97
     98                // Get the attribute, and overwrite it as a section attribute.
     99                auto found = std::find_if( attributes.begin(), attributes.end(),
     100                                is_cfa_linkonce );
     101                assert( attributes.end() != found );
     102                ast::Attribute * attribute = found->get_and_mutate();
     103                assert( attribute->params.empty() );
     104                assert( !decl->mangleName.empty() );
     105
     106                attribute->name = "section";
     107                attribute->params.push_back(
     108                        ast::ConstantExpr::from_string( mutDecl->location,
     109                                ".gnu.linkonce." + decl->mangleName
     110                        )
     111                );
     112
     113                // Unconditionnaly add "visibility(default)" to anything with
     114                // .gnu.linkonce visibility is a mess otherwise.
     115                attributes.push_back( new ast::Attribute( "visibility", {
     116                        ast::ConstantExpr::from_string( mutDecl->location, "default" )
     117                } ) );
     118                return mutDecl;
     119        }
     120};
     121
     122} // namespace
     123
    65124void translateLinkOnce( std::list< Declaration *> & translationUnit ) {
    66125        PassVisitor<LinkOnceVisitorCore> translator;
     
    68127}
    69128
     129void translateLinkOnce( ast::TranslationUnit & translationUnit ) {
     130        ast::Pass<LinkOnceCore>::run( translationUnit );
    70131}
     132
     133} // namespace CodeGen
  • src/CodeGen/LinkOnce.h

    r85034ed r8cbe732  
    1010// Created On       : Thur May 13 10:06:00 2021
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thur May 13 14:38:00 2021
    13 // Update Count     : 0
     12// Last Modified On : Wed Oct  4 10:52:00 2023
     13// Update Count     : 1
    1414//
    1515
     
    2323
    2424class Declaration;
     25namespace ast {
     26        class TranslationUnit;
     27}
    2528
    2629namespace CodeGen {
    2730
    2831void translateLinkOnce( std::list< Declaration *> & translationUnit );
     32void translateLinkOnce( ast::TranslationUnit & translationUnit );
    2933/* Convert the cfa_linkonce attribute on top level declaration into
    3034 * a special section declaration (.gnu.linkonce) so that it may be defined
  • src/Common/CodeLocationTools.cpp

    r85034ed r8cbe732  
    137137    macro(ImplicitCtorDtorStmt, Stmt) \
    138138    macro(MutexStmt, Stmt) \
     139    macro(CorunStmt, Stmt) \
    139140    macro(ApplicationExpr, Expr) \
    140141    macro(UntypedExpr, Expr) \
  • src/Concurrency/module.mk

    r85034ed r8cbe732  
    1818        Concurrency/Actors.cpp \
    1919        Concurrency/Actors.hpp \
     20        Concurrency/Corun.cpp \
     21        Concurrency/Corun.hpp \
    2022        Concurrency/KeywordsNew.cpp \
    2123        Concurrency/Keywords.cc \
  • src/GenPoly/Box.h

    r85034ed r8cbe732  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Box.h --
     7// Box.h -- Implement polymorphic function calls and types.
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:23:52 2017
    13 // Update Count     : 6
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Oct  6 13:37:00 2022
     13// Update Count     : 7
    1414//
    1515
     
    1919
    2020class Declaration;
     21namespace ast {
     22        class TranslationUnit;
     23}
    2124
    2225namespace GenPoly {
    2326        /// boxes polymorphic function calls
    2427        void box( std::list< Declaration* >& translationUnit );
     28void box( ast::TranslationUnit & translationUnit );
    2529} // namespace GenPoly
    2630
  • src/GenPoly/InstantiateGeneric.h

    r85034ed r8cbe732  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // InstantiateGeneric.h --
     7// InstantiateGeneric.h -- Create concrete instances of generic types.
    88//
    99// Author           : Aaron B. Moss
     
    2424
    2525namespace GenPoly {
    26 /// Replaces all generic types that have static layout with concrete
    27 /// instantiations. Types with concrete values for otype parameters will be
    28 /// template-expanded, while dtype and ftype parameters will be replaced by
    29 /// the appropriate void type.
     26
    3027void instantiateGeneric( std::list< Declaration* > &translationUnit );
    3128void instantiateGeneric( ast::TranslationUnit & translationUnit );
     29/// Replaces all generic types that have static layout with concrete
     30/// instantiations. Sized types are replaced with the concrete argument types
     31/// while unsized types are erased to a void type.
     32/// This pass can cause designators to ignore the pretty print option.
     33
    3234} // namespace GenPoly
    3335
  • src/GenPoly/InstantiateGenericNew.cpp

    r85034ed r8cbe732  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // InstantiateGenericNew.cpp --
     7// InstantiateGenericNew.cpp -- Create concrete instances of generic types.
    88//
    99// Author           : Andrew Beach
     
    335335ast::Expr const * FixDtypeStatic::postvisit( ast::MemberExpr const * expr ) {
    336336        ast::ptr<ast::Type> const & type = expr->aggregate->result;
    337         if ( !isGenericType( type ) ) {
    338                 return expr;
    339         } else if ( auto inst = type.as<ast::StructInstType>() ) {
    340                 return fixMemberExpr( inst, expr );
     337        if ( auto inst = type.as<ast::StructInstType>() ) {
     338                if ( !inst->params.empty() ) return fixMemberExpr( inst, expr );
    341339        } else if ( auto inst = type.as<ast::UnionInstType>() ) {
    342                 return fixMemberExpr( inst, expr );
     340                if ( !inst->params.empty() ) return fixMemberExpr( inst, expr );
    343341        }
    344342        return expr;
     
    451449        ast::Expr const * postvisit( ast::MemberExpr const * expr );
    452450        ast::Expr const * postvisit( ast::Expr const * expr );
    453         void previsit( ast::ParseNode const * node );
    454 
     451        ast::Designation const * postvisit( ast::Designation const * );
     452
     453        void previsit( ast::ParseNode const * node ) {
     454                GuardValue( location ) = &node->location;
     455        }
    455456        void previsit( ast::FunctionType const * ) {
    456457                GuardValue( inFunctionType ) = true;
     
    628629}
    629630
    630 void GenericInstantiator::previsit( ast::ParseNode const * node ) {
    631         GuardValue( location ) = &node->location;
     631// This attempts to figure out what the final name of the field will be.
     632// Pretty printing can cause this to become incorrect.
     633std::string getPrintName( ast::DeclWithType const * decl ) {
     634        return ( decl->linkage.is_mangled )
     635                ? decl->scopedMangleName() : decl->name;
     636}
     637
     638ast::Designation const * GenericInstantiator::postvisit(
     639                ast::Designation const * designation ) {
     640        // Disconnect designator names from their fields.
     641        // It is now incorrect to point at the generic definition where the used
     642        // type now is replaced with a concrete instance. Ideally, new variable
     643        // expressions would point at fields in the concrete instances, but that
     644        // is work and that information should not be needed this late in
     645        // compilation.
     646
     647        // Modify all designations, even if not needed.
     648        auto mutNode = mutate( designation );
     649        for ( ast::ptr<ast::Expr> & designator : mutNode->designators ) {
     650                if ( auto var = designator.as<ast::VariableExpr>() ) {
     651                        designator = new ast::NameExpr(
     652                                var->location, getPrintName( var->var ) );
     653                }
     654        }
     655        return mutNode;
    632656}
    633657
  • src/GenPoly/module.mk

    r85034ed r8cbe732  
    2222
    2323SRC += $(SRC_GENPOLY) \
     24        GenPoly/BoxNew.cpp \
    2425        GenPoly/Box.cc \
    2526        GenPoly/Box.h \
  • src/Parser/StatementNode.cc

    r85034ed r8cbe732  
    498498} // build_mutex
    499499
     500ast::Stmt * build_corun( const CodeLocation & location, StatementNode * stmt ) {
     501        ast::Stmt * body = maybeMoveBuild( stmt );
     502        return new ast::CorunStmt( location, body );
     503} // build_corun
     504
    500505// Local Variables: //
    501506// tab-width: 4 //
  • src/Parser/StatementNode.h

    r85034ed r8cbe732  
    105105ast::Stmt * build_with( const CodeLocation &, ExpressionNode * exprs, StatementNode * stmt );
    106106ast::Stmt * build_mutex( const CodeLocation &, ExpressionNode * exprs, StatementNode * stmt );
     107ast::Stmt * build_corun( const CodeLocation &, StatementNode * stmt );
  • src/Parser/lex.ll

    r85034ed r8cbe732  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Fri Jun  9 10:04:00 2023
    13  * Update Count     : 770
     12 * Last Modified On : Tue Oct  3 17:10:57 2023
     13 * Update Count     : 773
    1414 */
    1515
     
    217217
    218218                                /* keywords */
     219alignas                 { KEYWORD_RETURN(ALIGNAS); }                    // CFA
    219220_Alignas                { KEYWORD_RETURN(ALIGNAS); }                    // C11
     221alignof                 { KEYWORD_RETURN(ALIGNOF); }                    // CFA
    220222_Alignof                { KEYWORD_RETURN(ALIGNOF); }                    // C11
    221223__alignof               { KEYWORD_RETURN(ALIGNOF); }                    // GCC
     
    239241choose                  { KEYWORD_RETURN(CHOOSE); }                             // CFA
    240242coerce                  { KEYWORD_RETURN(COERCE); }                             // CFA
     243corun                   { KEYWORD_RETURN(CORUN); }                              // CFA
     244cofor                   { KEYWORD_RETURN(COFOR); }                              // CFA
    241245_Complex                { KEYWORD_RETURN(COMPLEX); }                    // C99
    242246__complex               { KEYWORD_RETURN(COMPLEX); }                    // GCC
     
    319323static                  { KEYWORD_RETURN(STATIC); }
    320324_Static_assert  { KEYWORD_RETURN(STATICASSERT); }               // C11
    321 _static_assert  { KEYWORD_RETURN(STATICASSERT); }               // C23
     325static_assert   { KEYWORD_RETURN(STATICASSERT); }               // C23
    322326struct                  { KEYWORD_RETURN(STRUCT); }
    323327suspend                 { KEYWORD_RETURN(SUSPEND); }                    // CFA
     
    326330__thread                { KEYWORD_RETURN(THREADLOCALGCC); }             // GCC
    327331_Thread_local   { KEYWORD_RETURN(THREADLOCALC11); }             // C11
     332thread_local    { KEYWORD_RETURN(THREADLOCALC11); }             // C23
    328333throw                   { KEYWORD_RETURN(THROW); }                              // CFA
    329334throwResume             { KEYWORD_RETURN(THROWRESUME); }                // CFA
  • src/Parser/parser.yy

    r85034ed r8cbe732  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep  4 18:28:12 2023
    13 // Update Count     : 6393
     12// Last Modified On : Tue Oct  3 17:14:12 2023
     13// Update Count     : 6396
    1414//
    1515
     
    350350%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    351351%token CHOOSE FALLTHRU FALLTHROUGH WITH WHEN WAITFOR WAITUNTIL // CFA
     352%token CORUN COFOR
    352353%token DISABLE ENABLE TRY THROW THROWRESUME AT                  // CFA
    353354%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
     
    422423%type<stmt> with_statement
    423424%type<expr> with_clause_opt
     425%type<stmt> corun_statement                             cofor_statement
    424426%type<stmt> exception_statement
    425427%type<clause> handler_clause                    finally_clause
     
    11401142        | waitfor_statement
    11411143        | waituntil_statement
     1144        | corun_statement
     1145        | cofor_statement
    11421146        | exception_statement
    11431147        | enable_disable_statement
     
    17131717        wor_waituntil_clause                                                            %prec THEN
    17141718                { $$ = new StatementNode( build_waituntil_stmt( yylloc, $1 ) ); }
     1719        ;
     1720
     1721corun_statement:
     1722        CORUN statement
     1723                { $$ = new StatementNode( build_corun( yylloc, $2 ) ); }
     1724        ;
     1725
     1726cofor_statement:
     1727        COFOR '(' for_control_expression_list ')' statement
     1728                { SemanticError( yylloc, "cofor statement is currently unimplemented." ); $$ = nullptr; }
    17151729        ;
    17161730
  • src/ResolvExpr/module.mk

    r85034ed r8cbe732  
    7272        ResolvExpr/AlternativePrinter.h \
    7373        ResolvExpr/CandidatePrinter.cpp \
    74         ResolvExpr/CandidatePrinter.hpp
     74        ResolvExpr/CandidatePrinter.hpp \
     75        ResolvExpr/EraseWith.cpp \
     76        ResolvExpr/EraseWith.hpp
    7577
    7678SRCDEMANGLE += $(SRC_RESOLVEXPR)
  • src/Validate/NoIdSymbolTable.hpp

    r85034ed r8cbe732  
    2020namespace Validate {
    2121
    22 // A SymbolTable that only has the operations used in the Translate Dimension
    23 // pass. More importantly, it doesn't have some methods that should no be
     22// A SymbolTable that only tracks names relevant to Validate passes.
     23// It tracks type names but not identifier names.
     24// Some of the canonicalization that occurs before the resolver
     25// affects how identifier name errors get reported to the user.
     26// The Validate phase needs to chase type names,
     27// but it is too early to try tracking identifier names.
     28// Identifier skipping is acheived by omitting methods that should not be
    2429// called by the Pass template (lookupId and addId).
    2530class NoIdSymbolTable {
    2631        ast::SymbolTable base;
    2732public:
     33        // All names that are tracked (now) are eligible for collision validation (now).
     34        // (Names that are only tracked later get their collision validation then.)
     35        NoIdSymbolTable() : base(ast::SymbolTable::ValidateOnAdd) {}
     36
    2837#       define FORWARD_X( func, types_and_names, just_names ) \
    2938        inline auto func types_and_names -> decltype( base.func just_names ) { \
  • src/main.cc

    r85034ed r8cbe732  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr 10 21:12:17 2023
    13 // Update Count     : 682
     12// Last Modified On : Thu Sep 28 22:28:45 2023
     13// Update Count     : 687
    1414//
    1515
     
    4646#include "Common/utility.h"                 // for deleteAll, filter, printAll
    4747#include "Concurrency/Actors.hpp"           // for implementActors
     48#include "Concurrency/Corun.hpp"            // for implementCorun
    4849#include "Concurrency/Keywords.h"           // for implementMutex, implement...
    4950#include "Concurrency/Waitfor.h"            // for generateWaitfor
     
    6263#include "Parser/RunParser.hpp"             // for buildList, dumpParseTree,...
    6364#include "ResolvExpr/CandidatePrinter.hpp"  // for printCandidates
     65#include "ResolvExpr/EraseWith.hpp"         // for eraseWith
    6466#include "ResolvExpr/Resolver.h"            // for resolve
    6567#include "SynTree/LinkageSpec.h"            // for Spec, Cforall, Intrinsic
     
    344346                PASS( "Implement Concurrent Keywords", Concurrency::implementKeywords, transUnit );
    345347                PASS( "Fix Unique Ids", Validate::fixUniqueIds, transUnit );
     348                PASS( "Implement Corun", Concurrency::implementCorun, transUnit );
    346349                PASS( "Hoist Control Declarations", ControlStruct::hoistControlDecls, transUnit );
    347350
     
    396399
    397400                PASS( "Fix Init", InitTweak::fix, transUnit, buildingLibrary() );
     401                PASS( "Erase With", ResolvExpr::eraseWith, transUnit );
    398402
    399403                // fix ObjectDecl - replaces ConstructorInit nodes
     
    419423
    420424                PASS( "Convert L-Value", GenPoly::convertLvalue, transUnit );
     425                DUMP( bboxp, std::move( transUnit ) );
     426                PASS( "Box", GenPoly::box, transUnit );
     427                PASS( "Link-Once", CodeGen::translateLinkOnce, transUnit );
    421428
    422429                translationUnit = convert( std::move( transUnit ) );
    423 
    424                 DUMP( bboxp, translationUnit );
    425                 PASS( "Box", GenPoly::box, translationUnit );
    426 
    427                 PASS( "Link-Once", CodeGen::translateLinkOnce, translationUnit );
    428430
    429431                // Code has been lowered to C, now we can start generation.
     
    540542        { "ascodegen", codegenp, true, "print AST as codegen rather than AST" },
    541543        { "asterr", errorp, true, "print AST on error" },
    542         { "declstats", declstatsp, true, "code property statistics" },
    543         { "parse", yydebug, true, "yacc (parsing) debug information" },
     544        { "declstats", declstatsp, true, "print code property statistics" },
     545        { "parse", yydebug, true, "print yacc (parsing) debug information" },
    544546        { "pretty", prettycodegenp, true, "prettyprint for ascodegen flag" },
    545547        { "rproto", resolvprotop, true, "resolver-proto instance" },
    546548        { "rsteps", resolvep, true, "print resolver steps" },
    547         // code dumps
     549        // AST dumps
    548550        { "ast", astp, true, "print AST after parsing" },
    549         { "exdecl", exdeclp, true, "print AST after translating exception decls" },
     551        { "excpdecl", exdeclp, true, "print AST after translating exception decls" },
    550552        { "symevt", symtabp, true, "print AST after symbol table events" },
    551         { "altexpr", expraltp, true, "print alternatives for expressions" },
    552         { "astdecl", validp, true, "print AST after declaration validation pass" },
    553         { "resolver", bresolvep, true, "print AST before resolver step" },
    554         { "astexpr", exprp, true, "print AST after expression analysis" },
     553        { "expralt", expraltp, true, "print AST after expressions alternatives" },
     554        { "valdecl", validp, true, "print AST after declaration validation pass" },
     555        { "bresolver", bresolvep, true, "print AST before resolver step" },
     556        { "expranly", exprp, true, "print AST after expression analysis" },
    555557        { "ctordtor", ctorinitp, true, "print AST after ctor/dtor are replaced" },
    556558        { "tuple", tuplep, true, "print AST after tuple expansion" },
    557         { "astgen", genericsp, true, "print AST after instantiate generics" },
    558         { "box", bboxp, true, "print AST before box step" },
    559         { "codegen", bcodegenp, true, "print AST before code generation" },
     559        { "instgen", genericsp, true, "print AST after instantiate generics" },
     560        { "bbox", bboxp, true, "print AST before box pass" },
     561        { "bcodegen", bcodegenp, true, "print AST before code generation" },
    560562};
    561563enum { printoptsSize = sizeof( printopts ) / sizeof( printopts[0] ) };
  • tests/.expect/linkonce.txt

    r85034ed r8cbe732  
    1 signed=-7 unsigned=12
     1signed=7 unsigned=12
  • tests/collections/.expect/string-istream-manip.txt

    r85034ed r8cbe732  
     1preS1 0123456
     2preS1 x
     3preS2 01234567
     4preS2 x
     5preS3 012345678
     6preS3 x
     7preS4 0123456789
     8preS4 x
     9preSMN1 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456
     10preSMN1 x
     11preSMN2 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...01234567
     12preSMN2 x
     13preSMN3 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...012345678
     14preSMN3 x
     15preSMN4 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456789
     16preSMN4 x
     17preRMN1 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456
     18preRMN1 x
     19preRMN2 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...01234567
     20preRMN2 x
     21preRMN3 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...012345678
     22preRMN3 x
     23preRMN4 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456789
     24preRMN4 x
     25preSMI1 "...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...       "
     26preSMI1 "x"
     27preSMI2 "...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...        "
     28preSMI2 "x"
     29preSMI3 "...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...         "
     30preSMI3 "x"
     31preSMI4 "...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...          "
     32preSMI4 "x"
     33preSME1 "...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...       "
     34preSME1 "x"
     35preSME2 "...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...        "
     36preSME2 "x"
     37preSME3 "...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...         "
     38preSME3 "x"
     39preSME4 "...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...          "
     40preSME4 "x"
     41preSMG1 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456
     42preSMG1 x
     43preSMG2 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...01234567
     44preSMG2 x
     45preSMG3 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...012345678
     46preSMG3 x
     47preSMG4 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456789
     48preSMG4 x
     49preSMD1 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456
     50preSMD1 x
     51preSMD2 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...01234567
     52preSMD2 x
     53preSMD3 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...012345678
     54preSMD3 x
     55preSMD4 ...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456789
     56preSMD4 x
    1571 yyyyyyyyyyyyyyyyyyyy
    2582 abcxxx
     
    126812 wwwwwwww
    136913 wwwwwwww
     7014 cccc
     7115
    14721 yyyyyyyyyyyyyyyyyyyy
    15732 abcxxx
     
    258312 wwwwwwww
    268413 wwwwwwww
     8514 cccc
     8615
  • tests/collections/.in/string-istream-manip.txt

    r85034ed r8cbe732  
     10123456 x
     201234567 x
     3012345678 x
     40123456789 x
     5...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456 x
     6...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...01234567 x
     7...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...012345678 x
     8...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456789 x
     9...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456 x
     10...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...01234567 x
     11...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...012345678 x
     12...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456789 x
     13...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...       -x-
     14...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...        -x-
     15...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...         -x-
     16...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...          -x-
     17...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...       -x-
     18...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...        -x-
     19...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...         -x-
     20...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...          -x-
     21...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456
     22x
     23...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...01234567
     24x
     25...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...012345678
     26x
     27...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456789
     28x
     29...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456@x@
     30...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...01234567@x@
     31...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...012345678@x@
     32...:...:...:...|...:...:...:...|...:...:...:...|...:...:...:...#...:...:...:...|...:...:...:...|...:...:...:...|...:...0123456789@x@
    133abc
    2 abc
     34cccccb
    335xx
    436abcxxx
    537abcyyy
    638aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww
     39uuuuuccccuuuuu
    740abc
    8 abc
     41cccccb
    942xx
    1043abcxxx
    1144abcyyy
    1245aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww
     46uuuuuccccuuuuu
  • tests/collections/string-istream-manip.cfa

    r85034ed r8cbe732  
    33#include <collections/string.hfa>
    44#include <collections/string_res.hfa>
     5#include <stdio.h>
     6
     7// No-op manipulators.
     8// Temporary hack while there are two code paths in the string implementation.
     9// (One for reading plain strings, the other for reading via a manipulator.)
     10// The test cases that use plainjane(-) are exercising the via-manipulator code path,
     11// just with trivial manipulation.
     12static _Istream_Sstr plainjane( string     & s )  { return (_Istream_Sstr)@{  s, {{0p}, -1, {.flags.rwd : false}} }; }
     13static _Istream_Rstr plainjane( string_res & s )  { return (_Istream_Rstr)@{ &s, {{0p}, -1, {.flags.rwd : false}} }; }
     14
     15static void forceStringHeapFreeSpaceTo(int desiredSize) {
     16    for (1_000_000) {
     17        string x = "a";
     18        (void)x;
     19      if (desiredSize == DEBUG_string_bytes_avail_until_gc(DEBUG_string_heap())) return;
     20    }
     21    sout | "Unable to force size" | desiredSize | "in 1,000,000 tries";
     22}
    523
    624int main() {
     25    // These "pre" cases deal with issues analogous to the "pre" cases of io/manipulatorsInput.
     26    // The acceptance criterion is simpler but driving the cases is harder.
     27    // The tests just read strings and echo what they read; acceptance of simple echoing assures
     28    // no spurious splitting merging.
     29    // The lengths of the strings are chosen to match white-box knowledge of when the string layer
     30    // has tor drive the cstring layer through a second iteration:
     31    //  - for no-manip, lengths are near the room at end of string heap
     32    //    (chosen target size of 9 showed the original bug on preS2, aligned with the other cases)
     33    //  - for manip, lengths are near the auxiliary buffer size of 128
     34    // Only first case repeats for string_res; rest run only from the passthru string layer.
     35    // Similarly, the manipulator breadth isn't checked at the cstring layer either.
     36    {
     37        // S: string, no manipulator
     38        void echoTillX(const char * casename) {
     39            string s;
     40            do {
     41                forceStringHeapFreeSpaceTo(9);
     42                sin | s;
     43                sout | casename | s;
     44            } while ( size(s) > 0 && s[size(s)-1] != 'x' );
     45        }
     46        echoTillX("preS1");
     47        echoTillX("preS2");
     48        echoTillX("preS3");
     49        echoTillX("preS4");
     50    }
     51    {
     52        // SMN: string, manipulator for no-op
     53        void echoTillX(const char * casename) {
     54            string s;
     55            do {
     56                sin | plainjane( s );
     57                sout | casename | s;
     58            } while ( size(s) > 0 && s[size(s)-1] != 'x' );
     59        }
     60        echoTillX("preSMN1");
     61        echoTillX("preSMN2");
     62        echoTillX("preSMN3");
     63        echoTillX("preSMN4");
     64    }
     65    {
     66        // RMN: string_res, manipulator for no-op
     67        void echoTillX(const char * casename) {
     68            string_res s;
     69            do {
     70                sin | plainjane( s );
     71                sout | casename | s;
     72            } while ( size(s) > 0 && s[size(s)-1] != 'x' );
     73        }
     74        echoTillX("preRMN1");
     75        echoTillX("preRMN2");
     76        echoTillX("preRMN3");
     77        echoTillX("preRMN4");
     78    }
     79    {
     80        // SMI: string, manipulator `incl`
     81        void echoTillX(const char * casename) {
     82            string s;
     83            do {
     84                sin | skip("-\n");
     85                sin | incl( ".:|# x", s );
     86                sout | casename | " \"" | s | "\"";
     87            } while ( size(s) > 0 && s[size(s)-1] != 'x' );
     88        }
     89        echoTillX("preSMI1");
     90        echoTillX("preSMI2");
     91        echoTillX("preSMI3");
     92        echoTillX("preSMI4");
     93    }
     94    {
     95        // SME: string, manipulator `excl`
     96        void echoTillX(const char * casename) {
     97            string s;
     98            do {
     99                sin | skip("-\n");
     100                sin | excl( "-\n", s );
     101                sout | casename | " \"" | s | "\"";
     102            } while ( size(s) > 0 && s[size(s)-1] != 'x' );
     103        }
     104        echoTillX("preSME1");
     105        echoTillX("preSME2");
     106        echoTillX("preSME3");
     107        echoTillX("preSME4");
     108    }
     109    sin | skip("-\n");
     110    {
     111        // SMG: string, manipulator `getline`
     112        void echoTillX(const char * casename) {
     113            string s;
     114            do {
     115                sin | getline( s );
     116                sout | casename | s;
     117            } while ( size(s) > 0 && s[size(s)-1] != 'x' );
     118        }
     119        echoTillX("preSMG1");
     120        echoTillX("preSMG2");
     121        echoTillX("preSMG3");
     122        echoTillX("preSMG4");
     123    }
     124    {
     125        // SMD: string, manipulator (`getline` with custom) delimiter
     126        void echoTillX(const char * casename) {
     127            string s;
     128            do {
     129                sin | getline( s, '@' );
     130                sout | casename | s;
     131            } while ( size(s) > 0 && s[size(s)-1] != 'x' );
     132            sin | skip(" \n");
     133        }
     134        echoTillX("preSMD1");
     135        echoTillX("preSMD2");
     136        echoTillX("preSMD3");
     137        echoTillX("preSMD4");
     138    }
     139
    7140    /* Keep harmonized with io/manipulatorsInput */
    8141    {
     
    23156        sin | ignore( incl( "abc", wdi( 8, s ) ) );     sout | "12" | s;
    24157        sin | ignore( excl( "abc", wdi( 8, s ) ) );     sout | "13" | s;
    25     }
     158
     159                s = "q";
     160                sin | incl( "abc", s );                         sout | "14" | s;
     161                s = "q";
     162                sin | excl( "u", s );                           sout | "15" | s;
     163                sin | skip( "u" );
     164                sin | "\n";
     165        }
     166    // Full repeat on string_res layer assures the full manipulator vocabulary is supported there.
    26167    {
    27168        string_res s = "yyyyyyyyyyyyyyyyyyyy";
     
    41182        sin | ignore( incl( "abc", wdi( 8, s ) ) );     sout | "12" | s;
    42183        sin | ignore( excl( "abc", wdi( 8, s ) ) );     sout | "13" | s;
     184
     185                s = "q";
     186                sin | incl( "abc", s );                         sout | "14" | s;
     187                s = "q";
     188                sin | excl( "u", s );                           sout | "15" | s;
     189                sin | skip( "u" );
     190                sin | "\n";
    43191    }
    44192}
  • tests/concurrency/cofor.cfa

    r85034ed r8cbe732  
    11#include <cofor.hfa>
    22
    3 long total = 0;
    4 void add_num( void * arg ) { __atomic_fetch_add( &total, (long)arg, __ATOMIC_SEQ_CST ); }
     3
     4void add_num( long * total, long val ) { __atomic_fetch_add( total, (long)val, __ATOMIC_SEQ_CST ); }
    55
    66int main() {
    77    printf("start\n");
    88    processor p[4];
     9    long total = 0;
    910    COFOR( i, 0, 10, __atomic_fetch_add( &total, i, __ATOMIC_SEQ_CST ); );
    10     parallel_stmt_t stmts[5] = { add_num, add_num, add_num, add_num, add_num };
    11     void * nums[5] = { (void *)11, (void *)12, (void *)13, (void *)14, (void *)15 };
    12     parallel( stmts, nums, 5 );
     11    {
     12        corun;      // does nothing
     13        corun{};    // does nothing
     14        corun add_num( &total, 11 );
     15        corun { add_num( &total, 12 ); }
     16        corun __atomic_fetch_add( &total, 13, __ATOMIC_SEQ_CST );
     17        corun { __atomic_fetch_add( &total, 14, __ATOMIC_SEQ_CST ); }
     18        __atomic_fetch_add( &total, 15, __ATOMIC_SEQ_CST ); // run by main thd
     19    }
    1320    printf("total: %ld\n", total);
    1421    printf("done\n");
  • tests/errors/.expect/scope.txt

    r85034ed r8cbe732  
    1 errors/scope.cfa:2:1 error: duplicate object definition for thisIsAnError: signed int
    2 errors/scope.cfa:20:1 error: duplicate function definition for butThisIsAnError: function
     1errors/scope.cfa:13:1 error: duplicate object definition for thisIsAnError: signed int
     2errors/scope.cfa:30:1 error: duplicate function definition for butThisIsAnError: function
    33... with parameters
    44  double
  • tests/errors/scope.cfa

    r85034ed r8cbe732  
    1 int thisIsAnError;
    2 int thisIsAnError;
     1// Keep harmonized with errors/scope.
    32
    4 int thisIsNotAnError;
    5 float thisIsNotAnError;
     3#ifdef OMIT_DRIVING_REJECTIONS
     4// For manual sanity checking:
     5// Leave out the offensive declarations and verify that what's left is accepted.
     6#define EXPREJ(...)
     7#else
     8#define EXPREJ(...) __VA_ARGS__
     9#endif
    610
    7 int thisIsAlsoNotAnError() {
    8   int thisIsNotAnError;
    9 }
    1011
    11 int thisIsAlsoNotAnError( double x ) {
    12 }
     12        int thisIsAnError;
     13EXPREJ( int thisIsAnError; )
    1314
    14 double thisIsStillNotAnError( double );
    15 double thisIsStillNotAnError( double );
     15        int thisIsNotAnError;
     16        float thisIsNotAnError;
    1617
    17 double butThisIsAnError( double ) {
    18 }
     18        int thisIsAlsoNotAnError() {
     19          int thisIsNotAnError;
     20        }
    1921
    20 double butThisIsAnError( double ) {
    21 }
     22        int thisIsAlsoNotAnError( double x ) {
     23        }
     24
     25        double thisIsStillNotAnError( double );
     26        double thisIsStillNotAnError( double );
     27
     28        double butThisIsAnError( double ) {
     29        }
     30EXPREJ(
     31        double butThisIsAnError( double ) {
     32        }
     33)
    2234
    2335// Local Variables: //
  • tests/io/.expect/manipulatorsInput.arm64.txt

    r85034ed r8cbe732  
    11pre1 "123456", canary ok
    2 pre2a "1234567", exception occurred, canary ok
    3 pre2b "89", canary ok
     2pre2 "1234567", canary ok
     3pre3a "1234567", exception occurred, canary ok
     4pre3b "8", canary ok
     5pre4a "1234567", exception occurred, canary ok
     6pre4b "89", canary ok
    471 yyyyyyyyyyyyyyyyyyyy
    582 abcxxx
     
    151812 wwwwwwww
    161913 wwwwwwww
     2014 rc=1, cccc
     2115 rc=0, q
    17221 yyyyyyyyyyyyyyyyyyyy
    18232 abcxxx
     
    283312 wwwwwwww
    293413 wwwwwwww
     3514 cccc
     3615
    3037a
    3138a
  • tests/io/.expect/manipulatorsInput.x64.txt

    r85034ed r8cbe732  
    11pre1 "123456", canary ok
    2 pre2a "1234567", exception occurred, canary ok
    3 pre2b "89", canary ok
     2pre2 "1234567", canary ok
     3pre3a "1234567", exception occurred, canary ok
     4pre3b "8", canary ok
     5pre4a "1234567", exception occurred, canary ok
     6pre4b "89", canary ok
    471 yyyyyyyyyyyyyyyyyyyy
    582 abcxxx
     
    151812 wwwwwwww
    161913 wwwwwwww
     2014 rc=1, cccc
     2115 rc=0, q
    17221 yyyyyyyyyyyyyyyyyyyy
    18232 abcxxx
     
    283312 wwwwwwww
    293413 wwwwwwww
     3514 cccc
     3615
    3037a
    3138a
  • tests/io/.expect/manipulatorsInput.x86.txt

    r85034ed r8cbe732  
    11pre1 "123456", canary ok
    2 pre2a "1234567", exception occurred, canary ok
    3 pre2b "89", canary ok
     2pre2 "1234567", canary ok
     3pre3a "1234567", exception occurred, canary ok
     4pre3b "8", canary ok
     5pre4a "1234567", exception occurred, canary ok
     6pre4b "89", canary ok
    471 yyyyyyyyyyyyyyyyyyyy
    582 abcxxx
     
    151812 wwwwwwww
    161913 wwwwwwww
     2014 rc=1, cccc
     2115 rc=0, q
    17221 yyyyyyyyyyyyyyyyyyyy
    18232 abcxxx
     
    283312 wwwwwwww
    293413 wwwwwwww
     3514 cccc
     3615
    3037a
    3138a
  • tests/io/.in/manipulatorsInput.txt

    r85034ed r8cbe732  
    11123456
     21234567
     312345678
    24123456789
    35abc
    4 abc
     6cccccb
    57xx
    68abcxxx
    79abcyyy
    810aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww
     11uuuuuccccuuuuu
    912abc
    10 abc
     13cccccb
    1114xx
    1215abcxxx
    1316abcyyy
    1417aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww
     18uuuuuccccuuuuu
    1519ab
    16200xff 017 15-15
  • tests/io/manipulatorsInput.cfa

    r85034ed r8cbe732  
    4545                }
    4646
    47                 rep("pre1");
    48                 rep("pre2a");
    49                 rep("pre2b");
     47                rep("pre1");    // 123456     |  123456
     48                rep("pre2");    // 1234567    |  1234567
     49                rep("pre3a");   // 12345678   |  1234567
     50                rep("pre3b");   //            |  8
     51                rep("pre4a");   // 123456789  |  1234567
     52                rep("pre4b");   //            |  89
     53
    5054                scanf("\n");  // next test does not start with %s so does not tolerate leading whitespace
    5155        }
    5256        {
    5357                char s[] = "yyyyyyyyyyyyyyyyyyyy";
    54                 const char sk[] = "abc";
    55                 scanf( "abc " ); scanf( sk ); for ( 5 ) scanf( "%*c" ); printf( "1 %s\n", s );
     58                const char sk_fmt[] = "%*[abc]";
     59                scanf( "abc " ); scanf( sk_fmt ); for ( 5 ) scanf( "%*c" ); printf( "1 %s\n", s );
    5660                scanf( "%s", s );                                                               printf( "2 %s\n", s );
    5761                scanf( "%*s" );                                                                 printf( "3 %s\n", s );
     
    6771                scanf( "%*8[abc]" );                                                    printf( "12 %s\n", s );
    6872                scanf( "%*8[^abc]" );                                                   printf( "13 %s\n", s );
     73
     74                int rc;
     75                s[0] = 'q'; s[1] = '\0'; rc = 99;
     76                rc = scanf( "%[abc]", s );                                              printf( "14 rc=%d, %s\n", rc, s );
     77                s[0] = 'q'; s[1] = '\0'; rc = 99;
     78                rc = scanf( "%[^u]", s );                                               printf( "15 rc=%d, %s\n", rc, s );
     79                scanf( "%*[u]" );
     80                scanf("\n");
    6981        }
    7082        {
     
    8597                sin | ignore( incl( "abc", wdi( sizeof(s), 8, s ) ) ); sout | "12" | s;
    8698                sin | ignore( excl( "abc", wdi( sizeof(s), 8, s ) ) ); sout | "13" | s;
     99
     100                s[0] = 'q'; s[1] = '\0';
     101                sin | incl( "abc", wdi( sizeof(s), s ) );               sout | "14" | s;
     102                s[0] = 'q'; s[1] = '\0';
     103                sin | excl( "u", wdi( sizeof(s), s ) );                 sout | "15" | s;
     104                sin | skip( "u" );
     105                sin | "\n";
    87106        }
    88107    /* Keep harmonized with collections/string-istream-manip */
  • tests/link-once/main.cfa

    r85034ed r8cbe732  
    11// Test our new cfa_linkonce attribute:
    22
    3 __attribute__(( cfa_linkonce )) signed int example = -7;
     3__attribute__(( cfa_linkonce )) signed int example = 7;
    44__attribute__(( cfa_linkonce )) unsigned int example = 12;
    55
  • tests/link-once/partner.cfa

    r85034ed r8cbe732  
    11// Side file for the link-once test.
    22
    3 __attribute__(( cfa_linkonce )) signed int example = -7;
     3__attribute__(( cfa_linkonce )) signed int example = 7;
    44__attribute__(( cfa_linkonce )) unsigned int example = 12;
    55
  • tests/test.py

    r85034ed r8cbe732  
    116116        parser.add_argument('--no-invariant', help='Tell the compiler not to check invariants.', action='store_false', dest='invariant')
    117117        parser.add_argument('--invariant', help='Tell the compiler to check invariants.', action='store_const', const=True)
    118         parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=180)
     118        parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=240)
    119119        parser.add_argument('--global-timeout', help='Maximum cumulative duration in seconds after the ALL tests are considered to have timed out', type=int, default=7200)
    120120        parser.add_argument('--timeout-with-gdb', help='Instead of killing the command when it times out, orphan it and print process id to allow gdb to attach', type=yes_no, default="no")
     
    125125        parser.add_argument('--archive-errors', help='If called with a valid path, on test crashes the test script will copy the core dump and the executable to the specified path.', type=str, default='')
    126126        parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously, 0 (default) for unlimited', nargs='?', const=0, type=int)
    127         parser.add_argument('--list-comp', help='List all valide arguments', action='store_true')
     127        parser.add_argument('--list-comp', help='List all valid arguments', action='store_true')
    128128        parser.add_argument('--list-dist', help='List all tests for distribution', action='store_true')
    129129        parser.add_argument('-I','--include', help='Directory of test to include, can be used multiple time, All  if omitted', action='append')
  • tools/build/cfa.m4

    r85034ed r8cbe732  
    6767                "x86_64"     ) cannon_arch_name="x64";;
    6868                "aarch64"    ) cannon_arch_name="arm64";;
    69                 "arm4"       ) cannon_arch_name="arm64";;
     69                "arm64"      ) cannon_arch_name="arm64";;
    7070                "ARM64"      ) cannon_arch_name="arm64";;
    7171                "x86"        ) cannon_arch_name="x86";;
Note: See TracChangeset for help on using the changeset viewer.