Changeset 3d5701e for tests


Ignore:
Timestamp:
Feb 25, 2020, 1:17:33 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
7dc2e015
Parents:
9fb8f01 (diff), dd9e1ca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

resolve conflict

Location:
tests
Files:
19 added
3 deleted
51 edited
20 moved

Legend:

Unmodified
Added
Removed
  • tests/.expect/alloc-ERROR.txt

    r9fb8f01 r3d5701e  
    1 alloc.cfa:265:1 error: No reasonable alternatives for expression Applying untyped:
     1alloc.cfa:310:1 error: No reasonable alternatives for expression Applying untyped:
    22  Name: ?=?
    33...to:
     
    1919
    2020
    21 alloc.cfa:266:1 error: No reasonable alternatives for expression Applying untyped:
     21alloc.cfa:311:1 error: No reasonable alternatives for expression Applying untyped:
    2222  Name: ?=?
    2323...to:
     
    3939
    4040
    41 alloc.cfa:267:1 error: No reasonable alternatives for expression Applying untyped:
     41alloc.cfa:312:1 error: No reasonable alternatives for expression Applying untyped:
    4242  Name: ?=?
    4343...to:
     
    5050
    5151
    52 alloc.cfa:268:1 error: No reasonable alternatives for expression Applying untyped:
     52alloc.cfa:313:1 error: No reasonable alternatives for expression Applying untyped:
    5353  Name: ?=?
    5454...to:
  • tests/.expect/alloc.txt

    r9fb8f01 r3d5701e  
    22CFA malloc 0xdeadbeef
    33CFA alloc 0xdeadbeef
    4 CFA alloc, fill ffffffff
     4CFA alloc, fill dededede
     5CFA alloc, fill 3
    56
    67C   array calloc, fill 0
     
    1011CFA array alloc, no fill
    11120xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
    12 CFA array alloc, fill 0xff
    13 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
     13CFA array alloc, fill 0xde
     140xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede
     15CFA array alloc, fill 0xef
     160xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef
     17CFA array alloc, fill from array
     180xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef,
    1419
    15 C   realloc
    16 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
     20C realloc
     210xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef
    1722CFA realloc
    18 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101
     230xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101
    1924
    20 CFA resize alloc
     25CFA resize array alloc
    21260xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
    2227CFA resize array alloc
     
    2429CFA resize array alloc
    25300xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
     31CFA resize array alloc
     320xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede
     33CFA resize array alloc
     340xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
    2635CFA resize array alloc, fill
    27 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
    28 CFA resize array alloc, fill
    29 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
    30 CFA resize array alloc, fill
    31 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
     360xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede
    3237
    3338C   memalign 42 42.5
     
    3540CFA posix_memalign 42 42.5
    3641CFA posix_memalign 42 42.5
    37 CFA aligned_alloc 42 42.5
    38 CFA align_alloc 42 42.5
    39 CFA align_alloc fill 0xffffffff -nan
     42CFA alloc_align 42 42.5
     43CFA alloc_align 42 42.5
     44CFA alloc_align fill 0xdededede -0x1.ededededededep+494
     45CFA alloc_align fill 42 42.5
     46CFA alloc_align 42 42.5
    4047
    41 CFA array align_alloc
     48CFA array alloc_align
    424942 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5,
    43 CFA array align_alloc, fill
    44 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan,
     50CFA array alloc_align, fill
     510xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494,
     52CFA array alloc_align, fill
     5342 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5,
     54CFA array alloc_align, fill array
     5542 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5,
     56CFA realloc array alloc_align
     5742 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5,
    4558
    46 CFA memset 0xffffffff -nan
    47 CFA memcpy 0xffffffff -nan
     59CFA memset 0xdededede -0x1.ededededededep+494
     60CFA memcpy 0xdededede -0x1.ededededededep+494
    4861
    4962CFA array memset
    50 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan,
     630xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494,
    5164CFA array memcpy
    52 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan,
     650xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494,
    5366
    5467CFA new initialize
  • tests/.expect/attributes.x64.txt

    r9fb8f01 r3d5701e  
    784784signed int _X4apd7Fi_Fi_i_Fi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object23)(__attribute__ ((unused)) signed int __anonymous_object24), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object25)(__attribute__ ((unused)) signed int __anonymous_object26));
    785785struct Vad {
    786     __attribute__ ((unused)) signed int __anonymous_object27:4;
    787     __attribute__ ((unused)) signed int __anonymous_object28:4;
    788     __attribute__ ((unused,unused)) signed int __anonymous_object29:6;
     786    __attribute__ ((unused)) signed int :4;
     787    __attribute__ ((unused)) signed int :4;
     788    __attribute__ ((unused,unused)) signed int :6;
    789789};
    790790static inline void _X12_constructorFv_S3Vad_autogen___1(struct Vad *_X4_dstS3Vad_1);
  • tests/.expect/attributes.x86.txt

    r9fb8f01 r3d5701e  
    784784signed int _X4apd7Fi_Fi_i_Fi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object23)(__attribute__ ((unused)) signed int __anonymous_object24), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object25)(__attribute__ ((unused)) signed int __anonymous_object26));
    785785struct Vad {
    786     __attribute__ ((unused)) signed int __anonymous_object27:4;
    787     __attribute__ ((unused)) signed int __anonymous_object28:4;
    788     __attribute__ ((unused,unused)) signed int __anonymous_object29:6;
     786    __attribute__ ((unused)) signed int :4;
     787    __attribute__ ((unused)) signed int :4;
     788    __attribute__ ((unused,unused)) signed int :6;
    789789};
    790790static inline void _X12_constructorFv_S3Vad_autogen___1(struct Vad *_X4_dstS3Vad_1);
  • tests/.expect/gccExtensions.x64.txt

    r9fb8f01 r3d5701e  
    1212    asm volatile ( "mov %1, %0\n\t" "add $1, %0" : "=" "r" ( _X3dsti_2 ) :  :  );
    1313    asm volatile ( "mov %1, %0\n\t" "add $1, %0" : "=r" ( _X3dsti_2 ) : "r" ( _X3srci_2 ) :  );
    14     asm ( "mov %1, %0\n\t" "add $1, %0" : "=r" ( _X3dsti_2 ), "=r" ( _X3srci_2 ) : [ _X3srci_2 ] "r" ( _X3dsti_2 ) : "r0" );
     14    asm ( "mov %1, %0\n\t" "add $1, %0" : "=r" ( _X3dsti_2 ), "=r" ( _X3srci_2 ) : [ src ] "r" ( _X3dsti_2 ) : "r0" );
    1515    L2: L1: asm goto ( "frob %%r5, %1; jc %l[L1]; mov (%2), %%r5" :  : "r" ( _X3srci_2 ), "r" ( (&_X3dsti_2) ) : "r5", "memory" : L1, L2 );
    1616    double _Complex _X2c1Cd_2;
  • tests/.expect/gccExtensions.x86.txt

    r9fb8f01 r3d5701e  
    1212    asm volatile ( "mov %1, %0\n\t" "add $1, %0" : "=" "r" ( _X3dsti_2 ) :  :  );
    1313    asm volatile ( "mov %1, %0\n\t" "add $1, %0" : "=r" ( _X3dsti_2 ) : "r" ( _X3srci_2 ) :  );
    14     asm ( "mov %1, %0\n\t" "add $1, %0" : "=r" ( _X3dsti_2 ), "=r" ( _X3srci_2 ) : [ _X3srci_2 ] "r" ( _X3dsti_2 ) : "r0" );
     14    asm ( "mov %1, %0\n\t" "add $1, %0" : "=r" ( _X3dsti_2 ), "=r" ( _X3srci_2 ) : [ src ] "r" ( _X3dsti_2 ) : "r0" );
    1515    L2: L1: asm goto ( "frob %%r5, %1; jc %l[L1]; mov (%2), %%r5" :  : "r" ( _X3srci_2 ), "r" ( (&_X3dsti_2) ) : "r5", "memory" : L1, L2 );
    1616    double _Complex _X2c1Cd_2;
  • tests/.expect/loopctrl.txt

    r9fb8f01 r3d5701e  
    66A
    77A A A A A A A A A A
     8A A A A A A A A A A A
    89B B B B B
    910C C C C C
     
    1213
    13140 1 2 3 4 5 6 7 8 9
     150 1 2 3 4 5 6 7 8 9 10
    14161 3 5 7 9
    151710 8 6 4 2
     
    2830N N N N N N N N N N
    29310 1 2 3 4 5 6 7 8 9
     320 1 2 3 4 5 6 7 8 9 10
    303310 9 8 7 6 5 4 3 2 1
    3134
  • tests/.expect/nested-types-ERR1.txt

    r9fb8f01 r3d5701e  
    1 nested-types.cfa:70:1 error: Use of undefined type T
     1nested-types.cfa:83:1 error: Use of undefined type T
  • tests/.expect/nested-types-ERR2.txt

    r9fb8f01 r3d5701e  
    1 nested-types.cfa:73:1 error: Use of undefined global type Z
    2 nested-types.cfa:74:1 error: Qualified type requires an aggregate on the left, but has: signed int
    3 nested-types.cfa:75:1 error: Undefined type in qualified type: Qualified Type:
     1nested-types.cfa:86:1 error: Use of undefined global type Z
     2nested-types.cfa:87:1 error: Qualified type requires an aggregate on the left, but has: signed int
     3nested-types.cfa:88:1 error: Undefined type in qualified type: Qualified Type:
    44  instance of struct S with body 1
    55  instance of type Z (not function type)
  • tests/.expect/rational.txt

    r9fb8f01 r3d5701e  
    11constructor
    2 3/1 4/1 0/1
     23/1 4/1 0/1 0/1 1/1
    331/2 5/7
    442/3 -3/2
  • tests/.expect/references.txt

    r9fb8f01 r3d5701e  
    36363
    37373 9 { 1., 7. }, [1, 2, 3]
     384
    3839Destructing a Y
    3940Destructing a Y
  • tests/.expect/time.txt

    r9fb8f01 r3d5701e  
    1818Dividing that by 2 gives 2403.5 seconds
    19194807 seconds is 1 hours, 20 minutes, 7 seconds
     202020 Jan  5 14:01:40 (GMT)
     211970 Jan  5 14:00:00 (GMT)
     221973 Jan  2 06:59:00 (GMT)
  • tests/Makefile.am

    r9fb8f01 r3d5701e  
    2424archiveerrors=
    2525
    26 INSTALL_FLAGS=-in-tree
    2726DEBUG_FLAGS=-debug -O0
    2827
     
    3534
    3635# applies to both programs
     36# since automake doesn't have support for CFA we have to
    3737AM_CFLAGS = $(if $(test), 2> $(test), ) \
    3838        -g \
     
    4242        -DIN_DIR="${abs_srcdir}/.in/"
    4343
    44 AM_CFLAGS += ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}
    45 CC = @CFACC@
     44# get the desired cfa to test
     45TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
     46
     47# adjust CC to current flags
     48CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
     49CFACC = $(CC)
     50
     51# get local binary for depedencies
     52CFACCBIN = @CFACC@
     53
     54# adjusted CC but without the actual distcc call
     55CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
    4656
    4757PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
     
    5767#----------------------------------------------------------------------------------------------------------------
    5868all-local :
    59         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
     69        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
    6070
    6171all-tests :
    62         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     72        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
    6373
    6474clean-local :
     
    8797
    8898# Use for all tests, make sure the path are correct and all flags are added
    89 CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
    90 
    91 # Use for tests that either generate an executable, print directyl to stdout or the make command is expected to fail
    92 CFATEST_STDOUT=$(CFACOMPILETEST) -o $(abspath ${@})
    93 
    94 # Use for tests where the make command is expecte to succeed but the expected.txt should be compared to stderr
    95 CFATEST_STDERR=$(CFACOMPILETEST) 2> $(abspath ${@})
     99CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
    96100
    97101#----------------------------------------------------------------------------------------------------------------
    98102
    99103# implicit rule so not all test require a rule
    100 % : %.cfa $(CFACC)
    101         $(CFATEST_STDOUT)
     104# split into two steps to support compiling remotely using distcc
     105# don't use distcc to do the linking because distcc doesn't do linking
     106% : %.cfa $(CFACCBIN)
     107        $(CFACOMPILETEST) -c -o $(abspath ${@}).o
     108        $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
    102109
     110# implicit rule for c++ test
     111# convient for testing the testsuite itself but not actuall used
    103112% : %.cpp
    104113        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    105114
    106115#------------------------------------------------------------------------------
    107 # TARGET WITH STANDARD RULE BUT CUSTOM FLAGS
     116# TARGETS WITH CUSTOM FLAGS
    108117#------------------------------------------------------------------------------
    109 # Expected failures
    110 declarationSpecifier_FLAGS= -CFA -XCFA -p
    111 gccExtensions_FLAGS= -CFA -XCFA -p
    112 extension_FLAGS= -CFA -XCFA -p
    113 attributes_FLAGS= -CFA -XCFA -p
    114 functions_FLAGS= -CFA -XCFA -p
    115 KRfunctions_FLAGS= -CFA -XCFA -p
    116 gmp_FLAGS= -lgmp
     118# custom libs
     119gmp_FLAGSLD= -lgmp
    117120
    118121#------------------------------------------------------------------------------
    119 # Expected failures
    120 completeTypeError_FLAGS= -DERR1
     122# Generated code
     123GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
     124$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
     125        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
     126
     127# Use for tests where the make command is expected to succeed but the expected.txt should be compared to stderr
     128EXPECT_STDERR = builtins/sync warnings/self-assignment
     129$(EXPECT_STDERR): % : %.cfa $(CFACCBIN)
     130        $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
    121131
    122132#------------------------------------------------------------------------------
    123133# CUSTOM TARGET
    124134#------------------------------------------------------------------------------
    125 typedefRedef-ERR1: typedefRedef.cfa $(CFACC)
    126         $(CFATEST_STDOUT) -DERR1
     135# expected failures
     136# use custom target since they require a custom define and custom dependencies
     137alloc-ERROR : alloc.cfa $(CFACCBIN)
     138        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    127139
    128 alloc-ERROR: alloc.cfa $(CFACC)
    129         $(CFATEST_STDOUT) -DERR1
     140typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
     141        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    130142
    131 nested-types-ERR1: nested-types.cfa $(CFACC)
    132         $(CFATEST_STDOUT) -DERR1
     143nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
     144        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    133145
    134 nested-types-ERR2: nested-types.cfa $(CFACC)
    135         $(CFATEST_STDOUT) -DERR2
     146nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
     147        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
    136148
    137 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
    138         $(CFATEST_STDOUT) -DERR1
     149raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
     150        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    139151
    140 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
    141         $(CFATEST_STDOUT) -DERR2
     152raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
     153        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    142154
    143 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
    144         $(CFATEST_STDOUT) -DERR1
     155raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
     156        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    145157
    146 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
    147         $(CFATEST_STDOUT) -DERR1
     158raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
     159        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
    148160
    149 #builtins
    150 builtins/sync: builtins/sync.cfa $(CFACC)
    151         $(CFATEST_STDERR) -fsyntax-only
    152 
    153 # Warnings
    154 warnings/self-assignment: warnings/self-assignment.cfa $(CFACC)
    155         $(CFATEST_STDERR) -fsyntax-only
     161#------------------------------------------------------------------------------
     162# Other targets
  • tests/Makefile.in

    r9fb8f01 r3d5701e  
    212212AWK = @AWK@
    213213BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@
    214 CC = @CFACC@
     214
     215# adjust CC to current flags
     216CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
    215217CCAS = @CCAS@
    216218CCASDEPMODE = @CCASDEPMODE@
    217219CCASFLAGS = @CCASFLAGS@
    218220CCDEPMODE = @CCDEPMODE@
    219 CFACC = @CFACC@
     221CFACC = $(CC)
     222CFACC_INSTALL = @CFACC_INSTALL@
    220223CFACPP = @CFACPP@
    221224CFA_BACKEND_CC = @CFA_BACKEND_CC@
     
    248251FGREP = @FGREP@
    249252GREP = @GREP@
     253HAS_DISTCC = @HAS_DISTCC@
    250254HOST_FLAGS = @HOST_FLAGS@
    251255INSTALL = @INSTALL@
     
    354358LTCFACOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
    355359        $(LIBTOOLFLAGS) --mode=compile $(CFACC) $(DEFS) \
    356         $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) \
    357         $(AM_CFLAGS) $(CFLAGS)
     360        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(AM_CFLAGS) $(CFAFLAGS) $(CFLAGS)
    358361
    359362AM_V_CFA = $(am__v_CFA_@AM_V@)
     
    361364am__v_CFA_0 = @echo "  CFA     " $@;
    362365am__v_CFA_1 =
    363 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@)
    364 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@)
    365 am__v_JAVAC_0 = @echo "  JAVAC   " $@;
    366 am__v_JAVAC_1 =
    367 AM_V_GOC = $(am__v_GOC_@AM_V@)
    368 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@)
    369 am__v_GOC_0 = @echo "  GOC     " $@;
    370 am__v_GOC_1 =
    371366UPPCC = u++
    372367UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
     
    375370am__v_UPP_0 = @echo "  UPP     " $@;
    376371am__v_UPP_1 =
     372AM_V_GOC = $(am__v_GOC_@AM_V@)
     373am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@)
     374am__v_GOC_0 = @echo "  GOC     " $@;
     375am__v_GOC_1 =
     376AM_V_PY = $(am__v_PY_@AM_V@)
     377am__v_PY_ = $(am__v_PY_@AM_DEFAULT_V@)
     378am__v_PY_0 = @echo "  PYTHON  " $@;
     379am__v_PY_1 =
     380AM_V_RUST = $(am__v_RUST_@AM_V@)
     381am__v_RUST_ = $(am__v_RUST_@AM_DEFAULT_V@)
     382am__v_RUST_0 = @echo "  RUST    " $@;
     383am__v_RUST_1 =
     384AM_V_NODEJS = $(am__v_NODEJS_@AM_V@)
     385am__v_NODEJS_ = $(am__v_NODEJS_@AM_DEFAULT_V@)
     386am__v_NODEJS_0 = @echo "  NODEJS  " $@;
     387am__v_NODEJS_1 =
     388AM_V_JAVAC = $(am__v_JAVAC_@AM_V@)
     389am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@)
     390am__v_JAVAC_0 = @echo "  JAVAC   " $@;
     391am__v_JAVAC_1 =
    377392debug = yes
    378393installed = no
    379394archiveerrors =
    380 INSTALL_FLAGS = -in-tree
    381395DEBUG_FLAGS = -debug -O0
    382396quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes
     
    386400
    387401# applies to both programs
    388 AM_CFLAGS = $(if $(test), 2> $(test), ) -g -Wall -Wno-unused-function \
    389         -quiet @CFA_FLAGS@ -DIN_DIR="${abs_srcdir}/.in/" \
    390         ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}
     402# since automake doesn't have support for CFA we have to
     403AM_CFLAGS = $(if $(test), 2> $(test), ) \
     404        -g \
     405        -Wall \
     406        -Wno-unused-function \
     407        -quiet @CFA_FLAGS@ \
     408        -DIN_DIR="${abs_srcdir}/.in/"
     409
     410
     411# get the desired cfa to test
     412TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
     413
     414# get local binary for depedencies
     415CFACCBIN = @CFACC@
     416
     417# adjusted CC but without the actual distcc call
     418CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
    391419PRETTY_PATH = mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
    392420avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
     
    397425
    398426# Use for all tests, make sure the path are correct and all flags are added
    399 CFACOMPILETEST = $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
    400 
    401 # Use for tests that either generate an executable, print directyl to stdout or the make command is expected to fail
    402 CFATEST_STDOUT = $(CFACOMPILETEST) -o $(abspath ${@})
    403 
    404 # Use for tests where the make command is expecte to succeed but the expected.txt should be compared to stderr
    405 CFATEST_STDERR = $(CFACOMPILETEST) 2> $(abspath ${@})
     427CFACOMPILETEST = $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
    406428
    407429#------------------------------------------------------------------------------
    408 # TARGET WITH STANDARD RULE BUT CUSTOM FLAGS
     430# TARGETS WITH CUSTOM FLAGS
    409431#------------------------------------------------------------------------------
    410 # Expected failures
    411 declarationSpecifier_FLAGS = -CFA -XCFA -p
    412 gccExtensions_FLAGS = -CFA -XCFA -p
    413 extension_FLAGS = -CFA -XCFA -p
    414 attributes_FLAGS = -CFA -XCFA -p
    415 functions_FLAGS = -CFA -XCFA -p
    416 KRfunctions_FLAGS = -CFA -XCFA -p
    417 gmp_FLAGS = -lgmp
     432# custom libs
     433gmp_FLAGSLD = -lgmp
    418434
    419435#------------------------------------------------------------------------------
    420 # Expected failures
    421 completeTypeError_FLAGS = -DERR1
     436# Generated code
     437GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
     438
     439# Use for tests where the make command is expected to succeed but the expected.txt should be compared to stderr
     440EXPECT_STDERR = builtins/sync warnings/self-assignment
    422441all: all-am
    423442
     
    771790#----------------------------------------------------------------------------------------------------------------
    772791all-local :
    773         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
     792        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
    774793
    775794all-tests :
    776         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     795        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
    777796
    778797clean-local :
     
    801820
    802821# implicit rule so not all test require a rule
    803 % : %.cfa $(CFACC)
    804         $(CFATEST_STDOUT)
    805 
     822# split into two steps to support compiling remotely using distcc
     823# don't use distcc to do the linking because distcc doesn't do linking
     824% : %.cfa $(CFACCBIN)
     825        $(CFACOMPILETEST) -c -o $(abspath ${@}).o
     826        $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
     827
     828# implicit rule for c++ test
     829# convient for testing the testsuite itself but not actuall used
    806830% : %.cpp
    807831        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     832$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
     833        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
     834$(EXPECT_STDERR): % : %.cfa $(CFACCBIN)
     835        $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
    808836
    809837#------------------------------------------------------------------------------
    810838# CUSTOM TARGET
    811839#------------------------------------------------------------------------------
    812 typedefRedef-ERR1: typedefRedef.cfa $(CFACC)
    813         $(CFATEST_STDOUT) -DERR1
    814 
    815 alloc-ERROR: alloc.cfa $(CFACC)
    816         $(CFATEST_STDOUT) -DERR1
    817 
    818 nested-types-ERR1: nested-types.cfa $(CFACC)
    819         $(CFATEST_STDOUT) -DERR1
    820 
    821 nested-types-ERR2: nested-types.cfa $(CFACC)
    822         $(CFATEST_STDOUT) -DERR2
    823 
    824 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
    825         $(CFATEST_STDOUT) -DERR1
    826 
    827 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
    828         $(CFATEST_STDOUT) -DERR2
    829 
    830 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
    831         $(CFATEST_STDOUT) -DERR1
    832 
    833 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
    834         $(CFATEST_STDOUT) -DERR1
    835 
    836 #builtins
    837 builtins/sync: builtins/sync.cfa $(CFACC)
    838         $(CFATEST_STDERR) -fsyntax-only
    839 
    840 # Warnings
    841 warnings/self-assignment: warnings/self-assignment.cfa $(CFACC)
    842         $(CFATEST_STDERR) -fsyntax-only
     840# expected failures
     841# use custom target since they require a custom define and custom dependencies
     842alloc-ERROR : alloc.cfa $(CFACCBIN)
     843        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     844
     845typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
     846        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     847
     848nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
     849        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     850
     851nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
     852        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
     853
     854raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
     855        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     856
     857raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
     858        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     859
     860raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
     861        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     862
     863raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
     864        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
     865
     866#------------------------------------------------------------------------------
     867# Other targets
    843868
    844869# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • tests/alloc.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Wed Feb  3 07:56:22 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:50:52 2018
    13 // Update Count     : 339
     12// Last Modified On : Sun Feb 16 09:21:13 2020
     13// Update Count     : 405
    1414//
    1515
     
    1919#include <stdlib.h>                                                                             // posix_memalign
    2020#include <fstream.hfa>
    21 #include <stdlib.hfa>                                                                           // access C malloc, realloc
     21#include <stdlib.hfa>                                                                   // access C malloc, realloc
    2222
    2323int * foo( int * p, int c ) { return p; }
     
    2727int main( void ) {
    2828        size_t dim = 10;
    29         char fill = '\xff';
    30         int * p;
     29        char fill = '\xde';
     30        int * p, * p1;
    3131
    3232        // allocation, non-array types
    33 
    34         // int & r = malloc();
    35         // r = 0xdeadbeef;
    36         // printf( "C   malloc %#x\n", r );
    37         // free( &r );
    3833
    3934        p = (int *)malloc( sizeof(*p) );                                        // C malloc, type unsafe
     
    5247        free( p );
    5348
    54         p = alloc( fill );                                  // CFA alloc, fill
     49        p = alloc_set( fill );                                                          // CFA alloc, fill
    5550        printf( "CFA alloc, fill %08x\n", *p );
     51        free( p );
     52
     53        p = alloc_set( 3 );                                                                     // CFA alloc, fill
     54        printf( "CFA alloc, fill %d\n", *p );
    5655        free( p );
    5756
     
    7978        free( p );
    8079
    81         p = alloc( 2 * dim, fill );                         // CFA array alloc, fill
     80        p = alloc_set( 2 * dim, fill );                                         // CFA array alloc, fill
    8281        printf( "CFA array alloc, fill %#hhx\n", fill );
    8382        for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
    8483        printf( "\n" );
    85         // do not free
     84        free( p );
     85
     86        p = alloc_set( 2 * dim, 0xdeadbeef );                           // CFA array alloc, fill
     87        printf( "CFA array alloc, fill %#hhx\n", 0xdeadbeef );
     88        for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
     89        printf( "\n" );
     90        // do not free
     91
     92        p1 = alloc_set( 2 * dim, p );                                           // CFA array alloc, fill
     93        printf( "CFA array alloc, fill from array\n" );
     94        for ( i; 2 * dim ) { printf( "%#x %#x, ", p[i], p1[i] ); }
     95        free( p1 );
     96        printf( "\n" );
    8697
    8798
     
    90101
    91102        p = (int *)realloc( p, dim * sizeof(*p) );                      // C realloc
    92         for ( i; dim ) { p[i] = 0xdeadbeef; }
    93         printf( "C   realloc\n" );
    94         for ( i; dim ) { printf( "%#x ", p[i] ); }
    95         printf( "\n" );
     103        printf( "C realloc\n" );
     104        for ( i; dim ) { printf( "%#x ", p[i] ); }
     105        printf( "\n" );
     106        // do not free
    96107
    97108        p = realloc( p, 2 * dim * sizeof(*p) );             // CFA realloc
     
    108119        p = alloc( p, dim );                                // CFA resize array alloc
    109120        for ( i; dim ) { p[i] = 0xdeadbeef; }
    110         printf( "CFA resize alloc\n" );
    111         for ( i; dim ) { printf( "%#x ", p[i] ); }
    112         printf( "\n" );
     121        printf( "CFA resize array alloc\n" );
     122        for ( i; dim ) { printf( "%#x ", p[i] ); }
     123        printf( "\n" );
     124        // do not free
    113125
    114126        p = alloc( p, 2 * dim );                            // CFA resize array alloc
    115         for ( i; dim ~ 2 * dim ) { p[i] = 0x1010101; }
     127        for ( i; dim ~ 2 * dim ) { p[i] = 0x1010101; }          // fill upper part
    116128        printf( "CFA resize array alloc\n" );
    117129        for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
    118130        printf( "\n" );
    119 
    120         p = alloc( p, dim );                                // CFA array alloc
    121         printf( "CFA resize array alloc\n" );
    122         for ( i; dim ) { printf( "%#x ", p[i] ); }
    123         printf( "\n" );
    124 
    125         free( p );
    126         p = 0;
    127 
    128         p = alloc( p, dim, fill );                          // CFA array alloc, fill
     131        // do not free
     132
     133        p = alloc( p, dim );                                // CFA resize array alloc
     134        printf( "CFA resize array alloc\n" );
     135        for ( i; dim ) { printf( "%#x ", p[i] ); }
     136        printf( "\n" );
     137        // do not free
     138
     139        p = alloc_set( p, 3 * dim, fill );                                      // CFA resize array alloc, fill
     140        printf( "CFA resize array alloc\n" );
     141        for ( i; 3 * dim ) { printf( "%#x ", p[i] ); }
     142        printf( "\n" );
     143        // do not free
     144
     145        p = alloc_set( p, dim, fill );                                          // CFA resize array alloc, fill
     146        printf( "CFA resize array alloc\n" );
     147        for ( i; dim ) { printf( "%#x ", p[i] ); }
     148        printf( "\n" );
     149        // do not free
     150
     151        p = alloc_set( p, 3 * dim, fill );                                      // CFA resize array alloc, fill
    129152        printf( "CFA resize array alloc, fill\n" );
    130         for ( i; dim ) { printf( "%#x ", p[i] ); }
    131         printf( "\n" );
    132 
    133         p = alloc( p, 2 * dim, fill );                      // CFA array alloc, fill
    134         printf( "CFA resize array alloc, fill\n" );
    135         for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
    136         printf( "\n" );
    137 
    138         p = alloc( p, dim, fill );                          // CFA array alloc, fill
    139         printf( "CFA resize array alloc, fill\n" );
    140         for ( i; dim ) { printf( "%#x ", p[i] );; }
     153        for ( i; 3 * dim ) { printf( "%#x ", p[i] );; }
    141154        printf( "\n" );
    142155        free( p );
     
    172185        free( stp );
    173186
    174         stp = &(*aligned_alloc( Alignment )){ 42, 42.5 };     // CFA aligned_alloc
    175         assert( (uintptr_t)stp % Alignment == 0 );
    176         printf( "CFA aligned_alloc %d %g\n", stp->x, stp->y );
    177         free( stp );
    178 
    179         stp = &(*align_alloc( Alignment )){ 42, 42.5 };       // CFA align_alloc
    180         assert( (uintptr_t)stp % Alignment == 0 );
    181         printf( "CFA align_alloc %d %g\n", stp->x, stp->y );
    182         free( stp );
    183 
    184         stp = align_alloc( Alignment, fill );               // CFA memalign, fill
    185         assert( (uintptr_t)stp % Alignment == 0 );
    186         printf( "CFA align_alloc fill %#x %a\n", stp->x, stp->y );
     187        stp = &(*alloc_align( Alignment)){ 42, 42.5 };          // CFA alloc_align
     188        assert( (uintptr_t)stp % Alignment == 0 );
     189        printf( "CFA alloc_align %d %g\n", stp->x, stp->y );
     190        free( stp );
     191
     192        stp = &(*alloc_align( Alignment )){ 42, 42.5 };         // CFA alloc_align
     193        assert( (uintptr_t)stp % Alignment == 0 );
     194        printf( "CFA alloc_align %d %g\n", stp->x, stp->y );
     195        free( stp );
     196
     197        stp = alloc_align_set( Alignment, fill );                       // CFA memalign, fill
     198        assert( (uintptr_t)stp % Alignment == 0 );
     199        printf( "CFA alloc_align fill %#x %a\n", stp->x, stp->y );
     200        free( stp );
     201
     202        stp = alloc_align_set( Alignment, (Struct){ 42, 42.5 } ); // CFA memalign, fill
     203        assert( (uintptr_t)stp % Alignment == 0 );
     204        printf( "CFA alloc_align fill %d %g\n", stp->x, stp->y );
     205        // do not free
     206
     207        stp = &(*alloc_align( stp, 4096 )){ 42, 42.5 };         // CFA realign
     208        assert( (uintptr_t)stp % 4096 == 0 );
     209        printf( "CFA alloc_align %d %g\n", stp->x, stp->y );
    187210        free( stp );
    188211
     
    191214        printf( "\n" );
    192215
    193         stp = align_alloc( Alignment, dim );                // CFA array memalign
     216        stp = alloc_align( Alignment, dim );                // CFA array memalign
    194217        assert( (uintptr_t)stp % Alignment == 0 );
    195218        for ( i; dim ) { stp[i] = (Struct){ 42, 42.5 }; }
    196         printf( "CFA array align_alloc\n" );
     219        printf( "CFA array alloc_align\n" );
    197220        for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); }
    198221        printf( "\n" );
    199222        free( stp );
    200223
    201         stp = align_alloc( Alignment, dim, fill );          // CFA array memalign, fill
    202         assert( (uintptr_t)stp % Alignment == 0 );
    203         printf( "CFA array align_alloc, fill\n" );
     224        stp = alloc_align_set( Alignment, dim, fill );          // CFA array memalign, fill
     225        assert( (uintptr_t)stp % Alignment == 0 );
     226        printf( "CFA array alloc_align, fill\n" );
    204227        for ( i; dim ) { printf( "%#x %a, ", stp[i].x, stp[i].y ); }
     228        printf( "\n" );
     229        free( stp );
     230
     231        stp = alloc_align_set( Alignment, dim, (Struct){ 42, 42.5 } ); // CFA array memalign, fill
     232        assert( (uintptr_t)stp % Alignment == 0 );
     233        printf( "CFA array alloc_align, fill\n" );
     234        for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); }
     235        printf( "\n" );
     236        // do not free
     237
     238        stp1 = alloc_align_set( Alignment, dim, stp );          // CFA array memalign, fill
     239        assert( (uintptr_t)stp % Alignment == 0 );
     240        printf( "CFA array alloc_align, fill array\n" );
     241        for ( i; dim ) { printf( "%d %g, ", stp1[i].x, stp1[i].y ); }
     242        printf( "\n" );
     243        free( stp1 );
     244
     245        stp = alloc_align( stp, 4096, dim );                            // CFA aligned realloc array
     246        assert( (uintptr_t)stp % 4096 == 0 );
     247        for ( i; dim ) { stp[i] = (Struct){ 42, 42.5 }; }
     248        printf( "CFA realloc array alloc_align\n" );
     249        for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); }
    205250        printf( "\n" );
    206251        free( stp );
  • tests/builtins/sync.cfa

    r9fb8f01 r3d5701e  
    44void foo() {
    55        volatile _Bool * vpB = 0; _Bool vB = 0;
    6         volatile char * vp1 = 0; char * rp1 = 0; char v1 = 0;
    7         volatile short * vp2 = 0; short * rp2 = 0; short v2 = 0;
    8         volatile int * vp4 = 0; int * rp4 = 0; int v4 = 0;
    9         volatile long long int * vp8 = 0; long long int * rp8 = 0; long long int v8 = 0;
    10         #if defined(__SIZEOF_INT128__)
    11         volatile __int128 * vp16 = 0; __int128 * rp16 = 0; __int128 v16 = 0;
     6        volatile char * vpc = 0; char * rpc = 0; char vc = 0;
     7        volatile short * vps = 0; short * rps = 0; short vs = 0;
     8        volatile int * vpi = 0; int * rpi = 0; int vi = 0;
     9        volatile long int * vpl = 0; long int * rpl = 0; long int vl = 0;
     10        volatile long long int * vpll = 0; long long int * rpll = 0; long long int vll = 0;
     11        #if defined(__SIZEOF_INT128__)
     12        volatile __int128 * vplll = 0; __int128 * rplll = 0; __int128 vlll = 0;
    1213        #endif
    1314        struct type * volatile * vpp = 0; struct type ** rpp = 0; struct type * vp = 0;
    1415
    15         { char ret; ret = __sync_fetch_and_add(vp1, v1); }
    16         { char ret; ret = __sync_fetch_and_add_1(vp1, v1); }
    17         { short ret; ret = __sync_fetch_and_add(vp2, v2); }
    18         { short ret; ret = __sync_fetch_and_add_2(vp2, v2); }
    19         { int ret; ret = __sync_fetch_and_add(vp4, v4); }
    20         { int ret; ret = __sync_fetch_and_add_4(vp4, v4); }
    21         { long long int ret; ret = __sync_fetch_and_add(vp8, v8); }
    22         { long long int ret; ret = __sync_fetch_and_add_8(vp8, v8); }
    23         #if defined(__SIZEOF_INT128__)
    24         { __int128 ret; ret = __sync_fetch_and_add(vp16, v16); }
    25         { __int128 ret; ret = __sync_fetch_and_add_16(vp16, v16); }
    26         #endif
    27 
    28         { char ret; ret = __sync_fetch_and_sub(vp1, v1); }
    29         { char ret; ret = __sync_fetch_and_sub_1(vp1, v1); }
    30         { short ret; ret = __sync_fetch_and_sub(vp2, v2); }
    31         { short ret; ret = __sync_fetch_and_sub_2(vp2, v2); }
    32         { int ret; ret = __sync_fetch_and_sub(vp4, v4); }
    33         { int ret; ret = __sync_fetch_and_sub_4(vp4, v4); }
    34         { long long int ret; ret = __sync_fetch_and_sub(vp8, v8); }
    35         { long long int ret; ret = __sync_fetch_and_sub_8(vp8, v8); }
    36         #if defined(__SIZEOF_INT128__)
    37         { __int128 ret; ret = __sync_fetch_and_sub(vp16, v16); }
    38         { __int128 ret; ret = __sync_fetch_and_sub_16(vp16, v16); }
    39         #endif
    40 
    41         { char ret; ret = __sync_fetch_and_or(vp1, v1); }
    42         { char ret; ret = __sync_fetch_and_or_1(vp1, v1); }
    43         { short ret; ret = __sync_fetch_and_or(vp2, v2); }
    44         { short ret; ret = __sync_fetch_and_or_2(vp2, v2); }
    45         { int ret; ret = __sync_fetch_and_or(vp4, v4); }
    46         { int ret; ret = __sync_fetch_and_or_4(vp4, v4); }
    47         { long long int ret; ret = __sync_fetch_and_or(vp8, v8); }
    48         { long long int ret; ret = __sync_fetch_and_or_8(vp8, v8); }
    49         #if defined(__SIZEOF_INT128__)
    50         { __int128 ret; ret = __sync_fetch_and_or(vp16, v16); }
    51         { __int128 ret; ret = __sync_fetch_and_or_16(vp16, v16); }
    52         #endif
    53 
    54         { char ret; ret = __sync_fetch_and_and(vp1, v1); }
    55         { char ret; ret = __sync_fetch_and_and_1(vp1, v1); }
    56         { short ret; ret = __sync_fetch_and_and(vp2, v2); }
    57         { short ret; ret = __sync_fetch_and_and_2(vp2, v2); }
    58         { int ret; ret = __sync_fetch_and_and(vp4, v4); }
    59         { int ret; ret = __sync_fetch_and_and_4(vp4, v4); }
    60         { long long int ret; ret = __sync_fetch_and_and(vp8, v8); }
    61         { long long int ret; ret = __sync_fetch_and_and_8(vp8, v8); }
    62         #if defined(__SIZEOF_INT128__)
    63         { __int128 ret; ret = __sync_fetch_and_and(vp16, v16); }
    64         { __int128 ret; ret = __sync_fetch_and_and_16(vp16, v16); }
    65         #endif
    66 
    67         { char ret; ret = __sync_fetch_and_xor(vp1, v1); }
    68         { char ret; ret = __sync_fetch_and_xor_1(vp1, v1); }
    69         { short ret; ret = __sync_fetch_and_xor(vp2, v2); }
    70         { short ret; ret = __sync_fetch_and_xor_2(vp2, v2); }
    71         { int ret; ret = __sync_fetch_and_xor(vp4, v4); }
    72         { int ret; ret = __sync_fetch_and_xor_4(vp4, v4); }
    73         { long long int ret; ret = __sync_fetch_and_xor(vp8, v8); }
    74         { long long int ret; ret = __sync_fetch_and_xor_8(vp8, v8); }
    75         #if defined(__SIZEOF_INT128__)
    76         { __int128 ret; ret = __sync_fetch_and_xor(vp16, v16); }
    77         { __int128 ret; ret = __sync_fetch_and_xor_16(vp16, v16); }
    78         #endif
    79 
    80         { char ret; ret = __sync_fetch_and_nand(vp1, v1); }
    81         { char ret; ret = __sync_fetch_and_nand_1(vp1, v1); }
    82         { short ret; ret = __sync_fetch_and_nand(vp2, v2); }
    83         { short ret; ret = __sync_fetch_and_nand_2(vp2, v2); }
    84         { int ret; ret = __sync_fetch_and_nand(vp4, v4); }
    85         { int ret; ret = __sync_fetch_and_nand_4(vp4, v4); }
    86         { long long int ret; ret = __sync_fetch_and_nand(vp8, v8); }
    87         { long long int ret; ret = __sync_fetch_and_nand_8(vp8, v8); }
    88         #if defined(__SIZEOF_INT128__)
    89         { __int128 ret; ret = __sync_fetch_and_nand(vp16, v16); }
    90         { __int128 ret; ret = __sync_fetch_and_nand_16(vp16, v16); }
    91         #endif
    92 
    93         { char ret; ret = __sync_add_and_fetch(vp1, v1); }
    94         { char ret; ret = __sync_add_and_fetch_1(vp1, v1); }
    95         { short ret; ret = __sync_add_and_fetch(vp2, v2); }
    96         { short ret; ret = __sync_add_and_fetch_2(vp2, v2); }
    97         { int ret; ret = __sync_add_and_fetch(vp4, v4); }
    98         { int ret; ret = __sync_add_and_fetch_4(vp4, v4); }
    99         { long long int ret; ret = __sync_add_and_fetch(vp8, v8); }
    100         { long long int ret; ret = __sync_add_and_fetch_8(vp8, v8); }
    101         #if defined(__SIZEOF_INT128__)
    102         { __int128 ret; ret = __sync_add_and_fetch(vp16, v16); }
    103         { __int128 ret; ret = __sync_add_and_fetch_16(vp16, v16); }
    104         #endif
    105 
    106         { char ret; ret = __sync_sub_and_fetch(vp1, v1); }
    107         { char ret; ret = __sync_sub_and_fetch_1(vp1, v1); }
    108         { short ret; ret = __sync_sub_and_fetch(vp2, v2); }
    109         { short ret; ret = __sync_sub_and_fetch_2(vp2, v2); }
    110         { int ret; ret = __sync_sub_and_fetch(vp4, v4); }
    111         { int ret; ret = __sync_sub_and_fetch_4(vp4, v4); }
    112         { long long int ret; ret = __sync_sub_and_fetch(vp8, v8); }
    113         { long long int ret; ret = __sync_sub_and_fetch_8(vp8, v8); }
    114         #if defined(__SIZEOF_INT128__)
    115         { __int128 ret; ret = __sync_sub_and_fetch(vp16, v16); }
    116         { __int128 ret; ret = __sync_sub_and_fetch_16(vp16, v16); }
    117         #endif
    118 
    119         { char ret; ret = __sync_or_and_fetch(vp1, v1); }
    120         { char ret; ret = __sync_or_and_fetch_1(vp1, v1); }
    121         { short ret; ret = __sync_or_and_fetch(vp2, v2); }
    122         { short ret; ret = __sync_or_and_fetch_2(vp2, v2); }
    123         { int ret; ret = __sync_or_and_fetch(vp4, v4); }
    124         { int ret; ret = __sync_or_and_fetch_4(vp4, v4); }
    125         { long long int ret; ret = __sync_or_and_fetch(vp8, v8); }
    126         { long long int ret; ret = __sync_or_and_fetch_8(vp8, v8); }
    127         #if defined(__SIZEOF_INT128__)
    128         { __int128 ret; ret = __sync_or_and_fetch(vp16, v16); }
    129         { __int128 ret; ret = __sync_or_and_fetch_16(vp16, v16); }
    130         #endif
    131 
    132         { char ret; ret = __sync_and_and_fetch(vp1, v1); }
    133         { char ret; ret = __sync_and_and_fetch_1(vp1, v1); }
    134         { short ret; ret = __sync_and_and_fetch(vp2, v2); }
    135         { short ret; ret = __sync_and_and_fetch_2(vp2, v2); }
    136         { int ret; ret = __sync_and_and_fetch(vp4, v4); }
    137         { int ret; ret = __sync_and_and_fetch_4(vp4, v4); }
    138         { long long int ret; ret = __sync_and_and_fetch(vp8, v8); }
    139         { long long int ret; ret = __sync_and_and_fetch_8(vp8, v8); }
    140         #if defined(__SIZEOF_INT128__)
    141         { __int128 ret; ret = __sync_and_and_fetch(vp16, v16); }
    142         { __int128 ret; ret = __sync_and_and_fetch_16(vp16, v16); }
    143         #endif
    144 
    145         { char ret; ret = __sync_xor_and_fetch(vp1, v1); }
    146         { char ret; ret = __sync_xor_and_fetch_1(vp1, v1); }
    147         { short ret; ret = __sync_xor_and_fetch(vp2, v2); }
    148         { short ret; ret = __sync_xor_and_fetch_2(vp2, v2); }
    149         { int ret; ret = __sync_xor_and_fetch(vp4, v4); }
    150         { int ret; ret = __sync_xor_and_fetch_4(vp4, v4); }
    151         { long long int ret; ret = __sync_xor_and_fetch(vp8, v8); }
    152         { long long int ret; ret = __sync_xor_and_fetch_8(vp8, v8); }
    153         #if defined(__SIZEOF_INT128__)
    154         { __int128 ret; ret = __sync_xor_and_fetch(vp16, v16); }
    155         { __int128 ret; ret = __sync_xor_and_fetch_16(vp16, v16); }
    156         #endif
    157 
    158         { char ret; ret = __sync_nand_and_fetch(vp1, v1); }
    159         { char ret; ret = __sync_nand_and_fetch_1(vp1, v1); }
    160         { short ret; ret = __sync_nand_and_fetch(vp2, v2); }
    161         { short ret; ret = __sync_nand_and_fetch_2(vp2, v2); }
    162         { int ret; ret = __sync_nand_and_fetch(vp4, v4); }
    163         { int ret; ret = __sync_nand_and_fetch_4(vp4, v4); }
    164         { long long int ret; ret = __sync_nand_and_fetch(vp8, v8); }
    165         { long long int ret; ret = __sync_nand_and_fetch_8(vp8, v8); }
    166         #if defined(__SIZEOF_INT128__)
    167         { __int128 ret; ret = __sync_nand_and_fetch(vp16, v16); }
    168         { __int128 ret; ret = __sync_nand_and_fetch_16(vp16, v16); }
    169         #endif
    170 
    171         { _Bool ret; ret = __sync_bool_compare_and_swap(vp1, v1, v1); }
    172         { _Bool ret; ret = __sync_bool_compare_and_swap_1(vp1, v1, v1); }
    173         { _Bool ret; ret = __sync_bool_compare_and_swap(vp2, v2, v2); }
    174         { _Bool ret; ret = __sync_bool_compare_and_swap_2(vp2, v2, v2); }
    175         { _Bool ret; ret = __sync_bool_compare_and_swap(vp4, v4, v4); }
    176         { _Bool ret; ret = __sync_bool_compare_and_swap_4(vp4, v4, v4); }
    177         { _Bool ret; ret = __sync_bool_compare_and_swap(vp8, v8, v8); }
    178         { _Bool ret; ret = __sync_bool_compare_and_swap_8(vp8, v8, v8); }
    179         #if defined(__SIZEOF_INT128__)
    180         { _Bool ret; ret = __sync_bool_compare_and_swap(vp16, v16, v16); }
    181         { _Bool ret; ret = __sync_bool_compare_and_swap_16(vp16, v16,v16); }
     16        { char ret; ret = __sync_fetch_and_add(vpc, vc); }
     17        { short ret; ret = __sync_fetch_and_add(vps, vs); }
     18        { int ret; ret = __sync_fetch_and_add(vpi, vi); }
     19        { long int ret; ret = __sync_fetch_and_add(vpl, vl); }
     20        { long long int ret; ret = __sync_fetch_and_add(vpll, vll); }
     21        #if defined(__SIZEOF_INT128__)
     22        { __int128 ret; ret = __sync_fetch_and_add(vplll, vlll); }
     23        #endif
     24
     25        { char ret; ret = __sync_fetch_and_sub(vpc, vc); }
     26        { short ret; ret = __sync_fetch_and_sub(vps, vs); }
     27        { int ret; ret = __sync_fetch_and_sub(vpi, vi); }
     28        { long int ret; ret = __sync_fetch_and_sub(vpl, vl); }
     29        { long long int ret; ret = __sync_fetch_and_sub(vpll, vll); }
     30        #if defined(__SIZEOF_INT128__)
     31        { __int128 ret; ret = __sync_fetch_and_sub(vplll, vlll); }
     32        #endif
     33
     34        { char ret; ret = __sync_fetch_and_or(vpc, vc); }
     35        { short ret; ret = __sync_fetch_and_or(vps, vs); }
     36        { int ret; ret = __sync_fetch_and_or(vpi, vi); }
     37        { long int ret; ret = __sync_fetch_and_or(vpl, vl); }
     38        { long long int ret; ret = __sync_fetch_and_or(vpll, vll); }
     39        #if defined(__SIZEOF_INT128__)
     40        { __int128 ret; ret = __sync_fetch_and_or(vplll, vlll); }
     41        #endif
     42
     43        { char ret; ret = __sync_fetch_and_and(vpc, vc); }
     44        { short ret; ret = __sync_fetch_and_and(vps, vs); }
     45        { int ret; ret = __sync_fetch_and_and(vpi, vi); }
     46        { long int ret; ret = __sync_fetch_and_and(vpl, vl); }
     47        { long long int ret; ret = __sync_fetch_and_and(vpll, vll); }
     48        #if defined(__SIZEOF_INT128__)
     49        { __int128 ret; ret = __sync_fetch_and_and(vplll, vlll); }
     50        #endif
     51
     52        { char ret; ret = __sync_fetch_and_xor(vpc, vc); }
     53        { short ret; ret = __sync_fetch_and_xor(vps, vs); }
     54        { int ret; ret = __sync_fetch_and_xor(vpi, vi); }
     55        { long int ret; ret = __sync_fetch_and_xor(vpl, vl); }
     56        { long long int ret; ret = __sync_fetch_and_xor(vpll, vll); }
     57        #if defined(__SIZEOF_INT128__)
     58        { __int128 ret; ret = __sync_fetch_and_xor(vplll, vlll); }
     59        #endif
     60
     61        { char ret; ret = __sync_fetch_and_nand(vpc, vc); }
     62        { short ret; ret = __sync_fetch_and_nand(vps, vs); }
     63        { int ret; ret = __sync_fetch_and_nand(vpi, vi); }
     64        { long int ret; ret = __sync_fetch_and_nand(vpl, vl); }
     65        { long long int ret; ret = __sync_fetch_and_nand(vpll, vll); }
     66        #if defined(__SIZEOF_INT128__)
     67        { __int128 ret; ret = __sync_fetch_and_nand(vplll, vlll); }
     68        { __int128 ret; ret = __sync_fetch_and_nand_16(vplll, vlll); }
     69        #endif
     70
     71        { char ret; ret = __sync_add_and_fetch(vpc, vc); }
     72        { short ret; ret = __sync_add_and_fetch(vps, vs); }
     73        { int ret; ret = __sync_add_and_fetch(vpi, vi); }
     74        { long int ret; ret = __sync_add_and_fetch(vpl, vl); }
     75        { long long int ret; ret = __sync_add_and_fetch(vpll, vll); }
     76        #if defined(__SIZEOF_INT128__)
     77        { __int128 ret; ret = __sync_add_and_fetch(vplll, vlll); }
     78        #endif
     79
     80        { char ret; ret = __sync_sub_and_fetch(vpc, vc); }
     81        { short ret; ret = __sync_sub_and_fetch(vps, vs); }
     82        { int ret; ret = __sync_sub_and_fetch(vpi, vi); }
     83        { long int ret; ret = __sync_sub_and_fetch(vpl, vl); }
     84        { long long int ret; ret = __sync_sub_and_fetch(vpll, vll); }
     85        #if defined(__SIZEOF_INT128__)
     86        { __int128 ret; ret = __sync_sub_and_fetch(vplll, vlll); }
     87        #endif
     88
     89        { char ret; ret = __sync_or_and_fetch(vpc, vc); }
     90        { short ret; ret = __sync_or_and_fetch(vps, vs); }
     91        { int ret; ret = __sync_or_and_fetch(vpi, vi); }
     92        { long int ret; ret = __sync_or_and_fetch(vpl, vl); }
     93        { long long int ret; ret = __sync_or_and_fetch(vpll, vll); }
     94        #if defined(__SIZEOF_INT128__)
     95        { __int128 ret; ret = __sync_or_and_fetch(vplll, vlll); }
     96        #endif
     97
     98        { char ret; ret = __sync_and_and_fetch(vpc, vc); }
     99        { short ret; ret = __sync_and_and_fetch(vps, vs); }
     100        { int ret; ret = __sync_and_and_fetch(vpi, vi); }
     101        { long int ret; ret = __sync_and_and_fetch(vpl, vl); }
     102        { long long int ret; ret = __sync_and_and_fetch(vpll, vll); }
     103        #if defined(__SIZEOF_INT128__)
     104        { __int128 ret; ret = __sync_and_and_fetch(vplll, vlll); }
     105        #endif
     106
     107        { char ret; ret = __sync_xor_and_fetch(vpc, vc); }
     108        { short ret; ret = __sync_xor_and_fetch(vps, vs); }
     109        { int ret; ret = __sync_xor_and_fetch(vpi, vi); }
     110        { long int ret; ret = __sync_xor_and_fetch(vpl, vl); }
     111        { long long int ret; ret = __sync_xor_and_fetch(vpll, vll); }
     112        #if defined(__SIZEOF_INT128__)
     113        { __int128 ret; ret = __sync_xor_and_fetch(vplll, vlll); }
     114        #endif
     115
     116        { char ret; ret = __sync_nand_and_fetch(vpc, vc); }
     117        { short ret; ret = __sync_nand_and_fetch(vps, vs); }
     118        { int ret; ret = __sync_nand_and_fetch(vpi, vi); }
     119        { long int ret; ret = __sync_nand_and_fetch(vpl, vl); }
     120        { long long int ret; ret = __sync_nand_and_fetch(vpll, vll); }
     121        #if defined(__SIZEOF_INT128__)
     122        { __int128 ret; ret = __sync_nand_and_fetch(vplll, vlll); }
     123        #endif
     124
     125        { _Bool ret; ret = __sync_bool_compare_and_swap(vpc, vc, vc); }
     126        { _Bool ret; ret = __sync_bool_compare_and_swap(vps, vs, vs); }
     127        { _Bool ret; ret = __sync_bool_compare_and_swap(vpi, vi, vi); }
     128        { _Bool ret; ret = __sync_bool_compare_and_swap(vpl, vl, vl); }
     129        { _Bool ret; ret = __sync_bool_compare_and_swap(vpll, vll, vll); }
     130        #if defined(__SIZEOF_INT128__)
     131        { _Bool ret; ret = __sync_bool_compare_and_swap(vplll, vlll, vlll); }
    182132        #endif
    183133        { _Bool ret; ret = __sync_bool_compare_and_swap(vpp, vp, vp); }
    184134
    185         { char ret; ret = __sync_val_compare_and_swap(vp1, v1, v1); }
    186         { char ret; ret = __sync_val_compare_and_swap_1(vp1, v1, v1); }
    187         { short ret; ret = __sync_val_compare_and_swap(vp2, v2, v2); }
    188         { short ret; ret = __sync_val_compare_and_swap_2(vp2, v2, v2); }
    189         { int ret; ret = __sync_val_compare_and_swap(vp4, v4, v4); }
    190         { int ret; ret = __sync_val_compare_and_swap_4(vp4, v4, v4); }
    191         { long long int ret; ret = __sync_val_compare_and_swap(vp8, v8, v8); }
    192         { long long int ret; ret = __sync_val_compare_and_swap_8(vp8, v8, v8); }
    193         #if defined(__SIZEOF_INT128__)
    194         { __int128 ret; ret = __sync_val_compare_and_swap(vp16, v16, v16); }
    195         { __int128 ret; ret = __sync_val_compare_and_swap_16(vp16, v16,v16); }
     135        { char ret; ret = __sync_val_compare_and_swap(vpc, vc, vc); }
     136        { short ret; ret = __sync_val_compare_and_swap(vps, vs, vs); }
     137        { int ret; ret = __sync_val_compare_and_swap(vpi, vi, vi); }
     138        { long int ret; ret = __sync_val_compare_and_swap(vpl, vl, vl); }
     139        { long long int ret; ret = __sync_val_compare_and_swap(vpll, vll, vll); }
     140        #if defined(__SIZEOF_INT128__)
     141        { __int128 ret; ret = __sync_val_compare_and_swap(vplll, vlll, vlll); }
    196142        #endif
    197143        { struct type * ret; ret = __sync_val_compare_and_swap(vpp, vp, vp); }
    198144
    199145
    200         { char ret; ret = __sync_lock_test_and_set(vp1, v1); }
    201         { char ret; ret = __sync_lock_test_and_set_1(vp1, v1); }
    202         { short ret; ret = __sync_lock_test_and_set(vp2, v2); }
    203         { short ret; ret = __sync_lock_test_and_set_2(vp2, v2); }
    204         { int ret; ret = __sync_lock_test_and_set(vp4, v4); }
    205         { int ret; ret = __sync_lock_test_and_set_4(vp4, v4); }
    206         { long long int ret; ret = __sync_lock_test_and_set(vp8, v8); }
    207         { long long int ret; ret = __sync_lock_test_and_set_8(vp8, v8); }
    208         #if defined(__SIZEOF_INT128__)
    209         { __int128 ret; ret = __sync_lock_test_and_set(vp16, v16); }
    210         { __int128 ret; ret = __sync_lock_test_and_set_16(vp16, v16); }
    211         #endif
    212 
    213         { __sync_lock_release(vp1); }
    214         { __sync_lock_release_1(vp1); }
    215         { __sync_lock_release(vp2); }
    216         { __sync_lock_release_2(vp2); }
    217         { __sync_lock_release(vp4); }
    218         { __sync_lock_release_4(vp4); }
    219         { __sync_lock_release(vp8); }
    220         { __sync_lock_release_8(vp8); }
    221         #if defined(__SIZEOF_INT128__)
    222         { __sync_lock_release(vp16); }
    223         { __sync_lock_release_16(vp16); }
     146        { char ret; ret = __sync_lock_test_and_set(vpc, vc); }
     147        { short ret; ret = __sync_lock_test_and_set(vps, vs); }
     148        { int ret; ret = __sync_lock_test_and_set(vpi, vi); }
     149        { long int ret; ret = __sync_lock_test_and_set(vpl, vl); }
     150        { long long int ret; ret = __sync_lock_test_and_set(vpll, vll); }
     151        #if defined(__SIZEOF_INT128__)
     152        { __int128 ret; ret = __sync_lock_test_and_set(vplll, vlll); }
     153        #endif
     154
     155        { __sync_lock_release(vpc); }
     156        { __sync_lock_release(vps); }
     157        { __sync_lock_release(vpi); }
     158        { __sync_lock_release(vpl); }
     159        { __sync_lock_release(vpll); }
     160        #if defined(__SIZEOF_INT128__)
     161        { __sync_lock_release(vplll); }
    224162        #endif
    225163
     
    230168
    231169        { _Bool ret; ret = __atomic_test_and_set(vpB, vB); }
    232         { _Bool ret; ret = __atomic_test_and_set(vp1, v1); }
     170        { _Bool ret; ret = __atomic_test_and_set(vpc, vc); }
    233171        { __atomic_clear(vpB, vB); }
    234         { __atomic_clear(vp1, v1); }
    235 
    236         { char ret; ret = __atomic_exchange_n(vp1, v1, __ATOMIC_SEQ_CST); }
    237         { char ret; ret = __atomic_exchange_1(vp1, v1, __ATOMIC_SEQ_CST); }
    238         { char ret; __atomic_exchange(vp1, &v1, &ret, __ATOMIC_SEQ_CST); }
    239         { short ret; ret = __atomic_exchange_n(vp2, v2, __ATOMIC_SEQ_CST); }
    240         { short ret; ret = __atomic_exchange_2(vp2, v2, __ATOMIC_SEQ_CST); }
    241         { short ret; __atomic_exchange(vp2, &v2, &ret, __ATOMIC_SEQ_CST); }
    242         { int ret; ret = __atomic_exchange_n(vp4, v4, __ATOMIC_SEQ_CST); }
    243         { int ret; ret = __atomic_exchange_4(vp4, v4, __ATOMIC_SEQ_CST); }
    244         { int ret; __atomic_exchange(vp4, &v4, &ret, __ATOMIC_SEQ_CST); }
    245         { long long int ret; ret = __atomic_exchange_n(vp8, v8, __ATOMIC_SEQ_CST); }
    246         { long long int ret; ret = __atomic_exchange_8(vp8, v8, __ATOMIC_SEQ_CST); }
    247         { long long int ret; __atomic_exchange(vp8, &v8, &ret, __ATOMIC_SEQ_CST); }
    248         #if defined(__SIZEOF_INT128__)
    249         { __int128 ret; ret = __atomic_exchange_n(vp16, v16, __ATOMIC_SEQ_CST); }
    250         { __int128 ret; ret = __atomic_exchange_16(vp16, v16, __ATOMIC_SEQ_CST); }
    251         { __int128 ret; __atomic_exchange(vp16, &v16, &ret, __ATOMIC_SEQ_CST); }
     172        { __atomic_clear(vpc, vc); }
     173
     174        { char ret; ret = __atomic_exchange_n(vpc, vc, __ATOMIC_SEQ_CST); }
     175        { char ret; __atomic_exchange(vpc, &vc, &ret, __ATOMIC_SEQ_CST); }
     176        { short ret; ret = __atomic_exchange_n(vps, vs, __ATOMIC_SEQ_CST); }
     177        { short ret; __atomic_exchange(vps, &vs, &ret, __ATOMIC_SEQ_CST); }
     178        { int ret; ret = __atomic_exchange_n(vpi, vi, __ATOMIC_SEQ_CST); }
     179        { int ret; __atomic_exchange(vpi, &vi, &ret, __ATOMIC_SEQ_CST); }
     180        { long int ret; ret = __atomic_exchange_n(vpl, vl, __ATOMIC_SEQ_CST); }
     181        { long int ret; __atomic_exchange(vpl, &vl, &ret, __ATOMIC_SEQ_CST); }
     182        { long long int ret; ret = __atomic_exchange_n(vpll, vll, __ATOMIC_SEQ_CST); }
     183        { long long int ret; __atomic_exchange(vpll, &vll, &ret, __ATOMIC_SEQ_CST); }
     184        #if defined(__SIZEOF_INT128__)
     185        { __int128 ret; ret = __atomic_exchange_n(vplll, vlll, __ATOMIC_SEQ_CST); }
     186        { __int128 ret; __atomic_exchange(vplll, &vlll, &ret, __ATOMIC_SEQ_CST); }
    252187        #endif
    253188        { struct type * ret; ret = __atomic_exchange_n(vpp, vp, __ATOMIC_SEQ_CST); }
    254189        { struct type * ret; __atomic_exchange(vpp, &vp, &ret, __ATOMIC_SEQ_CST); }
    255190
    256         { char ret; ret = __atomic_load_n(vp1, __ATOMIC_SEQ_CST); }
    257         { char ret; ret = __atomic_load_1(vp1, __ATOMIC_SEQ_CST); }
    258         { char ret; __atomic_load(vp1, &ret, __ATOMIC_SEQ_CST); }
    259         { short ret; ret = __atomic_load_n(vp2, __ATOMIC_SEQ_CST); }
    260         { short ret; ret = __atomic_load_2(vp2, __ATOMIC_SEQ_CST); }
    261         { short ret; __atomic_load(vp2, &ret, __ATOMIC_SEQ_CST); }
    262         { int ret; ret = __atomic_load_n(vp4, __ATOMIC_SEQ_CST); }
    263         { int ret; ret = __atomic_load_4(vp4, __ATOMIC_SEQ_CST); }
    264         { int ret; __atomic_load(vp4, &ret, __ATOMIC_SEQ_CST); }
    265         { long long int ret; ret = __atomic_load_n(vp8, __ATOMIC_SEQ_CST); }
    266         { long long int ret; ret = __atomic_load_8(vp8, __ATOMIC_SEQ_CST); }
    267         { long long int ret; __atomic_load(vp8, &ret, __ATOMIC_SEQ_CST); }
    268         #if defined(__SIZEOF_INT128__)
    269         { __int128 ret; ret = __atomic_load_n(vp16, __ATOMIC_SEQ_CST); }
    270         { __int128 ret; ret = __atomic_load_16(vp16, __ATOMIC_SEQ_CST); }
    271         { __int128 ret; __atomic_load(vp16, &ret, __ATOMIC_SEQ_CST); }
     191        { char ret; ret = __atomic_load_n(vpc, __ATOMIC_SEQ_CST); }
     192        { char ret; __atomic_load(vpc, &ret, __ATOMIC_SEQ_CST); }
     193        { short ret; ret = __atomic_load_n(vps, __ATOMIC_SEQ_CST); }
     194        { short ret; __atomic_load(vps, &ret, __ATOMIC_SEQ_CST); }
     195        { int ret; ret = __atomic_load_n(vpi, __ATOMIC_SEQ_CST); }
     196        { int ret; __atomic_load(vpi, &ret, __ATOMIC_SEQ_CST); }
     197        { long int ret; ret = __atomic_load_n(vpl, __ATOMIC_SEQ_CST); }
     198        { long int ret; __atomic_load(vpl, &ret, __ATOMIC_SEQ_CST); }
     199        { long long int ret; ret = __atomic_load_n(vpll, __ATOMIC_SEQ_CST); }
     200        { long long int ret; __atomic_load(vpll, &ret, __ATOMIC_SEQ_CST); }
     201        #if defined(__SIZEOF_INT128__)
     202        { __int128 ret; ret = __atomic_load_n(vplll, __ATOMIC_SEQ_CST); }
     203        { __int128 ret; __atomic_load(vplll, &ret, __ATOMIC_SEQ_CST); }
    272204        #endif
    273205        { struct type * ret; ret = __atomic_load_n(vpp, __ATOMIC_SEQ_CST); }
    274206        { struct type * ret; __atomic_load(vpp, &ret, __ATOMIC_SEQ_CST); }
    275207
    276         { _Bool ret; ret = __atomic_compare_exchange_n(vp1, rp1, v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    277         { _Bool ret; ret = __atomic_compare_exchange_1(vp1, rp1, v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    278         { _Bool ret; ret = __atomic_compare_exchange(vp1, rp1, &v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    279         { _Bool ret; ret = __atomic_compare_exchange_n(vp2, rp2, v2, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    280         { _Bool ret; ret = __atomic_compare_exchange_2(vp2, rp2, v2, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    281         { _Bool ret; ret = __atomic_compare_exchange(vp2, rp2, &v2, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    282         { _Bool ret; ret = __atomic_compare_exchange_n(vp4, rp4, v4, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    283         { _Bool ret; ret = __atomic_compare_exchange_4(vp4, rp4, v4, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    284         { _Bool ret; ret = __atomic_compare_exchange(vp4, rp4, &v4, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    285         { _Bool ret; ret = __atomic_compare_exchange_n(vp8, rp8, v8, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    286         { _Bool ret; ret = __atomic_compare_exchange_8(vp8, rp8, v8, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    287         { _Bool ret; ret = __atomic_compare_exchange(vp8, rp8, &v8, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    288         #if defined(__SIZEOF_INT128__)
    289         { _Bool ret; ret = __atomic_compare_exchange_n(vp16, rp16, v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    290         { _Bool ret; ret = __atomic_compare_exchange_16(vp16, rp16, v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    291         { _Bool ret; ret = __atomic_compare_exchange(vp16, rp16, &v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     208        { _Bool ret; ret = __atomic_compare_exchange_n(vpc, rpc, vc, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     209        { _Bool ret; ret = __atomic_compare_exchange(vpc, rpc, &vc, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     210        { _Bool ret; ret = __atomic_compare_exchange_n(vps, rps, vs, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     211        { _Bool ret; ret = __atomic_compare_exchange(vps, rps, &vs, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     212        { _Bool ret; ret = __atomic_compare_exchange_n(vpi, rpi, vi, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     213        { _Bool ret; ret = __atomic_compare_exchange(vpi, rpi, &vi, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     214        { _Bool ret; ret = __atomic_compare_exchange_n(vpl, rpl, vl, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     215        { _Bool ret; ret = __atomic_compare_exchange(vpl, rpl, &vl, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     216        { _Bool ret; ret = __atomic_compare_exchange_n(vpll, rpll, vll, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     217        { _Bool ret; ret = __atomic_compare_exchange(vpll, rpll, &vll, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     218        #if defined(__SIZEOF_INT128__)
     219        { _Bool ret; ret = __atomic_compare_exchange_n(vplll, rplll, vlll, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
     220        { _Bool ret; ret = __atomic_compare_exchange(vplll, rplll, &vlll, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    292221        #endif
    293222        { _Bool ret; ret = __atomic_compare_exchange_n(vpp, rpp, vp, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    294223        { _Bool ret; ret = __atomic_compare_exchange(vpp, rpp, &vp, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
    295224
    296         { __atomic_store_n(vp1, v1, __ATOMIC_SEQ_CST); }
    297         { __atomic_store_1(vp1, v1, __ATOMIC_SEQ_CST); }
    298         { __atomic_store(vp1, &v1, __ATOMIC_SEQ_CST); }
    299         { __atomic_store_n(vp2, v2, __ATOMIC_SEQ_CST); }
    300         { __atomic_store_2(vp2, v2, __ATOMIC_SEQ_CST); }
    301         { __atomic_store(vp2, &v2, __ATOMIC_SEQ_CST); }
    302         { __atomic_store_n(vp4, v4, __ATOMIC_SEQ_CST); }
    303         { __atomic_store_4(vp4, v4, __ATOMIC_SEQ_CST); }
    304         { __atomic_store(vp4, &v4, __ATOMIC_SEQ_CST); }
    305         { __atomic_store_n(vp8, v8, __ATOMIC_SEQ_CST); }
    306         { __atomic_store_8(vp8, v8, __ATOMIC_SEQ_CST); }
    307         { __atomic_store(vp8, &v8, __ATOMIC_SEQ_CST); }
    308         #if defined(__SIZEOF_INT128__)
    309         { __atomic_store_n(vp16, v16, __ATOMIC_SEQ_CST); }
    310         { __atomic_store_16(vp16, v16, __ATOMIC_SEQ_CST); }
    311         { __atomic_store(vp16, &v16, __ATOMIC_SEQ_CST); }
     225        { __atomic_store_n(vpc, vc, __ATOMIC_SEQ_CST); }
     226        { __atomic_store(vpc, &vc, __ATOMIC_SEQ_CST); }
     227        { __atomic_store_n(vps, vs, __ATOMIC_SEQ_CST); }
     228        { __atomic_store(vps, &vs, __ATOMIC_SEQ_CST); }
     229        { __atomic_store_n(vpi, vi, __ATOMIC_SEQ_CST); }
     230        { __atomic_store(vpi, &vi, __ATOMIC_SEQ_CST); }
     231        { __atomic_store_n(vpl, vl, __ATOMIC_SEQ_CST); }
     232        { __atomic_store(vpl, &vl, __ATOMIC_SEQ_CST); }
     233        { __atomic_store_n(vpll, vll, __ATOMIC_SEQ_CST); }
     234        { __atomic_store(vpll, &vll, __ATOMIC_SEQ_CST); }
     235        #if defined(__SIZEOF_INT128__)
     236        { __atomic_store_n(vplll, vlll, __ATOMIC_SEQ_CST); }
     237        { __atomic_store(vplll, &vlll, __ATOMIC_SEQ_CST); }
    312238        #endif
    313239        { __atomic_store_n(vpp, vp, __ATOMIC_SEQ_CST); }
    314240        { __atomic_store(vpp, &vp, __ATOMIC_SEQ_CST); }
    315241
    316         { char ret; ret = __atomic_add_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
    317         { char ret; ret = __atomic_add_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
    318         { short ret; ret = __atomic_add_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
    319         { short ret; ret = __atomic_add_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
    320         { int ret; ret = __atomic_add_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
    321         { int ret; ret = __atomic_add_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
    322         { long long int ret; ret = __atomic_add_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
    323         { long long int ret; ret = __atomic_add_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
    324         #if defined(__SIZEOF_INT128__)
    325         { __int128 ret; ret = __atomic_add_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
    326         { __int128 ret; ret = __atomic_add_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
    327         #endif
    328 
    329         { char ret; ret = __atomic_sub_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
    330         { char ret; ret = __atomic_sub_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
    331         { short ret; ret = __atomic_sub_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
    332         { short ret; ret = __atomic_sub_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
    333         { int ret; ret = __atomic_sub_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
    334         { int ret; ret = __atomic_sub_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
    335         { long long int ret; ret = __atomic_sub_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
    336         { long long int ret; ret = __atomic_sub_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
    337         #if defined(__SIZEOF_INT128__)
    338         { __int128 ret; ret = __atomic_sub_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
    339         { __int128 ret; ret = __atomic_sub_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
    340         #endif
    341 
    342         { char ret; ret = __atomic_and_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
    343         { char ret; ret = __atomic_and_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
    344         { short ret; ret = __atomic_and_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
    345         { short ret; ret = __atomic_and_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
    346         { int ret; ret = __atomic_and_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
    347         { int ret; ret = __atomic_and_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
    348         { long long int ret; ret = __atomic_and_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
    349         { long long int ret; ret = __atomic_and_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
    350         #if defined(__SIZEOF_INT128__)
    351         { __int128 ret; ret = __atomic_and_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
    352         { __int128 ret; ret = __atomic_and_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
    353         #endif
    354 
    355         { char ret; ret = __atomic_nand_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
    356         { char ret; ret = __atomic_nand_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
    357         { short ret; ret = __atomic_nand_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
    358         { short ret; ret = __atomic_nand_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
    359         { int ret; ret = __atomic_nand_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
    360         { int ret; ret = __atomic_nand_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
    361         { long long int ret; ret = __atomic_nand_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
    362         { long long int ret; ret = __atomic_nand_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
    363         #if defined(__SIZEOF_INT128__)
    364         { __int128 ret; ret = __atomic_nand_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
    365         { __int128 ret; ret = __atomic_nand_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
    366         #endif
    367 
    368         { char ret; ret = __atomic_xor_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
    369         { char ret; ret = __atomic_xor_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
    370         { short ret; ret = __atomic_xor_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
    371         { short ret; ret = __atomic_xor_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
    372         { int ret; ret = __atomic_xor_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
    373         { int ret; ret = __atomic_xor_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
    374         { long long int ret; ret = __atomic_xor_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
    375         { long long int ret; ret = __atomic_xor_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
    376         #if defined(__SIZEOF_INT128__)
    377         { __int128 ret; ret = __atomic_xor_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
    378         { __int128 ret; ret = __atomic_xor_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
    379         #endif
    380 
    381         { char ret; ret = __atomic_or_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
    382         { char ret; ret = __atomic_or_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
    383         { short ret; ret = __atomic_or_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
    384         { short ret; ret = __atomic_or_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
    385         { int ret; ret = __atomic_or_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
    386         { int ret; ret = __atomic_or_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
    387         { long long int ret; ret = __atomic_or_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
    388         { long long int ret; ret = __atomic_or_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
    389         #if defined(__SIZEOF_INT128__)
    390         { __int128 ret; ret = __atomic_or_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
    391         { __int128 ret; ret = __atomic_or_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
    392         #endif
    393 
    394         { char ret; ret = __atomic_fetch_add(vp1, v1, __ATOMIC_SEQ_CST); }
    395         { char ret; ret = __atomic_fetch_add_1(vp1, v1, __ATOMIC_SEQ_CST); }
    396         { short ret; ret = __atomic_fetch_add(vp2, v2, __ATOMIC_SEQ_CST); }
    397         { short ret; ret = __atomic_fetch_add_2(vp2, v2, __ATOMIC_SEQ_CST); }
    398         { int ret; ret = __atomic_fetch_add(vp4, v4, __ATOMIC_SEQ_CST); }
    399         { int ret; ret = __atomic_fetch_add_4(vp4, v4, __ATOMIC_SEQ_CST); }
    400         { long long int ret; ret = __atomic_fetch_add(vp8, v8, __ATOMIC_SEQ_CST); }
    401         { long long int ret; ret = __atomic_fetch_add_8(vp8, v8, __ATOMIC_SEQ_CST); }
    402         #if defined(__SIZEOF_INT128__)
    403         { __int128 ret; ret = __atomic_fetch_add(vp16, v16, __ATOMIC_SEQ_CST); }
    404         { __int128 ret; ret = __atomic_fetch_add_16(vp16, v16, __ATOMIC_SEQ_CST); }
    405         #endif
    406 
    407         { char ret; ret = __atomic_fetch_sub(vp1, v1, __ATOMIC_SEQ_CST); }
    408         { char ret; ret = __atomic_fetch_sub_1(vp1, v1, __ATOMIC_SEQ_CST); }
    409         { short ret; ret = __atomic_fetch_sub(vp2, v2, __ATOMIC_SEQ_CST); }
    410         { short ret; ret = __atomic_fetch_sub_2(vp2, v2, __ATOMIC_SEQ_CST); }
    411         { int ret; ret = __atomic_fetch_sub(vp4, v4, __ATOMIC_SEQ_CST); }
    412         { int ret; ret = __atomic_fetch_sub_4(vp4, v4, __ATOMIC_SEQ_CST); }
    413         { long long int ret; ret = __atomic_fetch_sub(vp8, v8, __ATOMIC_SEQ_CST); }
    414         { long long int ret; ret = __atomic_fetch_sub_8(vp8, v8, __ATOMIC_SEQ_CST); }
    415         #if defined(__SIZEOF_INT128__)
    416         { __int128 ret; ret = __atomic_fetch_sub(vp16, v16, __ATOMIC_SEQ_CST); }
    417         { __int128 ret; ret = __atomic_fetch_sub_16(vp16, v16, __ATOMIC_SEQ_CST); }
    418         #endif
    419 
    420         { char ret; ret = __atomic_fetch_and(vp1, v1, __ATOMIC_SEQ_CST); }
    421         { char ret; ret = __atomic_fetch_and_1(vp1, v1, __ATOMIC_SEQ_CST); }
    422         { short ret; ret = __atomic_fetch_and(vp2, v2, __ATOMIC_SEQ_CST); }
    423         { short ret; ret = __atomic_fetch_and_2(vp2, v2, __ATOMIC_SEQ_CST); }
    424         { int ret; ret = __atomic_fetch_and(vp4, v4, __ATOMIC_SEQ_CST); }
    425         { int ret; ret = __atomic_fetch_and_4(vp4, v4, __ATOMIC_SEQ_CST); }
    426         { long long int ret; ret = __atomic_fetch_and(vp8, v8, __ATOMIC_SEQ_CST); }
    427         { long long int ret; ret = __atomic_fetch_and_8(vp8, v8, __ATOMIC_SEQ_CST); }
    428         #if defined(__SIZEOF_INT128__)
    429         { __int128 ret; ret = __atomic_fetch_and(vp16, v16, __ATOMIC_SEQ_CST); }
    430         { __int128 ret; ret = __atomic_fetch_and_16(vp16, v16, __ATOMIC_SEQ_CST); }
    431         #endif
    432 
    433         { char ret; ret = __atomic_fetch_nand(vp1, v1, __ATOMIC_SEQ_CST); }
    434         { char ret; ret = __atomic_fetch_nand_1(vp1, v1, __ATOMIC_SEQ_CST); }
    435         { short ret; ret = __atomic_fetch_nand(vp2, v2, __ATOMIC_SEQ_CST); }
    436         { short ret; ret = __atomic_fetch_nand_2(vp2, v2, __ATOMIC_SEQ_CST); }
    437         { int ret; ret = __atomic_fetch_nand(vp4, v4, __ATOMIC_SEQ_CST); }
    438         { int ret; ret = __atomic_fetch_nand_4(vp4, v4, __ATOMIC_SEQ_CST); }
    439         { long long int ret; ret = __atomic_fetch_nand(vp8, v8, __ATOMIC_SEQ_CST); }
    440         { long long int ret; ret = __atomic_fetch_nand_8(vp8, v8, __ATOMIC_SEQ_CST); }
    441         #if defined(__SIZEOF_INT128__)
    442         { __int128 ret; ret = __atomic_fetch_nand(vp16, v16, __ATOMIC_SEQ_CST); }
    443         { __int128 ret; ret = __atomic_fetch_nand_16(vp16, v16, __ATOMIC_SEQ_CST); }
    444         #endif
    445 
    446         { char ret; ret = __atomic_fetch_xor(vp1, v1, __ATOMIC_SEQ_CST); }
    447         { char ret; ret = __atomic_fetch_xor_1(vp1, v1, __ATOMIC_SEQ_CST); }
    448         { short ret; ret = __atomic_fetch_xor(vp2, v2, __ATOMIC_SEQ_CST); }
    449         { short ret; ret = __atomic_fetch_xor_2(vp2, v2, __ATOMIC_SEQ_CST); }
    450         { int ret; ret = __atomic_fetch_xor(vp4, v4, __ATOMIC_SEQ_CST); }
    451         { int ret; ret = __atomic_fetch_xor_4(vp4, v4, __ATOMIC_SEQ_CST); }
    452         { long long int ret; ret = __atomic_fetch_xor(vp8, v8, __ATOMIC_SEQ_CST); }
    453         { long long int ret; ret = __atomic_fetch_xor_8(vp8, v8, __ATOMIC_SEQ_CST); }
    454         #if defined(__SIZEOF_INT128__)
    455         { __int128 ret; ret = __atomic_fetch_xor(vp16, v16, __ATOMIC_SEQ_CST); }
    456         { __int128 ret; ret = __atomic_fetch_xor_16(vp16, v16, __ATOMIC_SEQ_CST); }
    457         #endif
    458 
    459         { char ret; ret = __atomic_fetch_or(vp1, v1, __ATOMIC_SEQ_CST); }
    460         { char ret; ret = __atomic_fetch_or_1(vp1, v1, __ATOMIC_SEQ_CST); }
    461         { short ret; ret = __atomic_fetch_or(vp2, v2, __ATOMIC_SEQ_CST); }
    462         { short ret; ret = __atomic_fetch_or_2(vp2, v2, __ATOMIC_SEQ_CST); }
    463         { int ret; ret = __atomic_fetch_or(vp4, v4, __ATOMIC_SEQ_CST); }
    464         { int ret; ret = __atomic_fetch_or_4(vp4, v4, __ATOMIC_SEQ_CST); }
    465         { long long int ret; ret = __atomic_fetch_or(vp8, v8, __ATOMIC_SEQ_CST); }
    466         { long long int ret; ret = __atomic_fetch_or_8(vp8, v8, __ATOMIC_SEQ_CST); }
    467         #if defined(__SIZEOF_INT128__)
    468         { __int128 ret; ret = __atomic_fetch_or(vp16, v16, __ATOMIC_SEQ_CST); }
    469         { __int128 ret; ret = __atomic_fetch_or_16(vp16, v16, __ATOMIC_SEQ_CST); }
    470         #endif
    471 
    472         { _Bool ret; ret = __atomic_always_lock_free(sizeof(int), vp4); }
    473         { _Bool ret; ret = __atomic_is_lock_free(sizeof(int), vp4); }
     242        { char ret; ret = __atomic_add_fetch(vpc, vc, __ATOMIC_SEQ_CST); }
     243        { short ret; ret = __atomic_add_fetch(vps, vs, __ATOMIC_SEQ_CST); }
     244        { int ret; ret = __atomic_add_fetch(vpi, vi, __ATOMIC_SEQ_CST); }
     245        { long int ret; ret = __atomic_add_fetch(vpl, vl, __ATOMIC_SEQ_CST); }
     246        { long long int ret; ret = __atomic_add_fetch(vpll, vll, __ATOMIC_SEQ_CST); }
     247        #if defined(__SIZEOF_INT128__)
     248        { __int128 ret; ret = __atomic_add_fetch(vplll, vlll, __ATOMIC_SEQ_CST); }
     249        #endif
     250
     251        { char ret; ret = __atomic_sub_fetch(vpc, vc, __ATOMIC_SEQ_CST); }
     252        { short ret; ret = __atomic_sub_fetch(vps, vs, __ATOMIC_SEQ_CST); }
     253        { int ret; ret = __atomic_sub_fetch(vpi, vi, __ATOMIC_SEQ_CST); }
     254        { long int ret; ret = __atomic_sub_fetch(vpl, vl, __ATOMIC_SEQ_CST); }
     255        { long long int ret; ret = __atomic_sub_fetch(vpll, vll, __ATOMIC_SEQ_CST); }
     256        #if defined(__SIZEOF_INT128__)
     257        { __int128 ret; ret = __atomic_sub_fetch(vplll, vlll, __ATOMIC_SEQ_CST); }
     258        #endif
     259
     260        { char ret; ret = __atomic_and_fetch(vpc, vc, __ATOMIC_SEQ_CST); }
     261        { short ret; ret = __atomic_and_fetch(vps, vs, __ATOMIC_SEQ_CST); }
     262        { int ret; ret = __atomic_and_fetch(vpi, vi, __ATOMIC_SEQ_CST); }
     263        { long int ret; ret = __atomic_and_fetch(vpl, vl, __ATOMIC_SEQ_CST); }
     264        { long long int ret; ret = __atomic_and_fetch(vpll, vll, __ATOMIC_SEQ_CST); }
     265        #if defined(__SIZEOF_INT128__)
     266        { __int128 ret; ret = __atomic_and_fetch(vplll, vlll, __ATOMIC_SEQ_CST); }
     267        #endif
     268
     269        { char ret; ret = __atomic_nand_fetch(vpc, vc, __ATOMIC_SEQ_CST); }
     270        { short ret; ret = __atomic_nand_fetch(vps, vs, __ATOMIC_SEQ_CST); }
     271        { int ret; ret = __atomic_nand_fetch(vpi, vi, __ATOMIC_SEQ_CST); }
     272        { long int ret; ret = __atomic_nand_fetch(vpl, vl, __ATOMIC_SEQ_CST); }
     273        { long long int ret; ret = __atomic_nand_fetch(vpll, vll, __ATOMIC_SEQ_CST); }
     274        #if defined(__SIZEOF_INT128__)
     275        { __int128 ret; ret = __atomic_nand_fetch(vplll, vlll, __ATOMIC_SEQ_CST); }
     276        #endif
     277
     278        { char ret; ret = __atomic_xor_fetch(vpc, vc, __ATOMIC_SEQ_CST); }
     279        { short ret; ret = __atomic_xor_fetch(vps, vs, __ATOMIC_SEQ_CST); }
     280        { int ret; ret = __atomic_xor_fetch(vpi, vi, __ATOMIC_SEQ_CST); }
     281        { long int ret; ret = __atomic_xor_fetch(vpl, vl, __ATOMIC_SEQ_CST); }
     282        { long long int ret; ret = __atomic_xor_fetch(vpll, vll, __ATOMIC_SEQ_CST); }
     283        #if defined(__SIZEOF_INT128__)
     284        { __int128 ret; ret = __atomic_xor_fetch(vplll, vlll, __ATOMIC_SEQ_CST); }
     285        #endif
     286
     287        { char ret; ret = __atomic_or_fetch(vpc, vc, __ATOMIC_SEQ_CST); }
     288        { short ret; ret = __atomic_or_fetch(vps, vs, __ATOMIC_SEQ_CST); }
     289        { int ret; ret = __atomic_or_fetch(vpi, vi, __ATOMIC_SEQ_CST); }
     290        { long int ret; ret = __atomic_or_fetch(vpl, vl, __ATOMIC_SEQ_CST); }
     291        { long long int ret; ret = __atomic_or_fetch(vpll, vll, __ATOMIC_SEQ_CST); }
     292        #if defined(__SIZEOF_INT128__)
     293        { __int128 ret; ret = __atomic_or_fetch(vplll, vlll, __ATOMIC_SEQ_CST); }
     294        #endif
     295
     296        { char ret; ret = __atomic_fetch_add(vpc, vc, __ATOMIC_SEQ_CST); }
     297        { short ret; ret = __atomic_fetch_add(vps, vs, __ATOMIC_SEQ_CST); }
     298        { int ret; ret = __atomic_fetch_add(vpi, vi, __ATOMIC_SEQ_CST); }
     299        { long int ret; ret = __atomic_fetch_add(vpl, vl, __ATOMIC_SEQ_CST); }
     300        { long long int ret; ret = __atomic_fetch_add(vpll, vll, __ATOMIC_SEQ_CST); }
     301        #if defined(__SIZEOF_INT128__)
     302        { __int128 ret; ret = __atomic_fetch_add(vplll, vlll, __ATOMIC_SEQ_CST); }
     303        #endif
     304
     305        { char ret; ret = __atomic_fetch_sub(vpc, vc, __ATOMIC_SEQ_CST); }
     306        { short ret; ret = __atomic_fetch_sub(vps, vs, __ATOMIC_SEQ_CST); }
     307        { int ret; ret = __atomic_fetch_sub(vpi, vi, __ATOMIC_SEQ_CST); }
     308        { long int ret; ret = __atomic_fetch_sub(vpl, vl, __ATOMIC_SEQ_CST); }
     309        { long long int ret; ret = __atomic_fetch_sub(vpll, vll, __ATOMIC_SEQ_CST); }
     310        #if defined(__SIZEOF_INT128__)
     311        { __int128 ret; ret = __atomic_fetch_sub(vplll, vlll, __ATOMIC_SEQ_CST); }
     312        #endif
     313
     314        { char ret; ret = __atomic_fetch_and(vpc, vc, __ATOMIC_SEQ_CST); }
     315        { short ret; ret = __atomic_fetch_and(vps, vs, __ATOMIC_SEQ_CST); }
     316        { int ret; ret = __atomic_fetch_and(vpi, vi, __ATOMIC_SEQ_CST); }
     317        { long int ret; ret = __atomic_fetch_and(vpl, vl, __ATOMIC_SEQ_CST); }
     318        { long long int ret; ret = __atomic_fetch_and(vpll, vll, __ATOMIC_SEQ_CST); }
     319        #if defined(__SIZEOF_INT128__)
     320        { __int128 ret; ret = __atomic_fetch_and(vplll, vlll, __ATOMIC_SEQ_CST); }
     321        #endif
     322
     323        { char ret; ret = __atomic_fetch_nand(vpc, vc, __ATOMIC_SEQ_CST); }
     324        { short ret; ret = __atomic_fetch_nand(vps, vs, __ATOMIC_SEQ_CST); }
     325        { int ret; ret = __atomic_fetch_nand(vpi, vi, __ATOMIC_SEQ_CST); }
     326        { long int ret; ret = __atomic_fetch_nand(vpl, vl, __ATOMIC_SEQ_CST); }
     327        { long long int ret; ret = __atomic_fetch_nand(vpll, vll, __ATOMIC_SEQ_CST); }
     328        #if defined(__SIZEOF_INT128__)
     329        { __int128 ret; ret = __atomic_fetch_nand(vplll, vlll, __ATOMIC_SEQ_CST); }
     330        #endif
     331
     332        { char ret; ret = __atomic_fetch_xor(vpc, vc, __ATOMIC_SEQ_CST); }
     333        { short ret; ret = __atomic_fetch_xor(vps, vs, __ATOMIC_SEQ_CST); }
     334        { int ret; ret = __atomic_fetch_xor(vpi, vi, __ATOMIC_SEQ_CST); }
     335        { long int ret; ret = __atomic_fetch_xor(vpl, vl, __ATOMIC_SEQ_CST); }
     336        { long long int ret; ret = __atomic_fetch_xor(vpll, vll, __ATOMIC_SEQ_CST); }
     337        #if defined(__SIZEOF_INT128__)
     338        { __int128 ret; ret = __atomic_fetch_xor(vplll, vlll, __ATOMIC_SEQ_CST); }
     339        #endif
     340
     341        { char ret; ret = __atomic_fetch_or(vpc, vc, __ATOMIC_SEQ_CST); }
     342        { short ret; ret = __atomic_fetch_or(vps, vs, __ATOMIC_SEQ_CST); }
     343        { int ret; ret = __atomic_fetch_or(vpi, vi, __ATOMIC_SEQ_CST); }
     344        { long int ret; ret = __atomic_fetch_or(vpl, vl, __ATOMIC_SEQ_CST); }
     345        { long long int ret; ret = __atomic_fetch_or(vpll, vll, __ATOMIC_SEQ_CST); }
     346        #if defined(__SIZEOF_INT128__)
     347        { __int128 ret; ret = __atomic_fetch_or(vplll, vlll, __ATOMIC_SEQ_CST); }
     348        #endif
     349
     350        { _Bool ret; ret = __atomic_always_lock_free(sizeof(int), vpi); }
     351        { _Bool ret; ret = __atomic_is_lock_free(sizeof(int), vpi); }
    474352        { __atomic_thread_fence(__ATOMIC_SEQ_CST); }
    475353        { __atomic_signal_fence(__ATOMIC_SEQ_CST); }
  • tests/concurrent/examples/.expect/datingService.txt

    r9fb8f01 r3d5701e  
    1 Girl:17 is dating Boy at 2 with ccode 17
    2  Boy:2 is dating Girl 17 with ccode 17
    3  Boy:14 is dating Girl 5 with ccode 5
    4 Girl:5 is dating Boy at 14 with ccode 5
    5  Boy:9 is dating Girl 10 with ccode 10
    6 Girl:10 is dating Boy at 9 with ccode 10
    7  Boy:1 is dating Girl 18 with ccode 18
    8 Girl:18 is dating Boy at 1 with ccode 18
    9  Boy:16 is dating Girl 3 with ccode 3
    10 Girl:3 is dating Boy at 16 with ccode 3
    11  Boy:5 is dating Girl 14 with ccode 14
    12 Girl:14 is dating Boy at 5 with ccode 14
    13  Boy:15 is dating Girl 4 with ccode 4
    14 Girl:4 is dating Boy at 15 with ccode 4
    15 Girl:0 is dating Boy at 19 with ccode 0
    16  Boy:19 is dating Girl 0 with ccode 0
    17 Girl:9 is dating Boy at 10 with ccode 9
    18  Boy:10 is dating Girl 9 with ccode 9
    19 Girl:11 is dating Boy at 8 with ccode 11
    20  Boy:8 is dating Girl 11 with ccode 11
    21  Boy:12 is dating Girl 7 with ccode 7
    22 Girl:7 is dating Boy at 12 with ccode 7
    23  Boy:11 is dating Girl 8 with ccode 8
    24 Girl:8 is dating Boy at 11 with ccode 8
    25 Girl:16 is dating Boy at 3 with ccode 16
    26  Boy:3 is dating Girl 16 with ccode 16
    27 Girl:15 is dating Boy at 4 with ccode 15
    28  Boy:4 is dating Girl 15 with ccode 15
    29 Girl:19 is dating Boy at 0 with ccode 19
    30  Boy:0 is dating Girl 19 with ccode 19
    31 Girl:2 is dating Boy at 17 with ccode 2
    32  Boy:17 is dating Girl 2 with ccode 2
    33  Boy:13 is dating Girl 6 with ccode 6
    34 Girl:6 is dating Boy at 13 with ccode 6
    35  Boy:7 is dating Girl 12 with ccode 12
    36 Girl:12 is dating Boy at 7 with ccode 12
    37 Girl:13 is dating Boy at 6 with ccode 13
    38  Boy:6 is dating Girl 13 with ccode 13
    39 Girl:1 is dating Boy at 18 with ccode 1
    40  Boy:18 is dating Girl 1 with ccode 1
  • tests/concurrent/examples/boundedBufferEXT.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Wed Apr 18 22:52:12 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 21 08:19:20 2019
    13 // Update Count     : 14
     12// Last Modified On : Thu Jan 16 22:36:34 2020
     13// Update Count     : 15
    1414//
    1515
     
    3737
    3838        void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
    39                 if ( count == BufferSize ) waitfor( remove, buffer );
     39                if ( count == BufferSize ) waitfor( remove : buffer );
    4040                elements[back] = elem;
    4141                back = ( back + 1 ) % BufferSize;
     
    4444
    4545        T remove( Buffer(T) & mutex buffer ) with( buffer ) {
    46                 if ( count == 0 ) waitfor( insert, buffer );
     46                if ( count == 0 ) waitfor( insert : buffer );
    4747                T elem = elements[front];
    4848                front = ( front + 1 ) % BufferSize;
  • tests/concurrent/examples/boundedBufferTHREAD.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Wed Apr 18 22:52:12 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 21 11:50:12 2019
    13 // Update Count     : 24
     12// Last Modified On : Thu Jan 16 23:09:43 2020
     13// Update Count     : 25
    1414//
    1515
     
    4444        void main( Buffer & buffer ) with( buffer ) {
    4545                for () {
    46                         waitfor( ^?{}, buffer ) {
     46                        waitfor( ^?{} : buffer ) {
    4747                                break;
    48                         } or when ( count != 20 ) waitfor( insert, buffer ) {
     48                        } or when ( count != 20 ) waitfor( insert : buffer ) {
    4949                                back = (back + 1) % 20;
    5050                                count += 1;
    51                         } or when ( count != 0 ) waitfor( remove, buffer ) {
     51                        } or when ( count != 0 ) waitfor( remove : buffer ) {
    5252                                front = (front + 1) % 20;
    5353                                count -= 1;
  • tests/concurrent/examples/datingService.cfa

    r9fb8f01 r3d5701e  
    11//
    22// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
    3 // 
     3//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
     
    3535                signal_block( Boys[ccode] );                                    // restart boy to set phone number
    3636        } // if
    37         sout | "Girl:" | PhoneNo | "is dating Boy at" | BoyPhoneNo | "with ccode" | ccode;
     37        //sout | "Girl:" | PhoneNo | "is dating Boy at" | BoyPhoneNo | "with ccode" | ccode;
    3838        return BoyPhoneNo;
    3939} // DatingService girl
     
    4747                signal_block( Girls[ccode] );                                   // restart girl to set phone number
    4848        } // if
    49         sout | " Boy:" | PhoneNo | "is dating Girl" | GirlPhoneNo | "with ccode" | ccode;
     49        //sout | " Boy:" | PhoneNo | "is dating Girl" | GirlPhoneNo | "with ccode" | ccode;
    5050        return GirlPhoneNo;
    5151} // DatingService boy
  • tests/concurrent/examples/gortn.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Wed Feb 20 08:02:37 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 21 08:25:03 2019
    13 // Update Count     : 4
     12// Last Modified On : Thu Jan 16 22:43:40 2020
     13// Update Count     : 5
    1414//
    1515
     
    2626void main( GoRtn & gortn ) with( gortn ) {
    2727        for () {
    28                 waitfor( mem1, gortn ) sout | i;
    29                 or waitfor( mem2, gortn ) sout | f;
    30                 or waitfor( mem3, gortn ) sout | m.i | m.j;
    31                 or waitfor( ^?{}, gortn ) break;
     28                waitfor( mem1 : gortn ) sout | i;
     29                or waitfor( mem2 : gortn ) sout | f;
     30                or waitfor( mem3 : gortn ) sout | m.i | m.j;
     31                or waitfor( ^?{} : gortn ) break;
    3232        }
    3333}
  • tests/concurrent/examples/quickSort.cfa

    r9fb8f01 r3d5701e  
    1111// Created On       : Wed Dec  6 12:15:52 2017
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Fri Jun 21 08:27:45 2019
    14 // Update Count     : 172
     13// Last Modified On : Wed Feb 12 18:24:47 2020
     14// Update Count     : 177
    1515//
    1616
     
    2727
    2828void ?{}( Quicksort & qs, int values[], int size, int depth ) {
    29         qs.values = values;  qs.low = 0;  qs.high = size;  qs.depth = depth;
     29        qs.[values, low, high, depth] = [values, 0, size, depth];
    3030} // Quicksort
    3131
     
    6666                        if ( depth > 0 ) {
    6767                                depth -= 1;
    68                                 Quicksort rqs = { values, low, right, depth }; // concurrently sort upper half
    69                                 //Quicksort lqs( values, left, high, depth ); // concurrently sort lower half
    70                                 sort( values, left, high, depth );              // concurrently sort lower half
     68                                Quicksort lqs = { values, low, right, depth }; // concurrently sort lower half
     69                                Quicksort rqs = { values, left, high, depth }; // concurrently sort upper half
     70                                // Quicksort lqs = { values, low, right, depth }; // concurrently sort lower half
     71                                // sort( values, left, high, depth );           // concurrently sort upper half
    7172                        } else {
    7273                                sort( values, low, right, 0 );                  // sequentially sort lower half
     
    162163                processor processors[ (1 << depth) - 1 ] __attribute__(( unused )); // create 2^depth-1 kernel threads
    163164
    164                 int * values = alloc( size );                           // values to be sorted, too large to put on stack
    165                 for ( counter; size ) {                                         // generate unsorted numbers
     165                int * values = alloc( size );                                   // values to be sorted, too large to put on stack
     166                for ( counter; size ) {                                                 // generate unsorted numbers
    166167                        values[counter] = size - counter;                       // descending values
     168                } // for
     169                for ( i; 200 ) {                                                                // random shuffle a few values
     170                        swap( values[rand() % size], values[rand() % size] );
    167171                } // for
    168172                {
     
    178182} // main
    179183
     184// for depth in 0 1 2 3 4 5 ; do echo "sort 500000000 values with ${depth} depth" ; time -f "%Uu %Ss %E %Mkb" a.out -t 500000000 ${depth} ; done
     185
    180186// Local Variables: //
    181187// tab-width: 4 //
  • tests/concurrent/multi-monitor.cfa

    r9fb8f01 r3d5701e  
    1111
    1212void increment( monitor_t & mutex p1, monitor_t & mutex p2, int & value ) {
     13        assert(active_thread() == get_monitor(p1)->owner);
     14        assert(active_thread() == get_monitor(p2)->owner);
    1315        value += 1;
     16        assert(active_thread() == get_monitor(p1)->owner);
     17        assert(active_thread() == get_monitor(p2)->owner);
    1418}
    1519
  • tests/concurrent/preempt.cfa

    r9fb8f01 r3d5701e  
    3636                if( (counter % 7) == this.value ) {
    3737                        __cfaabi_check_preemption();
    38                         int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST);
     38                        int next = __atomic_add_fetch( &counter, 1, __ATOMIC_SEQ_CST );
    3939                        __cfaabi_check_preemption();
    4040                        if( (next % 100) == 0 ) printf("%d\n", (int)next);
  • tests/concurrent/signal/block.cfa

    r9fb8f01 r3d5701e  
    3333
    3434monitor global_data_t {
    35         thread_desc * last_thread;
    36         thread_desc * last_signaller;
     35        $thread * last_thread;
     36        $thread * last_signaller;
    3737};
    3838
     
    8282        if( !is_empty( cond ) ) {
    8383
    84                 thread_desc * next = front( cond );
     84                $thread * next = front( cond );
    8585
    8686                if( ! signal_block( cond ) ) {
  • tests/concurrent/signal/wait.cfa

    r9fb8f01 r3d5701e  
    9898        }
    9999
    100         __sync_fetch_and_sub_4( &waiter_left, 1);
     100        __atomic_fetch_sub( &waiter_left, 1,  __ATOMIC_SEQ_CST );
    101101}
    102102
     
    109109        }
    110110
    111         __sync_fetch_and_sub_4( &waiter_left, 1);
     111        __atomic_fetch_sub( &waiter_left, 1,  __ATOMIC_SEQ_CST );
    112112}
    113113
     
    120120        }
    121121
    122         __sync_fetch_and_sub_4( &waiter_left, 1);
     122        __atomic_fetch_sub( &waiter_left, 1,  __ATOMIC_SEQ_CST );
    123123}
    124124
     
    131131        }
    132132
    133         __sync_fetch_and_sub_4( &waiter_left, 1);
     133        __atomic_fetch_sub( &waiter_left, 1,  __ATOMIC_SEQ_CST );
    134134}
    135135
  • tests/concurrent/thread.cfa

    r9fb8f01 r3d5701e  
    77thread Second { semaphore* lock; };
    88
    9 void ?{}( First  & this, semaphore & lock ) { ((thread&)this){"Thread 1"}; this.lock = &lock; }
    10 void ?{}( Second & this, semaphore & lock ) { ((thread&)this){"Thread 2"}; this.lock = &lock; }
     9void ?{}( First  & this, semaphore & lock ) { ((thread&)this){ "Thread 1" }; this.lock = &lock; }
     10void ?{}( Second & this, semaphore & lock ) { ((thread&)this){ "Thread 2" }; this.lock = &lock; }
    1111
    1212void main(First& this) {
  • tests/concurrent/waitfor/barge.cfa

    r9fb8f01 r3d5701e  
    6565                yield(random( 10 ));
    6666                this.state = WAITFOR;
    67                 waitfor(do_call, this) {
     67                waitfor(do_call : this) {
    6868                        sout | i;
    6969                }
  • tests/concurrent/waitfor/dtor.cfa

    r9fb8f01 r3d5701e  
    4747        yield(random( 10 ));
    4848        set_state( this, MAIN );
    49         waitfor( ^?{}, this ) {
     49        waitfor( ^?{} : this ) {
    5050                set_state( this, AFTER );
    5151        }
  • tests/concurrent/waitfor/else.cfa

    r9fb8f01 r3d5701e  
    1414        sout | "Starting";
    1515
    16         when( false ) waitfor( notcalled, m );
     16        when( false ) waitfor( notcalled : m );
    1717
    1818        sout | "Step" | i++;
    1919
    20         waitfor( notcalled, m ); or else {
     20        waitfor( notcalled : m ); or else {
    2121                sout | "else called";
    2222        }
     
    2424        sout | "Step" | i++;
    2525
    26         when( true ) waitfor( notcalled, m ); or when( true ) else {
     26        when( true ) waitfor( notcalled : m ); or when( true ) else {
    2727                sout | "else called";
    2828        }
     
    3030        sout | "Step" | i++;
    3131
    32         when( false ) waitfor( notcalled, m ); or when( true ) else {
     32        when( false ) waitfor( notcalled : m ); or when( true ) else {
    3333                sout | "else called";
    3434        }
     
    3636        sout | "Step" | i++;
    3737
    38         when( false ) waitfor( notcalled, m ); or when( false ) else {
     38        when( false ) waitfor( notcalled : m ); or when( false ) else {
    3939                sout | "else called";
    4040        }
  • tests/concurrent/waitfor/parse.cfa

    r9fb8f01 r3d5701e  
    2424
    2525        //---------------------------------------
    26         waitfor( f1, a ) {
     26        waitfor( f1 : a ) {
    2727                1;
    2828        }
    2929
    3030        //---------------------------------------
    31         waitfor( f1, a ) {
     31        waitfor( f1 : a ) {
    3232                2;
    3333        }
    34         waitfor( f2, a ) {
     34        waitfor( f2 : a ) {
    3535                3;
    3636        }
    3737
    3838        //---------------------------------------
    39         when( 1 < 3 ) waitfor( f2, a, a ) {
     39        when( 1 < 3 ) waitfor( f2 : a, a ) {
    4040                4;
    4141        }
     
    4545
    4646        //---------------------------------------
    47         when( 2 < 3 ) waitfor( f3, a ) {
     47        when( 2 < 3 ) waitfor( f3 : a ) {
    4848                5;
    4949        }
     
    5353
    5454        //---------------------------------------
    55         when( 3 < 3 ) waitfor( f3, a, a ) {
     55        when( 3 < 3 ) waitfor( f3 : a, a ) {
    5656                7;
    5757        }
     
    6464
    6565        //---------------------------------------
    66         when( 6 < 3 ) waitfor( f3, a, a, a ) {
     66        when( 6 < 3 ) waitfor( f3 : a, a, a ) {
    6767                10;
    6868        }
    69         or when( 7 < 3 ) waitfor( f1, a  ) {
     69        or when( 7 < 3 ) waitfor( f1 : a  ) {
    7070                11;
    7171        }
     
    7575
    7676        //---------------------------------------
    77         when( 8 < 3 ) waitfor( f3, a, a ) {
     77        when( 8 < 3 ) waitfor( f3 : a, a ) {
    7878                13;
    7979        }
    80         or waitfor( f1, a  ) {
     80        or waitfor( f1 : a  ) {
    8181                14;
    8282        }
     
    8686
    8787        //---------------------------------------
    88         when( 10 < 3 ) waitfor( f1, a ) {
     88        when( 10 < 3 ) waitfor( f1 : a ) {
    8989                16;
    9090        }
    91         or waitfor( f2, a, a ) {
     91        or waitfor( f2 : a, a ) {
    9292                17;
    9393        }
     
    100100}
    101101
    102 int main() {
    103 
    104 }
     102int main() {}
  • tests/concurrent/waitfor/parse2.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Wed Aug 30 17:53:29 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 22 13:42:11 2019
    13 // Update Count     : 3
     12// Last Modified On : Thu Jan 16 23:13:37 2020
     13// Update Count     : 6
    1414//
    1515
     
    2626        }
    2727
    28         waitfor( x, z ) {
     28        waitfor( x : z ) {
    2929        }
    3030
     
    3737        or waitfor( y );
    3838
    39         waitfor( x, z );
     39        waitfor( x : z );
    4040        or waitfor( y );
    4141
     
    4343        or when( true ) waitfor( y );
    4444
    45         when( true ) waitfor( x, z );
     45        when( true ) waitfor( x : z );
    4646        or when( true ) waitfor( y );
    4747
     
    5050        }
    5151
    52         waitfor( x, z ) {
     52        waitfor( x : z ) {
    5353        } or waitfor( y ) {
    5454        }
     
    8080        or else;
    8181
    82         when( true ) waitfor( x, z );
     82        when( true ) waitfor( x : z );
    8383        or else;
    8484
     
    9999        }
    100100
    101         when( true ) waitfor( x, z );
     101        when( true ) waitfor( x : z );
    102102        or else {
    103103        }
     
    115115        or when( true ) else;
    116116
    117         when( true ) waitfor( x, z );
     117        when( true ) waitfor( x : z );
    118118        or when( true ) else;
    119119
     
    134134        }
    135135
    136         when( true ) waitfor( x, z );
     136        when( true ) waitfor( x : z );
    137137        or when( true ) else {
    138138        }
     
    149149        or timeout( 3 );
    150150
    151         waitfor( x, z );
     151        waitfor( x : z );
    152152        or timeout( 3 );
    153153
     
    163163        }
    164164
    165         when( true ) waitfor( x, z ) {
     165        when( true ) waitfor( x : z ) {
    166166        } or timeout( 3 ) {
    167167        }
     
    171171        }
    172172
    173         when( true ) waitfor( x, z ) {
     173        when( true ) waitfor( x : z ) {
    174174        } or when ( true ) timeout( 3 ) {
    175175        }
     
    229229
    230230        int or, timeout;
    231         waitfor( timeout, 7 ) 3;
    232         waitfor( timeout, 7 ) 3; or waitfor( timeout, 7 ) 3;
    233         when( or ) waitfor( or, ) { 4; } or timeout( 1 ) 3;
    234         when( 3 ) waitfor( or, 2 ) 4; or else 4;
    235         when( 3 ) waitfor( or, 3 ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout;
    236         when( 3 ) waitfor( or, or ) 3; or when( or ) waitfor( or, timeout ) 4; or else 4;
    237         when( 3 ) waitfor( or, or ) 3; or waitfor( or, 9 ) 4; or when( or ) timeout( timeout ) 4;
    238         when( 3 ) waitfor( or, 3 ) 3; or waitfor( or, 7 ) or; or timeout( 1 ) or; or when( 3 ) else or;
     231        waitfor( timeout : 7 ) 3;
     232        waitfor( timeout : 7 ) 3; or waitfor( timeout : 7 ) 3;
     233        when( or ) waitfor( or : ) { 4; } or timeout( 1 ) 3;
     234        when( 3 ) waitfor( or : 2 ) 4; or else 4;
     235        when( 3 ) waitfor( or : 3 ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout;
     236        when( 3 ) waitfor( or : or ) 3; or when( or ) waitfor( or : timeout ) 4; or else 4;
     237        when( 3 ) waitfor( or : or ) 3; or waitfor( or : 9 ) 4; or when( or ) timeout( timeout ) 4;
     238        when( 3 ) waitfor( or : 3 ) 3; or waitfor( or : 7 ) or; or timeout( 1 ) or; or when( 3 ) else or;
    239239
    240240        // test else selection
  • tests/concurrent/waitfor/recurse.cfa

    r9fb8f01 r3d5701e  
    6666
    6767        rand_yield();
    68         waitfor( call4, this );
     68        waitfor( call4 : this );
    6969        rand_yield();
    7070
     
    7878
    7979        rand_yield();
    80         waitfor( call3, this );
     80        waitfor( call3 : this );
    8181        rand_yield();
    8282
     
    9292
    9393        rand_yield();
    94         waitfor( call2, this );
     94        waitfor( call2 : this );
    9595        rand_yield();
    9696
  • tests/concurrent/waitfor/statment.cfa

    r9fb8f01 r3d5701e  
    101101
    102102        while( !done ) {
    103                    waitfor( get_index, this );
    104                 or waitfor( call1, this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } }
    105                 or waitfor( call2, this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } }
    106                 or waitfor( call3, this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } }
    107                 or waitfor( call4, this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } }
    108                 or waitfor( call5, this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } }
    109                 or waitfor( call6, this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } }
    110                 or waitfor( call7, this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } }
     103                   waitfor( get_index : this );
     104                or waitfor( call1 : this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } }
     105                or waitfor( call2 : this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } }
     106                or waitfor( call3 : this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } }
     107                or waitfor( call4 : this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } }
     108                or waitfor( call5 : this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } }
     109                or waitfor( call6 : this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } }
     110                or waitfor( call7 : this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } }
    111111
    112112                done = true;
  • tests/concurrent/waitfor/when.cfa

    r9fb8f01 r3d5701e  
    5858void arbiter( global_t & mutex this ) {
    5959        for( int i = 0; i < N; i++ ) {
    60                    when( this.last_call == 6 ) waitfor( call1, this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } }
    61                 or when( this.last_call == 1 ) waitfor( call2, this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } }
    62                 or when( this.last_call == 2 ) waitfor( call3, this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } }
    63                 or when( this.last_call == 3 ) waitfor( call4, this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } }
    64                 or when( this.last_call == 4 ) waitfor( call5, this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } }
    65                 or when( this.last_call == 5 ) waitfor( call6, this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } }
     60                   when( this.last_call == 6 ) waitfor( call1 : this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } }
     61                or when( this.last_call == 1 ) waitfor( call2 : this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } }
     62                or when( this.last_call == 2 ) waitfor( call3 : this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } }
     63                or when( this.last_call == 3 ) waitfor( call4 : this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } }
     64                or when( this.last_call == 4 ) waitfor( call5 : this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } }
     65                or when( this.last_call == 5 ) waitfor( call6 : this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } }
    6666
    6767                sout | this.last_call;
  • tests/config.py.in

    r9fb8f01 r3d5701e  
    88BUILDDIR = "@abs_builddir@"
    99HOSTARCH = "@host_cpu@"
     10DISTRIBUTE = @HAS_DISTCC@
  • tests/errors/.expect/completeType.txt

    r9fb8f01 r3d5701e  
    1 completeTypeError.cfa:34:1 error: Cannot choose between 2 alternatives for expression
     1errors/completeType.cfa:34:1 error: Cannot choose between 2 alternatives for expression
    22Generated Cast of:
    33  Applying untyped:
     
    1010      Application of
    1111        Variable Expression: *?: forall
    12           DT: object type
     12          DT: data type
    1313          function
    1414        ... with parameters
     
    3333      Application of
    3434        Variable Expression: *?: forall
    35           DT: object type
     35          DT: data type
    3636          function
    3737        ... with parameters
     
    5454
    5555
    56 completeTypeError.cfa:35:1 error: No reasonable alternatives for expression Applying untyped:
     56errors/completeType.cfa:35:1 error: No reasonable alternatives for expression Applying untyped:
    5757  Name: foo
    5858...to:
    5959  Name: v
    6060
    61 completeTypeError.cfa:36:1 error: No reasonable alternatives for expression Applying untyped:
     61errors/completeType.cfa:36:1 error: No reasonable alternatives for expression Applying untyped:
    6262  Name: baz
    6363...to:
    6464  Name: v
    6565
    66 completeTypeError.cfa:37:1 error: No reasonable alternatives for expression Applying untyped:
     66errors/completeType.cfa:37:1 error: No reasonable alternatives for expression Applying untyped:
    6767  Name: quux
    6868...to:
    6969  Name: v
    7070
    71 completeTypeError.cfa:59:1 error: No reasonable alternatives for expression Applying untyped:
     71errors/completeType.cfa:59:1 error: No reasonable alternatives for expression Applying untyped:
    7272  Name: baz
    7373...to:
    7474  Name: y
    7575
    76 completeTypeError.cfa:60:1 error: No reasonable alternatives for expression Applying untyped:
     76errors/completeType.cfa:60:1 error: No reasonable alternatives for expression Applying untyped:
    7777  Name: quux
    7878...to:
    7979  Name: y
    8080
    81 completeTypeError.cfa:72:1 error: No alternatives with satisfiable assertions for Applying untyped:
     81errors/completeType.cfa:72:1 error: No alternatives with satisfiable assertions for Applying untyped:
    8282  Name: baz
    8383...to:
     
    8787Cost ( 0, 1, 0, 0, 1, -5, 0 ): Application of
    8888            Variable Expression: baz: forall
    89               T: sized object type
     89              T: sized data type
    9090              ... with assertions
    9191                ?=?: pointer to function
  • tests/exceptions/except-0.cfa

    r9fb8f01 r3d5701e  
    1919};
    2020
    21 void ?{}(signal_exit * this, const char * area) {
    22         this->area = area;
    23 }
    24 
    25 void ^?{}(signal_exit * this) {
    26         printf("Exiting: %s\n", this->area);
     21void ?{}(signal_exit & this, const char * area) {
     22        this.area = area;
     23}
     24
     25void ^?{}(signal_exit & this) {
     26        printf("Exiting: %s\n", this.area);
    2727//      sout | "Exiting:" | this->area;
    2828}
     
    242242
    243243        // Uncaught termination test.
     244        /* Removed due to non-deterministic output.
    244245        printf("Throw uncaught.\n");
    245246        yang z;
    246247        terminate(&z);
    247 }
     248        */
     249}
  • tests/exceptions/except-2.cfa

    r9fb8f01 r3d5701e  
    1212        struct TABLE(BASE_EXCEPT) const * parent;
    1313        size_t size;
    14         void (*copy)(num_error *this, num_error * other);
    15         void (*free)(num_error *this);
     14        void (*copy)(num_error &this, num_error & other);
     15        void (*free)(num_error &this);
    1616        const char * (*msg)(num_error *this);
    1717        int (*code)(num_error *this);
     
    2828        if ( ! this->msg ) {
    2929                static const char * base = "Num Error with code: X";
    30                 this->msg = malloc(22);
     30                this->msg = (char *)malloc(22);
    3131                for (int i = 0 ; (this->msg[i] = base[i]) ; ++i);
    3232        }
     
    3434        return this->msg;
    3535}
    36 void ?{}(num_error * this, int num) {
    37         this->virtual_table = &INSTANCE(num_error);
    38         this->msg = 0;
    39         this->num = num;
     36void ?{}(num_error & this, int num) {
     37        this.virtual_table = &INSTANCE(num_error);
     38        this.msg = 0;
     39        this.num = num;
    4040}
    41 void ?{}(num_error * this, num_error * other) {
    42         this->virtual_table = other->virtual_table;
    43         this->msg = 0;
    44         this->num = other->num;
     41void ?{}(num_error & this, num_error & other) {
     42        this.virtual_table = other.virtual_table;
     43        this.msg = 0;
     44        this.num = other.num;
    4545}
    46 void ^?{}(num_error * this) {
    47         if( this->msg ) free( this->msg );
     46void ^?{}(num_error & this) {
     47        if( this.msg ) free( this.msg );
    4848}
    4949int num_error_code( num_error * this ) {
  • tests/expression.cfa

    r9fb8f01 r3d5701e  
     1struct S { int i; };
     2void ?{}( S & s, int i ) { s.i = i; }
     3int ?`mary( int );
     4int ?`mary( S );
     5[int] ?`mary( [int, int] );
     6int & ?`jane( int & );
     7int jack( int );
     8
    19int main() {
    2     struct s { int i; } x, *p = &x;
    3     int i = 3;
     10    int a[3] = { 0, 0, 0 };
     11    S s = { 3 }, * ps = &s;
     12    [int] t = { 3 };
     13    * [int] pt = &t;
     14    int i = 1, j = 2;
    415
    516    // operators
    617
    7     ! i;
     18    !i;
    819    ~i;
    920    +i;
    1021    -i;
    11     *p;
    12     ++p;
    13     --p;
    14     p++;
    15     p--;
     22    *ps;
     23    ++ps;
     24    --ps;
     25    ps++;
     26    ps--;
    1627
    17     i+i;
    18     i-i;
    19     i*i;
     28    i + j;
     29    i - j;
     30    i * j;
    2031
    21     i/i;
    22     i%i;
    23     i^i;
    24     i&i;
    25     i|i;
    26     i<i;
    27     i>i;
    28     i=i;
     32    i / j;
     33    i % j;
     34    i ^ j;
     35    i & j;
     36    i | j;
     37    i < j;
     38    i > j;
     39    i = j;
    2940
    30     i==i;
    31     i!=i;
    32     i<<i;
    33     i>>i;
    34     i<=i;
    35     i>=i;
    36     i&&i;
    37     i||i;
    38     p->i;
    39     i*=i;
    40     i/=i;
    41     i%=i;
    42     i+=i;
    43     i-=i;
    44     i&=i;
    45     i|=i;
    46     i^=i;
    47     i<<=i;
    48     i>>=i;
     41    i == j;
     42    i != j;
     43    i << j;
     44    i >> j;
     45    i <= j;
     46    i >= j;
     47    i && j;
     48    i || j;
     49    ps->i;
    4950
    50     i?i:i;
     51    i *= j;
     52    i /= j;
     53    i %= j;
     54    i += j;
     55    i -= j;
     56    i &= j;
     57    i |= j;
     58    i ^= j;
     59    i <<= j;
     60    i >>= j;
     61
     62    i ? i : j;
     63
     64    // postfix function call
     65
     66    (3 + 4)`mary;
     67    ({3 + 4;})`mary;
     68    [3, 4]`mary;
     69    3`mary;
     70    a[0]`mary;
     71    a[0]`mary`mary;
     72    s{0}`mary;
     73    a[3]`jane++;
     74    jack(3)`mary;
     75    s.i`mary;
     76    t.0`mary;
     77    s.[i]`mary;
     78    ps->i`mary;
     79    pt->0`mary;
     80    ps->[i]`mary;
     81    i++`mary;
     82    i--`mary;
     83    (S){2}`mary;
     84    (S)@{2}`mary;
    5185} // main
  • tests/heap.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Tue Nov  6 17:54:56 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 19 08:22:34 2019
    13 // Update Count     : 19
     12// Last Modified On : Sun Nov 24 12:34:51 2019
     13// Update Count     : 28
    1414//
    1515
     
    3838        enum { NoOfAllocs = 5000, NoOfMmaps = 10 };
    3939        char * locns[NoOfAllocs];
    40         int i;
     40        size_t amount;
     41        enum { limit = 64 * 1024 };                                                     // check alignments up to here
    4142
    4243        // check alloc/free
     
    7475                size_t s = (i + 1) * 20;
    7576                char * area = (char *)malloc( s );
    76                 if ( area == 0 ) abort( "malloc/free out of memory" );
     77                if ( area == 0p ) abort( "malloc/free out of memory" );
    7778                area[0] = '\345'; area[s - 1] = '\345';                 // fill first/last
    7879                area[malloc_usable_size( area ) - 1] = '\345';  // fill ultimate byte
     
    8384                size_t s = i + 1;                                                               // +1 to make initialization simpler
    8485                locns[i] = (char *)malloc( s );
    85                 if ( locns[i] == 0 ) abort( "malloc/free out of memory" );
     86                if ( locns[i] == 0p ) abort( "malloc/free out of memory" );
    8687                locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last
    8788                locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte
     
    99100                size_t s = i + default_mmap_start();                    // cross over point
    100101                char * area = (char *)malloc( s );
    101                 if ( area == 0 ) abort( "malloc/free out of memory" );
     102                if ( area == 0p ) abort( "malloc/free out of memory" );
    102103                area[0] = '\345'; area[s - 1] = '\345';                 // fill first/last
    103104                area[malloc_usable_size( area ) - 1] = '\345';  // fill ultimate byte
     
    108109                size_t s = i + default_mmap_start();                    // cross over point
    109110                locns[i] = (char *)malloc( s );
    110                 if ( locns[i] == 0 ) abort( "malloc/free out of memory" );
     111                if ( locns[i] == 0p ) abort( "malloc/free out of memory" );
    111112                locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last
    112113                locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte
     
    124125                size_t s = (i + 1) * 20;
    125126                char * area = (char *)calloc( 5, s );
    126                 if ( area == 0 ) abort( "calloc/free out of memory" );
     127                if ( area == 0p ) abort( "calloc/free out of memory" );
    127128                if ( area[0] != '\0' || area[s - 1] != '\0' ||
    128129                         area[malloc_usable_size( area ) - 1] != '\0' ||
     
    136137                size_t s = i + 1;
    137138                locns[i] = (char *)calloc( 5, s );
    138                 if ( locns[i] == 0 ) abort( "calloc/free out of memory" );
     139                if ( locns[i] == 0p ) abort( "calloc/free out of memory" );
    139140                if ( locns[i][0] != '\0' || locns[i][s - 1] != '\0' ||
    140141                         locns[i][malloc_usable_size( locns[i] ) - 1] != '\0' ||
     
    155156                size_t s = i + default_mmap_start();                    // cross over point
    156157                char * area = (char *)calloc( 1, s );
    157                 if ( area == 0 ) abort( "calloc/free out of memory" );
     158                if ( area == 0p ) abort( "calloc/free out of memory" );
    158159                if ( area[0] != '\0' || area[s - 1] != '\0' ) abort( "calloc/free corrupt storage4.1" );
    159160                if ( area[malloc_usable_size( area ) - 1] != '\0' ) abort( "calloc/free corrupt storage4.2" );
     
    167168                size_t s = i + default_mmap_start();                    // cross over point
    168169                locns[i] = (char *)calloc( 1, s );
    169                 if ( locns[i] == 0 ) abort( "calloc/free out of memory" );
     170                if ( locns[i] == 0p ) abort( "calloc/free out of memory" );
    170171                if ( locns[i][0] != '\0' || locns[i][s - 1] != '\0' ||
    171172                         locns[i][malloc_usable_size( locns[i] ) - 1] != '\0' ||
     
    183184        // check memalign/free (sbrk)
    184185
    185         enum { limit = 64 * 1024 };                                                     // check alignments up to here
    186 
    187186        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
    188187                //sout | alignments[a];
    189188                for ( s; 1 ~ NoOfAllocs ) {                                             // allocation of size 0 can return null
    190189                        char * area = (char *)memalign( a, s );
    191                         if ( area == 0 ) abort( "memalign/free out of memory" );
    192                         //sout | i | " " | area;
     190                        if ( area == 0p ) abort( "memalign/free out of memory" );
     191                        //sout | i | area;
    193192                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    194193                                abort( "memalign/free bad alignment : memalign(%d,%d) = %p", (int)a, s, area );
    195194                        } // if
    196                         area[0] = '\345'; area[s - 1] = '\345'; // fill first/last byte
     195                        area[0] = '\345'; area[s - 1] = '\345';         // fill first/last byte
    197196                        area[malloc_usable_size( area ) - 1] = '\345'; // fill ultimate byte
    198197                        free( area );
     
    207206                        size_t s = i + default_mmap_start();            // cross over point
    208207                        char * area = (char *)memalign( a, s );
    209                         if ( area == 0 ) abort( "memalign/free out of memory" );
    210                         //sout | i | " " | area;
     208                        if ( area == 0p ) abort( "memalign/free out of memory" );
     209                        //sout | i | area;
    211210                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    212211                                abort( "memalign/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)s, area );
     
    223222                // initial N byte allocation
    224223                char * area = (char *)calloc( 5, i );
    225                 if ( area == 0 ) abort( "calloc/realloc/free out of memory" );
     224                if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
    226225                if ( area[0] != '\0' || area[i - 1] != '\0' ||
    227226                         area[malloc_usable_size( area ) - 1] != '\0' ||
     
    231230                for ( s; i ~ 256 * 1024 ~ 26 ) {                                // start at initial memory request
    232231                        area = (char *)realloc( area, s );                      // attempt to reuse storage
    233                         if ( area == 0 ) abort( "calloc/realloc/free out of memory" );
     232                        if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
    234233                        if ( area[0] != '\0' || area[s - 1] != '\0' ||
    235234                                 area[malloc_usable_size( area ) - 1] != '\0' ||
     
    245244                size_t s = i + default_mmap_start();                    // cross over point
    246245                char * area = (char *)calloc( 1, s );
    247                 if ( area == 0 ) abort( "calloc/realloc/free out of memory" );
     246                if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
    248247                if ( area[0] != '\0' || area[s - 1] != '\0' ||
    249248                         area[malloc_usable_size( area ) - 1] != '\0' ||
     
    253252                for ( r; i ~ 256 * 1024 ~ 26 ) {                                // start at initial memory request
    254253                        area = (char *)realloc( area, r );                      // attempt to reuse storage
    255                         if ( area == 0 ) abort( "calloc/realloc/free out of memory" );
     254                        if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
    256255                        if ( area[0] != '\0' || area[r - 1] != '\0' ||
    257256                                 area[malloc_usable_size( area ) - 1] != '\0' ||
     
    263262        // check memalign/realloc/free
    264263
    265         size_t amount = 2;
     264        amount = 2;
    266265        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
    267266                // initial N byte allocation
    268267                char * area = (char *)memalign( a, amount );    // aligned N-byte allocation
    269                 if ( area == 0 ) abort( "memalign/realloc/free out of memory" ); // no storage ?
    270                 //sout | alignments[a] | " " | area;
     268                if ( area == 0p ) abort( "memalign/realloc/free out of memory" ); // no storage ?
     269                //sout | alignments[a] | area;
    271270                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    272271                        abort( "memalign/realloc/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)amount, area );
     
    278277                        if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "memalign/realloc/free corrupt storage" );
    279278                        area = (char *)realloc( area, s );                      // attempt to reuse storage
    280                         if ( area == 0 ) abort( "memalign/realloc/free out of memory" ); // no storage ?
    281                         //sout | i | " " | area;
     279                        if ( area == 0p ) abort( "memalign/realloc/free out of memory" ); // no storage ?
     280                        //sout | i | area;
    282281                        if ( (size_t)area % a != 0 ) {                          // check for initial alignment
    283282                                abort( "memalign/realloc/free bad alignment %p", area );
     
    294293                for ( s; 1 ~ limit ) {                                                  // allocation of size 0 can return null
    295294                        char * area = (char *)cmemalign( a, 1, s );
    296                         if ( area == 0 ) abort( "cmemalign/free out of memory" );
    297                         //sout | i | " " | area;
     295                        if ( area == 0p ) abort( "cmemalign/free out of memory" );
     296                        //sout | i | area;
    298297                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    299298                                abort( "cmemalign/free bad alignment : cmemalign(%d,%d) = %p", (int)a, s, area );
     
    313312                // initial N byte allocation
    314313                char * area = (char *)cmemalign( a, 1, amount ); // aligned N-byte allocation
    315                 if ( area == 0 ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?
    316                 //sout | alignments[a] | " " | area;
     314                if ( area == 0p ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?
     315                //sout | alignments[a] | area;
    317316                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    318317                        abort( "cmemalign/realloc/free bad alignment : cmemalign(%d,%d) = %p", (int)a, (int)amount, area );
     
    327326                        if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "cmemalign/realloc/free corrupt storage2" );
    328327                        area = (char *)realloc( area, s );                      // attempt to reuse storage
    329                         if ( area == 0 ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?
    330                         //sout | i | " " | area;
     328                        if ( area == 0p ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?
     329                        //sout | i | area;
    331330                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    332331                                abort( "cmemalign/realloc/free bad alignment %p", area );
     
    339338                free( area );
    340339        } // for
     340
     341        // check memalign/realloc with align/free
     342
     343        amount = 2;
     344        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
     345                // initial N byte allocation
     346                char * area = (char *)memalign( a, amount );    // aligned N-byte allocation
     347                if ( area == 0p ) abort( "memalign/realloc with align/free out of memory" ); // no storage ?
     348                //sout | alignments[a] | area | endl;
     349                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
     350                        abort( "memalign/realloc with align/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)amount, area );
     351                } // if
     352                area[0] = '\345'; area[amount - 2] = '\345';    // fill first/penultimate byte
     353
     354                // Do not start this loop index at 0 because realloc of 0 bytes frees the storage.
     355                for ( s; amount ~ 256 * 1024 ) {                                // start at initial memory request
     356                        if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "memalign/realloc/free corrupt storage" );
     357                        area = (char *)realloc( area, a * 2, s );       // attempt to reuse storage
     358                        if ( area == 0p ) abort( "memalign/realloc with align/free out of memory" ); // no storage ?
     359                        //sout | i | area | endl;
     360                        if ( (size_t)area % a * 2 != 0 ) {                      // check for initial alignment
     361                                abort( "memalign/realloc with align/free bad alignment %p", area );
     362                        } // if
     363                        area[s - 1] = '\345';                                           // fill last byte
     364                } // for
     365                free( area );
     366        } // for
     367
     368        // check cmemalign/realloc with align/free
     369
     370        amount = 2;
     371        for ( size_t a = libAlign() + libAlign(); a <= limit; a += a ) { // generate powers of 2
     372                // initial N byte allocation
     373                char *area = (char *)cmemalign( a, 1, amount ); // aligned N-byte allocation
     374                if ( area == 0p ) abort( "cmemalign/realloc with align/free out of memory" ); // no storage ?
     375                //sout | alignments[a] | area | endl;
     376                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
     377                        abort( "cmemalign/realloc with align/free bad alignment : cmemalign(%d,%d) = %p", (int)a, (int)amount, area );
     378                } // if
     379                if ( area[0] != '\0' || area[amount - 1] != '\0' ||
     380                         area[malloc_usable_size( area ) - 1] != '\0' ||
     381                         ! malloc_zero_fill( area ) ) abort( "cmemalign/realloc with align/free corrupt storage1" );
     382                area[0] = '\345'; area[amount - 2] = '\345';    // fill first/penultimate byte
     383
     384                // Do not start this loop index at 0 because realloc of 0 bytes frees the storage.
     385                for ( int s = amount; s < 256 * 1024; s += 1 ) { // start at initial memory request
     386                        if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "cmemalign/realloc with align/free corrupt storage2" );
     387                        area = (char *)realloc( area, a * 2, s );       // attempt to reuse storage
     388                        if ( area == 0p ) abort( "cmemalign/realloc with align/free out of memory" ); // no storage ?
     389                        //sout | i | area | endl;
     390                        if ( (size_t)area % a * 2 != 0 || malloc_alignment( area ) != a * 2 ) { // check for initial alignment
     391                                abort( "cmemalign/realloc with align/free bad alignment %p %jd %jd", area, malloc_alignment( area ), a * 2 );
     392                        } // if
     393                        if ( area[s - 1] != '\0' || area[s - 1] != '\0' ||
     394                                 area[malloc_usable_size( area ) - 1] != '\0' ||
     395                                 ! malloc_zero_fill( area ) ) abort( "cmemalign/realloc/free corrupt storage3" );
     396                        area[s - 1] = '\345';                                           // fill last byte
     397                } // for
     398                free( area );
     399        } // for
     400
    341401        //sout | "worker" | thisTask() | "successful completion";
    342402} // Worker main
  • tests/labelledExit.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Wed Aug 10 07:29:39 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:57:42 2018
    13 // Update Count     : 4
     12// Last Modified On : Wed Feb  5 16:49:48 2020
     13// Update Count     : 9
    1414//
    1515
     
    136136        }
    137137
     138        // all nested control options, labelled exits
     139
     140  Comp: {
     141          Try: try {
     142                  For: for ( ;; ) {
     143                          While: while ( true ) {
     144                                  Do: do {
     145                                          If: if ( true ) {
     146                                                  Switch2: switch ( 3 ) {
     147                                                          case 3:
     148                                                                break Try;
     149                                                                break Comp;
     150                                                                break For;              continue For;
     151                                                                break While;    continue While;
     152                                                                break Do;               continue Do;
     153                                                                break If;
     154                                                                break Switch2;
     155                                                        } // switch
     156                                                } // if
     157                                        } while ( true );
     158                                } // while
     159                        } // for
     160                } finally {} // always executed
     161        } // compound
     162
    138163        // computed goto
    139         // {
    140         //      void *array[] = { &&foo, &&bar, &&hack };
    141         //   foo: bar: hack:
    142         //      &&foo;
    143         //      &&bar;
    144         //      goto *array[i];
    145         // }
     164        {
     165                void *array[] = { &&foo, &&bar, &&hack };
     166          foo: bar: hack:
     167                &&foo;
     168                &&bar;
     169                goto *array[i];
     170        }
    146171
    147172  Q: if ( i > 5 ) {
  • tests/linking/withthreads.cfa

    r9fb8f01 r3d5701e  
    3434// Local Variables: //
    3535// tab-width: 4 //
    36 // compile-command: "cfa nothreads.cfa" //
     36// compile-command: "cfa withthreads.cfa" //
    3737// End: //
  • tests/loopctrl.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Wed Aug  8 18:32:59 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 12 12:05:05 2019
    13 // Update Count     : 106
     12// Last Modified On : Thu Dec 12 17:55:26 2019
     13// Update Count     : 108
    1414//
    1515
     
    4343        for ( 1 ) { sout | "A"; }                                                       sout | nl;
    4444        for ( 10 ) { sout | "A"; }                                                      sout | nl;
     45        for ( = 10 ) { sout | "A"; }                                            sout | nl;
    4546        for ( 1 ~= 10 ~ 2 ) { sout | "B"; }                                     sout | nl;
    4647        for ( 10 -~= 1 ~ 2 ) { sout | "C"; }                            sout | nl;
     
    4950
    5051        for ( i; 10 ) { sout | i; }                                                     sout | nl;
     52        for ( i; = 10 ) { sout | i; }                                           sout | nl;
    5153        for ( i; 1 ~= 10 ~ 2 ) { sout | i; }                            sout | nl;
    5254        for ( i; 10 -~= 1 ~ 2 ) { sout | i; }                           sout | nl;
     
    8789        for ( N ) { sout | "N"; }                                                       sout | nl;
    8890        for ( i; N ) { sout | i; }                                                      sout | nl;
     91        for ( i; = N ) { sout | i; }                                            sout | nl;
    8992        for ( i; N -~ 0 ) { sout | i; }                                         sout | nl | nl;
    9093
  • tests/nested-types.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Mon Jul 9 10:20:03 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:59:40 2018
    13 // Update Count     : 2
     12// Last Modified On : Wed Feb 12 18:21:15 2020
     13// Update Count     : 3
    1414//
    1515
     
    5050//   double d;
    5151// };
     52
     53// struct S {
     54//     enum C { R, G, B };
     55//     int i;
     56//     struct T {
     57//      int i;
     58//     };
     59//     T t;
     60// };
     61
     62// S s;
     63// S.C c;
     64// S.T t;
    5265
    5366int main() {
  • tests/pybin/settings.py

    r9fb8f01 r3d5701e  
    1414        SRCDIR = os.path.abspath(config.SRCDIR)
    1515        BUILDDIR = os.path.abspath(config.BUILDDIR)
     16        distribute = config.DISTRIBUTE
    1617        os.chdir(testpath)
    1718
     
    8889                self.string = "debug" if value else "no debug"
    8990                self.flags  = """DEBUG_FLAGS=%s""" % ("-debug -O0" if value else "-nodebug -O2")
     91                self.path   = "debug" if value else "nodebug"
    9092
    9193class Install:
    9294        def __init__(self, value):
    93                 self.string = "installed" if value else "in-tree"
    94                 self.flags  = """INSTALL_FLAGS=%s""" % ("" if value else "-in-tree")
     95                if value:
     96                        distribute = False
     97
     98                self.string = "installed" if value else "in tree"
     99                self.flags  = """installed=%s""" % ("yes" if value else "no")
    95100
    96101class Timeouts:
     
    109114def init( options ):
    110115        global arch
     116        global archive
     117        global debug
     118        global distcc
    111119        global dry_run
    112120        global generating
     121        global install
    113122        global make
    114         global debug
    115         global install
     123        global output_width
    116124        global timeout
    117         global output_width
    118         global archive
    119125
    120         dry_run      = options.dry_run
     126        arch         = Architecture(options.arch)
     127        archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
     128        debug        = Debug(options.debug)
     129        dry_run      = options.dry_run # must be called before tools.config_hash()
     130        distcc       = "DISTCC_CFA_PATH=~/.cfadistcc/%s/cfa" % tools.config_hash()
    121131        generating   = options.regenerate_expected
     132        install      = Install(options.install)
    122133        make         = ['make']
    123         debug        = Debug(options.debug)
    124         install      = Install(options.install)
    125         arch         = Architecture(options.arch)
     134        output_width = 24
    126135        timeout      = Timeouts(options.timeout, options.global_timeout)
    127         output_width = 24
    128         archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
    129136
     137        # if we distribute, distcc errors will fail tests, use log file for distcc
     138        # don't use "'DISTCC_LOG' not in os.environ" because it can be set to ''
     139        if distribute and not os.environ.get('DISTCC_LOG'):
     140                os.putenv('DISTCC_LOG', os.path.join(BUILDDIR, 'distcc_error.log'))
    130141
    131142def update_make_cmd(force, jobs):
     
    136147def validate():
    137148        errf = os.path.join(BUILDDIR, ".validate.err")
    138         make_ret, out = tools.make( ".validate", error_file = errf, output=subprocess.DEVNULL, error=subprocess.DEVNULL )
     149        make_ret, out = tools.make( ".validate", error_file = errf, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL )
    139150        if make_ret != 0:
    140151                with open (errf, "r") as myfile:
  • tests/pybin/tools.py

    r9fb8f01 r3d5701e  
    2323
    2424# helper functions to run terminal commands
    25 def sh(*cmd, timeout = False, output = None, input = None, error = subprocess.STDOUT):
    26         cmd = list(cmd)
    27 
    28         # if this is a dry_run, only print the commands that would be ran
    29         if settings.dry_run :
    30                 cmd = "{} cmd: {}".format(os.getcwd(), ' '.join(cmd))
    31                 if output and not isinstance(output, int):
    32                         cmd += " > "
    33                         cmd += output
    34 
    35                 if error and not isinstance(error, int):
    36                         cmd += " 2> "
    37                         cmd += error
    38 
    39                 if input and not isinstance(input, int) and os.path.isfile(input):
    40                         cmd += " < "
    41                         cmd += input
    42 
    43                 print(cmd)
    44                 return 0, None
    45 
    46         with contextlib.ExitStack() as onexit:
    47                 # add input redirection if needed
    48                 input = openfd(input, 'r', onexit, True)
    49 
    50                 # add output redirection if needed
    51                 output = openfd(output, 'w', onexit, False)
    52 
    53                 # add error redirection if needed
    54                 error = openfd(error, 'w', onexit, False)
    55 
    56                 # run the desired command
    57                 try:
    58                         proc = subprocess.run(
     25def sh(*cmd, timeout = False, output_file = None, input_file = None, input_text = None, error = subprocess.STDOUT, ignore_dry_run = False):
     26        try:
     27                cmd = list(cmd)
     28
     29                if input_file and input_text:
     30                        return 401, "Cannot use both text and file inputs"
     31
     32                # if this is a dry_run, only print the commands that would be ran
     33                if settings.dry_run and not ignore_dry_run:
     34                        cmd = "{} cmd: {}".format(os.getcwd(), ' '.join(cmd))
     35                        if output_file and not isinstance(output_file, int):
     36                                cmd += " > "
     37                                cmd += output_file
     38
     39                        if error and not isinstance(error, int):
     40                                cmd += " 2> "
     41                                cmd += error
     42
     43                        if input_file and not isinstance(input_file, int) and os.path.isfile(input_file):
     44                                cmd += " < "
     45                                cmd += input_file
     46
     47                        print(cmd)
     48                        return 0, None
     49
     50                with contextlib.ExitStack() as onexit:
     51                        # add input redirection if needed
     52                        input_file = openfd(input_file, 'r', onexit, True)
     53
     54                        # add output redirection if needed
     55                        output_file = openfd(output_file, 'w', onexit, False)
     56
     57                        # add error redirection if needed
     58                        error = openfd(error, 'w', onexit, False)
     59
     60                        # run the desired command
     61                        # use with statement to make sure proc is cleaned
     62                        # don't use subprocess.run because we want to send SIGABRT on exit
     63                        with subprocess.Popen(
    5964                                cmd,
    60                                 stdin =input,
    61                                 stdout=output,
    62                                 stderr=error,
    63                                 timeout=settings.timeout.single if timeout else None
    64                         )
    65                         return proc.returncode, proc.stdout.decode("utf-8") if proc.stdout else None
    66                 except subprocess.TimeoutExpired:
    67                         return 124, str(None)
     65                                **({'input' : bytes(input_text, encoding='utf-8')} if input_text else {'stdin' : input_file}),
     66                                stdout  = output_file,
     67                                stderr  = error
     68                        ) as proc:
     69
     70                                try:
     71                                        out, _ = proc.communicate(
     72                                                timeout = settings.timeout.single if timeout else None
     73                                        )
     74
     75                                        return proc.returncode, out.decode("utf-8") if out else None
     76                                except subprocess.TimeoutExpired:
     77                                        proc.send_signal(signal.SIGABRT)
     78                                        proc.communicate()
     79                                        return 124, str(None)
     80
     81        except Exception as ex:
     82                print ("Unexpected error: %s" % ex)
     83                raise
    6884
    6985def is_ascii(fname):
     
    7591                return False
    7692
    77         code, out = sh("file %s" % fname, output=subprocess.PIPE)
     93        code, out = sh("file %s" % fname, output_file=subprocess.PIPE)
    7894        if code != 0:
    7995                return False
     
    107123        if isinstance(files, str ): files = [ files ]
    108124        for file in files:
    109                 sh( 'rm', '-f', file, output=subprocess.DEVNULL, error=subprocess.DEVNULL )
     125                sh( 'rm', '-f', file, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL )
    110126
    111127# Create 1 or more directory
     
    115131                p = os.path.normpath( file )
    116132                d = os.path.dirname ( p )
    117                 sh( 'mkdir', '-p', d, output=subprocess.DEVNULL, error=subprocess.DEVNULL )
     133                sh( 'mkdir', '-p', d, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL )
    118134
    119135
     
    138154                lhs,
    139155                rhs,
    140                 output=subprocess.PIPE
     156                output_file=subprocess.PIPE
    141157        )
    142158
    143159# call make
    144 def make(target, *, flags = '', output = None, error = None, error_file = None, silent = False):
     160def make(target, *, flags = '', output_file = None, error = None, error_file = None, silent = False):
    145161        test_param = """test="%s" """ % (error_file) if error_file else None
    146162        cmd = [
     
    151167                settings.debug.flags,
    152168                settings.install.flags,
     169                settings.distcc if settings.distribute else None,
    153170                flags,
    154171                target
    155172        ]
    156173        cmd = [s for s in cmd if s]
    157         return sh(*cmd, output=output, error=error)
     174        return sh(*cmd, output_file=output_file, error=error)
    158175
    159176def which(program):
    160     fpath, fname = os.path.split(program)
    161     if fpath:
    162         if is_exe(program):
    163             return program
    164     else:
    165         for path in os.environ["PATH"].split(os.pathsep):
    166             exe_file = os.path.join(path, program)
    167             if is_exe(exe_file):
    168                 return exe_file
    169 
    170     return None
     177        fpath, fname = os.path.split(program)
     178        if fpath:
     179                if is_exe(program):
     180                        return program
     181        else:
     182                for path in os.environ["PATH"].split(os.pathsep):
     183                        exe_file = os.path.join(path, program)
     184                        if is_exe(exe_file):
     185                                return exe_file
     186        return None
    171187
    172188@contextlib.contextmanager
     
    201217# cat one file into the other
    202218def cat(source, dest):
    203         ret, _ = sh("cat", source, output=dest)
     219        ret, _ = sh("cat", source, output_file=dest)
    204220        return ret
    205221
     
    256272                        os.write(int(make_jobs_fds.group(3)), tokens)
    257273                else :
    258                         options.jobs = multiprocessing.cpu_count()
     274                        if settings.distribute:
     275                                ret, jstr = sh("distcc", "-j", output_file=subprocess.PIPE, ignore_dry_run=True)
     276                                if ret == 0:
     277                                        options.jobs = int(jstr.strip())
     278                                else :
     279                                        options.jobs = multiprocessing.cpu_count()
     280                        else:
     281                                options.jobs = multiprocessing.cpu_count()
    259282        else :
    260283                force = True
     
    274297################################################################################
    275298
     299# get hash for given configuration
     300def config_hash():
     301        path = os.path.normpath(os.path.join(
     302                settings.SRCDIR,
     303        ))
     304
     305        distcc_hash = os.path.join(settings.SRCDIR, '../tools/build/distcc_hash')
     306        config = "%s-%s" % (settings.arch.target, settings.debug.path)
     307        _, out = sh(distcc_hash, config, output_file=subprocess.PIPE, ignore_dry_run=True)
     308        return out.strip()
     309
     310# get pretty string for time of day
    276311def pretty_now():
    277312        ts = time.time()
     
    308343                return 1, "ERR No core dump"
    309344
    310         return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output=subprocess.PIPE)
     345        return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output_file=subprocess.PIPE)
    311346
    312347def core_archive(dst, name, exe):
    313         # Get the files to copy
     348        # Get the core dump
    314349        core = os.path.join(os.getcwd(), "core" )
    315350
    316         # Uncomment if we want timestamps on coredumps
    317         # dst  = os.path.join(dst, "%s_%s" % (name, pretty_now()))
     351        # update the path for this test
     352        dst  = os.path.join(dst, name)
    318353
    319354        # make a directory for this test
    320         mkdir(os.path.join(dst, "dir"))
     355        # mkdir makes the parent directory only so add a dummy
     356        mkdir(os.path.join(dst, name ))
    321357
    322358        # moves the files
     
    328364
    329365class Timed:
    330     def __enter__(self):
    331         self.start = time.time()
    332         return self
    333 
    334     def __exit__(self, *args):
    335         self.end = time.time()
    336         self.duration = self.end - self.start
     366        def __enter__(self):
     367                self.start = time.time()
     368                return self
     369
     370        def __exit__(self, *args):
     371                self.end = time.time()
     372                self.duration = self.end - self.start
    337373
    338374def timed(src, timeout):
    339375        expire = time.time() + timeout
    340376        i = iter(src)
    341         while True:
    342                 yield i.next(max(expire - time.time(), 0))
     377        with contextlib.suppress(StopIteration):
     378                while True:
     379                        yield i.next(max(expire - time.time(), 0))
  • tests/quotedKeyword.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec  4 21:45:53 2018
    13 // Update Count     : 23
     12// Last Modified On : Fri Feb  7 19:07:07 2020
     13// Update Count     : 25
    1414//
    1515
     
    1717
    1818struct {
    19         int `otype`;
    20         int `struct`;
     19        int ``otype;
     20        int ``struct;
    2121} st = { 10, 10 };
    2222
    23 typedef int `forall`;
    24 `forall` xxx = 10;
     23typedef int ``forall;
     24``forall xxx = 10;
    2525
    26 int `_Alignas`, `_Alignof`, `__alignof`, `__alignof__`, `asm`, `__asm`, `__asm__`, `_At`, `_Atomic`, `__attribute`,
    27         `__attribute__`, `auto`, `_Bool`, `break`, `case`, `catch`, `catchResume`, `char`, `choose`, `_Complex`, `__complex`,
    28         `__complex__`, `const`, `__const`, `__const__`, `continue`, `default`, `disable`, `do`, `double`, `dtype`, `else`,
    29         `enable`, `enum`, `__extension__`, `extern`, `fallthru`, `finally`, `float`, `__float128`, `for`, `forall`, `fortran`,
    30         `ftype`, `_Generic`, `goto`, `if`, `_Imaginary`, `__imag`, `__imag__`, `inline`, `__inline`, `__inline__`, `int`,
    31         `__int128`, `__label__`, `long`, `lvalue`, `_Noreturn`, `__builtin_offsetof`, `otype`, `register`, `restrict`,
    32         `__restrict`, `__restrict__`, `return`, `short`, `signed`, `__signed`, `__signed__`, `sizeof`, `static`,
    33         `_Static_assert`, `struct`, `switch`, `_Thread_local`, `throw`, `throwResume`, `trait`, `try`, `typedef`,
    34         `typeof`, `__typeof`, `__typeof__`, `union`, `unsigned`, `__builtin_va_list`, `void`, `volatile`, `__volatile`,
    35         `__volatile__`, `while`;
     26int ``_Alignas, ``_Alignof, ``__alignof, ``__alignof__, ``asm, ``__asm, ``__asm__, ``_At, ``_Atomic, ``__attribute,
     27        ``__attribute__, ``auto, ``_Bool, ``break, ``case, ``catch, ``catchResume, ``char, ``choose, ``_Complex, ``__complex,
     28        ``__complex__, ``const, ``__const, ``__const__, ``continue, ``default, ``disable, ``do, ``double, ``dtype, ``else,
     29        ``enable, ``enum, ``__extension__, ``extern, ``fallthru, ``finally, ``float, ``__float128, ``for, ``forall, ``fortran,
     30        ``ftype, ``_Generic, ``goto, ``if, ``_Imaginary, ``__imag, ``__imag__, ``inline, ``__inline, ``__inline__, ``int,
     31        ``__int128, ``__label__, ``long, ``lvalue, ``_Noreturn, ``__builtin_offsetof, ``otype, ``register, ``restrict,
     32        ``__restrict, ``__restrict__, ``return, ``short, ``signed, ``__signed, ``__signed__, ``sizeof, ``static,
     33        ``_Static_assert, ``struct, ``switch, ``_Thread_local, ``throw, ``throwResume, ``trait, ``try, ``typedef,
     34        ``typeof, ``__typeof, ``__typeof__, ``union, ``unsigned, ``__builtin_va_list, ``void, ``volatile, ``__volatile,
     35        ``__volatile__, ``while;
    3636
    3737int main() {
    38         int `if` = 0;
    39         `catch` = 1;
    40         st.`otype` = 2;
    41         st.`struct` = 3;
    42         `throw` = 4;
    43         sout | `catch` + st.`otype` + st.`struct` + `throw`;
     38        int ``if = 0;
     39        ``catch = 1;
     40        st.``otype = 2;
     41        st.``struct = 3;
     42        ``throw = 4;
     43        sout | ``catch + st.``otype + st.``struct + ``throw;
    4444}
    4545
  • tests/raii/dtor-early-exit.cfa

    r9fb8f01 r3d5701e  
    217217}
    218218
     219void i() {
     220        // potential loop
     221        for() {
     222                if(true) continue;
     223                int t = 0;
     224        }
     225}
     226
    219227// TODO: implement __label__ and uncomment these lines
    220228void computedGoto() {
  • tests/rational.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Mon Mar 28 08:43:12 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 27 07:37:17 2019
    13 // Update Count     : 80
     12// Last Modified On : Sat Feb  8 18:46:23 2020
     13// Update Count     : 86
    1414//
    1515
     
    1919#include <fstream.hfa>
    2020
    21 double convert( int i ) { return (double)i; }
     21typedef Rational(int) RatInt;
     22double convert( int i ) { return (double)i; }                   // used by narrow/widen
    2223int convert( double d ) { return (int)d; }
    2324
    2425int main() {
    2526        sout | "constructor";
    26         Rational(int) a = { 3 }, b = { 4 }, c;
    27         sout | a | b | c;
     27        RatInt a = { 3 }, b = { 4 }, c, d = 0, e = 1;
     28        sout | a | b | c | d | e;
    2829
    29         a = (Rational(int)){ 4, 8 };
    30         b = (Rational(int)){ 5, 7 };
     30        a = (RatInt){ 4, 8 };
     31        b = (RatInt){ 5, 7 };
    3132        sout | a | b;
    32         a = (Rational(int)){ -2, -3 };
    33         b = (Rational(int)){ 3, -2 };
     33        a = (RatInt){ -2, -3 };
     34        b = (RatInt){ 3, -2 };
    3435        sout | a | b;
    35         a = (Rational(int)){ -2, 3 };
    36         b = (Rational(int)){ 3, 2 };
     36        a = (RatInt){ -2, 3 };
     37        b = (RatInt){ 3, 2 };
    3738        sout | a | b;
    3839
    3940        sout | "logical";
    40         a = (Rational(int)){ -2 };
    41         b = (Rational(int)){ -3, 2 };
     41        a = (RatInt){ -2 };
     42        b = (RatInt){ -3, 2 };
    4243        sout | a | b;
    4344//      sout | a == 1; // FIX ME
     
    5859
    5960        sout | "conversion";
    60         a = (Rational(int)){ 3, 4 };
     61        a = (RatInt){ 3, 4 };
    6162        sout | widen( a );
    62         a = (Rational(int)){ 1, 7 };
     63        a = (RatInt){ 1, 7 };
    6364        sout | widen( a );
    64         a = (Rational(int)){ 355, 113 };
     65        a = (RatInt){ 355, 113 };
    6566        sout | widen( a );
    6667        sout | narrow( 0.75, 4 );
     
    7475
    7576        sout | "more tests";
    76         Rational(int) x = { 1, 2 }, y = { 2 };
     77        RatInt x = { 1, 2 }, y = { 2 };
    7778        sout | x - y;
    7879        sout | x > y;
     
    8081        sout | y | denominator( y, -2 ) | y;
    8182
    82         Rational(int) z = { 0, 5 };
     83        RatInt z = { 0, 5 };
    8384        sout | z;
    8485
    8586        sout | x | numerator( x, 0 ) | x;
    8687
    87         x = (Rational(int)){ 1, MAX } + (Rational(int)){ 1, MAX };
     88        x = (RatInt){ 1, MAX } + (RatInt){ 1, MAX };
    8889        sout | x;
    89         x = (Rational(int)){ 3, MAX } + (Rational(int)){ 2, MAX };
     90        x = (RatInt){ 3, MAX } + (RatInt){ 2, MAX };
    9091        sout | x;
    9192
  • tests/references.cfa

    r9fb8f01 r3d5701e  
    119119                f( 3, a + b, (S){ 1.0, 7.0 }, (int [3]){ 1, 2, 3 } ); // two rvalue to reference
    120120        }
     121
     122        {
     123                int a = 3;
     124                int *p = &a;
     125                asm (
     126                        "incl %[p]\n\t"
     127                        : [p] "+m" (*p)
     128                );
     129                printf("%d\n", a);
     130        }
    121131}
    122132
  • tests/test.py

    r9fb8f01 r3d5701e  
    1010import tempfile
    1111import time
     12
     13import os
     14import psutil
     15import signal
    1216
    1317################################################################################
     
    143147        # build, skipping to next test on error
    144148        with Timed() as comp_dur:
    145                 make_ret, _ = make( test.target(), output=subprocess.DEVNULL, error=out_file, error_file = err_file )
     149                make_ret, _ = make( test.target(), output_file=subprocess.DEVNULL, error=out_file, error_file = err_file )
    146150
    147151        run_dur = None
    148152        # run everything in a temp directory to make sure core file are handled properly
    149153        with tempdir():
    150                 # if the make command succeds continue otherwise skip to diff
     154                # if the make command succeeds continue otherwise skip to diff
    151155                if success(make_ret):
    152156                        with Timed() as run_dur:
    153157                                if settings.dry_run or is_exe(exe_file):
    154158                                        # run test
    155                                         retcode, _ = sh(exe_file, output=out_file, input=in_file, timeout=True)
     159                                        retcode, _ = sh(exe_file, output_file=out_file, input_file=in_file, timeout=True)
    156160                                else :
    157161                                        # simply cat the result into the output
     
    210214        except KeyboardInterrupt:
    211215                return False, ""
    212         except:
    213                 print("Unexpected error in worker thread", file=sys.stderr)
     216        except Exception as ex:
     217                print("Unexpected error in worker thread: %s" % ex, file=sys.stderr)
    214218                sys.stderr.flush()
    215219                return False, ""
     
    219223def run_tests(tests, jobs) :
    220224        # clean the sandbox from previous commands
    221         make('clean', output=subprocess.DEVNULL, error=subprocess.DEVNULL)
     225        make('clean', output_file=subprocess.DEVNULL, error=subprocess.DEVNULL)
     226
     227        # since python prints stacks by default on a interrupt, redo the interrupt handling to be silent
     228        def worker_init():
     229                def sig_int(signal_num, frame):
     230                        pass
     231
     232                signal.signal(signal.SIGINT, sig_int)
    222233
    223234        # create the executor for our jobs and handle the signal properly
    224         pool = multiprocessing.Pool(jobs)
     235        pool = multiprocessing.Pool(jobs, worker_init)
    225236
    226237        failed = False
     238
     239        def stop(x, y):
     240                print("Tests interrupted by user", file=sys.stderr)
     241                sys.exit(1)
     242        signal.signal(signal.SIGINT, stop)
    227243
    228244        # for each test to run
     
    260276
    261277        # clean the workspace
    262         make('clean', output=subprocess.DEVNULL, error=subprocess.DEVNULL)
     278        make('clean', output_file=subprocess.DEVNULL, error=subprocess.DEVNULL)
    263279
    264280        return 1 if failed else 0
  • tests/time.cfa

    r9fb8f01 r3d5701e  
    1010// Created On       : Tue Mar 27 17:24:56 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec 20 23:09:21 2018
    13 // Update Count     : 23
     12// Last Modified On : Sun Jan  5 18:27:37 2020
     13// Update Count     : 34
    1414//
    1515
     
    2020        Duration d1 = 3`h, d2 = 2`s, d3 = 3.375`s, d4 = 12`s, d5 = 1`s + 10_000`ns;
    2121        sout | d1 | d2 | d3 | d4 | d5;
    22         int i;
    2322        d1 = 0;
    2423        sout | d1 | d2 | d3;
     
    3534        sout | t;
    3635        t = t + d1;
    37         sout | t | t.tv;
     36        sout | t | t`ns;
    3837        Time t1 = (timespec){ 104_414, 10_000_000 };
    39         sout | t1 | t1.tv;
    40         sout | t - t  | t + d5 | t.tv;
    41         char buf[16];
     38        sout | t1 | t1`ns;
     39        sout | t - t  | t + d5 | t`ns;
     40        char buf[64];
    4241        sout | "yy/mm/dd" | [t, buf]`ymd | nonl;                        // shared buf => separate calls
    4342        sout | "mm/dd/yy" | mm_dd_yy( t, buf ) | nonl;
     
    4645        sout | "dd/yy/mm" | [t, buf]`dmy;
    4746        Time t2 = { 2001, 7, 4, 0, 0, 1, 0 }, t3 = (timeval){ 994_219_201 };
    48         sout | t2 | t2.tv | nl | t3 | t3.tv;
     47        sout | t2 | t2`ns | nl | t3 | t3`ns;
    4948        sout | nl;
    5049
     
    6362        sout | "Dividing that by 2 gives" | s / 2 | "seconds";
    6463        sout | s | "seconds is" | s`h | "hours," | (s % 1`h)`m | "minutes," | (s % 1`m)`s | "seconds";
     64
     65    t1 = (Time){ 2020, 1, 5, 9, 0, 0, 100000000000LL };
     66    t2 = (Time){ 1969, 13, 5, 9 };
     67    t3 = (Time){ 1970, 25, 366, 48, 120, -120, 60000000000LL };
     68    strftime( buf, 128, "%Y %b %e %H:%M:%S (GMT)", t1 );
     69    sout | buf;
     70    strftime( buf, 128, "%Y %b %e %H:%M:%S (GMT)", t2 );
     71    sout | buf;
     72    strftime( buf, 128, "%Y %b %e %H:%M:%S (GMT)", t3 );
     73    sout | buf;
    6574} // main
    6675
  • tests/userLiterals.cfa

    r9fb8f01 r3d5701e  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // user_literals.cfa --
     7// userLiterals.cfa --
    88//
    99// Author           : Peter A. Buhr
    1010// Created On       : Wed Sep  6 21:40:50 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec  4 22:03:10 2018
    13 // Update Count     : 56
     12// Last Modified On : Wed Feb 19 07:48:45 2020
     13// Update Count     : 74
    1414//
    1515
     
    2424int ?`__thingy_( int x ) { sout | "_thingy_" | x; return x; }
    2525
    26 int ?`s( const char * s ) { sout | "secs" | s; return 0; }
    27 int ?`m( const char16_t * m ) { sout | "mins" | m; return 0;}
    28 int ?`h( const char32_t * h ) { sout | "hours" | h; return 0; }
     26int ?`s( const char * s ) { sout | "s" | s; return 0; }
     27int ?`m( const char16_t * m ) { sout | "m" | m; return 0;}
     28int ?`h( const char32_t * h ) { sout | "h" | h; return 0; }
    2929int ?`_A_( const wchar_t * str ) { sout | "_A_" | str; return 0; }
    3030int ?`__thingy_( const char * str ) { sout | "_thingy_" | str; return 0; }
     
    3737        return (Weight){ l.stones + r.stones };
    3838}
    39 ofstream & ?|?( ofstream & os, Weight w ) { return os | w.stones; }
     39ofstream & ?|?( ofstream & os, Weight w ) { return os | wd(1,1, w.stones); }
     40void ?|?( ofstream & os, Weight w ) { (ofstream)(os | w); ends( os ); }
    4041
    4142Weight ?`st( double w ) { return (Weight){ w }; }               // backquote for user literals
     
    6061        sout | w;
    6162
    62 //      0`secs;
     63        0`s;
    6364        1`s;
    6465        23`s;
     
    8283
    8384        "abc"`s;
    84 //      u"abc"`m;
    85 //      U_"abc"`h;
    86 //      L"abc"`_A_;
     85        // FIX ME: requires char16_t, char32_t, and wchar_t be unique types
     86        // u"abc"`m;
     87        // U_"abc"`h;
     88        // L"abc"`_A_;
    8789        u8_"abc"`__thingy_;
    8890} // main
     
    9092// Local Variables: //
    9193// tab-width: 4 //
    92 // compile-command: "cfa user_literals.cfa" //
     94// compile-command: "cfa userLiterals.cfa" //
    9395// End: //
Note: See TracChangeset for help on using the changeset viewer.