Changes in / [b4b63e8:dd53f75]


Ignore:
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/fangren_yu_COOP_S20/Report.tex

    rb4b63e8 rdd53f75  
    1313\usepackage{latexsym}                                   % \Box glyph
    1414\usepackage{mathptmx}                                   % better math font with "times"
     15\usepackage{appendix}
    1516\usepackage[usenames]{color}
    1617\input{common}                                          % common CFA document macros
    1718\usepackage[dvips,plainpages=false,pdfpagelabels,pdfpagemode=UseNone,colorlinks=true,pagebackref=true,linkcolor=blue,citecolor=blue,urlcolor=blue,pagebackref=true,breaklinks=true]{hyperref}
    1819\usepackage{breakurl}
     20\urlstyle{sf}
     21
     22% reduce spacing
     23\setlist[itemize]{topsep=5pt,parsep=0pt}% global
     24\setlist[enumerate]{topsep=5pt,parsep=0pt}% global
    1925
    2026\usepackage[pagewise]{lineno}
     
    112118\begin{itemize}
    113119\item
    114 type declaration: @struct@, @union@, @typedef@ or type parameter (see Appendix A.1)
     120type declaration: @struct@, @union@, @typedef@ or type parameter (see \VRef[Appendix]{s:KindsTypeParameters})
    115121\item
    116122variable declaration
     
    374380
    375381\subsubsection{Source: \lstinline{AST/SymbolTable.hpp}}
     382
     383
    376384\subsubsection{Source: \lstinline{SymTab/Indexer.h}}
    377385
     
    526534Each pair of compatible branch expression types produce a possible interpretation, and the cost is defined as the sum of the expression costs plus the sum of conversion costs to the common type.
    527535
     536
    528537\subsection{Conversion and Application Cost}
    529 There were some unclear parts in the previous documentation of cost system, as described in the Moss thesis \cite{Moss19}, section 4.1.2. Some clarification are presented in this section.
     538
     539There were some unclear parts in the previous documentation in the cost system, as described in the Moss thesis~\cite{Moss19}, section 4.1.2.
     540Some clarification are presented in this section.
    530541
    531542\begin{enumerate}
    532543\item
    533 Conversion to a type denoted by parameter may incur additional cost if the match is not exact. For example, if a function is declared to accept @(T, T)@ and receives @(int, long)@, @T@ is deducted @long@ and an additional widening conversion cost is added for @int@ to @T@.
    534 
    535 \item
    536 The specialization level of a function is the sum of the least depth of an appearance of type parameter (counting pointers, references and parameterized types), plus the number of assertions. A higher specialization level is favored if conversion cost of arguments are equal.
    537 
    538 \item
    539 Coercion of pointer types is only allowed in explicit cast expressions; the only allowed implicit pointer casts are adding qualifiers to the base type and cast to @void*@, and those counts as safe conversions. Note that implicit cast from @void*@ to other pointer types is no longer valid, as opposed to standard C.
    540 
     544Conversion to a type denoted by parameter may incur additional cost if the match is not exact.
     545For example, if a function is declared to accept @(T, T)@ and receives @(int, long)@, @T@ is deducted @long@ and an additional widening conversion cost is added for @int@ to @T@.
     546
     547\item
     548The specialization level of a function is the sum of the least depth of an appearance of a type parameter (counting pointers, references and parameterized types), plus the number of assertions.
     549A higher specialization level is favoured if argument conversion costs are equal.
     550
     551\item
     552Coercion of pointer types is only allowed in explicit cast expressions;
     553the only allowed implicit pointer casts are adding qualifiers to the base type and cast to @void*@, and these counts as safe conversions.
     554Note that implicit cast from @void *@ to other pointer types is no longer valid, as opposed to standard C.
    541555\end{enumerate}
    542556
     
    556570At the call site, implicit parameters are automatically inserted by the compiler.
    557571
    558 Implementation of implicit parameters is discussed in Appendix A.3.
     572Implementation of implicit parameters is discussed in \VRef[Appendix]{s:ImplementationParametricFunctions}.
    559573
    560574\section{Tests}
     
    597611It is suggested to run performance tests with optimization (@g++@ flag @-O3@).
    598612
     613
     614\begin{appendices}[toc,titletoc]
    599615\section{Appendix}
    600616
     617
    601618\subsection{Kinds of Type Parameters}
    602 The type parameters in a @forall@ clause has three different kinds:
    603 \begin{enumerate}
    604 \item
    605 @dtype@: any data type (built-in or user defined). There is also a difference between opaque types (incomplete types, those with only a forward declaration) and concrete types. Only concrete types can be directly used as a variable type. \CFA provides the @otype@ shorthand to require a type parameter as concrete, which also implicitly asserts the existence of its constructor and destructor\footnote{\CFA implements the same automatic resource management (RAII) semantics as \CC.}.
    606 \item
    607 @ftype@: any function type. Since @ftype@ does not provide any information about parameter types of a function, it is rarely used. The main purpose of introducing @ftype@ is to disallow a function to match a pointer overload, since variables and functions can have the same names.
    608 \item
    609 @ttype@: tuple (variadic) type. @ttype@ parameter may only appear as type of the last parameter in a function, and it provides a type-safe way to implement variadic functions. Note however, that it has certain restrictions, as described in the implementation section below.
    610 
     619\label{s:KindsTypeParameters}
     620
     621A type parameter in a @forall@ clause has three possible kinds:
     622\begin{enumerate}[listparindent=0pt]
     623\item
     624@dtype@: any data type (built-in or user defined).
     625
     626There is also a difference between opaque types (incomplete types, \ie those with only a forward declaration) and concrete types.
     627Only concrete types can be directly used as a variable type.
     628
     629\CFA provides the @otype@ shorthand to require a type parameter be concrete, which also implicitly asserts the existence of its default and copy constructors, assignment, and destructor\footnote{\CFA implements the same automatic resource management (RAII) semantics as \CC.}.
     630\item
     631@ftype@: any function type.
     632
     633@ftype@ provides two purposes:
     634\begin{itemize}
     635\item
     636Differentiate function pointer from data pointer because (in theory) some systems have different sizes for these pointers.
     637\item
     638Disallow a function pointer to match an overloaded data pointer, since variables and functions can have the same names.
     639\end{itemize}
     640
     641\item
     642@ttype@: tuple (variadic) type.
     643
     644@ttype@ parameter may only appear as type of the last parameter in a function, and it provides a type-safe way to implement variadic functions.
     645Note however, that it has certain restrictions, as described in the implementation section below.
    611646\end{enumerate}
    612647
     648
    613649\subsection{GNU C Nested Functions}
    614650
     
    616652
    617653In ISO C, function definitions are not allowed to be nested. GCC allows nested functions with full lexical scoping. The following example is taken from GCC documentation\footnote{\url{https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html}}:
    618 
    619 \begin{C++}
    620 bar (int *array, int offset, int size)
    621 {
    622   int access (int *array, int index)
    623     { return array[index + offset]; }
    624   int i;
    625   /* ... */
    626   for (i = 0; i < size; i++)
    627     /* ... */ access (array, i) /* ... */
     654\begin{C++}
     655void bar( int * array, int offset, int size ) {
     656        int access( int * array, int index ) { return array[index + offset]; }
     657        int i;
     658        /* ... */
     659        for ( i = 0; i < size; i++ )
     660                /* ... */ access (array, i) /* ... */
    628661}
    629662\end{C++}
    630 
    631 GCC nested functions behave identically to \CC lambda functions with default by-reference capture (stack-allocated, lifetime ends upon exiting the block declared in), while also possible to be passed as arguments with standard function pointer types.
     663GCC nested functions behave identically to \CC lambda functions with default by-reference capture (stack-allocated, lifetime ends upon exiting the declared block), while also possible to be passed as arguments with standard function pointer types.
     664
    632665
    633666\subsection{Implementation of Parametric Functions}
    634 \CFA implements parametric functions using the implicit parameter approach: required assertions are passed to the callee by function pointers; size of a parametric type must also be known if referenced directly (i.e. not as a pointer).
     667\label{s:ImplementationParametricFunctions}
     668
     669\CFA implements parametric functions using the implicit parameter approach: required assertions are passed to the callee by function pointers;
     670size of a parametric type must also be known if referenced directly (\ie not as a pointer).
    635671
    636672The implementation is similar to the one from Scala\footnote{\url{https://www.scala-lang.org/files/archive/spec/2.13/07-implicits.html}}, with some notable differences in resolution:
     
    641677The parameter (assertion) name must match the actual declarations.
    642678\item
    643 Currently, assertions are all functions. Note that since \CFA has variable overloading, implicit value parameters might also be supported in the future.
     679Currently, assertions are all functions.
     680Note that since \CFA has variable overloading, implicit value parameters might also be supported in the future.
    644681\end{enumerate}
    645682
    646683For example, the \CFA function declaration
    647 
    648684\begin{cfa}
    649 forall(otype T | {int foo(T, int);})
     685forall( otype T | { int foo( T, int ); } )
    650686int bar(T);
    651687\end{cfa}
    652 
    653688after implicit parameter expansion, has the actual signature\footnote{\textbf{otype} also requires the type to have constructor and destructor, which are the first two function pointers preceding the one for \textbf{foo}.}
    654 
    655 \begin{C++}
    656 int bar(T, size_t, void (*)(T&), void (*)(T&), int (*)(T, int));
    657 \end{C++}
    658 
    659 The implicit parameter approach has an apparent issue: when the satisfying declaration is also parametric, it may require its own implicit parameters too. That also causes the supplied implicit parameter to have a different \textbf{actual} type than the \textbf{nominal} type, so it cannot be passed directly. Therefore, a wrapper with matching actual type must be created, and here it is where GCC nested function is used internally by the compiler.
     689\begin{C++}
     690int bar( T, size_t, void (*)(T&), void (*)(T&), int (*)(T, int) );
     691\end{C++}
     692The implicit parameter approach has an apparent issue: when the satisfying declaration is also parametric, it may require its own implicit parameters too.
     693That also causes the supplied implicit parameter to have a different \textbf{actual} type than the \textbf{nominal} type, so it cannot be passed directly.
     694Therefore, a wrapper with matching actual type must be created, and it is here where GCC nested functions are used internally by the compiler.
    660695
    661696Consider the following program:
     
    663698int assertion(int);
    664699
    665 forall (otype T | {int assertion(T);})
     700forall( otype T | { int assertion(T); } )
    666701void foo(T);
    667702
    668 forall (otype T | {void foo(T);})
     703forall(otype T | { void foo(T); } )
    669704void bar(T t) {
    670705        foo(t);
    671706}
    672707\end{cfa}
    673 
    674 \CFA compiler translates the program to non-parametric form\footnote{In the final code output, T needs to be replaced by an opaque type, and arguments must be accessed by a frame pointer offset table, due to the unknown sizes. The presented code here is simplified for better understanding.}
    675 
     708The \CFA compiler translates the program to non-parametric form\footnote{In the final code output, \lstinline@T@ needs to be replaced by an opaque type, and arguments must be accessed by a frame pointer offset table, due to the unknown sizes. The presented code here is simplified for better understanding.}
    676709\begin{C++}
    677710// ctor, dtor and size arguments are omitted
     
    682715}
    683716\end{C++}
    684 
    685717However, when @bar(1)@ is called, @foo@ cannot be directly provided as an argument:
    686 
    687718\begin{C++}
    688719bar(1, foo); // WRONG: foo has different actual type
    689720\end{C++}
    690 
    691721and an additional step is required:
    692 
    693722\begin{C++}
    694723{
    695724        void _foo_wrapper(int t) {
    696                 foo(t, assertion);
     725                foo( t, assertion );
    697726        }
    698         bar(1, _foo_wrapper);
     727        bar( 1, _foo_wrapper );
    699728}
    700729\end{C++}
    701 
    702 Nested assertions and implicit parameter creation may continue indefinitely. This is a limitation of implicit parameter implementation. In particular, polymorphic variadic recursion must be structural (i.e. number of arguments decreases in any possible recursive calls), otherwise code generation gets into an infinite loop. \CFA compiler sets a limit on assertion depth and reports an error if assertion resolution does not terminate within the limit.
     730Nested assertions and implicit parameter creation may continue indefinitely.
     731This issue is a limitation of implicit parameter implementation.
     732In particular, polymorphic variadic recursion must be structural (\ie the number of arguments decreases in any possible recursive calls), otherwise code generation gets into an infinite loop.
     733The \CFA compiler sets a limit on assertion depth and reports an error if assertion resolution does not terminate within the limit (as for \lstinline[language=C++]@templates@ in \CC).
     734\end{appendices}
    703735
    704736\bibliographystyle{plain}
  • libcfa/src/limits.cfa

    rb4b63e8 rdd53f75  
    1010// Created On       : Wed Apr  6 18:06:52 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  1 16:22:51 2018
    13 // Update Count     : 74
     12// Last Modified On : Wed Sep 30 22:56:32 2020
     13// Update Count     : 76
    1414//
    1515
     
    2323// Integral Constants
    2424
    25 const signed char MIN = SCHAR_MIN;
    26 const unsigned char MIN = 0;
    27 const short int MIN = SHRT_MIN;
    28 const unsigned short int MIN = 0;
    29 const int MIN = INT_MIN;
    30 const unsigned int MIN = 0;
    31 const long int MIN = LONG_MIN;
    32 const unsigned long int MIN = 0;
    33 const long long int MIN = LLONG_MIN;
    34 const unsigned long long int MIN = 0;
     25signed char MIN = SCHAR_MIN;
     26unsigned char MIN = 0;
     27short int MIN = SHRT_MIN;
     28unsigned short int MIN = 0;
     29int MIN = INT_MIN;
     30unsigned int MIN = 0;
     31long int MIN = LONG_MIN;
     32unsigned long int MIN = 0;
     33long long int MIN = LLONG_MIN;
     34unsigned long long int MIN = 0;
    3535
    36 const signed char MAX = SCHAR_MAX;
    37 const unsigned char MAX = UCHAR_MAX;
    38 const short int MAX = SHRT_MAX;
    39 const unsigned short int MAX = USHRT_MAX;
    40 const int MAX = INT_MAX;
    41 const unsigned int MAX = UINT_MAX;
    42 const long int MAX = LONG_MAX;
    43 const unsigned long int MAX = ULONG_MAX;
    44 const long long int MAX = LLONG_MAX;
    45 const unsigned long long int MAX = ULLONG_MAX;
     36signed char MAX = SCHAR_MAX;
     37unsigned char MAX = UCHAR_MAX;
     38short int MAX = SHRT_MAX;
     39unsigned short int MAX = USHRT_MAX;
     40int MAX = INT_MAX;
     41unsigned int MAX = UINT_MAX;
     42long int MAX = LONG_MAX;
     43unsigned long int MAX = ULONG_MAX;
     44long long int MAX = LLONG_MAX;
     45unsigned long long int MAX = ULLONG_MAX;
    4646
    4747// Floating-Point Constants
    4848
    49 const float MIN = FLT_MIN;
    50 const double MIN = DBL_MIN;
    51 const long double MIN = LDBL_MIN;
    52 const float _Complex MIN = __FLT_MIN__ + __FLT_MIN__ * I;
    53 const double _Complex MIN = DBL_MIN +  DBL_MIN * I;
    54 const long double _Complex MIN = LDBL_MIN + LDBL_MIN * I;
     49float MIN = FLT_MIN;
     50double MIN = DBL_MIN;
     51long double MIN = LDBL_MIN;
     52float _Complex MIN = __FLT_MIN__ + __FLT_MIN__ * I;
     53double _Complex MIN = DBL_MIN +  DBL_MIN * I;
     54long double _Complex MIN = LDBL_MIN + LDBL_MIN * I;
    5555
    56 const float MAX = FLT_MAX;
    57 const double MAX = DBL_MAX;
    58 const long double MAX = LDBL_MAX;
    59 const float _Complex MAX = FLT_MAX + FLT_MAX * I;
    60 const double _Complex MAX = DBL_MAX + DBL_MAX * I;
    61 const long double _Complex MAX = LDBL_MAX + LDBL_MAX * I;
     56float MAX = FLT_MAX;
     57double MAX = DBL_MAX;
     58long double MAX = LDBL_MAX;
     59float _Complex MAX = FLT_MAX + FLT_MAX * I;
     60double _Complex MAX = DBL_MAX + DBL_MAX * I;
     61long double _Complex MAX = LDBL_MAX + LDBL_MAX * I;
    6262
    63 const float PI = (float)M_PI;                                                   // pi
    64 const float PI_2 = (float)M_PI_2;                                               // pi / 2
    65 const float PI_4 = (float)M_PI_4;                                               // pi / 4
    66 const float _1_PI = (float)M_1_PI;                                              // 1 / pi
    67 const float _2_PI = (float)M_2_PI;                                              // 2 / pi
    68 const float _2_SQRT_PI = (float)M_2_SQRTPI;                             // 2 / sqrt(pi)
     63float PI = (float)M_PI;                                                                 // pi
     64float PI_2 = (float)M_PI_2;                                                             // pi / 2
     65float PI_4 = (float)M_PI_4;                                                             // pi / 4
     66float _1_PI = (float)M_1_PI;                                                    // 1 / pi
     67float _2_PI = (float)M_2_PI;                                                    // 2 / pi
     68float _2_SQRT_PI = (float)M_2_SQRTPI;                                   // 2 / sqrt(pi)
    6969
    70 const double PI = M_PI;                                                                 // pi
    71 const double PI_2 = M_PI_2;                                                             // pi / 2
    72 const double PI_4 = M_PI_4;                                                             // pi / 4
    73 const double _1_PI = M_1_PI;                                                    // 1 / pi
    74 const double _2_PI = M_2_PI;                                                    // 2 / pi
    75 const double _2_SQRT_PI = M_2_SQRTPI;                                   // 2 / sqrt(pi)
     70double PI = M_PI;                                                                               // pi
     71double PI_2 = M_PI_2;                                                                   // pi / 2
     72double PI_4 = M_PI_4;                                                                   // pi / 4
     73double _1_PI = M_1_PI;                                                                  // 1 / pi
     74double _2_PI = M_2_PI;                                                                  // 2 / pi
     75double _2_SQRT_PI = M_2_SQRTPI;                                                 // 2 / sqrt(pi)
    7676
    77 const long double PI = M_PIl;                                                   // pi
    78 const long double PI_2 = M_PI_2l;                                               // pi / 2
    79 const long double PI_4 = M_PI_4l;                                               // pi / 4
    80 const long double _1_PI = M_1_PIl;                                              // 1 / pi
    81 const long double _2_PI = M_2_PIl;                                              // 2 / pi
    82 const long double _2_SQRT_PI = M_2_SQRTPIl;                             // 2 / sqrt(pi)
     77long double PI = M_PIl;                                                                 // pi
     78long double PI_2 = M_PI_2l;                                                             // pi / 2
     79long double PI_4 = M_PI_4l;                                                             // pi / 4
     80long double _1_PI = M_1_PIl;                                                    // 1 / pi
     81long double _2_PI = M_2_PIl;                                                    // 2 / pi
     82long double _2_SQRT_PI = M_2_SQRTPIl;                                   // 2 / sqrt(pi)
    8383
    84 const float _Complex PI = (float)M_PI + 0.0_iF;                 // pi
    85 const float _Complex PI_2 = (float)M_PI_2 + 0.0_iF;             // pi / 2
    86 const float _Complex PI_4 = (float)M_PI_4 + 0.0_iF;             // pi / 4
    87 const float _Complex _1_PI = (float)M_1_PI + 0.0_iF;    // 1 / pi
    88 const float _Complex _2_PI = (float)M_2_PI + 0.0_iF;    // 2 / pi
    89 const float _Complex _2_SQRT_PI = (float)M_2_SQRTPI + 0.0_iF; // 2 / sqrt(pi)
     84float _Complex PI = (float)M_PI + 0.0_iF;                               // pi
     85float _Complex PI_2 = (float)M_PI_2 + 0.0_iF;                   // pi / 2
     86float _Complex PI_4 = (float)M_PI_4 + 0.0_iF;                   // pi / 4
     87float _Complex _1_PI = (float)M_1_PI + 0.0_iF;                  // 1 / pi
     88float _Complex _2_PI = (float)M_2_PI + 0.0_iF;                  // 2 / pi
     89float _Complex _2_SQRT_PI = (float)M_2_SQRTPI + 0.0_iF; // 2 / sqrt(pi)
    9090
    91 const double _Complex PI = M_PI + 0.0_iD;                               // pi
    92 const double _Complex PI_2 = M_PI_2 + 0.0_iD;                   // pi / 2
    93 const double _Complex PI_4 = M_PI_4 + 0.0_iD;                   // pi / 4
    94 const double _Complex _1_PI = M_1_PI + 0.0_iD;                  // 1 / pi
    95 const double _Complex _2_PI = M_2_PI + 0.0_iD;                  // 2 / pi
    96 const double _Complex _2_SQRT_PI = M_2_SQRTPI + 0.0_iD; // 2 / sqrt(pi)
     91double _Complex PI = M_PI + 0.0_iD;                                             // pi
     92double _Complex PI_2 = M_PI_2 + 0.0_iD;                                 // pi / 2
     93double _Complex PI_4 = M_PI_4 + 0.0_iD;                                 // pi / 4
     94double _Complex _1_PI = M_1_PI + 0.0_iD;                                // 1 / pi
     95double _Complex _2_PI = M_2_PI + 0.0_iD;                                // 2 / pi
     96double _Complex _2_SQRT_PI = M_2_SQRTPI + 0.0_iD;               // 2 / sqrt(pi)
    9797
    98 const long double _Complex PI = M_PIl + 0.0_iL;                 // pi
    99 const long double _Complex PI_2 = M_PI_2l + 0.0_iL;             // pi / 2
    100 const long double _Complex PI_4 = M_PI_4l + 0.0_iL;             // pi / 4
    101 const long double _Complex _1_PI = M_1_PIl + 0.0_iL;    // 1 / pi
    102 const long double _Complex _2_PI = M_2_PIl + 0.0_iL;    // 2 / pi
    103 const long double _Complex _2_SQRT_PI = M_2_SQRTPIl + 0.0_iL; // 2 / sqrt(pi)
     98long double _Complex PI = M_PIl + 0.0_iL;                               // pi
     99long double _Complex PI_2 = M_PI_2l + 0.0_iL;                   // pi / 2
     100long double _Complex PI_4 = M_PI_4l + 0.0_iL;                   // pi / 4
     101long double _Complex _1_PI = M_1_PIl + 0.0_iL;                  // 1 / pi
     102long double _Complex _2_PI = M_2_PIl + 0.0_iL;                  // 2 / pi
     103long double _Complex _2_SQRT_PI = M_2_SQRTPIl + 0.0_iL; // 2 / sqrt(pi)
    104104
    105 const float E = (float)M_E;                                                             // e
    106 const float LOG2_E = (float)M_LOG2E;                                    // log_2(e)
    107 const float LOG10_E = (float)M_LOG10E;                                  // log_10(e)
    108 const float LN_2 = (float)M_LN2;                                                // log_e(2)
    109 const float LN_10 = (float)M_LN10;                                              // log_e(10)
    110 const float SQRT_2 = (float)M_SQRT2;                                    // sqrt(2)
    111 const float _1_SQRT_2 = (float)M_SQRT1_2;                               // 1 / sqrt(2)
     105float E = (float)M_E;                                                                   // e
     106float LOG2_E = (float)M_LOG2E;                                                  // log_2(e)
     107float LOG10_E = (float)M_LOG10E;                                                // log_10(e)
     108float LN_2 = (float)M_LN2;                                                              // log_e(2)
     109float LN_10 = (float)M_LN10;                                                    // log_e(10)
     110float SQRT_2 = (float)M_SQRT2;                                                  // sqrt(2)
     111float _1_SQRT_2 = (float)M_SQRT1_2;                                             // 1 / sqrt(2)
    112112
    113 const double E = M_E;                                                                   // e
    114 const double LOG2_E = M_LOG2E;                                                  // log_2(e)
    115 const double LOG10_E = M_LOG10E;                                                // log_10(e)
    116 const double LN_2 = M_LN2;                                                              // log_e(2)
    117 const double LN_10 = M_LN10;                                                    // log_e(10)
    118 const double SQRT_2 = M_SQRT2;                                                  // sqrt(2)
    119 const double _1_SQRT_2 = M_SQRT1_2;                                             // 1 / sqrt(2)
     113double E = M_E;                                                                                 // e
     114double LOG2_E = M_LOG2E;                                                                // log_2(e)
     115double LOG10_E = M_LOG10E;                                                              // log_10(e)
     116double LN_2 = M_LN2;                                                                    // log_e(2)
     117double LN_10 = M_LN10;                                                                  // log_e(10)
     118double SQRT_2 = M_SQRT2;                                                                // sqrt(2)
     119double _1_SQRT_2 = M_SQRT1_2;                                                   // 1 / sqrt(2)
    120120
    121 const long double E = M_El;                                                             // e
    122 const long double LOG2_E = M_LOG2El;                                    // log_2(e)
    123 const long double LOG10_E = M_LOG10El;                                  // log_10(e)
    124 const long double LN_2 = M_LN2l;                                                // log_e(2)
    125 const long double LN_10 = M_LN10l;                                              // log_e(10)
    126 const long double SQRT_2 = M_SQRT2l;                                    // sqrt(2)
    127 const long double _1_SQRT_2 = M_SQRT1_2l;                               // 1 / sqrt(2)
     121long double E = M_El;                                                                   // e
     122long double LOG2_E = M_LOG2El;                                                  // log_2(e)
     123long double LOG10_E = M_LOG10El;                                                // log_10(e)
     124long double LN_2 = M_LN2l;                                                              // log_e(2)
     125long double LN_10 = M_LN10l;                                                    // log_e(10)
     126long double SQRT_2 = M_SQRT2l;                                                  // sqrt(2)
     127long double _1_SQRT_2 = M_SQRT1_2l;                                             // 1 / sqrt(2)
    128128
    129 const float _Complex E = M_E + 0.0_iF;                                  // e
    130 const float _Complex LOG2_E = M_LOG2E + 0.0_iF;                 // log_2(e)
    131 const float _Complex LOG10_E = M_LOG10E + 0.0_iF;               // log_10(e)
    132 const float _Complex LN_2 = M_LN2 + 0.0_iF;                             // log_e(2)
    133 const float _Complex LN_10 = M_LN10 + 0.0_iF;                   // log_e(10)
    134 const float _Complex SQRT_2 = M_SQRT2 + 0.0_iF;                 // sqrt(2)
    135 const float _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iF;    // 1 / sqrt(2)
     129float _Complex E = M_E + 0.0_iF;                                                // e
     130float _Complex LOG2_E = M_LOG2E + 0.0_iF;                               // log_2(e)
     131float _Complex LOG10_E = M_LOG10E + 0.0_iF;                             // log_10(e)
     132float _Complex LN_2 = M_LN2 + 0.0_iF;                                   // log_e(2)
     133float _Complex LN_10 = M_LN10 + 0.0_iF;                                 // log_e(10)
     134float _Complex SQRT_2 = M_SQRT2 + 0.0_iF;                               // sqrt(2)
     135float _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iF;                  // 1 / sqrt(2)
    136136
    137 const double _Complex E = M_E + 0.0_iD;                                 // e
    138 const double _Complex LOG2_E = M_LOG2E + 0.0_iD;                // log_2(e)
    139 const double _Complex LOG10_E = M_LOG10E + 0.0_iD;              // log_10(e)
    140 const double _Complex LN_2 = M_LN2 + 0.0_iD;                    // log_e(2)
    141 const double _Complex LN_10 = M_LN10 + 0.0_iD;                  // log_e(10)
    142 const double _Complex SQRT_2 = M_SQRT2 + 0.0_iD;                // sqrt(2)
    143 const double _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iD;   // 1 / sqrt(2)
     137double _Complex E = M_E + 0.0_iD;                                               // e
     138double _Complex LOG2_E = M_LOG2E + 0.0_iD;                              // log_2(e)
     139double _Complex LOG10_E = M_LOG10E + 0.0_iD;                    // log_10(e)
     140double _Complex LN_2 = M_LN2 + 0.0_iD;                                  // log_e(2)
     141double _Complex LN_10 = M_LN10 + 0.0_iD;                                // log_e(10)
     142double _Complex SQRT_2 = M_SQRT2 + 0.0_iD;                              // sqrt(2)
     143double _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iD;                 // 1 / sqrt(2)
    144144
    145 const long double _Complex E = M_El + 0.0_iL;                   // e
    146 const long double _Complex LOG2_E = M_LOG2El + 0.0_iL;  // log_2(e)
    147 const long double _Complex LOG10_E = M_LOG10El + 0.0_iL; // log_10(e)
    148 const long double _Complex LN_2 = M_LN2l + 0.0_iL;              // log_e(2)
    149 const long double _Complex LN_10 = M_LN10l + 0.0_iL;    // log_e(10)
    150 const long double _Complex SQRT_2 = M_SQRT2l + 0.0_iL;  // sqrt(2)
    151 const long double _Complex _1_SQRT_2 = M_SQRT1_2l + 0.0_iL; // 1 / sqrt(2)
     145long double _Complex E = M_El + 0.0_iL;                                 // e
     146long double _Complex LOG2_E = M_LOG2El + 0.0_iL;                // log_2(e)
     147long double _Complex LOG10_E = M_LOG10El + 0.0_iL;              // log_10(e)
     148long double _Complex LN_2 = M_LN2l + 0.0_iL;                    // log_e(2)
     149long double _Complex LN_10 = M_LN10l + 0.0_iL;                  // log_e(10)
     150long double _Complex SQRT_2 = M_SQRT2l + 0.0_iL;                // sqrt(2)
     151long double _Complex _1_SQRT_2 = M_SQRT1_2l + 0.0_iL;   // 1 / sqrt(2)
    152152
    153153// Local Variables: //
  • libcfa/src/limits.hfa

    rb4b63e8 rdd53f75  
    1010// Created On       : Wed Apr  6 18:06:52 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  1 16:20:54 2018
    13 // Update Count     : 13
     12// Last Modified On : Wed Sep 30 22:56:35 2020
     13// Update Count     : 15
    1414//
    1515
     
    1818// Integral Constants
    1919
    20 extern const signed char MIN;
    21 extern const unsigned char MIN;
    22 extern const short int MIN;
    23 extern const unsigned short int MIN;
    24 extern const int MIN;
    25 extern const unsigned int MIN;
    26 extern const long int MIN;
    27 extern const unsigned long int MIN;
    28 extern const long long int MIN;
    29 extern const unsigned long long int MIN;
     20extern signed char MIN;
     21extern unsigned char MIN;
     22extern short int MIN;
     23extern unsigned short int MIN;
     24extern int MIN;
     25extern unsigned int MIN;
     26extern long int MIN;
     27extern unsigned long int MIN;
     28extern long long int MIN;
     29extern unsigned long long int MIN;
    3030
    31 extern const signed char MAX;
    32 extern const unsigned char MAX;
    33 extern const short int MAX;
    34 extern const unsigned short int MAX;
    35 extern const int MAX;
    36 extern const unsigned int MAX;
    37 extern const long int MAX;
    38 extern const unsigned long int MAX;
    39 extern const long long int MAX;
    40 extern const unsigned long long int MAX;
     31extern signed char MAX;
     32extern unsigned char MAX;
     33extern short int MAX;
     34extern unsigned short int MAX;
     35extern int MAX;
     36extern unsigned int MAX;
     37extern long int MAX;
     38extern unsigned long int MAX;
     39extern long long int MAX;
     40extern unsigned long long int MAX;
    4141
    4242// Floating-Point Constants
    4343
    44 extern const float MIN;
    45 extern const double MIN;
    46 extern const long double MIN;
    47 extern const float _Complex MIN;
    48 extern const double _Complex MIN;
    49 extern const long double _Complex MIN;
     44extern float MIN;
     45extern double MIN;
     46extern long double MIN;
     47extern float _Complex MIN;
     48extern double _Complex MIN;
     49extern long double _Complex MIN;
    5050
    51 extern const float MAX;
    52 extern const double MAX;
    53 extern const long double MAX;
    54 extern const float _Complex MAX;
    55 extern const double _Complex MAX;
    56 extern const long double _Complex MAX;
     51extern float MAX;
     52extern double MAX;
     53extern long double MAX;
     54extern float _Complex MAX;
     55extern double _Complex MAX;
     56extern long double _Complex MAX;
    5757
    58 extern const float PI;                                                                  // pi
    59 extern const float PI_2;                                                                // pi / 2
    60 extern const float PI_4;                                                                // pi / 4
    61 extern const float _1_PI;                                                               // 1 / pi
    62 extern const float _2_PI;                                                               // 2 / pi
    63 extern const float _2_SQRT_PI;                                                  // 2 / sqrt(pi)
     58extern float PI;                                                                                // pi
     59extern float PI_2;                                                                              // pi / 2
     60extern float PI_4;                                                                              // pi / 4
     61extern float _1_PI;                                                                             // 1 / pi
     62extern float _2_PI;                                                                             // 2 / pi
     63extern float _2_SQRT_PI;                                                                // 2 / sqrt(pi)
    6464
    65 extern const double PI;                                                                 // pi
    66 extern const double PI_2;                                                               // pi / 2
    67 extern const double PI_4;                                                               // pi / 4
    68 extern const double _1_PI;                                                              // 1 / pi
    69 extern const double _2_PI;                                                              // 2 / pi
    70 extern const double _2_SQRT_PI;                                                 // 2 / sqrt(pi)
     65extern double PI;                                                                               // pi
     66extern double PI_2;                                                                             // pi / 2
     67extern double PI_4;                                                                             // pi / 4
     68extern double _1_PI;                                                                    // 1 / pi
     69extern double _2_PI;                                                                    // 2 / pi
     70extern double _2_SQRT_PI;                                                               // 2 / sqrt(pi)
    7171
    72 extern const long double PI;                                                    // pi
    73 extern const long double PI_2;                                                  // pi / 2
    74 extern const long double PI_4;                                                  // pi / 4
    75 extern const long double _1_PI;                                                 // 1 / pi
    76 extern const long double _2_PI;                                                 // 2 / pi
    77 extern const long double _2_SQRT_PI;                                    // 2 / sqrt(pi)
     72extern long double PI;                                                                  // pi
     73extern long double PI_2;                                                                // pi / 2
     74extern long double PI_4;                                                                // pi / 4
     75extern long double _1_PI;                                                               // 1 / pi
     76extern long double _2_PI;                                                               // 2 / pi
     77extern long double _2_SQRT_PI;                                                  // 2 / sqrt(pi)
    7878
    79 extern const float _Complex PI;                                                 // pi
    80 extern const float _Complex PI_2;                                               // pi / 2
    81 extern const float _Complex PI_4;                                               // pi / 4
    82 extern const float _Complex _1_PI;                                              // 1 / pi
    83 extern const float _Complex _2_PI;                                              // 2 / pi
    84 extern const float _Complex _2_SQRT_PI;                                 // 2 / sqrt(pi)
     79extern float _Complex PI;                                                               // pi
     80extern float _Complex PI_2;                                                             // pi / 2
     81extern float _Complex PI_4;                                                             // pi / 4
     82extern float _Complex _1_PI;                                                    // 1 / pi
     83extern float _Complex _2_PI;                                                    // 2 / pi
     84extern float _Complex _2_SQRT_PI;                                               // 2 / sqrt(pi)
    8585
    86 extern const double _Complex PI;                                                // pi
    87 extern const double _Complex PI_2;                                              // pi / 2
    88 extern const double _Complex PI_4;                                              // pi / 4
    89 extern const double _Complex _1_PI;                                             // 1 / pi
    90 extern const double _Complex _2_PI;                                             // 2 / pi
    91 extern const double _Complex _2_SQRT_PI;                                // 2 / sqrt(pi)
     86extern double _Complex PI;                                                              // pi
     87extern double _Complex PI_2;                                                    // pi / 2
     88extern double _Complex PI_4;                                                    // pi / 4
     89extern double _Complex _1_PI;                                                   // 1 / pi
     90extern double _Complex _2_PI;                                                   // 2 / pi
     91extern double _Complex _2_SQRT_PI;                                              // 2 / sqrt(pi)
    9292
    93 extern const long double _Complex PI;                                   // pi
    94 extern const long double _Complex PI_2;                                 // pi / 2
    95 extern const long double _Complex PI_4;                                 // pi / 4
    96 extern const long double _Complex _1_PI;                                // 1 / pi
    97 extern const long double _Complex _2_PI;                                // 2 / pi
    98 extern const long double _Complex _2_SQRT_PI;                   // 2 / sqrt(pi)
     93extern long double _Complex PI;                                                 // pi
     94extern long double _Complex PI_2;                                               // pi / 2
     95extern long double _Complex PI_4;                                               // pi / 4
     96extern long double _Complex _1_PI;                                              // 1 / pi
     97extern long double _Complex _2_PI;                                              // 2 / pi
     98extern long double _Complex _2_SQRT_PI;                                 // 2 / sqrt(pi)
    9999
    100 extern const float E;                                                                   // e
    101 extern const float LOG2_E;                                                              // log_2(e)
    102 extern const float LOG10_E;                                                             // log_10(e)
    103 extern const float LN_2;                                                                // log_e(2)
    104 extern const float LN_10;                                                               // log_e(10)
    105 extern const float SQRT_2;                                                              // sqrt(2)
    106 extern const float _1_SQRT_2;                                                   // 1 / sqrt(2)
     100extern float E;                                                                                 // e
     101extern float LOG2_E;                                                                    // log_2(e)
     102extern float LOG10_E;                                                                   // log_10(e)
     103extern float LN_2;                                                                              // log_e(2)
     104extern float LN_10;                                                                             // log_e(10)
     105extern float SQRT_2;                                                                    // sqrt(2)
     106extern float _1_SQRT_2;                                                                 // 1 / sqrt(2)
    107107
    108 extern const double E;                                                                  // e
    109 extern const double LOG2_E;                                                             // log_2(e)
    110 extern const double LOG10_E;                                                    // log_10(e)
    111 extern const double LN_2;                                                               // log_e(2)
    112 extern const double LN_10;                                                              // log_e(10)
    113 extern const double SQRT_2;                                                             // sqrt(2)
    114 extern const double _1_SQRT_2;                                                  // 1 / sqrt(2)
     108extern double E;                                                                                // e
     109extern double LOG2_E;                                                                   // log_2(e)
     110extern double LOG10_E;                                                                  // log_10(e)
     111extern double LN_2;                                                                             // log_e(2)
     112extern double LN_10;                                                                    // log_e(10)
     113extern double SQRT_2;                                                                   // sqrt(2)
     114extern double _1_SQRT_2;                                                                // 1 / sqrt(2)
    115115
    116 extern const long double E;                                                             // e
    117 extern const long double LOG2_E;                                                // log_2(e)
    118 extern const long double LOG10_E;                                               // log_10(e)
    119 extern const long double LN_2;                                                  // log_e(2)
    120 extern const long double LN_10;                                                 // log_e(10)
    121 extern const long double SQRT_2;                                                // sqrt(2)
    122 extern const long double _1_SQRT_2;                                             // 1/sqrt(2)
     116extern long double E;                                                                   // e
     117extern long double LOG2_E;                                                              // log_2(e)
     118extern long double LOG10_E;                                                             // log_10(e)
     119extern long double LN_2;                                                                // log_e(2)
     120extern long double LN_10;                                                               // log_e(10)
     121extern long double SQRT_2;                                                              // sqrt(2)
     122extern long double _1_SQRT_2;                                                   // 1/sqrt(2)
    123123
    124 extern const float _Complex E;                                                  // e
    125 extern const float _Complex LOG2_E;                                             // log_2(e)
    126 extern const float _Complex LOG10_E;                                    // log_10(e)
    127 extern const float _Complex LN_2;                                               // log_e(2)
    128 extern const float _Complex LN_10;                                              // log_e(10)
    129 extern const float _Complex SQRT_2;                                             // sqrt(2)
    130 extern const float _Complex _1_SQRT_2;                                  // 1 / sqrt(2)
     124extern float _Complex E;                                                                // e
     125extern float _Complex LOG2_E;                                                   // log_2(e)
     126extern float _Complex LOG10_E;                                                  // log_10(e)
     127extern float _Complex LN_2;                                                             // log_e(2)
     128extern float _Complex LN_10;                                                    // log_e(10)
     129extern float _Complex SQRT_2;                                                   // sqrt(2)
     130extern float _Complex _1_SQRT_2;                                                // 1 / sqrt(2)
    131131
    132 extern const double _Complex E;                                                 // e
    133 extern const double _Complex LOG2_E;                                    // log_2(e)
    134 extern const double _Complex LOG10_E;                                   // log_10(e)
    135 extern const double _Complex LN_2;                                              // log_e(2)
    136 extern const double _Complex LN_10;                                             // log_e(10)
    137 extern const double _Complex SQRT_2;                                    // sqrt(2)
    138 extern const double _Complex _1_SQRT_2;                                 // 1 / sqrt(2)
     132extern double _Complex E;                                                               // e
     133extern double _Complex LOG2_E;                                                  // log_2(e)
     134extern double _Complex LOG10_E;                                                 // log_10(e)
     135extern double _Complex LN_2;                                                    // log_e(2)
     136extern double _Complex LN_10;                                                   // log_e(10)
     137extern double _Complex SQRT_2;                                                  // sqrt(2)
     138extern double _Complex _1_SQRT_2;                                               // 1 / sqrt(2)
    139139
    140 extern const long double _Complex E;                                    // e
    141 extern const long double _Complex LOG2_E;                               // log_2(e)
    142 extern const long double _Complex LOG10_E;                              // log_10(e)
    143 extern const long double _Complex LN_2;                                 // log_e(2)
    144 extern const long double _Complex LN_10;                                // log_e(10)
    145 extern const long double _Complex SQRT_2;                               // sqrt(2)
    146 extern const long double _Complex _1_SQRT_2;                    // 1 / sqrt(2)
     140extern long double _Complex E;                                                  // e
     141extern long double _Complex LOG2_E;                                             // log_2(e)
     142extern long double _Complex LOG10_E;                                    // log_10(e)
     143extern long double _Complex LN_2;                                               // log_e(2)
     144extern long double _Complex LN_10;                                              // log_e(10)
     145extern long double _Complex SQRT_2;                                             // sqrt(2)
     146extern long double _Complex _1_SQRT_2;                                  // 1 / sqrt(2)
    147147
    148148// Local Variables: //
  • src/GenPoly/InstantiateGeneric.cc

    rb4b63e8 rdd53f75  
    172172                InstantiationMap< AggregateDecl, AggregateDecl > instantiations;
    173173                /// Set of types which are dtype-only generic (and therefore have static layout)
    174                 ScopedSet< AggregateDecl* > dtypeStatics;
     174                std::set<AggregateDecl *> dtypeStatics;
    175175                /// Namer for concrete types
    176176                UniqueName typeNamer;
     
    505505        void GenericInstantiator::beginScope() {
    506506                instantiations.beginScope();
    507                 dtypeStatics.beginScope();
    508507        }
    509508
    510509        void GenericInstantiator::endScope() {
    511510                instantiations.endScope();
    512                 dtypeStatics.endScope();
    513511        }
    514512
  • tests/zombies/Rank2.c

    rb4b63e8 rdd53f75  
    1 int ?=?( int *, int );
    2 forall(dtype DT) DT * ?=?( DT **, DT * );
     1int ?=?( int &, int );
     2forall(dtype DT) DT * ?=?( DT *&, DT * );
    33
    44void a() {
     
    1111        void h( int *null );
    1212        forall( otype T ) T id( T );
    13         forall( dtype T ) T *0;
    14         int 0;
     13//      forall( dtype T ) T *0;
     14//      int 0;
    1515        h( id( id( id( 0 ) ) ) );
    1616}
  • tests/zombies/Tuple.c

    rb4b63e8 rdd53f75  
    4646        [ 3, 5 ];
    4747        [ a, b ] = 3;
    48 //      [ a, b ] = [ 4.6 ];
     48        [ a, b ] = [ 4.6 ];
    4949        [ a, b ] = 4.6;
    5050        [ a, b ] = [ c, d ] = [ 3, 5 ];
     
    5959        [ a, b ] = t1 = [ c, d ];
    6060        [ a, b ] = t1 = t2 = [ c, d ];
    61 //      t1 = [ 3, 4 ] = [ 3, 4 ] = t1 = [ 3, 4 ];
     61        t1 = [ 3, 4 ] = [ 3, 4 ] = t1 = [ 3, 4 ];
    6262
    6363        s.[ f1, i.[ f2, f3 ], f4 ] = [ 11, 12, 13, 3.14159 ];
     
    6565//      [ a, , b, ] = h( 3, 3, 0, "abc" );                      /* ignore some results */
    6666        sp->[ f4, f1 ] = sp->[ f1, f4 ];
    67         printf( "expecting 3, 17, 23, 4; got %d, %d, %d, %d\n", s.[ f4, i.[ f3, f2 ], f1 ] );
     67        printf( "expecting 3, 17, 23, 4; got %g, %d, %d, %d\n", s.[ f4, i.[ f3, f2 ], f1 ] );
    6868        rc = 0;
    6969}
  • tests/zombies/abstype.c

    rb4b63e8 rdd53f75  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun 14 14:27:48 2016
    13 // Update Count     : 9
     12// Last Modified On : Wed Sep 30 13:55:47 2020
     13// Update Count     : 10
    1414//
    1515
     
    2121}
    2222
    23 forall( otype T ) lvalue T *?( T * );
     23forall( otype T ) T *?( T * );
    2424int ?++( int * );
    2525int ?=?( int *, int );
  • tests/zombies/constructors.c

    rb4b63e8 rdd53f75  
    1 int fred() {
     1#include <fstream.hfa>
     2#include <stdlib.hfa>
     3
     4int main() {
    25    // initialize basic structure
    36    struct S {
    47        int i, j, k;
    58    };
    6     void ?{}( S *s ) { s->i = 1, s->k = 2; }            // default constructor
    7     void ?{}( S *s, int i, int k ) { s->i = i, s->k = k; } // 2 parameter constructor
    8     void ?{}( S *s, S c ) { *s = c; }                   // copy constructor
    9     void ^?{}( S *s ) { s->i = 0, s->k = 0; }           // default destructor
    10     void ^?{}( S *s, int i ) { s->i = i, s->k = i; }    // 1 parameter destructor
     9    void ?{}( S & s ) { s.i = 1, s.k = 2; }             // default constructor
     10    void ?{}( S & s, int i, int k ) { s.i = i, s.k = k; } // 2 parameter constructor
     11    void ?{}( S & s, S c ) { /* s @= c */ s.[i,j,k] = c.[i,j,k]; } // copy constructor
     12    void ^?{}( S & s ) { s.i = 0, s.k = 0; }            // default destructor
     13    void ^?{}( S & s, int i ) { s.i = i, s.k = i; }     // 1 parameter destructor
    1114    {
    12         S s1;                   // default constructor
    13         S s2 = { 3, 7 };        // 2 parameter constructor
    14         S s3 @= { .k:3, .i:7 }; // 2 parameter C initialization
    15         ?{}( &s3, 2, 5 );       // explicit 2 parameter constructor
    16         ^?{}( &s1 );            // explicit call to default destructor
     15        S s1;                                           // default constructor
     16        S s2 = { 3, 7 };                                // 2 parameter constructor
     17        S s3 @= { .k:3, .i:7 };                         // 2 parameter C initialization
     18        ?{}( s3, 2, 5 );                                // explicit 2 parameter constructor
     19        ^?{}( s1 );                                     // explicit call to default destructor
    1720    } // implicit call to default destructor for s2, explicit call s1, no call for s3
    18     S s4 @= {};                 // no default construction
    19     (&s4){ 2, 5 };              // explicit 2 parameter constructor
    20     ^s4{ 3 };                   // explicit call to 1 parameter destructor
     21    S s4 @= {};                                         // no default construction
     22    (s4){ 2, 5 };                                       // explicit 2 parameter constructor
     23    ^s4{ 3 };                                           // explicit call to 1 parameter destructor
    2124
    2225    // initialize pointer to a basic structure
    2326
    24     void ?{}( S **s ) { *s = malloc(); (*s)->i = 1, (*s)->k = 2; } // default constructor
    25     void ?{}( S **s, int i, int k ) { *s = malloc(); (*s)->i = i, (*s)->k = k; } // 2 parameter constructor
    26     void ^?{}( S **s ) { (*s)->i = 0, (*s)->k = 0; free( *s ); *s = 0; } // default destructor
     27    void ?{}( S *& s ) { s = malloc(); s->i = 1, (*s).k = 2; } // default constructor
     28    void ?{}( S *& s, int i, int k ) { s = malloc(); (*s).i = i, (*s).k = k; } // 2 parameter constructor
     29    void ^?{}( S *& s ) { (*s).i = 0, (*s).k = 0; free( s ); &s = 0p; } // default destructor
    2730    {
    28         S *ps1;                 // default constructor
    29         S *ps2 = { 3, 7 };      // 2 parameter constructor
    30         S *ps3 @= 0;            // C initialization
    31         S *ps4 @= {};           // no default construction
     31        S * ps1;                                        // default constructor
     32        S * ps2 = { 3, 7 };                             // 2 parameter constructor
     33        sout | ps1 | ps2;
     34
     35        S * ps3 @= 0p;                                  // C initialization
     36        S * ps4 @= { 3 };                               // no default construction
     37        sout | ps3 | ps4;
     38
     39        ?{}( ps3, 2, 5 );                               // explicit 2 parameter constructor
     40        (ps4){ 2, 5 };                                  // explicit 2 parameter constructor
     41        sout | ps3 | ps4;
     42
     43        ^?{}( ps3 );                                    // explicit call to default destructor
     44        ^ps4{};                                         // explicit call to default destructor
     45        sout | ps3 | ps4;
    3246    } // implicit call to default destructor for ps2 and ps1, checks ordering of explicit destructor calls
    33 
    34     ?{}( &ps3, 2, 5 );          // explicit 2 parameter constructor
    35     (&ps4){ 2, 5 };             // explicit 2 parameter constructor
    36    
    37     ^?{}( &ps3 );               // explicit call to default destructor
    38     ^ps4{};                     // explicit call to default destructor
    3947
    4048    // initialize complex structure
     
    4452    };
    4553
    46     void ?{}( T *t ) {}                                 // default constructor => implicitly call constructor for field s
    47     void ?{}( T *t, int i, int k ) { (&t->s){ i, k }; } // 2 parameter constructor => explicitly call constructor for field s
    48     void ?{}( T *t, S c ) { (&t->s){ c }; }             // 1 parameter constructor => explicitly call copy constructor for field s
    49     void ^?{}( T *s, int i ) {}                         // destructor => implicitly call destructor for field s
     54    void ?{}( T & t ) {}        // default constructor => implicitly call constructor for field s
     55    void ?{}( T & t, int i, int k ) { (t.s){ i, k }; } // 2 parameter constructor => explicitly call constructor for field s
     56    void ?{}( T & t, S c ) { (t.s){ c }; }// 1 parameter constructor => explicitly call copy constructor for field s
     57    void ^?{}( T & s ) {}       // destructor => implicitly call destructor for field s
     58    void ^?{}( T & s, int i ) {}// destructor => implicitly call destructor for field s
    5059    {
    51         S s;                    // default constructor
    52         T t1;                   // default constructor
    53         T t2 = { s };           // 1 parameter constructor
    54         ^?{}( &t1 );            // explicit call to default destructor => implicit call to t1.s's destructor
     60        S s;                                            // default constructor
     61        T t1;                                           // default constructor
     62        T t2 = { s };                                   // 1 parameter constructor
     63        ^?{}( t1, 3 );                                  // explicit call to default destructor => implicit call to t1.s's destructor
     64        T t3;                                           // default constructor
     65        T t4 @= { { 1, 3 } };                           // C initialization
     66        (t4){ 2, 5 };                                   // explicit 2 parameter constructor
    5567    } // implicit call to default destructor for t2 and implicit call for s;
    56     T t3;                       // default constructor
    57     T t4 @= { { 1, 3 } };       // C initialization
    58     (&t4){ 2, 5 };              // explicit 2 parameter constructor
    5968
    6069    T *pt = malloc(){ 3, 4 };   // common usage
  • tests/zombies/includes.c

    rb4b63e8 rdd53f75  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Nov 15 23:06:24 2017
    13 // Update Count     : 597
     12// Last Modified On : Wed Sep 30 13:59:18 2020
     13// Update Count     : 598
    1414//
    1515
     
    2424#if 1
    2525#define _GNU_SOURCE
    26 #include <a.out.h>
    27 #include <aio.h>
    28 #include <aliases.h>
    29 #include <alloca.h>
    30 #include <ansidecl.h>
    31 #include <ar.h>
    32 #include <argp.h>
    33 #include <argz.h>
    34 #include <assert.h>
    35 //#include <bfd.h>
    36 // #include <bfdlink.h>                         // keyword with
    37 #include <byteswap.h>
    38 #include <bzlib.h>
    39 #include <cblas.h>
    40 #include <cblas_f77.h>
    41 #include <complex.h>
    42 #include <com_err.h>
    43 #include <cpio.h>
    44 #include <crypt.h>
    45 #include <ctype.h>
    46 #include <curses.h>
    47 #include <dialog.h>
    48 #include <dirent.h>
    49 #include <dis-asm.h>
    50 #include <dlfcn.h>
    51 #include <dlg_colors.h>
    52 #include <dlg_config.h>
    53 #include <dlg_keys.h>
    54 #include <elf.h>
    55 #include <endian.h>
    56 #include <envz.h>
    57 #include <err.h>
    58 #include <errno.h>
    59 #include <error.h>
    60 #include <eti.h>
    61 #include <evdns.h>
    62 #include <event.h>
     26// #include <a.out.h>
     27// #include <aio.h>
     28// #include <aliases.h>
     29// #include <alloca.h>
     30// #include <ansidecl.h>
     31// #include <ar.h>
     32// #include <argp.h>
     33// #include <argz.h>
     34// #include <assert.h>
     35// #include <bfd.h>
     36// #include <bfdlink.h>                                                                 // keyword with
     37// #include <byteswap.h>
     38// #include <bzlib.h>
     39// #include <cblas.h>
     40// #include <cblas_f77.h>
     41// #include <complex.h>
     42// #include <com_err.h>
     43// #include <cpio.h>
     44
     45// #include <crypt.h>
     46// #include <ctype.h>
     47// #include <curses.h>
     48// #include <dialog.h>
     49// #include <dirent.h>
     50// #include <dis-asm.h>
     51// #include <dlfcn.h>
     52// #include <dlg_colors.h>
     53// #include <dlg_config.h>
     54// #include <dlg_keys.h>
     55// #include <elf.h>
     56// #include <endian.h>
     57// #include <envz.h>
     58// #include <err.h>
     59// #include <errno.h>
     60// #include <error.h>
     61// #include <eti.h>
     62// #include <evdns.h>
     63// #include <event.h>
    6364
    6465// #include <evhttp.h>
    6566// #include <sys/queue.h>
    66 // #include <evrpc.h>                                   // evrpc.h depends on sys/queue.h
     67// #include <evrpc.h>                                                                           // evrpc.h depends on sys/queue.h
    6768// #include <evutil.h>
    6869// #include <execinfo.h>
     
    8081// #include <fts.h>
    8182// #include <ftw.h>
     83
    8284// #include <gconv.h>
    8385// #include <getopt.h>
     
    8991// #include <gshadow.h>
    9092// #include <gssapi.h>
    91 // #include <hwloc.h>                                   // keyword thread (setjmp)
     93#include <hwloc.h>                                                                              // keyword thread (setjmp)
    9294// #include <iconv.h>
    9395// #include <idna.h>
Note: See TracChangeset for help on using the changeset viewer.