Changes in / [2125443a:db9d7a9]


Ignore:
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/builtins.c

    r2125443a rdb9d7a9  
    1010// Created On       : Fri Jul 21 16:21:03 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:33:56 2023
    13 // Update Count     : 135
     12// Last Modified On : Sat Aug 14 08:45:54 2021
     13// Update Count     : 133
    1414//
    1515
     
    6464static inline void ^?{}(generator$ &) {}
    6565
    66 forall( T & )
    67 trait is_generator {
     66trait is_generator(T &) {
    6867      void main(T & this);
    6968      generator$ * get_generator(T & this);
  • libcfa/prelude/prelude-gen.cc

    r2125443a rdb9d7a9  
    1010// Created On       : Sat Feb 16 08:44:58 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:40:01 2023
    13 // Update Count     : 38
     12// Last Modified On : Tue Apr  2 17:18:24 2019
     13// Update Count     : 37
    1414//
    1515
     
    159159int main() {
    160160        cout << "# 2 \"prelude.cfa\"  // needed for error messages from this file" << endl;
    161         cout << "forall( T & ) trait sized {};" << endl;
     161        cout << "trait sized(T &) {};" << endl;
    162162
    163163        cout << "//////////////////////////" << endl;
  • libcfa/src/bits/containers.hfa

    r2125443a rdb9d7a9  
    1010// Created On       : Tue Oct 31 16:38:50 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:33:08 2023
    13 // Update Count     : 29
     12// Last Modified On : Wed Jan 15 07:42:35 2020
     13// Update Count     : 28
    1414
    1515#pragma once
     
    6969
    7070#ifdef __cforall
    71         forall( T & )
    72         trait is_node {
     71        trait is_node(T &) {
    7372                T *& get_next( T & );
    7473        };
  • libcfa/src/concurrency/coroutine.hfa

    r2125443a rdb9d7a9  
    1010// Created On       : Mon Nov 28 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:31:42 2023
    13 // Update Count     : 13
     12// Last Modified On : Thu Jan  6 16:33:16 2022
     13// Update Count     : 12
    1414//
    1515
     
    3838// Anything that implements this trait can be resumed.
    3939// Anything that is resumed is a coroutine.
    40 forall( T & | IS_RESUMPTION_EXCEPTION(CoroutineCancelled(T)) )
    41 trait is_coroutine {
     40trait is_coroutine(T & | IS_RESUMPTION_EXCEPTION(CoroutineCancelled(T))) {
    4241        void main(T & this);
    4342        coroutine$ * get_coroutine(T & this);
  • libcfa/src/concurrency/locks.hfa

    r2125443a rdb9d7a9  
    640640//-----------------------------------------------------------------------------
    641641// is_blocking_lock
    642 forall( L & | sized(L) )
    643 trait is_blocking_lock {
     642trait is_blocking_lock(L & | sized(L)) {
    644643        // For synchronization locks to use when acquiring
    645644        void on_notify( L &, struct thread$ * );
  • libcfa/src/concurrency/monitor.hfa

    r2125443a rdb9d7a9  
    1010// Created On       : Thd Feb 23 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:29:21 2023
    13 // Update Count     : 12
     12// Last Modified On : Wed Dec  4 07:55:32 2019
     13// Update Count     : 11
    1414//
    1515
     
    2222#include "stdlib.hfa"
    2323
    24 forall( T & )
    25 trait is_monitor {
     24trait is_monitor(T &) {
    2625        monitor$ * get_monitor( T & );
    2726        void ^?{}( T & mutex );
  • libcfa/src/concurrency/mutex.hfa

    r2125443a rdb9d7a9  
    1212// Created On       : Fri May 25 01:24:09 2018
    1313// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Thu Feb  2 11:46:08 2023
    15 // Update Count     : 2
     14// Last Modified On : Wed Dec  4 09:16:53 2019
     15// Update Count     : 1
    1616//
    1717
     
    7070void unlock(recursive_mutex_lock & this) __attribute__((deprecated("use concurrency/locks.hfa instead")));
    7171
    72 forall( L & | sized(L) )
    73 trait is_lock {
     72trait is_lock(L & | sized(L)) {
    7473        void lock  (L &);
    7574        void unlock(L &);
  • libcfa/src/concurrency/thread.hfa

    r2125443a rdb9d7a9  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:27:59 2023
    13 // Update Count     : 37
     12// Last Modified On : Tue Nov 22 22:18:34 2022
     13// Update Count     : 35
    1414//
    1515
     
    2727//-----------------------------------------------------------------------------
    2828// thread trait
    29 forall( T & )
    30 trait is_thread {
     29trait is_thread(T &) {
    3130        void ^?{}(T& mutex this);
    3231        void main(T& this);
  • libcfa/src/containers/list.hfa

    r2125443a rdb9d7a9  
    99// Author           : Michael Brooks
    1010// Created On       : Wed Apr 22 18:00:00 2020
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:32:26 2023
    13 // Update Count     : 2
     11// Last Modified By : Michael Brooks
     12// Last Modified On : Wed Apr 22 18:00:00 2020
     13// Update Count     : 1
    1414//
    1515
     
    2323};
    2424
    25 forall( tOuter &, tMid &, tInner & )
    26 trait embedded {
     25trait embedded( tOuter &, tMid &, tInner & ) {
    2726    tytagref( tMid, tInner ) ?`inner( tOuter & );
    2827};
  • libcfa/src/containers/vector.hfa

    r2125443a rdb9d7a9  
    1010// Created On       : Tue Jul  5 18:00:07 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:41:24 2023
    13 // Update Count     : 5
     12// Last Modified On : Wed Jun 17 11:02:46 2020
     13// Update Count     : 4
    1414//
    1515
     
    5050//------------------------------------------------------------------------------
    5151//Declaration
    52 forall( T, allocator_t )
    53 trait allocator_c {
     52trait allocator_c(T, allocator_t)
     53{
    5454        void realloc_storage(allocator_t*, size_t);
    5555        T* data(allocator_t*);
  • libcfa/src/exception.h

    r2125443a rdb9d7a9  
    99// Author           : Andrew Beach
    1010// Created On       : Mon Jun 26 15:11:00 2017
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:20:19 2023
    13 // Update Count     : 13
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Apr  8 15:20:00 2021
     13// Update Count     : 12
    1414//
    1515
     
    101101// implemented in the .c file either so they all have to be inline.
    102102
    103 forall( exceptT &, virtualT & )
    104 trait is_exception {
     103trait is_exception(exceptT &, virtualT &) {
    105104        /* The first field must be a pointer to a virtual table.
    106105         * That virtual table must be a decendent of the base exception virtual table.
     
    110109};
    111110
    112 forall( exceptT &, virtualT & | is_exception(exceptT, virtualT) )
    113 trait is_termination_exception {
     111trait is_termination_exception(exceptT &, virtualT & | is_exception(exceptT, virtualT)) {
    114112        void defaultTerminationHandler(exceptT &);
    115113};
    116114
    117 forall( exceptT &, virtualT & | is_exception(exceptT, virtualT) )
    118 trait is_resumption_exception {
     115trait is_resumption_exception(exceptT &, virtualT & | is_exception(exceptT, virtualT)) {
    119116        void defaultResumptionHandler(exceptT &);
    120117};
  • libcfa/src/iostream.hfa

    r2125443a rdb9d7a9  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:25:39 2023
    13 // Update Count     : 410
     12// Last Modified On : Sun Oct 10 10:02:07 2021
     13// Update Count     : 407
    1414//
    1515
     
    2222
    2323
    24 forall( ostype & )
    25 trait basic_ostream {
     24trait basic_ostream( ostype & ) {
    2625        // private
    2726        bool sepPrt$( ostype & );                                                       // get separator state (on/off)
     
    5251}; // basic_ostream
    5352       
    54 forall( ostype & | basic_ostream( ostype ) )
    55 trait ostream {
     53trait ostream( ostype & | basic_ostream( ostype ) ) {
    5654        bool fail( ostype & );                                                          // operation failed?
    5755        void clear( ostype & );
     
    6260}; // ostream
    6361
    64 // forall( T )
    65 // trait writeable {
     62// trait writeable( T ) {
    6663//      forall( ostype & | ostream( ostype ) ) ostype & ?|?( ostype &, T );
    6764// }; // writeable
    6865
    69 forall( T, ostype & | ostream( ostype ) )
    70         trait writeable {
     66trait writeable( T, ostype & | ostream( ostype ) ) {
    7167        ostype & ?|?( ostype &, T );
    7268}; // writeable
     
    294290
    295291
    296 forall( istype & )
    297 trait basic_istream {
     292trait basic_istream( istype & ) {
    298293        // private
    299294        bool getANL$( istype & );                                                       // get scan newline (on/off)
     
    307302}; // basic_istream
    308303
    309 forall( istype & | basic_istream( istype ) )
    310 trait istream {
     304trait istream( istype & | basic_istream( istype ) ) {
    311305        bool fail( istype & );
    312306        void clear( istype & );
     
    316310}; // istream
    317311
    318 forall( T )
    319 trait readable {
     312trait readable( T ) {
    320313        forall( istype & | istream( istype ) ) istype & ?|?( istype &, T );
    321314}; // readable
  • libcfa/src/iterator.hfa

    r2125443a rdb9d7a9  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:21:50 2023
    13 // Update Count     : 11
     12// Last Modified On : Fri Jul  7 08:37:25 2017
     13// Update Count     : 10
    1414//
    1515
     
    1717
    1818// An iterator can be used to traverse a data structure.
    19 forall( iterator_type, elt_type )
    20 trait iterator {
     19trait iterator( iterator_type, elt_type ) {
    2120        // point to the next element
    2221//      iterator_type ?++( iterator_type & );
     
    3231};
    3332
    34 forall( iterator_type, collection_type, elt_type | iterator( iterator_type, elt_type ) )
    35         trait iterator_for {
     33trait iterator_for( iterator_type, collection_type, elt_type | iterator( iterator_type, elt_type ) ) {
    3634//      [ iterator_type begin, iterator_type end ] get_iterators( collection_type );
    3735        iterator_type begin( collection_type );
  • libcfa/src/math.trait.hfa

    r2125443a rdb9d7a9  
    1010// Created On       : Fri Jul 16 15:40:52 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:36:56 2023
    13 // Update Count     : 20
     12// Last Modified On : Tue Jul 20 17:47:19 2021
     13// Update Count     : 19
    1414//
    1515
    1616#pragma once
    1717
    18 forall( U )
    19 trait Not {
     18trait Not( U ) {
    2019        void ?{}( U &, zero_t );
    2120        int !?( U );
    2221}; // Not
    2322
    24 forall( T | Not( T ) )
    25 trait Equality {
     23trait Equality( T | Not( T ) ) {
    2624        int ?==?( T, T );
    2725        int ?!=?( T, T );
    2826}; // Equality
    2927
    30 forall( U | Equality( U ) )
    31 trait Relational {
     28trait Relational( U | Equality( U ) ) {
    3229        int ?<?( U, U );
    3330        int ?<=?( U, U );
     
    3633}; // Relational
    3734
    38 forall ( T )
    39 trait Signed {
     35trait Signed( T ) {
    4036        T +?( T );
    4137        T -?( T );
     
    4339}; // Signed
    4440
    45 forall( U | Signed( U ) )
    46 trait Additive {
     41trait Additive( U | Signed( U ) ) {
    4742        U ?+?( U, U );
    4843        U ?-?( U, U );
     
    5146}; // Additive
    5247
    53 forall( T | Additive( T ) )
    54 trait Incdec {
     48trait Incdec( T | Additive( T ) ) {
    5549        void ?{}( T &, one_t );
    5650        // T ?++( T & );
     
    6054}; // Incdec
    6155
    62 forall( U | Incdec( U ) )
    63 trait Multiplicative {
     56trait Multiplicative( U | Incdec( U ) ) {
    6457        U ?*?( U, U );
    6558        U ?/?( U, U );
     
    6861}; // Multiplicative
    6962
    70 forall( T | Relational( T ) | Multiplicative( T ) )
    71 trait Arithmetic {
     63trait Arithmetic( T | Relational( T ) | Multiplicative( T ) ) {
    7264}; // Arithmetic
    7365
  • libcfa/src/stdlib.hfa

    r2125443a rdb9d7a9  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:30:04 2023
    13 // Update Count     : 766
     12// Last Modified On : Sun Dec 11 18:25:53 2022
     13// Update Count     : 765
    1414//
    1515
     
    404404//   calls( sprng );
    405405
    406 forall( PRNG &, R )
    407 trait basic_prng {
     406trait basic_prng( PRNG &, R ) {
    408407        void set_seed( PRNG & prng, R seed );                           // set seed
    409408        R get_seed( PRNG & prng );                                                      // get seed
  • src/Common/SemanticError.h

    r2125443a rdb9d7a9  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 10:59:10 2023
    13 // Update Count     : 36
     12// Last Modified On : Wed May  4 14:08:26 2022
     13// Update Count     : 35
    1414//
    1515
     
    5454
    5555constexpr WarningData WarningFormats[] = {
    56         {"self-assign"              , Severity::Warn    , "self assignment of expression: %s"                          },
    57         {"reference-conversion"     , Severity::Warn    , "rvalue to reference conversion of rvalue: %s"               },
    58         {"qualifiers-zero_t-one_t"  , Severity::Warn    , "questionable use of type qualifier %s with %s"              },
    59         {"aggregate-forward-decl"   , Severity::Warn    , "forward declaration of nested aggregate: %s"                },
    60         {"superfluous-decl"         , Severity::Warn    , "declaration does not allocate storage: %s"                  },
    61         {"superfluous-else"         , Severity::Warn    , "else clause never executed for empty loop conditional"      },
    62         {"gcc-attributes"           , Severity::Warn    , "invalid attribute: %s"                                      },
    63         {"c++-like-copy"            , Severity::Warn    , "Constructor from reference is not a valid copy constructor" },
    64         {"depreciated-trait-syntax" , Severity::Warn    , "trait type-parameters are now specified using the forall clause" },
     56        {"self-assign"            , Severity::Warn    , "self assignment of expression: %s"                          },
     57        {"reference-conversion"   , Severity::Warn    , "rvalue to reference conversion of rvalue: %s"               },
     58        {"qualifiers-zero_t-one_t", Severity::Warn    , "questionable use of type qualifier %s with %s"              },
     59        {"aggregate-forward-decl" , Severity::Warn    , "forward declaration of nested aggregate: %s"                },
     60        {"superfluous-decl"       , Severity::Warn    , "declaration does not allocate storage: %s"                  },
     61        {"superfluous-else"       , Severity::Warn    , "else clause never executed for empty loop conditional"      },
     62        {"gcc-attributes"         , Severity::Warn    , "invalid attribute: %s"                                      },
     63        {"c++-like-copy"          , Severity::Warn    , "Constructor from reference is not a valid copy constructor" },
    6564};
    6665
     
    7473        GccAttributes,
    7574        CppCopy,
    76         DeprecTraitSyntax,
    7775        NUMBER_OF_WARNINGS, // This MUST be the last warning
    7876};
  • src/Parser/parser.yy

    r2125443a rdb9d7a9  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 21:36:16 2023
    13 // Update Count     : 5865
     12// Last Modified On : Tue Jan 31 08:55:11 2023
     13// Update Count     : 5861
    1414//
    1515
     
    29792979trait_specifier:                                                                                // CFA
    29802980        TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' '}'
    2981                 {
    2982                         SemanticWarning( yylloc, Warning::DeprecTraitSyntax, "" );
    2983                         $$ = DeclarationNode::newTrait( $2, $4, nullptr );
    2984                 }
    2985         | forall TRAIT identifier_or_type_name '{' '}'          // alternate
     2981                { $$ = DeclarationNode::newTrait( $2, $4, nullptr ); }
     2982        | forall TRAIT identifier_or_type_name '{' '}' // alternate
    29862983                { $$ = DeclarationNode::newTrait( $3, $1, nullptr ); }
    29872984        | TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' push trait_declaration_list pop '}'
    2988                 {
    2989                         SemanticWarning( yylloc, Warning::DeprecTraitSyntax, "" );
    2990                         $$ = DeclarationNode::newTrait( $2, $4, $8 );
    2991                 }
     2985                { $$ = DeclarationNode::newTrait( $2, $4, $8 ); }
    29922986        | forall TRAIT identifier_or_type_name '{' push trait_declaration_list pop '}' // alternate
    29932987                { $$ = DeclarationNode::newTrait( $3, $1, $6 ); }
  • tests/forall.cfa

    r2125443a rdb9d7a9  
    1010// Created On       : Wed May  9 08:48:15 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 15:28:45 2023
    13 // Update Count     : 38
     12// Last Modified On : Sat Jun  5 10:06:08 2021
     13// Update Count     : 36
    1414//
    1515
     
    5656}
    5757
    58 forall( T ) trait sumable {
     58trait sumable( T ) {
    5959        void ?{}( T &, zero_t );                                                        // 0 literal constructor
    6060        T ?+?( T, T );                                                                          // assortment of additions
     
    6464}; // sumable
    6565
    66 forall( T | sumable( T ) )                                                              // use trait
     66forall( T | sumable( T ) )                                              // use trait
    6767T sum( size_t size, T a[] ) {
    6868        T total = 0;                                                                            // initialize by 0 constructor
Note: See TracChangeset for help on using the changeset viewer.