Changes in / [53bb8f1:9d9a451]


Ignore:
Files:
17 added
31 deleted
107 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    r53bb8f1 r9d9a451  
    1010config.py
    1111stamp-h1
    12 libtool
    1312/Makefile
    1413**/Makefile
     
    5049libcfa/arm-nolib/
    5150
     51
    5252# generated by bison and lex from parser.yy and lex.ll
    5353src/Parser/parser.output
  • Makefile.am

    r53bb8f1 r9d9a451  
    1111## Created On       : Sun May 31 22:14:18 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Sat Feb  2 16:54:42 2019
    14 ## Update Count     : 21
     13## Last Modified On : Wed Dec 14 14:20:48 2016
     14## Update Count     : 15
    1515###############################################################################
    1616
     
    1818ACLOCAL_AMFLAGS  = -I automake
    1919
    20 MAINTAINERCLEANFILES = lib/* bin/* tests/.deps/* tests/.out/* # order important
     20MAINTAINERCLEANFILES = lib/* bin/* tests/.deps/* tests/.out/*
     21 # order important
    2122
    2223SUBDIRS = driver src . @LIBCFA_TARGET_DIRS@
  • Makefile.in

    r53bb8f1 r9d9a451  
    250250distcleancheck_listfiles = find . -type f -print
    251251ACLOCAL = @ACLOCAL@
     252ALLOCA = @ALLOCA@
    252253AMTAR = @AMTAR@
    253254AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     
    395396AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
    396397ACLOCAL_AMFLAGS = -I automake
    397 MAINTAINERCLEANFILES = lib/* bin/* tests/.deps/* tests/.out/* # order important
     398MAINTAINERCLEANFILES = lib/* bin/* tests/.deps/* tests/.out/*
    398399SUBDIRS = driver src . @LIBCFA_TARGET_DIRS@
    399400noinst_DATA = @LIBCFA_TARGET_MAKEFILES@
     
    927928.PRECIOUS: Makefile
    928929
     930 # order important
    929931
    930932@LIBCFA_TARGET_MAKEFILES@ : Makefile $(srcdir)/libcfa/configure
  • automake/cfa.m4

    r53bb8f1 r9d9a451  
    8080        esac
    8181])
    82 
    83 # http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_compile_flag.m4
    84 AC_DEFUN([M4CFA_CHECK_COMPILE_FLAG],
    85 [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
    86 AS_VAR_PUSHDEF([CACHEVAR],[m4cfa_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
    87 AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
    88         m4cfa_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
    89         _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
    90         AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
    91                 [AS_VAR_SET(CACHEVAR,[yes])],
    92                 [AS_VAR_SET(CACHEVAR,[no])])
    93         _AC_LANG_PREFIX[]FLAGS=$m4cfa_check_save_flags])
    94 AS_VAR_IF(CACHEVAR,yes,
    95         [m4_default([$2], :)],
    96         [m4_default([$3], :)])
    97 AS_VAR_POPDEF([CACHEVAR])dnl
    98 ])dnl M4CFA_CHECK_COMPILE_FLAGS
  • benchmark/Makefile.am

    r53bb8f1 r9d9a451  
    2121include $(top_srcdir)/src/cfa.make
    2222
     23UPPCC = u++
     24
    2325AM_CFLAGS = -O2 -Wall -I$(srcdir) -lrt -pthread
    2426AM_CFAFLAGS = -quiet -in-tree -nodebug
    2527AM_UPPFLAGS = -quiet -nodebug -multi
    2628
    27 BENCH_V_CC = $(__bench_v_CC_$(__quiet))
    28 BENCH_V_CFA = $(__bench_v_CFA_$(__quiet))
    29 BENCH_V_CXX = $(__bench_v_CXX_$(__quiet))
    30 BENCH_V_GOC = $(__bench_v_GOC_$(__quiet))
    31 BENCH_V_JAVAC = $(__bench_v_JAVAC_$(__quiet))
    32 BENCH_V_UPP = $(__bench_v_UPP_$(__quiet))
    33 
    34 __quiet = verbose
    35 __bench_v_CC_quiet = @
    36 __bench_v_CFA_quiet = @
    37 __bench_v_CXX_quiet = @
    38 __bench_v_GOC_quiet = @
    39 __bench_v_JAVAC_quiet = @
    40 __bench_v_UPP_quiet = @
    41 __bench_v_CC_verbose = $(AM_V_CC)
    42 __bench_v_CFA_verbose = $(AM_V_CFA)
    43 __bench_v_CXX_verbose = $(AM_V_CXX)
    44 __bench_v_GOC_verbose = $(AM_V_GOC)
    45 __bench_v_JAVAC_verbose = $(AM_V_JAVAC)
    46 __bench_v_UPP_verbose = $(AM_V_UPP)
    47 
    48 
    49 
    50 TOOLSDIR = ${abs_top_builddir}/tools/
    51 REPEAT   = ${abs_top_builddir}/tools/repeat
    52 STATS    = ${abs_top_srcdir}/tools/stat.py
     29TOOLSDIR = ${abs_top_srcdir}/tools/
     30REPEAT   = ${TOOLSDIR}repeat
     31STATS    = ${TOOLSDIR}stat.py
    5332repeats  = 30
    5433skipcompile = no
     
    5635PRINT_FORMAT = %20s: #Comments needed for spacing
    5736
    58 # Dummy hack tricks
    59 EXTRA_PROGRAMS = dummy # build but do not install
    60 dummy_SOURCES = dummyC.c dummyCXX.cpp
    61 
    62 dummyC.c:
    63         @echo "int main() { return 0; }" > ${@}
    64 
    65 dummyCXX.cpp:
    66         @echo "int main() { return 0; }" > ${@}
    67 
     37#prevent any tests in parallel
    6838.NOTPARALLEL:
     39
     40#make sure automake includes the compile rules for C and C++
     41EXTRA_PROGRAMS = dummy
     42dummy_SOURCES = c.c cxx.cpp
    6943
    7044## =========================================================================================================
     
    8155
    8256%.runquiet :
    83         @+make $(basename $@) CFLAGS="-w" __quiet=quiet
     57        @+make $(basename $@) CFLAGS="-w"
    8458        @taskset -c 1 ./a.out
    8559        @rm -f a.out
     
    9064
    9165${REPEAT} :
    92         @+make -C ${abs_top_builddir}/tools repeat
     66        @+make -C ${TOOLSDIR} repeat
    9367
    9468## =========================================================================================================
     
    131105## =========================================================================================================
    132106loop$(EXEEXT):
    133         $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c
     107        $(AM_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c
    134108
    135109function$(EXEEXT):
    136         $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/function.c
     110        $(AM_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/function.c
    137111
    138112fetch_add$(EXEEXT):
    139         $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000000  $(srcdir)/fetch_add.c
     113        $(AM_V_CC)$(COMPILE) -DBENCH_N=500000000  $(srcdir)/fetch_add.c
    140114
    141115## =========================================================================================================
     
    160134
    161135ctxswitch-kos_fibre$(EXEEXT):
    162         $(BENCH_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
     136        $(AM_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
    163137
    164138ctxswitch-kos_fibre2$(EXEEXT):
    165         $(BENCH_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
     139        $(AM_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
    166140endif
    167141
     
    169143
    170144ctxswitch-pthread$(EXEEXT):
    171         $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c
     145        $(AM_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c
    172146
    173147ctxswitch-cfa_coroutine$(EXEEXT):
    174         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_cor.cfa
     148        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_cor.c
    175149
    176150ctxswitch-cfa_thread$(EXEEXT):
    177         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd.cfa
     151        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd.c
    178152
    179153ctxswitch-cfa_thread2$(EXEEXT):
    180         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd2.cfa
     154        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd2.c
    181155
    182156ctxswitch-upp_coroutine$(EXEEXT):
    183         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_cor.cc
     157        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_cor.cc
    184158
    185159ctxswitch-upp_thread$(EXEEXT):
    186         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc
     160        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc
    187161
    188162ctxswitch-goroutine$(EXEEXT):
    189         $(BENCH_V_GOC)go build -o a.out $(srcdir)/ctxswitch/goroutine.go
     163        $(AM_V_GOC)go build -o a.out $(srcdir)/ctxswitch/goroutine.go
    190164
    191165ctxswitch-java_thread$(EXEEXT):
    192         $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java
     166        $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java
    193167        @echo "#!/bin/sh" > a.out
    194168        @echo "java JavaThread" >> a.out
     
    208182
    209183mutex-pthread_lock$(EXEEXT):
    210         $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/mutex/pthreads.c
     184        $(AM_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/mutex/pthreads.c
    211185
    212186mutex-upp$(EXEEXT):
    213         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/upp.cc
     187        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/upp.cc
    214188
    215189mutex-cfa1$(EXEEXT):
    216         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa1.cfa
     190        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa1.c
    217191
    218192mutex-cfa2$(EXEEXT):
    219         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa2.cfa
     193        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa2.c
    220194
    221195mutex-cfa4$(EXEEXT):
    222         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa4.cfa
     196        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa4.c
    223197
    224198mutex-java_thread$(EXEEXT):
    225         $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java
     199        $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java
    226200        @echo "#!/bin/sh" > a.out
    227201        @echo "java JavaThread" >> a.out
     
    238212
    239213signal-pthread_cond$(EXEEXT):
    240         $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=500000  $(srcdir)/schedint/pthreads.c
     214        $(AM_V_CC)$(COMPILE)    -DBENCH_N=500000  $(srcdir)/schedint/pthreads.c
    241215
    242216signal-upp$(EXEEXT):
    243         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedint/upp.cc
     217        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedint/upp.cc
    244218
    245219signal-cfa1$(EXEEXT):
    246         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa1.cfa
     220        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa1.c
    247221
    248222signal-cfa2$(EXEEXT):
    249         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa2.cfa
     223        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa2.c
    250224
    251225signal-cfa4$(EXEEXT):
    252         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa4.cfa
     226        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa4.c
    253227
    254228signal-java_thread$(EXEEXT):
    255         $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
     229        $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
    256230        @echo "#!/bin/sh" > a.out
    257231        @echo "java JavaThread" >> a.out
     
    267241
    268242waitfor-upp$(EXEEXT):
    269         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedext/upp.cc
     243        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedext/upp.cc
    270244
    271245waitfor-cfa1$(EXEEXT):
    272         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa1.cfa
     246        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa1.c
    273247
    274248waitfor-cfa2$(EXEEXT):
    275         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa2.cfa
     249        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa2.c
    276250
    277251waitfor-cfa4$(EXEEXT):
    278         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa4.cfa
     252        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa4.c
    279253
    280254## =========================================================================================================
     
    290264
    291265creation-cfa_coroutine$(EXEEXT):
    292         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.cfa
     266        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.c
    293267
    294268creation-cfa_coroutine_eager$(EXEEXT):
    295         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.cfa  -DEAGER
     269        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.c
    296270
    297271creation-cfa_thread$(EXEEXT):
    298         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_thrd.cfa
     272        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_thrd.c
    299273
    300274creation-upp_coroutine$(EXEEXT):
    301         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_cor.cc
     275        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_cor.cc
    302276
    303277creation-upp_thread$(EXEEXT):
    304         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_thrd.cc
     278        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_thrd.cc
    305279
    306280creation-pthread$(EXEEXT):
    307         $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=250000   $(srcdir)/creation/pthreads.c
     281        $(AM_V_CC)$(COMPILE)    -DBENCH_N=250000   $(srcdir)/creation/pthreads.c
    308282
    309283creation-goroutine$(EXEEXT):
    310         $(BENCH_V_GOC)go build -o a.out $(srcdir)/creation/goroutine.go
     284        $(AM_V_GOC)go build -o a.out $(srcdir)/creation/goroutine.go
    311285
    312286creation-java_thread$(EXEEXT):
    313         $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
     287        $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
    314288        @echo "#!/bin/sh" > a.out
    315289        @echo "java JavaThread" >> a.out
     
    332306
    333307compile-array$(EXEEXT):
    334         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/array.cfa
     308        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/array.c
    335309
    336310compile-attributes$(EXEEXT):
    337         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa
     311        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa
    338312
    339313compile-empty$(EXEEXT):
    340         @$(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.cfa
     314        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.c
    341315
    342316compile-expression$(EXEEXT):
    343         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.cfa
     317        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.c
    344318
    345319compile-io$(EXEEXT):
    346         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.cfa
     320        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.c
    347321
    348322compile-monitor$(EXEEXT):
    349         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.cfa
     323        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.c
    350324
    351325compile-operators$(EXEEXT):
    352         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.cfa
     326        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.c
    353327
    354328compile-thread$(EXEEXT):
    355         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.cfa
     329        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.c
    356330
    357331compile-typeof$(EXEEXT):
    358         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.cfa
    359 
     332        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.c
     333
  • benchmark/Makefile.in

    r53bb8f1 r9d9a451  
    111111CONFIG_CLEAN_FILES =
    112112CONFIG_CLEAN_VPATH_FILES =
    113 am_dummy_OBJECTS = dummyC.$(OBJEXT) dummyCXX.$(OBJEXT)
     113am_dummy_OBJECTS = c.$(OBJEXT) cxx.$(OBJEXT)
    114114dummy_OBJECTS = $(am_dummy_OBJECTS)
    115115dummy_LDADD = $(LDADD)
     
    200200DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    201201ACLOCAL = @ACLOCAL@
     202ALLOCA = @ALLOCA@
    202203AMTAR = @AMTAR@
    203204AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     
    363364am__v_GOC_0 = @echo "  GOC     " $@;
    364365am__v_GOC_1 =
    365 UPPCC = u++
    366366UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
    367367AM_V_UPP = $(am__v_UPP_@AM_V@)
     
    371371
    372372# applies to both programs
     373UPPCC = u++
    373374AM_CFLAGS = -O2 -Wall -I$(srcdir) -lrt -pthread
    374375AM_CFAFLAGS = -quiet -in-tree -nodebug
    375376AM_UPPFLAGS = -quiet -nodebug -multi
    376 BENCH_V_CC = $(__bench_v_CC_$(__quiet))
    377 BENCH_V_CFA = $(__bench_v_CFA_$(__quiet))
    378 BENCH_V_CXX = $(__bench_v_CXX_$(__quiet))
    379 BENCH_V_GOC = $(__bench_v_GOC_$(__quiet))
    380 BENCH_V_JAVAC = $(__bench_v_JAVAC_$(__quiet))
    381 BENCH_V_UPP = $(__bench_v_UPP_$(__quiet))
    382 __quiet = verbose
    383 __bench_v_CC_quiet = @
    384 __bench_v_CFA_quiet = @
    385 __bench_v_CXX_quiet = @
    386 __bench_v_GOC_quiet = @
    387 __bench_v_JAVAC_quiet = @
    388 __bench_v_UPP_quiet = @
    389 __bench_v_CC_verbose = $(AM_V_CC)
    390 __bench_v_CFA_verbose = $(AM_V_CFA)
    391 __bench_v_CXX_verbose = $(AM_V_CXX)
    392 __bench_v_GOC_verbose = $(AM_V_GOC)
    393 __bench_v_JAVAC_verbose = $(AM_V_JAVAC)
    394 __bench_v_UPP_verbose = $(AM_V_UPP)
    395 TOOLSDIR = ${abs_top_builddir}/tools/
    396 REPEAT = ${abs_top_builddir}/tools/repeat
    397 STATS = ${abs_top_srcdir}/tools/stat.py
     377TOOLSDIR = ${abs_top_srcdir}/tools/
     378REPEAT = ${TOOLSDIR}repeat
     379STATS = ${TOOLSDIR}stat.py
    398380repeats = 30
    399381skipcompile = no
    400382TIME_FORMAT = "%E"
    401383PRINT_FORMAT = %20s: #Comments needed for spacing
    402 dummy_SOURCES = dummyC.c dummyCXX.cpp
     384dummy_SOURCES = c.c cxx.cpp
    403385CTXSWITCH_DEPEND = loop.run function.run fetch_add.run \
    404386        ctxswitch-pthread.run ctxswitch-cfa_coroutine.run \
     
    453435        -rm -f *.tab.c
    454436
    455 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummyC.Po@am__quote@
    456 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummyCXX.Po@am__quote@
     437@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c.Po@am__quote@
     438@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxx.Po@am__quote@
    457439
    458440.c.o:
     
    724706        $(am__mv) $$depbase.Tpo $$depbase.Plo
    725707
    726 dummyC.c:
    727         @echo "int main() { return 0; }" > ${@}
    728 
    729 dummyCXX.cpp:
    730         @echo "int main() { return 0; }" > ${@}
    731 
     708#prevent any tests in parallel
    732709.NOTPARALLEL:
    733710
     
    744721
    745722%.runquiet :
    746         @+make $(basename $@) CFLAGS="-w" __quiet=quiet
     723        @+make $(basename $@) CFLAGS="-w"
    747724        @taskset -c 1 ./a.out
    748725        @rm -f a.out
     
    753730
    754731${REPEAT} :
    755         @+make -C ${abs_top_builddir}/tools repeat
     732        @+make -C ${TOOLSDIR} repeat
    756733
    757734jenkins$(EXEEXT):
     
    791768
    792769loop$(EXEEXT):
    793         $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c
     770        $(AM_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c
    794771
    795772function$(EXEEXT):
    796         $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/function.c
     773        $(AM_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/function.c
    797774
    798775fetch_add$(EXEEXT):
    799         $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000000  $(srcdir)/fetch_add.c
     776        $(AM_V_CC)$(COMPILE) -DBENCH_N=500000000  $(srcdir)/fetch_add.c
    800777
    801778@WITH_LIBFIBRE_TRUE@ctxswitch-kos_fibre$(EXEEXT):
    802 @WITH_LIBFIBRE_TRUE@    $(BENCH_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
     779@WITH_LIBFIBRE_TRUE@    $(AM_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
    803780
    804781@WITH_LIBFIBRE_TRUE@ctxswitch-kos_fibre2$(EXEEXT):
    805 @WITH_LIBFIBRE_TRUE@    $(BENCH_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
     782@WITH_LIBFIBRE_TRUE@    $(AM_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
    806783
    807784ctxswitch$(EXEEXT): $(CTXSWITCH_DEPEND)
    808785
    809786ctxswitch-pthread$(EXEEXT):
    810         $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c
     787        $(AM_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c
    811788
    812789ctxswitch-cfa_coroutine$(EXEEXT):
    813         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_cor.cfa
     790        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_cor.c
    814791
    815792ctxswitch-cfa_thread$(EXEEXT):
    816         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd.cfa
     793        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd.c
    817794
    818795ctxswitch-cfa_thread2$(EXEEXT):
    819         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd2.cfa
     796        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd2.c
    820797
    821798ctxswitch-upp_coroutine$(EXEEXT):
    822         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_cor.cc
     799        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_cor.cc
    823800
    824801ctxswitch-upp_thread$(EXEEXT):
    825         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc
     802        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc
    826803
    827804ctxswitch-goroutine$(EXEEXT):
    828         $(BENCH_V_GOC)go build -o a.out $(srcdir)/ctxswitch/goroutine.go
     805        $(AM_V_GOC)go build -o a.out $(srcdir)/ctxswitch/goroutine.go
    829806
    830807ctxswitch-java_thread$(EXEEXT):
    831         $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java
     808        $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java
    832809        @echo "#!/bin/sh" > a.out
    833810        @echo "java JavaThread" >> a.out
     
    846823
    847824mutex-pthread_lock$(EXEEXT):
    848         $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/mutex/pthreads.c
     825        $(AM_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/mutex/pthreads.c
    849826
    850827mutex-upp$(EXEEXT):
    851         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/upp.cc
     828        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/upp.cc
    852829
    853830mutex-cfa1$(EXEEXT):
    854         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa1.cfa
     831        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa1.c
    855832
    856833mutex-cfa2$(EXEEXT):
    857         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa2.cfa
     834        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa2.c
    858835
    859836mutex-cfa4$(EXEEXT):
    860         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa4.cfa
     837        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa4.c
    861838
    862839mutex-java_thread$(EXEEXT):
    863         $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java
     840        $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java
    864841        @echo "#!/bin/sh" > a.out
    865842        @echo "java JavaThread" >> a.out
     
    875852
    876853signal-pthread_cond$(EXEEXT):
    877         $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=500000  $(srcdir)/schedint/pthreads.c
     854        $(AM_V_CC)$(COMPILE)    -DBENCH_N=500000  $(srcdir)/schedint/pthreads.c
    878855
    879856signal-upp$(EXEEXT):
    880         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedint/upp.cc
     857        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedint/upp.cc
    881858
    882859signal-cfa1$(EXEEXT):
    883         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa1.cfa
     860        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa1.c
    884861
    885862signal-cfa2$(EXEEXT):
    886         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa2.cfa
     863        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa2.c
    887864
    888865signal-cfa4$(EXEEXT):
    889         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa4.cfa
     866        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa4.c
    890867
    891868signal-java_thread$(EXEEXT):
    892         $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
     869        $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
    893870        @echo "#!/bin/sh" > a.out
    894871        @echo "java JavaThread" >> a.out
     
    902879
    903880waitfor-upp$(EXEEXT):
    904         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedext/upp.cc
     881        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedext/upp.cc
    905882
    906883waitfor-cfa1$(EXEEXT):
    907         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa1.cfa
     884        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa1.c
    908885
    909886waitfor-cfa2$(EXEEXT):
    910         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa2.cfa
     887        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa2.c
    911888
    912889waitfor-cfa4$(EXEEXT):
    913         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa4.cfa
     890        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa4.c
    914891
    915892creation$(EXEEXT) :\
     
    924901
    925902creation-cfa_coroutine$(EXEEXT):
    926         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.cfa
     903        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.c
    927904
    928905creation-cfa_coroutine_eager$(EXEEXT):
    929         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.cfa  -DEAGER
     906        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.c
    930907
    931908creation-cfa_thread$(EXEEXT):
    932         $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_thrd.cfa
     909        $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_thrd.c
    933910
    934911creation-upp_coroutine$(EXEEXT):
    935         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_cor.cc
     912        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_cor.cc
    936913
    937914creation-upp_thread$(EXEEXT):
    938         $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_thrd.cc
     915        $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_thrd.cc
    939916
    940917creation-pthread$(EXEEXT):
    941         $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=250000   $(srcdir)/creation/pthreads.c
     918        $(AM_V_CC)$(COMPILE)    -DBENCH_N=250000   $(srcdir)/creation/pthreads.c
    942919
    943920creation-goroutine$(EXEEXT):
    944         $(BENCH_V_GOC)go build -o a.out $(srcdir)/creation/goroutine.go
     921        $(AM_V_GOC)go build -o a.out $(srcdir)/creation/goroutine.go
    945922
    946923creation-java_thread$(EXEEXT):
    947         $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
     924        $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
    948925        @echo "#!/bin/sh" > a.out
    949926        @echo "java JavaThread" >> a.out
     
    961938
    962939compile-array$(EXEEXT):
    963         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/array.cfa
     940        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/array.c
    964941
    965942compile-attributes$(EXEEXT):
    966         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa
     943        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa
    967944
    968945compile-empty$(EXEEXT):
    969         @$(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.cfa
     946        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.c
    970947
    971948compile-expression$(EXEEXT):
    972         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.cfa
     949        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.c
    973950
    974951compile-io$(EXEEXT):
    975         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.cfa
     952        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.c
    976953
    977954compile-monitor$(EXEEXT):
    978         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.cfa
     955        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.c
    979956
    980957compile-operators$(EXEEXT):
    981         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.cfa
     958        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.c
    982959
    983960compile-thread$(EXEEXT):
    984         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.cfa
     961        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.c
    985962
    986963compile-typeof$(EXEEXT):
    987         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.cfa
     964        $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.c
    988965
    989966# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • configure

    r53bb8f1 r9d9a451  
    637637LIBOBJS
    638638CFA_BACKEND_CC
     639ALLOCA
    639640WITH_LIBFIBRE_FALSE
    640641WITH_LIBFIBRE_TRUE
     
    19601961} # ac_fn_cxx_try_link
    19611962
     1963# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
     1964# -------------------------------------------
     1965# Tests whether TYPE exists after having included INCLUDES, setting cache
     1966# variable VAR accordingly.
     1967ac_fn_c_check_type ()
     1968{
     1969  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
     1970  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
     1971$as_echo_n "checking for $2... " >&6; }
     1972if eval \${$3+:} false; then :
     1973  $as_echo_n "(cached) " >&6
     1974else
     1975  eval "$3=no"
     1976  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     1977/* end confdefs.h.  */
     1978$4
     1979int
     1980main ()
     1981{
     1982if (sizeof ($2))
     1983         return 0;
     1984  ;
     1985  return 0;
     1986}
     1987_ACEOF
     1988if ac_fn_c_try_compile "$LINENO"; then :
     1989  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     1990/* end confdefs.h.  */
     1991$4
     1992int
     1993main ()
     1994{
     1995if (sizeof (($2)))
     1996            return 0;
     1997  ;
     1998  return 0;
     1999}
     2000_ACEOF
     2001if ac_fn_c_try_compile "$LINENO"; then :
     2002
     2003else
     2004  eval "$3=yes"
     2005fi
     2006rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     2007fi
     2008rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     2009fi
     2010eval ac_res=\$$3
     2011               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
     2012$as_echo "$ac_res" >&6; }
     2013  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
     2014
     2015} # ac_fn_c_check_type
     2016
    19622017# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
    19632018# -------------------------------------------------------
     
    20512106} # ac_fn_c_check_header_mongrel
    20522107
    2053 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
    2054 # -------------------------------------------
    2055 # Tests whether TYPE exists after having included INCLUDES, setting cache
    2056 # variable VAR accordingly.
    2057 ac_fn_c_check_type ()
     2108# ac_fn_c_find_intX_t LINENO BITS VAR
     2109# -----------------------------------
     2110# Finds a signed integer type with width BITS, setting cache variable VAR
     2111# accordingly.
     2112ac_fn_c_find_intX_t ()
    20582113{
    20592114  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    2060   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
    2061 $as_echo_n "checking for $2... " >&6; }
     2115  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
     2116$as_echo_n "checking for int$2_t... " >&6; }
    20622117if eval \${$3+:} false; then :
    20632118  $as_echo_n "(cached) " >&6
    20642119else
    20652120  eval "$3=no"
    2066   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     2121     # Order is important - never check a type that is potentially smaller
     2122     # than half of the expected target width.
     2123     for ac_type in int$2_t 'int' 'long int' \
     2124         'long long int' 'short int' 'signed char'; do
     2125       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    20672126/* end confdefs.h.  */
    2068 $4
     2127$ac_includes_default
     2128             enum { N = $2 / 2 - 1 };
    20692129int
    20702130main ()
    20712131{
    2072 if (sizeof ($2))
    2073          return 0;
     2132static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
     2133test_array [0] = 0;
     2134return test_array [0];
     2135
    20742136  ;
    20752137  return 0;
     
    20792141  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    20802142/* end confdefs.h.  */
    2081 $4
     2143$ac_includes_default
     2144                enum { N = $2 / 2 - 1 };
    20822145int
    20832146main ()
    20842147{
    2085 if (sizeof (($2)))
    2086             return 0;
     2148static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
     2149                 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
     2150test_array [0] = 0;
     2151return test_array [0];
     2152
    20872153  ;
    20882154  return 0;
     
    20922158
    20932159else
    2094   eval "$3=yes"
     2160  case $ac_type in #(
     2161  int$2_t) :
     2162    eval "$3=yes" ;; #(
     2163  *) :
     2164    eval "$3=\$ac_type" ;;
     2165esac
    20952166fi
    20962167rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    20972168fi
    20982169rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     2170       if eval test \"x\$"$3"\" = x"no"; then :
     2171
     2172else
     2173  break
     2174fi
     2175     done
    20992176fi
    21002177eval ac_res=\$$3
     
    21032180  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
    21042181
    2105 } # ac_fn_c_check_type
     2182} # ac_fn_c_find_intX_t
     2183
     2184# ac_fn_c_find_uintX_t LINENO BITS VAR
     2185# ------------------------------------
     2186# Finds an unsigned integer type with width BITS, setting cache variable VAR
     2187# accordingly.
     2188ac_fn_c_find_uintX_t ()
     2189{
     2190  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
     2191  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
     2192$as_echo_n "checking for uint$2_t... " >&6; }
     2193if eval \${$3+:} false; then :
     2194  $as_echo_n "(cached) " >&6
     2195else
     2196  eval "$3=no"
     2197     # Order is important - never check a type that is potentially smaller
     2198     # than half of the expected target width.
     2199     for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
     2200         'unsigned long long int' 'unsigned short int' 'unsigned char'; do
     2201       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     2202/* end confdefs.h.  */
     2203$ac_includes_default
     2204int
     2205main ()
     2206{
     2207static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
     2208test_array [0] = 0;
     2209return test_array [0];
     2210
     2211  ;
     2212  return 0;
     2213}
     2214_ACEOF
     2215if ac_fn_c_try_compile "$LINENO"; then :
     2216  case $ac_type in #(
     2217  uint$2_t) :
     2218    eval "$3=yes" ;; #(
     2219  *) :
     2220    eval "$3=\$ac_type" ;;
     2221esac
     2222fi
     2223rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     2224       if eval test \"x\$"$3"\" = x"no"; then :
     2225
     2226else
     2227  break
     2228fi
     2229     done
     2230fi
     2231eval ac_res=\$$3
     2232               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
     2233$as_echo "$ac_res" >&6; }
     2234  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
     2235
     2236} # ac_fn_c_find_uintX_t
    21062237cat >config.log <<_ACEOF
    21072238This file contains any messages produced by compilers while
     
    25362667
    25372668
    2538 # http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_compile_flag.m4
    2539 
    25402669
    25412670# don't use the default CFLAGS as they unconditonnaly add -O2
     
    50545183
    50555184
     5185        # deprecated
    50565186# These are often not installed and people miss seeing the "no", so stop the configure.
    50575187for ac_prog in 'bison -y' byacc
     
    1660416734
    1660516735
     16736{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
     16737$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
     16738set x ${MAKE-make}
     16739ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
     16740if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
     16741  $as_echo_n "(cached) " >&6
     16742else
     16743  cat >conftest.make <<\_ACEOF
     16744SHELL = /bin/sh
     16745all:
     16746        @echo '@@@%%%=$(MAKE)=@@@%%%'
     16747_ACEOF
     16748# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
     16749case `${MAKE-make} -f conftest.make 2>/dev/null` in
     16750  *@@@%%%=?*=@@@%%%*)
     16751    eval ac_cv_prog_make_${ac_make}_set=yes;;
     16752  *)
     16753    eval ac_cv_prog_make_${ac_make}_set=no;;
     16754esac
     16755rm -f conftest.make
     16756fi
     16757if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
     16758  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
     16759$as_echo "yes" >&6; }
     16760  SET_MAKE=
     16761else
     16762  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     16763$as_echo "no" >&6; }
     16764  SET_MAKE="MAKE=${MAKE-make}"
     16765fi
     16766
    1660616767
    1660716768# Checks for libraries.
     
    1665816819
    1665916820# Checks for header files.
    16660 for ac_header in libintl.h malloc.h unistd.h
     16821ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
     16822if test "x$ac_cv_type_size_t" = xyes; then :
     16823
     16824else
     16825
     16826cat >>confdefs.h <<_ACEOF
     16827#define size_t unsigned int
     16828_ACEOF
     16829
     16830fi
     16831
     16832# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
     16833# for constant arguments.  Useless!
     16834{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
     16835$as_echo_n "checking for working alloca.h... " >&6; }
     16836if ${ac_cv_working_alloca_h+:} false; then :
     16837  $as_echo_n "(cached) " >&6
     16838else
     16839  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     16840/* end confdefs.h.  */
     16841#include <alloca.h>
     16842int
     16843main ()
     16844{
     16845char *p = (char *) alloca (2 * sizeof (int));
     16846                          if (p) return 0;
     16847  ;
     16848  return 0;
     16849}
     16850_ACEOF
     16851if ac_fn_c_try_link "$LINENO"; then :
     16852  ac_cv_working_alloca_h=yes
     16853else
     16854  ac_cv_working_alloca_h=no
     16855fi
     16856rm -f core conftest.err conftest.$ac_objext \
     16857    conftest$ac_exeext conftest.$ac_ext
     16858fi
     16859{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
     16860$as_echo "$ac_cv_working_alloca_h" >&6; }
     16861if test $ac_cv_working_alloca_h = yes; then
     16862
     16863$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
     16864
     16865fi
     16866
     16867{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
     16868$as_echo_n "checking for alloca... " >&6; }
     16869if ${ac_cv_func_alloca_works+:} false; then :
     16870  $as_echo_n "(cached) " >&6
     16871else
     16872  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     16873/* end confdefs.h.  */
     16874#ifdef __GNUC__
     16875# define alloca __builtin_alloca
     16876#else
     16877# ifdef _MSC_VER
     16878#  include <malloc.h>
     16879#  define alloca _alloca
     16880# else
     16881#  ifdef HAVE_ALLOCA_H
     16882#   include <alloca.h>
     16883#  else
     16884#   ifdef _AIX
     16885 #pragma alloca
     16886#   else
     16887#    ifndef alloca /* predefined by HP cc +Olibcalls */
     16888void *alloca (size_t);
     16889#    endif
     16890#   endif
     16891#  endif
     16892# endif
     16893#endif
     16894
     16895int
     16896main ()
     16897{
     16898char *p = (char *) alloca (1);
     16899                                    if (p) return 0;
     16900  ;
     16901  return 0;
     16902}
     16903_ACEOF
     16904if ac_fn_c_try_link "$LINENO"; then :
     16905  ac_cv_func_alloca_works=yes
     16906else
     16907  ac_cv_func_alloca_works=no
     16908fi
     16909rm -f core conftest.err conftest.$ac_objext \
     16910    conftest$ac_exeext conftest.$ac_ext
     16911fi
     16912{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
     16913$as_echo "$ac_cv_func_alloca_works" >&6; }
     16914
     16915if test $ac_cv_func_alloca_works = yes; then
     16916
     16917$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
     16918
     16919else
     16920  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
     16921# that cause trouble.  Some versions do not even contain alloca or
     16922# contain a buggy version.  If you still want to use their alloca,
     16923# use ar to extract alloca.o from them instead of compiling alloca.c.
     16924
     16925ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
     16926
     16927$as_echo "#define C_ALLOCA 1" >>confdefs.h
     16928
     16929
     16930{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
     16931$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
     16932if ${ac_cv_os_cray+:} false; then :
     16933  $as_echo_n "(cached) " >&6
     16934else
     16935  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     16936/* end confdefs.h.  */
     16937#if defined CRAY && ! defined CRAY2
     16938webecray
     16939#else
     16940wenotbecray
     16941#endif
     16942
     16943_ACEOF
     16944if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
     16945  $EGREP "webecray" >/dev/null 2>&1; then :
     16946  ac_cv_os_cray=yes
     16947else
     16948  ac_cv_os_cray=no
     16949fi
     16950rm -f conftest*
     16951
     16952fi
     16953{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
     16954$as_echo "$ac_cv_os_cray" >&6; }
     16955if test $ac_cv_os_cray = yes; then
     16956  for ac_func in _getb67 GETB67 getb67; do
     16957    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
     16958ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
     16959if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
     16960
     16961cat >>confdefs.h <<_ACEOF
     16962#define CRAY_STACKSEG_END $ac_func
     16963_ACEOF
     16964
     16965    break
     16966fi
     16967
     16968  done
     16969fi
     16970
     16971{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
     16972$as_echo_n "checking stack direction for C alloca... " >&6; }
     16973if ${ac_cv_c_stack_direction+:} false; then :
     16974  $as_echo_n "(cached) " >&6
     16975else
     16976  if test "$cross_compiling" = yes; then :
     16977  ac_cv_c_stack_direction=0
     16978else
     16979  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     16980/* end confdefs.h.  */
     16981$ac_includes_default
     16982int
     16983find_stack_direction (int *addr, int depth)
     16984{
     16985  int dir, dummy = 0;
     16986  if (! addr)
     16987    addr = &dummy;
     16988  *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
     16989  dir = depth ? find_stack_direction (addr, depth - 1) : 0;
     16990  return dir + dummy;
     16991}
     16992
     16993int
     16994main (int argc, char **argv)
     16995{
     16996  return find_stack_direction (0, argc + !argv + 20) < 0;
     16997}
     16998_ACEOF
     16999if ac_fn_c_try_run "$LINENO"; then :
     17000  ac_cv_c_stack_direction=1
     17001else
     17002  ac_cv_c_stack_direction=-1
     17003fi
     17004rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
     17005  conftest.$ac_objext conftest.beam conftest.$ac_ext
     17006fi
     17007
     17008fi
     17009{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
     17010$as_echo "$ac_cv_c_stack_direction" >&6; }
     17011cat >>confdefs.h <<_ACEOF
     17012#define STACK_DIRECTION $ac_cv_c_stack_direction
     17013_ACEOF
     17014
     17015
     17016fi
     17017
     17018for ac_header in fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h
    1666117019do :
    1666217020  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
     
    1666717025_ACEOF
    1666817026
    16669 else
    16670   echo "Error: Missing required header"; exit 1
    1667117027fi
    1667217028
     
    1667517031
    1667617032# Checks for typedefs, structures, and compiler characteristics.
    16677 ac_fn_c_check_type "$LINENO" "_Float32" "ac_cv_type__Float32" "
    16678 "
    16679 if test "x$ac_cv_type__Float32" = xyes; then :
    16680 
    16681 cat >>confdefs.h <<_ACEOF
    16682 #define HAVE__FLOAT32 1
    16683 _ACEOF
    16684 
    16685 
    16686 $as_echo "#define HAVE_KEYWORDS_FLOATXX /**/" >>confdefs.h
    16687 
    16688 fi
    16689 
    16690 
    16691 # Checks for compiler flags.
    16692 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wcast-function-type" >&5
    16693 $as_echo_n "checking whether C compiler accepts -Wcast-function-type... " >&6; }
    16694 if ${m4cfa_cv_check_cflags___Wcast_function_type+:} false; then :
     17033{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
     17034$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
     17035if ${ac_cv_header_stdbool_h+:} false; then :
    1669517036  $as_echo_n "(cached) " >&6
    1669617037else
    16697 
    16698         m4cfa_check_save_flags=$CFLAGS
    16699         CFLAGS="$CFLAGS  -Wcast-function-type"
    16700         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     17038  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1670117039/* end confdefs.h.  */
     17040
     17041             #include <stdbool.h>
     17042             #ifndef bool
     17043              "error: bool is not defined"
     17044             #endif
     17045             #ifndef false
     17046              "error: false is not defined"
     17047             #endif
     17048             #if false
     17049              "error: false is not 0"
     17050             #endif
     17051             #ifndef true
     17052              "error: true is not defined"
     17053             #endif
     17054             #if true != 1
     17055              "error: true is not 1"
     17056             #endif
     17057             #ifndef __bool_true_false_are_defined
     17058              "error: __bool_true_false_are_defined is not defined"
     17059             #endif
     17060
     17061             struct s { _Bool s: 1; _Bool t; } s;
     17062
     17063             char a[true == 1 ? 1 : -1];
     17064             char b[false == 0 ? 1 : -1];
     17065             char c[__bool_true_false_are_defined == 1 ? 1 : -1];
     17066             char d[(bool) 0.5 == true ? 1 : -1];
     17067             /* See body of main program for 'e'.  */
     17068             char f[(_Bool) 0.0 == false ? 1 : -1];
     17069             char g[true];
     17070             char h[sizeof (_Bool)];
     17071             char i[sizeof s.t];
     17072             enum { j = false, k = true, l = false * true, m = true * 256 };
     17073             /* The following fails for
     17074                HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
     17075             _Bool n[m];
     17076             char o[sizeof n == m * sizeof n[0] ? 1 : -1];
     17077             char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
     17078             /* Catch a bug in an HP-UX C compiler.  See
     17079                http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
     17080                http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
     17081              */
     17082             _Bool q = true;
     17083             _Bool *pq = &q;
    1670217084
    1670317085int
    1670417086main ()
    1670517087{
     17088
     17089             bool e = &s;
     17090             *pq |= q;
     17091             *pq |= ! q;
     17092             /* Refer to every declared value, to avoid compiler optimizations.  */
     17093             return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
     17094                     + !m + !n + !o + !p + !q + !pq);
    1670617095
    1670717096  ;
     
    1671017099_ACEOF
    1671117100if ac_fn_c_try_compile "$LINENO"; then :
    16712   m4cfa_cv_check_cflags___Wcast_function_type=yes
    16713 else
    16714   m4cfa_cv_check_cflags___Wcast_function_type=no
     17101  ac_cv_header_stdbool_h=yes
     17102else
     17103  ac_cv_header_stdbool_h=no
    1671517104fi
    1671617105rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    16717         CFLAGS=$m4cfa_check_save_flags
    16718 fi
    16719 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $m4cfa_cv_check_cflags___Wcast_function_type" >&5
    16720 $as_echo "$m4cfa_cv_check_cflags___Wcast_function_type" >&6; }
    16721 if test "x$m4cfa_cv_check_cflags___Wcast_function_type" = xyes; then :
    16722 
    16723 $as_echo "#define HAVE_CAST_FUNCTION_TYPE /**/" >>confdefs.h
    16724 
    16725 else
    16726   :
    16727 fi
     17106fi
     17107{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
     17108$as_echo "$ac_cv_header_stdbool_h" >&6; }
     17109   ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
     17110if test "x$ac_cv_type__Bool" = xyes; then :
     17111
     17112cat >>confdefs.h <<_ACEOF
     17113#define HAVE__BOOL 1
     17114_ACEOF
     17115
     17116
     17117fi
     17118
     17119
     17120if test $ac_cv_header_stdbool_h = yes; then
     17121
     17122$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
     17123
     17124fi
     17125
     17126{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
     17127$as_echo_n "checking for inline... " >&6; }
     17128if ${ac_cv_c_inline+:} false; then :
     17129  $as_echo_n "(cached) " >&6
     17130else
     17131  ac_cv_c_inline=no
     17132for ac_kw in inline __inline__ __inline; do
     17133  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     17134/* end confdefs.h.  */
     17135#ifndef __cplusplus
     17136typedef int foo_t;
     17137static $ac_kw foo_t static_foo () {return 0; }
     17138$ac_kw foo_t foo () {return 0; }
     17139#endif
     17140
     17141_ACEOF
     17142if ac_fn_c_try_compile "$LINENO"; then :
     17143  ac_cv_c_inline=$ac_kw
     17144fi
     17145rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     17146  test "$ac_cv_c_inline" != no && break
     17147done
     17148
     17149fi
     17150{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
     17151$as_echo "$ac_cv_c_inline" >&6; }
     17152
     17153case $ac_cv_c_inline in
     17154  inline | yes) ;;
     17155  *)
     17156    case $ac_cv_c_inline in
     17157      no) ac_val=;;
     17158      *) ac_val=$ac_cv_c_inline;;
     17159    esac
     17160    cat >>confdefs.h <<_ACEOF
     17161#ifndef __cplusplus
     17162#define inline $ac_val
     17163#endif
     17164_ACEOF
     17165    ;;
     17166esac
     17167
     17168ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t"
     17169case $ac_cv_c_int16_t in #(
     17170  no|yes) ;; #(
     17171  *)
     17172
     17173cat >>confdefs.h <<_ACEOF
     17174#define int16_t $ac_cv_c_int16_t
     17175_ACEOF
     17176;;
     17177esac
     17178
     17179ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
     17180case $ac_cv_c_int32_t in #(
     17181  no|yes) ;; #(
     17182  *)
     17183
     17184cat >>confdefs.h <<_ACEOF
     17185#define int32_t $ac_cv_c_int32_t
     17186_ACEOF
     17187;;
     17188esac
     17189
     17190ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t"
     17191case $ac_cv_c_int8_t in #(
     17192  no|yes) ;; #(
     17193  *)
     17194
     17195cat >>confdefs.h <<_ACEOF
     17196#define int8_t $ac_cv_c_int8_t
     17197_ACEOF
     17198;;
     17199esac
     17200
     17201{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
     17202$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
     17203if ${ac_cv_c_restrict+:} false; then :
     17204  $as_echo_n "(cached) " >&6
     17205else
     17206  ac_cv_c_restrict=no
     17207   # The order here caters to the fact that C++ does not require restrict.
     17208   for ac_kw in __restrict __restrict__ _Restrict restrict; do
     17209     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     17210/* end confdefs.h.  */
     17211typedef int * int_ptr;
     17212        int foo (int_ptr $ac_kw ip) {
     17213        return ip[0];
     17214       }
     17215int
     17216main ()
     17217{
     17218int s[1];
     17219        int * $ac_kw t = s;
     17220        t[0] = 0;
     17221        return foo(t)
     17222  ;
     17223  return 0;
     17224}
     17225_ACEOF
     17226if ac_fn_c_try_compile "$LINENO"; then :
     17227  ac_cv_c_restrict=$ac_kw
     17228fi
     17229rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     17230     test "$ac_cv_c_restrict" != no && break
     17231   done
     17232
     17233fi
     17234{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
     17235$as_echo "$ac_cv_c_restrict" >&6; }
     17236
     17237 case $ac_cv_c_restrict in
     17238   restrict) ;;
     17239   no) $as_echo "#define restrict /**/" >>confdefs.h
     17240 ;;
     17241   *)  cat >>confdefs.h <<_ACEOF
     17242#define restrict $ac_cv_c_restrict
     17243_ACEOF
     17244 ;;
     17245 esac
     17246
     17247ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
     17248if test "x$ac_cv_type_size_t" = xyes; then :
     17249
     17250else
     17251
     17252cat >>confdefs.h <<_ACEOF
     17253#define size_t unsigned int
     17254_ACEOF
     17255
     17256fi
     17257
     17258ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t"
     17259case $ac_cv_c_uint16_t in #(
     17260  no|yes) ;; #(
     17261  *)
     17262
     17263
     17264cat >>confdefs.h <<_ACEOF
     17265#define uint16_t $ac_cv_c_uint16_t
     17266_ACEOF
     17267;;
     17268  esac
     17269
     17270ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
     17271case $ac_cv_c_uint32_t in #(
     17272  no|yes) ;; #(
     17273  *)
     17274
     17275$as_echo "#define _UINT32_T 1" >>confdefs.h
     17276
     17277
     17278cat >>confdefs.h <<_ACEOF
     17279#define uint32_t $ac_cv_c_uint32_t
     17280_ACEOF
     17281;;
     17282  esac
     17283
     17284ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
     17285case $ac_cv_c_uint8_t in #(
     17286  no|yes) ;; #(
     17287  *)
     17288
     17289$as_echo "#define _UINT8_T 1" >>confdefs.h
     17290
     17291
     17292cat >>confdefs.h <<_ACEOF
     17293#define uint8_t $ac_cv_c_uint8_t
     17294_ACEOF
     17295;;
     17296  esac
     17297
     17298
     17299# Checks for library functions.
     17300for ac_func in memset putenv strchr strtol
     17301do :
     17302  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
     17303ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
     17304if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
     17305  cat >>confdefs.h <<_ACEOF
     17306#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
     17307_ACEOF
     17308
     17309fi
     17310done
    1672817311
    1672917312
  • configure.ac

    r53bb8f1 r9d9a451  
    178178AC_PROG_CC
    179179AM_PROG_AS
     180AM_PROG_CC_C_O  # deprecated
    180181# These are often not installed and people miss seeing the "no", so stop the configure.
    181182AC_PROG_YACC
     
    185186AC_PROG_LIBTOOL
    186187AC_PROG_INSTALL
     188AC_PROG_MAKE_SET
    187189
    188190# Checks for libraries.
     
    191193
    192194# Checks for header files.
    193 AC_CHECK_HEADERS([libintl.h malloc.h unistd.h], [], [echo "Error: Missing required header"; exit 1])
     195AC_FUNC_ALLOCA
     196AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
    194197
    195198# Checks for typedefs, structures, and compiler characteristics.
    196 AC_CHECK_TYPES([_Float32], AC_DEFINE([HAVE_KEYWORDS_FLOATXX], [], [Have keywords _FloatXX.]), [], [[]])
    197 
    198 # Checks for compiler flags.
    199 M4CFA_CHECK_COMPILE_FLAG([-Wcast-function-type], AC_DEFINE([HAVE_CAST_FUNCTION_TYPE], [], [Have compiler warning cast-function-type.]))
     199AC_HEADER_STDBOOL
     200AC_C_INLINE
     201AC_TYPE_INT16_T
     202AC_TYPE_INT32_T
     203AC_TYPE_INT8_T
     204AC_C_RESTRICT
     205AC_TYPE_SIZE_T
     206AC_TYPE_UINT16_T
     207AC_TYPE_UINT32_T
     208AC_TYPE_UINT8_T
     209
     210# Checks for library functions.
     211AC_CHECK_FUNCS([memset putenv strchr strtol])
    200212
    201213#==============================================================================
  • doc/LaTeXmacros/lstlang.sty

    r53bb8f1 r9d9a451  
    88%% Created On       : Sat May 13 16:34:42 2017
    99%% Last Modified By : Peter A. Buhr
    10 %% Last Modified On : Tue Jan  8 14:40:33 2019
    11 %% Update Count     : 21
     10%% Last Modified On : Fri Apr  6 23:44:50 2018
     11%% Update Count     : 20
    1212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1313
     
    114114                _Alignas, _Alignof, __alignof, __alignof__, asm, __asm, __asm__, __attribute, __attribute__,
    115115                auto, _Bool, catch, catchResume, choose, _Complex, __complex, __complex__, __const, __const__,
    116                 coroutine, disable, dtype, enable, exception, __extension__, fallthrough, fallthru, finally,
     116                coroutine, disable, dtype, enable, __extension__, exception, fallthrough, fallthru, finally,
    117117                __float80, float80, __float128, float128, forall, ftype, _Generic, _Imaginary, __imag, __imag__,
    118118                inline, __inline, __inline__, __int128, int128, __label__, monitor, mutex, _Noreturn, one_t, or,
  • doc/bibliography/pl.bib

    r53bb8f1 r9d9a451  
    330330    contributer = {pabuhr@plg},
    331331    author      = {Nissim Francez},
    332     title       = {Another Advantage of Keyword Notation for Parameter Communication with Subprograms},
     332    title       = {Another Advantage of Key word Notation for Parameter Communication with Subprograms},
    333333    journal     = cacm,
    334334    volume      = 20,
     
    831831    year        = 2015,
    832832    howpublished= {\href{http://www.boost.org/doc/libs/1_61_0/libs/coroutine/doc/html/index.html}
    833                   {http://www.boost.org/\-doc/\-libs/1\_61\_0/\-libs/\-coroutine/\-doc/\-html/\-index.html}},
    834 }
    835 
    836 @misc{BoostThreads,
    837     keywords    = {Boost Thread Library},
    838     contributer = {pabuhr@plg},
    839     author      = {Anthony Williams and Vicente J. Botet Escriba},
    840     title       = {Boost Thread Library},
    841     year        = 2015,
    842     howpublished= {\href{https://www.boost.org/doc/libs/1_61_0/doc/html/thread.html}
    843                   {https://\-www.boost.org/\-doc/\-libs/\-1\_61\_0/\-doc/\-html/\-thread.html}},
     833                  {{http://www.boost.org/\-doc/\-libs/1\_61\_0/\-libs/\-coroutine/\-doc/\-html/\-index.html}}},
     834    optnote     = {Accessed: 2016-09},
    844835}
    845836
     
    948939    author      = {{\textsf{C}{$\mathbf{\forall}$} Features}},
    949940    howpublished= {\href{https://plg.uwaterloo.ca/~cforall/features}{https://\-plg.uwaterloo.ca/\-$\sim$cforall/\-features}},
     941    optnote     = {Accessed: 2018-01-01},
    950942}
    951943
     
    967959    year        = 2018,
    968960    howpublished= {\href{https://cforall.uwaterloo.ca/CFAStackEvaluation.zip}{https://cforall.uwaterloo.ca/\-CFAStackEvaluation.zip}},
     961    optnote     = {[Accessed May 2018]},
    969962}
    970963
     
    11411134}
    11421135
    1143 @inproceedings{Tarditi18,
    1144     keywords    = {Checked C},
    1145     contributer = {a3moss@uwaterloo.ca},
    1146     author      = {Tarditi, David and Elliott, Archibald Samuel and Ruef, Andrew and Hicks, Michael},
    1147     title       = {Checked C: Making C Safe by Extension},
    1148     booktitle   = {2018 IEEE Cybersecurity Development (SecDev)}
     1136@Inproceedings{Tarditi18,
     1137    keywords = {Checked C},
     1138    contributer = {a3moss@uwaterloo.ca},
     1139    author = {Tarditi, David and Elliott, Archibald Samuel and Ruef, Andrew and Hicks, Michael},
     1140    title = {Checked C: Making C Safe by Extension},
    11491141    year = {2018},
    11501142    month = {September},
    1151     pages = {53-60},
    11521143    publisher = {IEEE},
    11531144    url = {https://www.microsoft.com/en-us/research/publication/checkedc-making-c-safe-by-extension/},
     1145    pages = {53-60},
    11541146}
    11551147
     
    13221314    journal     = sigplan,
    13231315    year        = 1986,
    1324     month       = oct,
    1325     volume      = 21,
    1326     number      = 10,
    1327     pages       = {19-28},
     1316    month       = oct, volume = 21, number = 10, pages = {19-28},
    13281317    note        = {Object Oriented Programming Workshop}
    13291318}
     
    14901479    title       = {concurrent-locking},
    14911480    howpublished= {\href{https://github.com/pabuhr/concurrent-locking}{https://\-github.com/\-pabuhr/\-concurrent-locking}},
     1481    optnote     = {[Accessed April 2017]},
    14921482}
    14931483
     
    17771767    howpublished= {\href{https://www.airs.com/blog/archives/428}
    17781768                  {https://www.airs.com/\-blog/\-archives/\-428}},
     1769    optnote     = {Accessed: 2018-05},
    17791770}
    17801771
     
    29652956    year        = 2014,
    29662957    howpublished= {\href{https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/C-Extensions.html}{https://\-gcc.gnu.org/\-onlinedocs/\-gcc-4.7.2/\-gcc/\-C\-Extensions.html}},
     2958    optnote     = {Accessed: 2017-04-02},
    29672959}
    29682960
     
    30483040}
    30493041
    3050 @manual{WindowsFibers,
    3051     keywords    = {threads, fibers},
    3052     contributer = {pabuhr@plg},
    3053     author      = {Windows},
    3054     title       = {Fibers},
    3055     organization= {Microsoft, Windows Development Center},
    3056     address     = {\href{https://docs.microsoft.com/en-us/windows/desktop/ProcThread/fibers}{https://\-docs.microsoft.com/\-en-us/\-windows/\-desktop/\-ProcThread/\-fibers}},
    3057     year        = 2018,
    3058 }
    3059 
    30603042@inproceedings{F-bound,
    30613043    keywords    = {},
     
    31053087}
    31063088
    3107 @manual{Folly,
    3108     keywords    = {Folly},
    3109     contributer = {pabuhr@plg},
    3110     author      = {Folly},
    3111     title       = {Facebook Open-source Library},
    3112     organization= {Facebook},
    3113     address     = {\href{https://github.com/facebook/folly}{https://\-github.com/\-facebook/\-folly}},
    3114     year        = 2018,
    3115 }
    3116 
    31173089@manual{Fortran95,
    31183090    keywords    = {Fortran 95},
     
    31353107    address     = {\href{https://www.iso.org/standard/50459.html}{https://\-www.iso.org/\-standard/\-50459.html}},
    31363108    year        = 2010,
    3137 }
    3138 
    3139 @manual{Fortran18,
    3140     keywords    = {ISO/IEC Fortran 10},
    3141     contributer = {pabuhr@plg},
    3142     author      = {Fortran18},
    3143     title       = {Programming Languages -- {Fortran} Part 1:Base Language ISO/IEC 1539-1:2018},
    3144     edition     = {4rd},
    3145     publisher   = {International Standard Organization},
    3146     address     = {\href{https://www.iso.org/standard/72320.html}{https://\-www.iso.org/\-standard/\-72320.html}},
    3147     year        = 2018,
    31483109}
    31493110
     
    33953356    year        = 2014,
    33963357    howpublished= {https://developer.gnome.org/gobject/stable/},
     3358    optnote     = {Accessed: 2017-04},
    33973359}
    33983360
     
    37093671    year        = {1964},
    37103672    publisher   = {ACM}
    3711 }
    3712 
    3713 @phdthesis{Barghi18,
    3714     keywords    = {concurrency, user threads, actors},
    3715     contributer = {pabuhr@plg},
    3716     author      = {Saman Barghi},
    3717     title       = {Improving the Performance of User-level Runtime Systems for Concurrent Applications},
    3718     school      = {School of Computer Science, University of Waterloo},
    3719     year        = 2018,
    3720     month       = sep,
    3721     optaddress  = {Waterloo, Ontario, Canada, N2L 3G1},
    3722     note        = {\href{https://uwspace.uwaterloo.ca/handle/10012/13935}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/\-13935}},
    37233673}
    37243674
     
    40483998    year        = 2015,
    40493999    edition     = {{J}ava {SE} 8},
    4050 }
    4051 
    4052 @manual{Java11,
    4053     keywords    = {Java SE 11},
    4054     contributer = {pabuhr@plg},
    4055     author      = {James Gosling and Bill Joy and Guy Steele and Gilad Bracha and Alex Buckley and Daniel Smith},
    4056     title       = {{Java} Language Specification},
    4057     publisher   = {Oracle},
    4058     month       = sep,
    4059     year        = 2018,
    4060     edition     = {{J}ava {SE} 11},
    4061 }
    4062 
    4063 @manual{JDK1.1,
    4064     keywords    = {JDK 1.1},
    4065     contributer = {pabuhr@plg},
    4066     author      = {{Multithreading Models}},
    4067     title       = {JDK 1.1 for Solaris Developer's Guide},
    4068     publisher   = {Oracle},
    4069     address     = {\href{https://docs.oracle.com/cd/E19455-01/806-3461/6jck06gqk/index.html#ch2mt-41}{https://\-docs.oracle.com/\-cd/\-E19455-01/\-806-3461/\-6jck06gqk/\-index.html\#ch2mt-41}},
    4070     year        = 2010,
    40714000}
    40724001
     
    42504179}
    42514180
    4252 @manual{libmill,
    4253     keywords    = {libmill},
    4254     contributer = {pabuhr@plg},
    4255     author      = {libmill},
    4256     title       = {{G}o-style concurrency in {C}, Version 1.18},
    4257     organization= {libmill},
    4258     address     = {\href{http://libmill.org/documentation.html}{http://\-libmill.org/\-documentation.html}},
    4259     month       = jan,
    4260     year        = 2017,
    4261 }
    4262 
    42634181@book{Weissman67,
    42644182    keywords    = {lisp},
     
    43064224    pages       = {161-169},
    43074225    note        = {Proceedings of the {SIGPLAN}~'89 Conference on Programming Language Design and Implementation}
    4308 }
    4309 
    4310 @manual{Lua,
    4311     keywords    = {Lua},
    4312     contributer = {pabuhr@plg},
    4313     author      = {Lua},
    4314     title       = {Lua 5.3 Reference Manual},
    4315     address     = {\href{https://www.lua.org/manual/5.3}{https://\-www.lua.org/\-manual/\-5.3}},
    4316     year        = 2018,
    43174226}
    43184227
     
    46574566}
    46584567%    editor     = {Allen Kent and James G. Williams},
    4659 
    4660 @incollection{MPC,
    4661     keywords    = {user-level threading},
    4662     contributer = {pabuhr@plg},
    4663     author      = {Marc P\'erache and Herv\'e Jourdren and Raymond Namyst},
    4664     title       = {MPC: A Unified Parallel Runtime for Clusters of {NUMA} Machines},
    4665     booktitle   = {Euro-Par 2008},
    4666     pages       = {329-342},
    4667     publisher   = {Springer},
    4668     address     = {Berlin, Heidelberg},
    4669     year        = 2008,
    4670     volume      = 5168,
    4671     series      = {Lecture Notes in Computer Science},
    4672 }
    46734568
    46744569@manual{MPI,
     
    50974992    year        = 2014,
    50984993    howpublished= {\href{https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC}{https://\-developer.apple.com/\-library/archive/\-documentation/\-Cocoa/\-Conceptual/\-ProgrammingWithObjectiveC}},
     4994    optnote     = {Accessed: 2018-03}
    50994995}
    51004996
     
    51065002    year        = 2015,
    51075003    howpublished= {\href{https://developer.apple.com/library/content/documentation/Xcode/Conceptual/RN-Xcode-Archive/Chapters/xc7_release_notes.html}{https://\-developer.apple.com/\-library/\-content/\-documentation/\-Xcode/\-Conceptual/\-RN-Xcode-Archive/\-Chapters/\-xc7\_release\_notes.html}},
     5004    optnote     = {Accessed: 2017-04}
    51085005}
    51095006
     
    56185515    year        = 2012,
    56195516    howpublished= {\href{http://cs.brown.edu/research/pubs/theses/masters/2012/verch.pdf}{http://cs.brown.edu/\-research/\-pubs/\-theses/\-masters/\-2012/\-verch.pdf}},
     5517    optnote     = {Accessed: 2013-10-4}
    56205518}
    56215519
     
    59415839    address     = {\href{https://www.iso.org/standard/64029.html}{https://\-www.iso.org/\-standard/\-64029.html}},
    59425840    year        = 2014,
    5943 }
    5944 
    5945 @manual{C++17,
    5946     keywords    = {ISO/IEC C++ 17},
    5947     contributer = {pabuhr@plg},
    5948     key         = {C++17},
    5949     title       = {{C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Programming Language ISO/IEC 14882:2017},
    5950     edition     = {5th},
    5951     publisher   = {International Standard Organization},
    5952     address     = {\href{https://www.iso.org/standard/68564.html}{https://\-www.iso.org/\-standard/\-68564.html}},
    5953     year        = 2017,
    59545841}
    59555842
     
    61055992    institution = {Carnegie Mellon University},
    61065993    year        = 1991,
    6107     month       = feb,
    6108     number      = {CMU-CS-91-106},
     5994    month       = feb, number = "CMU-CS-91-106",
    61095995    annote      = {
    61105996        Discusses a typed lambda calculus with
     
    61636049    journal     = sigplan,
    61646050    year        = 1988,
    6165     month       = jul,
    6166     volume      = 23,
    6167     number      = 7,
    6168     pages       = {260-267},
    6169     note        = {Proceedings of the SIGPLAN '88 Conference on Programming Language Design and Implementation},
     6051    month       = jul, volume = 23, number = 7, pages = {260-267},
     6052    note        = {Proceedings of the SIGPLAN '88 Conference on Programming Language
     6053         Design and Implementation},
    61706054    abstract    = {
    61716055        This paper deals with the integration of an efficient asynchronous
     
    62176101}
    62186102
    6219 @misc{Pthreads,
    6220     keywords    = {pthreads, C concurrency},
    6221     contributer = {pabuhr@plg},
    6222     key         = {pthreads},
    6223     title       = {{Pthread}.h, Specifications Issue 7, {IEEE} Std 1003.1-2017},
    6224     author      = {IEEE and {The Open Group}},
    6225     year        = 2018,
    6226     howpublished= {\href{http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html}
    6227                   {http://\-pubs.opengroup.org/\-onlinepubs/\-9699919799/\-basedefs/\-pthread.h.html}},
    6228 }
    6229 
    62306103@manual{Python,
    62316104    keywords    = {Python},
    62326105    contributer = {pabuhr@plg},
    6233     author      = {Python},
    6234     title       = {Python Language Reference, Release 3.7.2},
     6106    title       = {Python Reference Manual, Release 2.5},
     6107    author      = {Guido van Rossum},
    62356108    organization= {Python Software Foundation},
    6236     address     = {\href{https://docs.python.org/3/reference/index.html}{https://\-docs.python.org/\-3/\-reference/\-index.html}},
    6237     year        = 2018,
     6109    month       = sep,
     6110    year        = 2006,
     6111    note        = {Fred L. Drake, Jr., editor},
    62386112}
    62396113
    62406114% Q
    6241 
    6242 @inproceedings{Qthreads,
    6243     keywords    = {user-level threading},
    6244     author      = {Kyle B. Wheeler and Richard C. Murphy and Douglas Thain},
    6245     title       = {Qthreads: An API for Programming with Millions of Lightweight Threads},
    6246     booktitle   = {International Symposium on Parallel and Distributed Processing},
    6247     organization= {IEEE},
    6248     address     = {Miami, FL, USA},
    6249     month       = apr,
    6250     year        = 2008,
    6251 }
    62526115
    62536116@article{Grossman06,
     
    62866149}
    62876150
    6288 @manual{Quasar,
    6289     keywords    = {Quasar},
    6290     contributer = {pabuhr@plg},
    6291     author      = {Quasar},
    6292     title       = {Quasar Documentation, Release 0.8.0},
    6293     organization= {Parallel Universe},
    6294     address     = {\href{http://docs.paralleluniverse.co/quasar}{http://\-docs.paralleluniverse.co/\-quasar}},
    6295     year        = 2018,
    6296 }
    6297 
    62986151% R
    62996152
     
    64096262    number      = 10,
    64106263    pages       = {27-32},
    6411 }
    6412 
    6413 @article{Hesselink06,
    6414     author      = {Wim H. Hesselink},
    6415     title       = {Refinement Verification of the Lazy Caching Algorithm},
    6416     journal     = acta,
    6417     year        = 2006,
    6418     month       = oct,
    6419     volume      = 43,
    6420     number      = 3,
    6421     pages       = {195--222},
    64226264}
    64236265
     
    65586400}
    65596401
    6560 @manual{Ruby,
    6561     keywords    = {Ruby},
    6562     contributer = {pabuhr@plg},
    6563     author      = {Ruby},
    6564     title       = {Ruby Documentation, Release 2.6.0},
    6565     organization= {Python Software Foundation},
    6566     address     = {\href{https://www.ruby-lang.org/en/documentation}{https://\-www.ruby-lang.org/\-en/\-documentation}},
    6567     year        = 2018,
    6568 }
    6569 
    65706402% S
    65716403
     
    73587190    author      = {{TIOBE Index}},
    73597191    howpublished= {\href{http://www.tiobe.com/tiobe_index}{http://\-www.tiobe.com/\-tiobe\_index}},
    7360 }
    7361 
    7362 @misc{ThreadModel,
    7363     contributer = {pabuhr@plg},
    7364     key         = {ThreadModel},
    7365     title       = {Thread (computing)},
    7366     author      = {{Threading Model}},
    7367     howpublished= {\href{https://en.wikipedia.org/wiki/Thread_(computing)}{https://\-en.wikipedia.org/\-wiki/\-Thread\_(computing)}},
     7192    optnote     = {Accessed: 2018-09},
    73687193}
    73697194
     
    76977522    year        = 2017,
    76987523    howpublished= {\url{https://wiki.gnome.org/Projects/Vala/Manual}},
     7524    optnote     = {Accessed: 2017-04}
    76997525}
    77007526
     
    78707696% Y
    78717697
    7872 @article{Boehm12,
    7873     keywords    = {memory model, race condition},
    7874     contributer = {pabuhr@plg},
    7875     author      = {Boehm, Hans-J. and Adve, Sarita V.},
    7876     title       = {You Don'T Know Jack About Shared Variables or Memory Models},
    7877     journal     = cacm,
    7878     volume      = 55,
    7879     number      = 2,
    7880     month       = feb,
    7881     year        = 2012,
    7882     pages       = {48--54},
    7883     publisher   = {ACM},
    7884     address     = {New York, NY, USA},
    7885 }
    7886 
    78877698% Z
    78887699
  • doc/papers/concurrency/Paper.tex

    r53bb8f1 r9d9a451  
    228228}
    229229
    230 \title{\texorpdfstring{Advanced Control-flow in \protect\CFA}{Advanced Control-flow in Cforall}}
     230\title{\texorpdfstring{Concurrency in \protect\CFA}{Concurrency in Cforall}}
    231231
    232232\author[1]{Thierry Delisle}
     
    241241
    242242\abstract[Summary]{
    243 \CFA is a modern, polymorphic, non-object-oriented, backwards-compatible extension of the C programming language.
    244 This paper discusses the advanced control-flow features in \CFA, which include concurrency and parallelism, and its supporting runtime system.
    245 These features are created from scratch as ISO C's concurrency is low-level and unimplemented, so C programmers continue to rely on the C pthreads library.
    246 \CFA provides high-level control-flow mechanisms, like coroutines and user-level threads, and monitors for mutual exclusion and synchronization.
    247 A unique contribution of this work is allowing multiple monitors to be safely acquired \emph{simultaneously} (deadlock free), while integrating this capability with all monitor synchronization mechanisms.
     243\CFA is a modern, polymorphic, \emph{non-object-oriented} extension of the C programming language.
     244This paper discusses the design of the concurrency and parallelism features in \CFA, and its concurrent runtime-system.
     245These features are created from scratch as ISO C lacks concurrency, relying largely on the pthreads library for concurrency.
     246Coroutines and lightweight (user) threads are introduced into \CFA;
     247as well, monitors are added as a high-level mechanism for mutual exclusion and synchronization.
     248A unique contribution of this work is allowing multiple monitors to be safely acquired \emph{simultaneously}.
    248249All features respect the expectations of C programmers, while being fully integrate with the \CFA polymorphic type-system and other language features.
    249250Experimental results show comparable performance of the new features with similar mechanisms in other concurrent programming-languages.
    250251}%
    251252
    252 \keywords{coroutines, concurrency, parallelism, threads, monitors, runtime, C, \CFA (Cforall)}
     253\keywords{concurrency, parallelism, coroutines, threads, monitors, runtime, C, Cforall}
    253254
    254255
     
    261262\section{Introduction}
    262263
    263 This paper discusses the design of advanced, high-level control-flow extensions (especially concurrency and parallelism) in \CFA and its runtime.
    264 \CFA is a modern, polymorphic, non-object-oriented\footnote{
    265 \CFA has features often associated with object-oriented programming languages, such as constructors, destructors, virtuals and simple inheritance.
    266 However, functions \emph{cannot} be nested in structures, so there is no lexical binding between a structure and set of functions (member/method) implemented by an implicit \lstinline@this@ (receiver) parameter.},
    267 backwards-compatible extension of the C programming language~\cite{Moss18}.
    268 Within the \CFA framework, new control-flow features were created from scratch.
    269 ISO \Celeven defines only a subset of the \CFA extensions, and with respect to concurrency~\cite[\S~7.26]{C11}, the features are largely wrappers for a subset of the pthreads library~\cite{Butenhof97,Pthreads}.
    270 Furthermore, \Celeven and pthreads concurrency is basic, based on thread fork/join in a function and a few locks, which is low-level and error prone;
    271 no high-level language concurrency features exist.
    272 Interestingly, almost a decade after publication of the \Celeven standard, neither gcc-8, clang-8 nor msvc-19 (most recent versions) support the \Celeven include @threads.h@, indicating little interest in the C concurrency approach.
    273 Finally, while the \Celeven standard does not state a concurrent threading-model, the historical association with pthreads suggests the threading model is kernel-level threading (1:1)~\cite{ThreadModel}.
    274 
    275 In contrast, there has been a renewed interest during the past decade in user-level (M:N, green) threading in old and new programming languages.
    276 As multi-core hardware became available in the 1980/90s, both user and kernel threading were examined.
    277 Kernel threading was chosen, largely because of its simplicity and fit with the simpler operating systems and hardware architectures at the time, which gave it a performance advantage~\cite{Drepper03}.
    278 Libraries like pthreads were developed for C, and the Solaris operating-system switched from user (JDK 1.1~\cite{JDK1.1}) to kernel threads.
    279 As a result, languages like Java, Scala~\cite{Scala}, Objective-C~\cite{obj-c-book}, \CCeleven~\cite{C11}, and C\#~\cite{Csharp} adopted the 1:1 kernel-threading model, with a variety of presentation mechanisms.
    280 From 2000 onwards, languages like Go~\cite{Go}, Erlang~\cite{Erlang}, Haskell~\cite{Haskell}, D~\cite{D}, and \uC~\cite{uC++,uC++book} have championed the M:N user-threading model, and many user-threading libraries have appeared~\cite{Qthreads,MPC,BoostThreads}, including putting green threads back into Java~\cite{Quasar}.
    281 The main argument for user-level threading is that they are lighter weight than kernel threads (locking and context switching do not cross the kernel boundary), so there is less restriction on programming styles that encourage large numbers of threads performing smaller work-units to facilitate load balancing by the runtime~\cite{Verch12}.
    282 As well, user-threading facilitates a simpler concurrency approach using thread objects that leverage sequential patterns versus events with call-backs~\cite{vonBehren03}.
    283 Finally, performant user-threading implementations (both time and space) are largely competitive with direct kernel-threading implementations, while achieving the programming advantages of high concurrency levels and safety.
    284 
    285 A further effort over the past decade is the development of language memory-models to deal with the conflict between certain language features and compiler/hardware optimizations.
    286 This issue can be rephrased as some features are pervasive (language and runtime) and cannot be safely added via a library to prevent invalidation by sequential optimizations~\cite{Buhr95a,Boehm05}.
    287 The consequence is that a language must be cognizant of these features and provide sufficient tools to program around any safety issues.
    288 For example, C created the @volatile@ qualifier to provide correct execution for @setjmp@/@logjmp@ (concurrency came later).
    289 The simplest solution is to provide a handful of complex qualifiers and functions (e.g., @volatile@ and atomics) allowing programmers to write consistent/race-free programs, often in the sequentially-consistent memory-model~\cite{Boehm12}.
    290 
    291 While having a sufficient memory-model allows sound libraries to be constructed, writing these libraries can quickly become awkward and error prone, and using these low-level libraries has the same issues.
    292 Essentially, using low-level explicit locks is the concurrent equivalent of assembler programming.
    293 Just as most assembler programming is replaced with programming in a high-level language, explicit locks can be replaced with high-level concurrency constructs in a programming language.
    294 The goal is to get the compiler to check for correct usage and follow any complex coding conventions implicitly.
    295 The drawback is that language constructs may preclude certain specialized techniques, therefore introducing inefficiency or inhibiting concurrency.
    296 For most concurrent programs, these drawbacks are insignificant in comparison to the speed of composition, and subsequent reliability and maintainability of the high-level concurrent program.
    297 (The same is true for high-level programming versus assembler programming.)
    298 Only very rarely should it be necessary to drop down to races and/or explicit locks to apply a specialized technique to achieve maximum speed or concurrency.
    299 As stated, this observation applies to non-concurrent forms of complex control-flow, like exception handling and coroutines.
    300 
    301 Adapting the programming language allows matching the control-flow model with the programming-language style, versus adapting to one general (sound) library/paradigm.
    302 For example, it is possible to provide exceptions, coroutines, monitors, and tasks as specialized types in an object-oriented language, integrating these constructs to allow leveraging the type-system (static type-checking) and all other object-oriented capabilities~\cite{uC++}.
    303 It is also possible to leverage call/return for blocking communication via new control structures, versus switching to alternative communication paradigms, like channels or message passing.
    304 As well, user threading is often a complementary feature, allowing light-weight threading to match with low-cost objects, while hiding the application/kernel boundary.
    305 User threading also allows layering of implicit concurrency models (no explicit thread creation), such executors, data-flow, actors, into a single language, so programmers can chose the model that best fits an algorithm.\footnote{
    306 All implicit concurrency models have explicit threading in their implementation, and hence, can be build from explicit threading;
    307 however, the reverse is seldom true, i.e., given implicit concurrency, e.g., actors, it is virtually impossible to create explicit concurrency, e.g., blocking thread objects.}
    308 Finally, with extended language features and user-level threading it is possible to discretely fold locking and non-blocking I/O multiplexing into the language's I/O libraries, so threading implicitly dovetails with the I/O subsystem.
    309 
    310 \CFA embraces language extensions and user-level threading to provide advanced control-flow and concurrency.
    311 We attempt to show the \CFA extensions and runtime are demonstrably better than those proposed for \CC and other concurrent, imperative programming languages.
    312 The contributions of this work are:
    313 \begin{itemize}
    314 \item
    315 allowing multiple monitors to be safely acquired \emph{simultaneously} (deadlock free), while seamlessly integrating this capability with all monitor synchronization mechanisms.
    316 \item
    317 all control-flow features respect the expectations of C programmers, with statically type-safe interfaces that integrate with the \CFA polymorphic type-system and other language features.
    318 \item
    319 experimental results show comparable performance of the new features with similar mechanisms in other concurrent programming-languages.
    320 \end{itemize}
    321 
    322 \begin{comment}
    323264This paper provides a minimal concurrency \newterm{Application Program Interface} (API) that is simple, efficient and can be used to build other concurrency features.
    324265While the simplest concurrency system is a thread and a lock, this low-level approach is hard to master.
     
    340281The proposed concurrency API is implemented in a dialect of C, called \CFA (pronounced C-for-all).
    341282The paper discusses how the language features are added to the \CFA translator with respect to parsing, semantics, and type checking, and the corresponding high-performance runtime-library to implement the concurrent features.
    342 \end{comment}
    343 
    344 
    345 \begin{comment}
     283
     284
    346285\section{\CFA Overview}
    347286
     
    612551\end{cfa}
    613552where the return type supplies the type/size of the allocation, which is impossible in most type systems.
    614 \end{comment}
    615 
    616 
    617 \section{Coroutines: A Stepping Stone}\label{coroutine}
    618 
    619 Advanced controlWhile the focus of this discussion is concurrency and parallelism, it is important to address coroutines, which are a significant building block of a concurrency system (but not concurrent among themselves).
     553
     554
     555\section{Concurrency}
     556\label{s:Concurrency}
     557
     558At its core, concurrency is based on multiple call-stacks and scheduling threads executing on these stacks.
     559Multiple call stacks (or contexts) and a single thread of execution, called \newterm{coroutining}~\cite{Conway63,Marlin80}, does \emph{not} imply concurrency~\cite[\S~2]{Buhr05a}.
     560In coroutining, the single thread is self-scheduling across the stacks, so execution is deterministic, \ie the execution path from input to output is fixed and predictable.
     561A \newterm{stackless} coroutine executes on the caller's stack~\cite{Python} but this approach is restrictive, \eg preventing modularization and supporting only iterator/generator-style programming;
     562a \newterm{stackful} coroutine executes on its own stack, allowing full generality.
     563Only stackful coroutines are a stepping stone to concurrency.
     564
     565The transition to concurrency, even for execution with a single thread and multiple stacks, occurs when coroutines also context switch to a \newterm{scheduling oracle}, introducing non-determinism from the coroutine perspective~\cite[\S~3]{Buhr05a}.
     566Therefore, a minimal concurrency system is possible using coroutines (see Section \ref{coroutine}) in conjunction with a scheduler to decide where to context switch next.
     567The resulting execution system now follows a cooperative threading-model, called \newterm{non-preemptive scheduling}.
     568
     569Because the scheduler is special, it can either be a stackless or stackful coroutine.
     570For stackless, the scheduler performs scheduling on the stack of the current coroutine and switches directly to the next coroutine, so there is one context switch.
     571For stackful, the current coroutine switches to the scheduler, which performs scheduling, and it then switches to the next coroutine, so there are two context switches.
     572A stackful scheduler is often used for simplicity and security.
     573
     574Regardless of the approach used, a subset of concurrency related challenges start to appear.
     575For the complete set of concurrency challenges to occur, the missing feature is \newterm{preemption}, where context switching occurs randomly between any two instructions, often based on a timer interrupt, called \newterm{preemptive scheduling}.
     576While a scheduler introduces uncertainty in the order of execution, preemption introduces uncertainty about where context switches occur.
     577Interestingly, uncertainty is necessary for the runtime (operating) system to give the illusion of parallelism on a single processor and increase performance on multiple processors.
     578The reason is that only the runtime has complete knowledge about resources and how to best utilized them.
     579However, the introduction of unrestricted non-determinism results in the need for \newterm{mutual exclusion} and \newterm{synchronization} to restrict non-determinism for correctness;
     580otherwise, it is impossible to write meaningful programs.
     581Optimal performance in concurrent applications is often obtained by having as much non-determinism as correctness allows.
     582
     583An important missing feature in C is threading\footnote{While the C11 standard defines a \protect\lstinline@threads.h@ header, it is minimal and defined as optional.
     584As such, library support for threading is far from widespread.
     585At the time of writing the paper, neither \protect\lstinline@gcc@ nor \protect\lstinline@clang@ support \protect\lstinline@threads.h@ in their standard libraries.}.
     586In modern programming languages, a lack of threading is unacceptable~\cite{Sutter05, Sutter05b}, and therefore existing and new programming languages must have tools for writing efficient concurrent programs to take advantage of parallelism.
     587As an extension of C, \CFA needs to express these concepts in a way that is as natural as possible to programmers familiar with imperative languages.
     588Furthermore, because C is a system-level language, programmers expect to choose precisely which features they need and which cost they are willing to pay.
     589Hence, concurrent programs should be written using high-level mechanisms, and only step down to lower-level mechanisms when performance bottlenecks are encountered.
     590
     591
     592\subsection{Coroutines: A Stepping Stone}\label{coroutine}
     593
     594While the focus of this discussion is concurrency and parallelism, it is important to address coroutines, which are a significant building block of a concurrency system (but not concurrent among themselves).
    620595Coroutines are generalized routines allowing execution to be temporarily suspended and later resumed.
    621596Hence, unlike a normal routine, a coroutine may not terminate when it returns to its caller, allowing it to be restarted with the values and execution location present at the point of suspension.
     
    10851060\end{cquote}
    10861061The combination of these two approaches allows an easy and concise specification to coroutining (and concurrency) for normal users, while more advanced users have tighter control on memory layout and initialization.
    1087 
    1088 
    1089 \section{Concurrency}
    1090 \label{s:Concurrency}
    1091 
    1092 At its core, concurrency is based on multiple call-stacks and scheduling threads executing on these stacks.
    1093 Multiple call stacks (or contexts) and a single thread of execution, called \newterm{coroutining}~\cite{Conway63,Marlin80}, does \emph{not} imply concurrency~\cite[\S~2]{Buhr05a}.
    1094 In coroutining, the single thread is self-scheduling across the stacks, so execution is deterministic, \ie the execution path from input to output is fixed and predictable.
    1095 A \newterm{stackless} coroutine executes on the caller's stack~\cite{Python} but this approach is restrictive, \eg preventing modularization and supporting only iterator/generator-style programming;
    1096 a \newterm{stackful} coroutine executes on its own stack, allowing full generality.
    1097 Only stackful coroutines are a stepping stone to concurrency.
    1098 
    1099 The transition to concurrency, even for execution with a single thread and multiple stacks, occurs when coroutines also context switch to a \newterm{scheduling oracle}, introducing non-determinism from the coroutine perspective~\cite[\S~3]{Buhr05a}.
    1100 Therefore, a minimal concurrency system is possible using coroutines (see Section \ref{coroutine}) in conjunction with a scheduler to decide where to context switch next.
    1101 The resulting execution system now follows a cooperative threading-model, called \newterm{non-preemptive scheduling}.
    1102 
    1103 Because the scheduler is special, it can either be a stackless or stackful coroutine.
    1104 For stackless, the scheduler performs scheduling on the stack of the current coroutine and switches directly to the next coroutine, so there is one context switch.
    1105 For stackful, the current coroutine switches to the scheduler, which performs scheduling, and it then switches to the next coroutine, so there are two context switches.
    1106 A stackful scheduler is often used for simplicity and security.
    1107 
    1108 Regardless of the approach used, a subset of concurrency related challenges start to appear.
    1109 For the complete set of concurrency challenges to occur, the missing feature is \newterm{preemption}, where context switching occurs randomly between any two instructions, often based on a timer interrupt, called \newterm{preemptive scheduling}.
    1110 While a scheduler introduces uncertainty in the order of execution, preemption introduces uncertainty about where context switches occur.
    1111 Interestingly, uncertainty is necessary for the runtime (operating) system to give the illusion of parallelism on a single processor and increase performance on multiple processors.
    1112 The reason is that only the runtime has complete knowledge about resources and how to best utilized them.
    1113 However, the introduction of unrestricted non-determinism results in the need for \newterm{mutual exclusion} and \newterm{synchronization} to restrict non-determinism for correctness;
    1114 otherwise, it is impossible to write meaningful programs.
    1115 Optimal performance in concurrent applications is often obtained by having as much non-determinism as correctness allows.
    1116 
    1117 An important missing feature in C is threading\footnote{While the C11 standard defines a \protect\lstinline@threads.h@ header, it is minimal and defined as optional.
    1118 As such, library support for threading is far from widespread.
    1119 At the time of writing the paper, neither \protect\lstinline@gcc@ nor \protect\lstinline@clang@ support \protect\lstinline@threads.h@ in their standard libraries.}.
    1120 In modern programming languages, a lack of threading is unacceptable~\cite{Sutter05, Sutter05b}, and therefore existing and new programming languages must have tools for writing efficient concurrent programs to take advantage of parallelism.
    1121 As an extension of C, \CFA needs to express these concepts in a way that is as natural as possible to programmers familiar with imperative languages.
    1122 Furthermore, because C is a system-level language, programmers expect to choose precisely which features they need and which cost they are willing to pay.
    1123 Hence, concurrent programs should be written using high-level mechanisms, and only step down to lower-level mechanisms when performance bottlenecks are encountered.
    11241062
    11251063
  • doc/papers/concurrency/mail

    r53bb8f1 r9d9a451  
    2727
    2828Software: Practice and Experience Editorial Office
    29 
    30 
    31 
    32 Date: Wed, 3 Oct 2018 21:25:28 +0000
    33 From: Richard Jones <onbehalfof@manuscriptcentral.com>
    34 Reply-To: R.E.Jones@kent.ac.uk
    35 To: tdelisle@uwaterloo.ca, pabuhr@uwaterloo.ca
    36 Subject: Software: Practice and Experience - Decision on Manuscript ID
    37  SPE-18-0205
    38 
    39 03-Oct-2018
    40 
    41 Dear Dr Buhr,
    42 
    43 Many thanks for submitting SPE-18-0205 entitled "Concurrency in C∀" to Software: Practice and Experience.
    44 
    45 In view of the comments of the referees found at the bottom of this letter, I cannot accept your paper for publication in Software: Practice and Experience. I hope that you find the referees' very detailed comments helpful.
    46 
    47 Thank you for considering Software: Practice and Experience for the publication of your research.  I hope the outcome of this specific submission will not discourage you from submitting future manuscripts.
    48 
    49 Yours sincerely,
    50 
    51 
    52 Prof. Richard Jones
    53 Editor, Software: Practice and Experience
    54 R.E.Jones@kent.ac.uk
    55 
    56 Referee(s)' Comments to Author:
    57 
    58 Reviewing: 1
    59 
    60 Comments to the Author
    61 "Concurrency in Cforall" presents a design and implementation of a set of standard concurrency features, including coroutines, user-space and kernel-space threads, mutexes, monitors, and a scheduler, for a polymorphic derivation of C called Cforall.
    62 
    63 Section 2 is an overview of sequential Cforall that does not materially contribute to the paper. A brief syntax explanation where necessary in examples would be plenty.
    64 
    65 Section 3 begins with with an extensive discussion of concurrency that also does not materially contribute to the paper. A brief mention of whether a particular approach implements cooperative or preemptive scheduling would be sufficient. Section 3 also makes some unfortunate claims, such as C not having threads -- C does in fact define threads, and this is noted as being true in a footnote, immediately after claiming that it does not. The question remains why the C11 parallelism design is insufficient and in what way this paper proposes to augment it. While I am personally a proponent of parallel programming languages, backing the assertion that all modern languages must have threading with citations from 2005 ignores the massive popularity of modern non-parallel languages (Javascript, node.js, Typescript, Python, Ruby, etc.) and parallel languages that are not thread based, although the authors are clearly aware of such approaches.
    66 
    67 Sections 3.1 and 3.2 dicusses assymetric and symmetric coroutines. This also does not seem to materially contribute to a paper that is ostensibly about concurrency in a modern systems programming language. The area of coroutines, continuations, and generators is already well explored in the context of systems languages, including compilation techniques for these constructs that are more advanced than the stack instantiation model discussed in the paper.
    68 
    69 Section 3.3 describes threads in Cforall, briefly touching on user-space vs. kernel-space thread implementations without detailing the extensive practical differences. It is unclear how the described interface differes from C++11 threads, as the description seems to center on an RAII style approach to joining in the destructor.
    70 
    71 Section 4 briefly touches on a collection of well known synchronisation primitives. Again, this discussion does not materially contribute to the paper.
    72 
    73 Section 5 describes monitors, which are a well known and well researched technique. The Cforall implementation is unsurprising. The "multi-acquire semantics" described are not a contribution of this paper, as establishing a stable order for lock acquisition is a well known technique, one example of which is the C++ std::scoped_lock.
    74 
    75 Section 6 is a discussion of scheduling that does not appear to be informed by the literature. There is no discussion of work-stealing vs. work-scheduling, static vs. dynamic priorities, priority inversion, or fairness. There is a claim in secion 6.1 for a novel technique, partial signalling, that appears to be a form of dynamic priority, but no comparison is made. In section 6.6, a very brief mention of other synchronisation techniques is made, without reference to current techniques such as array-based locks, CLH or MCS queue locks, RCU and other epoch-based mechanisms, etc. Perhaps these are considered out of scope.
    76 
    77 Section 7 discusses parallelism, but does not materially contribute to the paper. It is claimed that preemption is necessary to implement spinning, which is not correct, since two cores can implement a spinning based approach without preemption. It is claimed that with thread pools "concurrency errors return", but no approach to removing concurrency errors with either preemptive or cooperatively scheduled user threads has been proposed in the paper that would not also apply to thread pools.
    78 
    79 Section 8 is intended to describe the Cforall runtime structure, but does so in a way that uses terminology in an unfamiliar way. The word cluster is more usually used in distributed systems, but here refers to a process. The term virtual processor is more usually used in hardware virtualisation, but here refers to a kernel thread. The term debug kernel is more usually used in operating systems to refer to kernels that have both debug info and a method for using a debugger in kernel space, but here refers to a debug build of a user-space process. This section does not materially contribute to the paper.
    80 
    81 Section 9 is intended to describe the Cforall runtime implementation. It makes some unusual claims, such as C libraries migrating to stack chaining (stack chaining was an experimental GCC feature that has been abandoned, much as it has been abandoned in both Go and Rust).
    82 
    83 The performance measurements in section 10 are difficult to evaluate. While I appreciate that comparable concurrency benchmarks are very difficult to write, and the corpus of existing benchmarks primarily boils down to the parallel programs in the Computer Language Benchmark Game, the lack of detail as to what is being measured in these benchmarks (particularly when implemented in other languages) is unfortunate. For example, in table 3, the benchmark appears to measure uncontended lock access, which is not a useful micro-benchmark.
    84 
    85 It is not clear what the contributions of this paper are intended to be. A concise listing of the intended contributions would be helpful. Currently, it appears that the paper makes neither PL contributions in terms of novel features in Cforall, nor does it make systems contributions in terms of novel features in the runtime.
    86 
    87 
    88 Reviewing: 2
    89 
    90 Comments to the Author
    91 This article presents the design and rationale behind the concurrency
    92 features of C-forall, a new low-level programming language.  After an
    93 introduction that defines a selection of standard terminology, section
    94 2 gives crucial background on the design of the C-forall language.
    95 Section 3 then starts the core of the article, discussing the
    96 language's support for "concurrency" which in this case means
    97 coroutines and threads; a very brief Section 4 builds on section 3
    98 with a discussion of lower level synchronizations.  Section 5 the
    99 presents the main features of concurrency control in C-forall:
    100 monitors and mutexes. Section 6 then extends monitors with condition
    101 variables to to support scheduling, and a very brief section 7
    102 discusses preemption and pooling. Section 8 discusses the runtime
    103 conceptual model, section 9 gives implementation detail, and section
    104 10 briefly evaluates C-forall's performance via five concurrent
    105 micro benchmarks. Finally section 11 concludes the article, and then
    106 section 12 presents some future work. 
    107 
    108 
    109 At the start of section 7, article lays out its rationale: that while
    110 "historically, computer performance was about processor speeds" but
    111 "Now, high-performance applications must care about parallelism,
    112 which requires concurrency". The doomsayers trumpeting the death of
    113 Moore's law have been proved correct at last, with CPUs sequential
    114 performance increasing much more slowly than the number of cores
    115 within each die. This means programmers --- especially low-level,
    116 systems programmers --- must somehow manage the essential complexity
    117 of writing concurrent programs to run in parallel in multiple threads
    118 across multiple cores. Unfortunately, the most venerable widely used
    119 systems programming language, C, supports parallelism only via an
    120 e.g. the threads library.  This article aims to integrate concurrent
    121 programming mechanisms more closely into a novel low-level C-based
    122 programming language, C-forall. The article gives an outline of much of
    123 C-forall, presents a series of concurrency mechanisms, and finally
    124 some microbenchmark results.  The article is detailed, comprehensive,
    125 and generally well written in understandable English.
    126 
    127 My main concern about the article are indicated by the fact that the
    128 best summary of the problem the design of concurrent C-forall sets
    129 out to solve is buried more than halfway through the article in section
    130 7, as above, and then the best overview of the proposed solution is
    131 given in the 2nd, 4th and 5th sentence of the conclusion:
    132 
    133    "The approach provides concurrency based on a preemptive M:N
    134     user-level threading-system, executing in clusters, which
    135     encapsulate scheduling of work on multiple kernel threads
    136     providing parallelism... High-level objects (monitor/task) are the
    137     core mechanism for mutual exclusion and synchronization. A novel
    138     aspect is allowing multiple mutex-objects to be accessed
    139     simultaneously reducing the potential for deadlock for this
    140     complex scenario."
    141 
    142 That is, in my reading of the article, it proceeds bottom up rather
    143 than top down, and so my main recommendation is to essentially reverse
    144 the order of the article, proceeding from the problem to be solved,
    145 the high level architecture of the proposed solutions, and then going
    146 down to the low-level mechanisms.  My biggest problem reading the
    147 article was for explanations of why a particular decision was taken,
    148 or why a particular mechanism may be used --- often this description
    149 is actually later in the article, but at that point it's too late for
    150 the reader.  I have tried to point out most of these places in the
    151 detailed comments below.
    152 
    153 My second concern is that the article makes several claims that are
    154 not really justified by the design or implementation in the article.
    155 These include claims that this approach meets the expectations of C
    156 programmers, is minimal, is implemented in itself, etc.  The article
    157 doesn't generally offer evidence to support these assertions (for many
    158 of them, that would require empirical studies of programmers, or at
    159 least corpus studies). The solution here is to talk about motivations
    160 for the design choices "we made these decisions hoping that C
    161 programmers would be comfortable" rather than claims of fact "C
    162 programmers are comfortable".  Again I attempt to point these out below.
    163 
    164 * abstract: needs to characterize the work top down, and not make
    165   claims "features respect the expectations of C programmers" that
    166   are not supported empirically.
    167 
    168 * p1 line 14 "integrated"
    169 
    170 * introduction needs to introduce the big ideas and scope of the
    171   article, not define terms.  Some of the terms / distinctions are
    172   non-standard (e.g. the distinction between "concurrency" and
    173   "parallelism") and can be avoided by using more specific terms
    174   (mutual exclusion, synchronization, parallel execution. etc).
    175 
    176 * to me this article introduces novel language features, not just an
    177   API.  Similarly, it doesn't talk about any additions "to the
    178   language translator" - i.e compiler changes! - rather about language
    179   features.
    180 
    181 
    182 * section 2 lines 6-9 why buy this fight against object-orientation?
    183   this article doesn't need to make this argument, but needs to do a
    184   better job of it if it does (see other comments below)
    185 
    186 * sec 2.1 - are these the same as C++. IF so, say so, if not, say why
    187   not.
    188 
    189 * 2.2 calling it a "with statement" was confusing, given that a with
    190   clause can appear in a routine declaration with a shorthand syntax.
    191 
    192 * 2.3 again compare with C++ and Java (as well as Ada)
    193 
    194 * line 9 "as we will see in section 3"
    195 
    196 * 2.4 I really quite like this syntax for operators, destructors not
    197   so much.
    198 
    199 * 2.5 and many places elsewhere. Always first describe the semantics
    200   of your language constructs, then describe their properties, then
    201   compare with e.g. related languages (mostly C++ & Java?).  E.g in
    202   this case, something like:
    203 
    204   "C-forall includes constructors, which are called to initialize
    205   newly allocated objects, and constructors, which are called when
    206   objects are deallocated. Constructors and destructors are written as
    207   functions returning void, under the special names "?{}" for
    208   constructors and "^{}" for destructors: constructors may be
    209   overridden, but destructors may not be.  The semantics of C-forall's
    210   constructors and destructors are essentially those of C++."
    211 
    212   this problem repeats many times throughout the article and should be
    213   fixed everywhere.
    214 
    215 
    216 * 2.6 again, first describe then properties then comparison.
    217    in this case, compare e.g. with C++ templates, Java/Ada generics
    218    etc.
    219 
    220 * why special case forward declarations? It's not 1970 any more.
    221 
    222 * what are traits?  structural interfaces (like Go interfaces) or
    223   nominal bindings?
    224 
    225 * section 3 - lines 2-30, also making very specific global definitions
    226   as in the introduction. The article does not need to take on this
    227   fight either, rather make clear that this is the conceptual model in
    228   C-forall. (If the article starts at the top and works down, that may
    229   well follow anyway).
    230 
    231 * "in modern programming languages... unacceptable"; "in a
    232   system-level language.. concurrent programs should be written with
    233   high-level features" - again, no need to take on these fights.
    234 
    235 * 3.1 onwards; I found all this "building" up hard to follow.
    236   also it's not clear a "minimal" API must separately support
    237   coroutines, threads, fibres, etc
    238 
    239 * FIG 2B - where's the output?
    240   syntax "sout | next(f1) | next(f2) | endl" nowhere explained
    241     why not use C++s' << and >>
    242 
    243 * FIG 3 be clearer, earlier about the coroutine" constructor syntax
    244 
    245 ** ensure all figures are placed *after* their first mention in the
    246    text. consider interleaving smaller snippets of text rather than
    247    just referring to large figures
    248 
    249 * sec 3.1 p7 etc,. need more context / comparison e.g. Python
    250   generators etc.
    251 
    252 * FIGURE 4 is this right?  should there a constructor for Cons taking
    253   a Prod?
    254 
    255 
    256 * sec 3.2 order of constructors depends on the language.  more
    257   generally, if the article is going to make arguments against OO
    258   (e.g. section 2) then the article needs to explain, in detail, why
    259   e.g. coroutine, thread, etc *cannot* be classes / objects.
    260 
    261 * "type coroutine_t must be an abstract handle.. descriptor and is
    262   stack are non-copyable" - too many assumptions in here (and other
    263   similar passages) that are not really spelled out in detail.
    264 
    265 * p10 line 4 introduces "coroutine" keyword. needs to give its
    266   semantics. also needs to introduce and define properties and compare
    267   before all the examples using coroutines.
    268 
    269 * p10 again, trait semantics need to be better defined
    270 
    271 * 3.3 should be an introduction to this section. Note that section
    272   titles are not part of the text of the article.
    273 
    274 * what's the difference between "coroutines" and "user threads" (and
    275   "fibres?")
    276 
    277 * what's a "task type" or an "interface routine"  or "underlying
    278   thread"
    279 
    280 * section 4 - "... meaningless". nope some semantics are possible
    281   e.g. if there's a memory model.
    282 
    283 * whatare "call/return based languages"
    284 
    285 * p12 - what if a programmer wants to join e.g. "1st of N" or "1st 3 of N"
    286   threads rather than all threads in order
    287 
    288 * 4.1 p12 13-25, again it's not clear where this is going.  presenting the model
    289   top down may hopefully resolve this
    290 
    291 * section 4 should be merged e.g. into sec 3 (or 5)
    292 
    293 
    294 
    295 * section 5 p13 what's "routine" scope. "call/return paradigm"
    296 
    297 * thread/ coroutine declarations, traits etc, all look pretty close to
    298   inheritance. why wouldn't inheritance work?
    299 
    300 * open/closed locks = free/acquired free locks?
    301 
    302 * testability?
    303 
    304 * p14 lines 14-20 I had trouble following this.  e.g/. what's the
    305   difference between "a type that is a monitor" and "a type that looks
    306   like a monitor"?  why?
    307 
    308 * line 39 - what's an "object-oriented monitor"?    Java?
    309     there is no one OO model of such things.
    310 
    311 * line 47 significant asset - how do you know?
    312 
    313 * how could this e.g. build a reader/writer lock
    314 
    315 * *p15 what's the "bank account transfer problem"
    316 
    317 *p16 lines6-10  why? explain?
    318 
    319 *p17 semantics of arrays of conditions is unclear
    320      given e.g. previous comments about arrays of mutexes.
    321 
    322 *p18 define "spurious wakeup"
    323 
    324 *p18 line 44 - "a number of approaches were examined"?  which
    325  approaches? examined by whom?  if this is a novel contribution, needs
    326  rather more there, and more comparison with related work
    327 
    328 * FIG 8 consider e.g. sequence diagrams rather than code to show these
    329   cases
    330 
    331 * 6.2 p19 line 5 "similarly, monitor routines can be added at any
    332   time" really?  I thought C-forall was compiled? there's a big
    333   difference between "static" and "dynamic" inheritance. which is this
    334   closer to?
    335 
    336 * line 25 "FIgure 9 (B) shows the monitor implementation"
    337    I didn't understand this, especially not as an implementation.
    338 
    339 * section 6.6 - if the article is to make claims about completeness,
    340   about supporting low and high level operations, then this must be
    341   expanded to give enough detail to support that argument
    342 
    343 * "truest realization" huh?
    344 
    345 * section 7 should be merged into 6 or 8.
    346   it's not clear if this is exploring rejected alternatives,
    347   out outlining different features offered by C-forall, or what.
    348 
    349 
    350 * sec 7.2 how do the other threads in sections 5 & 6 relate to the
    351   user threads, fibres, etc here;
    352 
    353 * sec 8.1 I found these sections hard to follow. how is a cluster a
    354   "collection of threads and virtual processors... like a virtual
    355   machine"? Where do the thread pools from 7.3 fit in?
    356 
    357 *  sec 8.3 is out of place, probably unneeded in the paper
    358 
    359 * section 9 dives straight into details with no overview.  Section 9
    360   seems very detailed, and depends on assumptions or details that are
    361   not in the article.
    362 
    363 * section 10 covers only microbenchmarks. are there any moderate sized
    364   macrobenchmarks that can compare across the different systems?
    365   (e.g the Erlang Ring?)
    366 
    367 * sec 11 claims that "the entire C-forall runtime system are written
    368   in C-forall". The article doesn't
    369 
    370 
    371 * future work should precede conclusion, not follow it
    372 
    373 * the article should have a related work section (2-3 pages) comparing
    374   the design overall with various competing designs (C++, Java, go,
    375   Rust,...)
    376 
    377 To encourage accountability, I'm signing my reviews in 2018. For the record, I am James Noble, kjx@ecs.vuw.ac.nz.
    378 
    379 Reviewing: 3
    380 
    381 Comments to the Author
    382 This paper describes the design and implementation of coroutine- and thread-based concurrency in the C-for-all (I will write "C\/") system, a considerably extended form of the C language with many concurrency features.
    383 
    384 It first provides an overview of the non-concurrency-related aspects of the host language (references, operator overloading, generics, etc.), then addresses several technical issues around concurrency, including the multi-monitor design, bulk acquiring of locks (including deadlock-avoiding management of acquisition order), solutions to difficult scheduling problems around these, and implementation of monitors in the presence of separate compilation. It also presents empirical data showing the execution times of several microbenchmarks in comparison with other threaded concurrency systems, in support of the claim that the implementation is competitive with them.
    385 
    386 Overall the impression I gained is that this is a substantial system into which have gone much thought and effort.
    387 
    388 However, the present paper is not written so as to communicate sufficiently clearly the novel practices or experiences that emerged from that effort. This manifests itself in several ways.
    389 
    390 The system is described in general, rather than with a focus on novel insights or experiences. It was not until page 18 that I found a statement that hinted at a possible core contribution: "Supporting barging prevention as well as extending internal scheduling to multiple monitors is the main source of complexity in design and implementation of C\/ concurrency." Even then, it is unclear whether such challenges have already been surmounted in prior systems, or what other challenges the paper may also be covering. The most complete list of claims appears to be in the Conclusion (section 11; oddly not the last section), although not everything listed is a novel feature of the work (e.g. N:M threading models are an old idea). This presentation needs to be completely inverted, to focus from the outset on the claimed novel/noteworthy experiences that the work embodies.
    391 
    392 The text describing the system's motivation is unconvincing on one point: the claim that library support for threading in C is "far from widespread" (p5, footnote A). The pthreads library API is standardised, albeit not in the C language specification but rather in POSIX -- a widespread standard indeed. (With systems languages, even if the language does not define a feature, it of course does not follow that that feature is not available -- since such languages permit extension of their own runtime and/or toolchain.) Of course, the combination of C and pthreads does not provide close to the full complement of C\/-supported features, so it is easy to make a case for C\/'s targeted "gap in the market". But again, a presentation focused on novel aspects would bring this out and enable the reader to learn from the authors' efforts much more readily.
    393 
    394 Certain sections of the text read like a tutorial on concurrency... which is potentially valuable, but does not seem to belong here. For example, much effort is spent introducing the notions of "synchronization" and "mutual exclusion", including the whole of Section 4.2. Presently it is unclear how this content supports the findings/experiences that the paper is detailing.
    395 
    396 Similarly, section 8 reads mostly as a basic introduction to user versus kernel threading implementations (including hybrid models such as N:M scheduling), and appears superfluous to this paper. Mixed into this are details of C\/'s specific approach. These could instead be stated directly, with references to handle the unlikely case where the reader is unfamiliar.
    397 
    398 I also found the definitions of certain terms through the paper a bit non-standard, for unclear reasons. For example, why "condition lock" rather than the standard "condition variable" (if indeed that is what is intended)? To say that "synchronisation" is about "timing" strikes me as potentially confusing, since in truth synchronisation concerns only relative timing, i.e. ordering. (Even ordering is something of a derived concept -- since of course, most commonly, control over ordering is built atop synchronisation primitives, rather than being provided directly by them.)
    399 
    400 The empirical data presented is a reasonable start at characterising the implementation's performance. However, it currently suffers certain flaws.
    401 
    402 Firstly, it is not clear what is being claimed. The data cannot really be said to "verify the implementation" (section 10). Presumably the claim is that the system is competitive with other systems offering reasonably high-level concurrency constructs (Java monitors, Go channels, etc.) and/or on low-level facilities (mutexes, coroutines). A claim of this form, emphasising the latter, does eventually appear in the Conclusion, but it needs to be made explicitly during the presentation of the experiments. Shifting the focus towards higher-level features may be a better target, since this appears to be C\/'s main advance over pthreads and similar libraries.
    403 
    404 It appears some additional or alternative competitor systems might be a better match. For example, many green-thread or N:M libraries for C exist (libdill/libmill, Marcel, even GNU Pth). It would be instructive to compare with these.
    405 
    406 It would help greatly if the "functionally identical" benchmark code that was run on the competing systems were made available somewhere. Omitting it from the main text of the paper is understandable, since it would take too much space, but its details may still have a critical bearing on the results.
    407 
    408 In some cases it simply wasn't clear what is being compared. In Table 3, what are "FetchAdd + FetchSub"? I'm guessing this is some open-coded mutex using C++ atomics, but (unless I'm missing something) I cannot see an explanation in the text.
    409 
    410 The reports of variance (or, rather, standard deviation) are not always plausible. Is there really no observable variation in three of Table 3's cases? At the least, I would appreciate more detail on the measures taken to reduce run-time variance (e.g. disabling CPU throttling perhaps?).
    411 
    412 The text habitually asserts the benefits of C\/'s design without convincing argument. For example, in 2.1, do C\/'s references really reduce "syntactic noise"? I am sympathetic to the problem here, because many design trade-offs simply cannot be evaluated without very large-scale or long-term studies. However, the authors could easily refrain from extrapolating to a grand claim that cannot be substantiated. For example, instead of saying C\/ is "expressive" or "flexible" or "natural", or (say) that fork/join concurrency is "awkward and unnecessary" (p11), it would be preferable simply to give examples of the cases are captured well in the C\/ design (ideally together with any less favourable examples that illustrate the design trade-off in question) and let them speak for themselves.
    413 
    414 One thing I found confusing in the presentation of coroutines is that it elides the distinction between "coroutines" (i.e. their definitions) and activations thereof. It would be helpful to make this clearer, since at present this makes some claims/statements hard to understand. For example, much of 3.2 talks about "adding fields", which implies that a coroutine's activation state exists as fields in a structured object -- as, indeed, it does in C\/. This is non-obvious because in a more classical presentation of coroutines, their state would live not in "fields" but in local variables. Similarly, the text also talks about composition of "coroutines" as fields within other "coroutines", and so on, whereas if I understand correctly, these are also activations. (By later on in the text, the "C\/ style" of such constructs is clear, but not at first.)
    415 
    416 I was expecting a reference to Adya et al's 2002 Usenix ATC paper, on the topic of "fibers" and cooperative threading generally but also for its illustrative examples of stack ripping (maybe around "linearized code is the bane of device drivers", p7, which seems to be making a similar observation).
    417 
    418 Minor comments:
    419 
    420 The writing is rather patchy. It has many typos, and also some cases of "not meaning what is said", unclear allusions, etc.. The following is a non-exhaustive list.
    421 
    422 - p2 line 7: "C has a notion of objects" -- true, but this is not intended as "object" in anything like the same sense as "object-oriented", so raising it here is somewhere between confusing and meaningless.
    423 
    424 - lots of extraneous hyphenation e.g "inheritance-relationships", "critical-section", "mutual-exclusion", "shared-state" (as a general rule, only hyphenate noun phrases when making an adjective out of them)
    425 
    426 - p4 "impossible in most type systems" -- this is not a property of the "type system" as usually understood, merely the wider language design
    427 
    428 - p17: "release all acquired mutex types in the parameter list" should just say "release all acquired mutexes that are designated in the parameter list" (it is not "types" that are being released or acquired);
    429 
    430 - p19: "a class includes an exhaustive list of operations" -- except it is definitively *not* exhaustive, for the reasons given immediately afterwards. I do see the problem here, about separate compilation meaning that the space of functions using a particular type is not bounded at compile time, but that needs to be identified clearly as the problem. (Incidentally, one idea is that perhaps this mapping onto a dense space could be solved at link- or load-time, in preference to run-time indirection.)
    431 
    432 - p22: in 6.5, the significance of this design decision ("threads... are monitors") was still not clear to me.
    433 
    434 - p22: [user threads are] "the truest realization of concurrency" sounds like unnecessary editorializing (many systems can exist that can also encode all others, without necessarily giving one supremacy... e.g. actors can be used to encode shared-state concurrency).
    435 
    436 - p24: on line 19, the necessary feature is not "garbage collection" but precise pointer identification (which is distinct; not all GCs have it, and it has other applications besides GC)
    437 
    438 - p24: lines 32-39 are very dense and of unclear significance; an example, including code, would be much clearer.
    439 
    440 - p25: "current UNIX systems" seems to mean "Linux", so please say that or give the behaviour or some other modern Unix (I believe Solaris is somewhat different, and possibly the BSDs too). Also, in the explanation of signal dynamics, it would be useful to adopt the quotation's own terminology of "process-directed" signals. Presumably the "internal" thread-directed signals were generated using tgkill()? And presumably the timer expiry signal is left unblocked only on the thread (virtual processor) running the "simulation"? (Calling it a "simulation" is a bit odd, although I realise it is borrowing the concept of a discrete event queue.)
    441 
  • driver/Makefile.in

    r53bb8f1 r9d9a451  
    187187DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    188188ACLOCAL = @ACLOCAL@
     189ALLOCA = @ALLOCA@
    189190AMTAR = @AMTAR@
    190191AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
  • driver/cfa.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Feb 10 08:28:09 2019
    13 // Update Count     : 281
     12// Last Modified On : Fri Sep 14 23:02:59 2018
     13// Update Count     : 277
    1414//
    1515
     
    107107        bool link = true;                                                                       // linking as well as compiling
    108108        bool verbose = false;                                                           // -v flag
    109         bool quiet = false;                                                             // -quiet flag
    110         bool debug = true;                                                              // -debug flag
    111         bool nolib = false;                                                             // -nolib flag
    112         bool help = false;                                                              // -help flag
     109        bool quiet = false;                                                                     // -quiet flag
     110        bool debug = true;                                                                      // -debug flag
     111        bool help = false;                                                                      // -help flag
    113112        bool CFA_flag = false;                                                          // -CFA flag
    114113        bool cpp_flag = false;                                                          // -E or -M flag, preprocessor only
     
    163162                                debug = true;                                                   // strip the debug flag
    164163                        } else if ( arg == "-nodebug" ) {
    165                                 debug = false;                                                  // strip the debug flag
    166                         } else if ( arg == "-nolib" ) {
    167                                 nolib = true;                                                   // strip the nodebug flag
     164                                debug = false;                                                  // strip the nodebug flag
    168165                        } else if ( arg == "-quiet" ) {
    169166                                quiet = true;                                                   // strip the quiet flag
     
    369366                }  // if
    370367        } // if
    371         const char * config = nolib ? "nolib" : (debug ? "debug": "nodebug");
     368        const char * config = debug ? "debug": "nodebug";
    372369        string libdir = libbase + arch + "-" + config;
    373370
    374         if ( ! nolib && ! dirExists( libdir ) ) {
     371        if ( ! dirExists( libdir ) ) {
    375372                cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
    376373                cerr << "Was looking for " << libdir << endl;
     
    387384        nargs += 1;
    388385
    389         for ( int i = 0; i < nlibs; i += 1 ) {                          // copy non-user libraries after all user libraries
    390                 args[nargs] = libs[i];
    391                 nargs += 1;
    392         } // for
    393 
    394386        if ( link ) {
    395387                args[nargs] = "-Xlinker";
     
    422414                nargs += 1;
    423415                args[nargs] = "-lrt";
    424                 nargs += 1;
    425                 args[nargs] = "-lm";
    426416                nargs += 1;
    427417        } // if
     
    498488                args[nargs] = "-Wno-deprecated";
    499489                nargs += 1;
    500 #ifdef HAVE_CAST_FUNCTION_TYPE
    501                 args[nargs] = "-Wno-cast-function-type";
    502                 nargs += 1;
    503 #endif // HAVE_CAST_FUNCTION_TYPE
    504490                if ( ! std_flag ) {                                                             // default c11, if none specified
    505491                        args[nargs] = "-std=gnu11";
     
    511497                nargs += 1;
    512498                args[nargs] = ( *new string( string("-B") + Bprefix ) ).c_str();
     499                nargs += 1;
     500                args[nargs] = "-lm";
    513501                nargs += 1;
    514502        } else {
     
    516504                exit( EXIT_FAILURE );
    517505        } // if
     506
     507        for ( int i = 0; i < nlibs; i += 1 ) {                          // copy non-user libraries after all user libraries
     508                args[nargs] = libs[i];
     509                nargs += 1;
     510        } // for
    518511
    519512        args[nargs] = NULL;                                                                     // terminate with NULL
  • libcfa/configure

    r53bb8f1 r9d9a451  
    23822382
    23832383
    2384 # http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_compile_flag.m4
    2385 
    23862384
    23872385am__api_version='1.15'
     
    29702968        "nolib"   )
    29712969                CONFIG_CFLAGS="-O2 -s"
    2972                 CONFIG_CFAFLAGS="-nolib"
     2970                CONFIG_CFAFLAGS="-nodebug"
    29732971                CONFIG_BUILDLIB="no"
    29742972        ;;
  • libcfa/configure.ac

    r53bb8f1 r9d9a451  
    5656        "nolib"   )
    5757                CONFIG_CFLAGS="-O2 -s"
    58                 CONFIG_CFAFLAGS="-nolib"
     58                CONFIG_CFAFLAGS="-nodebug"
    5959                CONFIG_BUILDLIB="no"
    6060        ;;
  • libcfa/prelude/builtins.c

    r53bb8f1 r9d9a451  
    1010// Created On       : Fri Jul 21 16:21:03 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Mar 10 10:52:50 2019
    13 // Update Count     : 31
     12// Last Modified On : Sun Aug  5 21:40:38 2018
     13// Update Count     : 20
    1414//
    1515
     
    2626// increment/decrement unification
    2727
    28 static inline forall( dtype T | { T & ?+=?( T &, one_t ); } )
    29 T & ++? ( T & x ) { return x += 1; }
     28static inline forall( dtype T | { T& ?+=?( T&, one_t ); } )
     29T& ++? ( T& x ) { return x += 1; }
    3030
    31 static inline forall( dtype T | sized(T) | { void ?{}( T &, T ); void ^?{}( T & ); T & ?+=?( T &, one_t ); } )
    32 T & ?++ ( T & x ) { T tmp = x; x += 1; return tmp; }
     31static inline forall( dtype T | sized(T) | { void ?{}( T&, T ); void ^?{}( T& ); T& ?+=?( T&, one_t ); } )
     32T& ?++ ( T& x ) { T tmp = x; x += 1; return tmp; }
    3333
    34 static inline forall( dtype T | { T & ?-=?( T &, one_t ); } )
    35 T & --? ( T & x ) { return x -= 1; }
     34static inline forall( dtype T | { T& ?-=?( T&, one_t ); } )
     35T& --? ( T& x ) { return x -= 1; }
    3636
    37 static inline forall( dtype T | sized(T) | { void ?{}( T &, T ); void ^?{}( T & ); T & ?-=?( T &, one_t ); } )
    38 T & ?-- ( T & x ) { T tmp = x; x -= 1; return tmp; }
    39 
    40 // universal typed pointer constant
    41 
    42 static inline forall( dtype T ) T * intptr( uintptr_t addr ) { return (T *)addr; }
     37static inline forall( dtype T | sized(T) | { void ?{}( T&, T ); void ^?{}( T& ); T& ?-=?( T&, one_t ); } )
     38T& ?-- ( T& x ) { T tmp = x; x -= 1; return tmp; }
    4339
    4440// exponentiation operator implementation
  • libcfa/prelude/extras.c

    r53bb8f1 r9d9a451  
    1 #include <stddef.h>                                     // size_t, ptrdiff_t, intptr_t, uintptr_t
     1#include <stddef.h>                                     // size_t, ptrdiff_t
    22#include <stdint.h>                                     // intX_t, uintX_t, where X is 8, 16, 32, 64
    33#include <uchar.h>                                      // char16_t, char32_t
  • libcfa/prelude/extras.regx

    r53bb8f1 r9d9a451  
    11typedef.* size_t;
    22typedef.* ptrdiff_t;
    3 typedef.* intptr_t;
    4 typedef.* uintptr_t;
    53typedef.* __int8_t;
    64typedef.* __int16_t;
  • libcfa/prelude/prelude-gen.cc

    r53bb8f1 r9d9a451  
    1 //
    2 // Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
    3 //
    4 // The contents of this file are covered under the licence agreement in the
    5 // file "LICENCE" distributed with Cforall.
    6 //
    7 // prelude-gen.cc --
    8 //
    9 // Author           : Rob Schluntz and Thierry Delisle
    10 // Created On       : Sat Feb 16 08:44:58 2019
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  8 16:00:22 2019
    13 // Update Count     : 26
    14 //
    15 
    161#include <algorithm>
    172#include <array>
     
    2611        bool hasComparison;
    2712} basicTypes[] = {
    28         { "char"                  , false, true , },
    29         { "signed char"           , false, true , },
    30         { "unsigned char"         , false, true , },
     13        // { "char"                  , false, true , },
     14        // { "signed char"           , false, true , },
     15        // { "unsigned char"         , false, true , },
    3116        { "signed short"          , false, true , },
    3217        { "unsigned short"        , false, true , },
     
    4934#if defined(__i386__) || defined(__ia64__) || defined(__x86_64__)
    5035        { "__float80"             , true , true , },
    51         { "__float128"            , true , true , },
     36        { "_Float128"             , true , true , },
    5237#endif
    5338};
     
    165150        cout << endl;
    166151
    167         cout << "signed int ?==?( zero_t, zero_t ),     ?!=?( zero_t, zero_t );" << endl;
    168         cout << "signed int ?==?( one_t, one_t ),       ?!=?( one_t, one_t );" << endl;
    169         cout << "signed int ?==?( _Bool, _Bool ),       ?!=?( _Bool, _Bool );" << endl;
    170         cout << "signed int !?( _Bool );" << endl;
     152        cout << "signed int ?==?( zero_t, zero_t ),                                                     ?!=?( zero_t, zero_t );" << endl;
     153        cout << "signed int ?==?( one_t, one_t ),                                                       ?!=?( one_t, one_t );" << endl;
     154        cout << "signed int ?==?( _Bool, _Bool ),                                                       ?!=?( _Bool, _Bool );" << endl;
     155        cout << "signed int     !?( _Bool );" << endl;
    171156
    172157        for (auto op : arithmeticOperators) {
     
    203188        cout << "// Arithmetic Constructors //" << endl;
    204189        cout << "/////////////////////////////" << endl;
    205         cout << endl;
    206 
    207190        auto otype = [](const std::string & type, bool do_volatile = false) {
    208                 cout << "void ?{} (" << type << " &);" << endl;
    209                 cout << "void ?{} (" << type << " &, " << type << ");" << endl;
    210                 cout << type << "  ?=? (" << type << " &, " << type << ")";
    211                 if ( do_volatile ) {
    212                         cout << ",  ?=?(volatile " << type << " &, " << type << ")";
     191                cout << "void \t?{} ( " << type << " & );" << endl;
     192                cout << "void \t?{} ( " << type << " &, " << type << " );" << endl;
     193                cout << type << " \t?=? ( " << type << " &, " << type << " )";
     194                if( do_volatile ) {
     195                        cout << ", \t?=?( volatile " << type << " &, " << type << " )";
    213196                }
    214197                cout << ";" << endl;
    215                 cout << "void ^?{}( " << type << " & );" << endl;
     198                cout << "void \t^?{}( " << type << " & );" << endl;
    216199        };
    217200
     
    219202        otype("one_t");
    220203        otype("_Bool", true);
    221         cout << endl;
     204        otype("char", true);
     205        otype("signed char", true);
     206        otype("unsigned char", true);
    222207
    223208        for (auto type : basicTypes) {
    224                 cout << "void ?{}(" << type.name << " &);" << endl;
    225                 cout << "void ?{}(" << type.name << " &, " << type.name << ");" << endl;
    226                 cout << "void ?{}(" << type.name << " &, zero_t);" << endl;
     209                cout << "void  ?{}(" << type.name << " &);" << endl;
     210                cout << "void  ?{}(" << type.name << " &, " << type.name << ");" << endl;
    227211                cout << "void ^?{}(" << type.name << " &);" << endl;
    228212                cout << endl;
     
    233217        cout << "// Pointer Constructors //" << endl;
    234218        cout << "//////////////////////////" << endl;
    235         cout << endl;
    236 
    237         cout << "forall(ftype FT) void ?{}( FT *&, FT * );" << endl;
    238         cout << "forall(ftype FT) void ?{}( FT * volatile &, FT * );" << endl;
     219        cout << "forall(ftype FT) void  ?{}( FT *&, FT * );" << endl;
     220        cout << "forall(ftype FT) void  ?{}( FT * volatile &, FT * );" << endl;
    239221
    240222        // generate qualifiers
     
    260242                for (auto cvq : qualifiersPair) {
    261243                        for (auto is_vol : { "        ", "volatile" }) {
    262                                 cout << "forall(dtype DT) void ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
     244                                cout << "forall(dtype DT) void  ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
    263245                        }
    264246                }
    265247                for (auto cvq : qualifiersSingle) {
    266248                        for (auto is_vol : { "        ", "volatile" }) {
    267                                 cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
     249                                cout << "forall(dtype DT) void  ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
    268250                        }
    269251                        for (auto is_vol : { "        ", "volatile" }) {
     
    287269        cout << "forall(ftype FT) FT *                  ?=?( FT *          &, zero_t );" << endl;
    288270        cout << "forall(ftype FT) FT *                  ?=?( FT * volatile &, zero_t );" << endl;
    289         cout << "forall(ftype FT) void  ?{}( FT *          & );" << endl;
    290         cout << "forall(ftype FT) void  ^?{}( FT *         & );" << endl;
     271        cout << "forall( ftype FT ) void        ?{}( FT *          & );" << endl;
     272        cout << "forall( ftype FT ) void        ^?{}( FT *         & );" << endl;
    291273        cout << endl;
    292274
     
    295277        cout << "///////////////////////" << endl;
    296278
    297         cout << "forall(ftype FT) FT *                  ?=?( FT *&, FT * );" << endl;
    298         cout << "forall(ftype FT) FT *                  ?=?( FT * volatile &, FT * );" << endl;
    299         cout << "forall(ftype FT) int !?( FT * );" << endl;
    300         cout << "forall(ftype FT) signed int ?==?( FT *, FT * );" << endl;
    301         cout << "forall(ftype FT) signed int ?!=?( FT *, FT * );" << endl;
    302         cout << "forall(ftype FT) FT &           *?( FT * );" << endl;
     279        cout << "forall( ftype FT ) FT *                        ?=?( FT *&, FT * );" << endl;
     280        cout << "forall( ftype FT ) FT *                        ?=?( FT * volatile &, FT * );" << endl;
     281        cout << "forall( ftype FT ) int !?( FT * );" << endl;
     282        cout << "forall( ftype FT ) signed int ?==?( FT *, FT * );" << endl;
     283        cout << "forall( ftype FT ) signed int ?!=?( FT *, FT * );" << endl;
     284        cout << "forall( ftype FT ) FT &                 *?( FT * );" << endl;
     285
    303286
    304287        for (auto op : pointerOperators) {
     
    404387}
    405388
    406 // Local Variables: //
    407 // tab-width: 4 //
    408 // End: //
  • libcfa/src/Makefile.in

    r53bb8f1 r9d9a451  
    415415am__v_GOC_0 = @echo "  GOC     " $@;
    416416am__v_GOC_1 =
    417 UPPCC = u++
    418417UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
    419418AM_V_UPP = $(am__v_UPP_@AM_V@)
  • libcfa/src/containers/maybe.cfa

    r53bb8f1 r9d9a451  
    1010// Created On       : Wed May 24 15:40:00 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Feb 17 11:22:03 2019
    13 // Update Count     : 3
     12// Last Modified On : Thu Jul 20 15:23:50 2017
     13// Update Count     : 2
    1414//
    1515
     
    3939forall(otype T)
    4040maybe(T) ?=?(maybe(T) & this, maybe(T) that) {
    41         if (this.has_value && that.has_value) {
     41        if (this.has_value & that.has_value) {
    4242                this.value = that.value;
    4343        } else if (this.has_value) {
  • libcfa/src/containers/result.cfa

    r53bb8f1 r9d9a451  
    1010// Created On       : Wed May 24 15:40:00 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Feb 17 11:24:04 2019
    13 // Update Count     : 3
     12// Last Modified On : Thu Jul 20 15:23:58 2017
     13// Update Count     : 2
    1414//
    1515
     
    4848forall(otype T, otype E)
    4949result(T, E) ?=?(result(T, E) & this, result(T, E) that) {
    50         if (this.has_value && that.has_value) {
     50        if (this.has_value & that.has_value) {
    5151                this.value = that.value;
    5252        } else if (this.has_value) {
  • libcfa/src/iostream.cfa

    r53bb8f1 r9d9a451  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  4 20:57:24 2019
    13 // Update Count     : 593
     12// Last Modified On : Mon Dec 24 18:33:40 2018
     13// Update Count     : 589
    1414//
    1515
     
    2727
    2828forall( dtype ostype | ostream( ostype ) ) {
    29         ostype & ?|?( ostype & os, zero_t ) {
    30                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    31                 fmt( os, "%d", 0n );
    32                 return os;
    33         } // ?|?
    34         void ?|?( ostype & os, zero_t z ) {
    35                 (ostype &)(os | z); nl( os );
    36         } // ?|?
    37 
    38         ostype & ?|?( ostype & os, one_t ) {
    39                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    40                 fmt( os, "%d", 1n );
    41                 return os;
    42         } // ?|?
    43         void ?|?( ostype & os, one_t o ) {
    44                 (ostype &)(os | o); nl( os );
    45         } // ?|?
    46 
    4729        ostype & ?|?( ostype & os, bool b ) {
    4830                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
  • libcfa/src/iostream.hfa

    r53bb8f1 r9d9a451  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb 26 16:57:22 2019
    13 // Update Count     : 221
     12// Last Modified On : Mon Dec 24 18:33:40 2018
     13// Update Count     : 220
    1414//
    1515
     
    6262
    6363forall( dtype ostype | ostream( ostype ) ) {
    64         ostype & ?|?( ostype &, zero_t );
    65         void ?|?( ostype &, zero_t );
    66         ostype & ?|?( ostype &, one_t );
    67         void ?|?( ostype &, one_t );
    68 
    6964        ostype & ?|?( ostype &, bool );
    7065        void ?|?( ostype &, bool );
  • src/CodeGen/module.mk

    r53bb8f1 r9d9a451  
    1818#       ArgTweak/Mutate.cc
    1919
    20 SRC_CODEGEN = \
     20SRC +=  CodeGen/Generate.cc \
    2121        CodeGen/CodeGenerator.cc \
     22        CodeGen/GenType.cc \
     23        CodeGen/FixNames.cc \
    2224        CodeGen/FixMain.cc \
    23         CodeGen/GenType.cc \
    2425        CodeGen/OperatorTable.cc
    25 
    26 
    27 SRC += $(SRC_CODEGEN) CodeGen/Generate.cc CodeGen/FixNames.cc
    28 SRCDEMANGLE += $(SRC_CODEGEN)
  • src/Common/PassVisitor.h

    r53bb8f1 r9d9a451  
    55#include <stack>
    66
    7 #include "Common/Stats.h"
    87#include "Common/utility.h"
    98
     
    427426};
    428427
    429 #include "Common/Stats.h"
    430 
    431 extern struct PassVisitorStats {
    432         size_t depth = 0;
    433         Stats::Counters::MaxCounter<double> * max = nullptr;
    434         Stats::Counters::AverageCounter<double> * avg = nullptr;
    435 } pass_visitor_stats;
    436 
    437428#include "SynTree/TypeSubstitution.h"
    438429#include "PassVisitor.impl.h"
  • src/Common/PassVisitor.impl.h

    r53bb8f1 r9d9a451  
    6767        SemanticErrorException errors;
    6868
    69         pass_visitor_stats.depth++;
    70         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    71         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    7269        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    73 
    74 
    7570                // splice in new declarations after previous decl
    7671                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
     
    8883                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    8984        }
    90         pass_visitor_stats.depth--;
    9185        if ( ! errors.isEmpty() ) {
    9286                throw errors;
     
    10094        SemanticErrorException errors;
    10195
    102         pass_visitor_stats.depth++;
    103         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    104         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    10596        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    10697                // splice in new declarations after previous decl
     
    118109                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    119110        }
    120         pass_visitor_stats.depth--;
    121111        if ( ! errors.isEmpty() ) {
    122112                throw errors;
     
    136126        if ( ! visitor.get_visit_children() ) return;
    137127        SemanticErrorException errors;
    138 
    139         pass_visitor_stats.depth++;
    140         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    141         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    142128        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    143129                try {
     
    149135                }
    150136        }
    151         pass_visitor_stats.depth--;
    152137        if ( ! errors.isEmpty() ) {
    153138                throw errors;
     
    168153        if ( ! mutator.get_visit_children() ) return;
    169154        SemanticErrorException errors;
    170 
    171         pass_visitor_stats.depth++;
    172         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    173         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    174155        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    175156                try {
     
    182163                } // try
    183164        } // for
    184         pass_visitor_stats.depth--;
    185165        if ( ! errors.isEmpty() ) {
    186166                throw errors;
     
    205185        DeclList_t* afterDecls  = get_afterDecls();
    206186
    207         pass_visitor_stats.depth++;
    208         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    209         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    210187        for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
    211188
     
    225202                if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
    226203        }
    227         pass_visitor_stats.depth--;
    228204
    229205        if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
  • src/Common/module.mk

    r53bb8f1 r9d9a451  
    1515###############################################################################
    1616
    17 SRC_COMMON = \
    18       Common/Assert.cc \
    19       Common/Eval.cc \
    20       Common/PassVisitor.cc \
    21       Common/SemanticError.cc \
    22       Common/Stats/Counter.cc \
    23       Common/Stats/Heap.cc \
    24       Common/Stats/Stats.cc \
    25       Common/Stats/Time.cc \
    26       Common/UniqueName.cc
    27 
    28 SRC += $(SRC_COMMON) Common/DebugMalloc.cc
    29 SRCDEMANGLE += $(SRC_COMMON)
     17SRC += Common/SemanticError.cc \
     18       Common/UniqueName.cc \
     19       Common/DebugMalloc.cc \
     20       Common/Assert.cc \
     21       Common/Heap.cc \
     22       Common/Eval.cc
  • src/Concurrency/Waitfor.cc

    r53bb8f1 r9d9a451  
    1111// Last Modified By :
    1212// Last Modified On :
    13 // Update Count     : 7
     13// Update Count     : 5
    1414//
    1515
  • src/Concurrency/module.mk

    r53bb8f1 r9d9a451  
    1515###############################################################################
    1616
    17 SRC += Concurrency/Keywords.cc Concurrency/Waitfor.cc
    18 SRCDEMANGLE += Concurrency/Keywords.cc
     17SRC += Concurrency/Keywords.cc \
     18       Concurrency/Waitfor.cc
    1919
  • src/ControlStruct/ExceptTranslate.cc

    r53bb8f1 r9d9a451  
    99// Author           : Andrew Beach
    1010// Created On       : Wed Jun 14 16:49:00 2017
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 13 18:15:29 2019
    13 // Update Count     : 11
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 17 17:19:00 2017
     13// Update Count     : 9
    1414//
    1515
  • src/ControlStruct/module.mk

    r53bb8f1 r9d9a451  
    1515###############################################################################
    1616
    17 SRC_CONTROLSTRUCT = \
     17SRC +=  ControlStruct/LabelGenerator.cc \
     18        ControlStruct/LabelFixer.cc \
     19        ControlStruct/MLEMutator.cc \
     20        ControlStruct/Mutate.cc \
    1821        ControlStruct/ForExprMutator.cc \
    19         ControlStruct/LabelFixer.cc \
    20         ControlStruct/LabelGenerator.cc \
    21         ControlStruct/MLEMutator.cc \
    22         ControlStruct/Mutate.cc
    23 
    24 SRC += $(SRC_CONTROLSTRUCT) ControlStruct/ExceptTranslate.cc
    25 SRCDEMANGLE += $(SRC_CONTROLSTRUCT)
    26 
     22        ControlStruct/ExceptTranslate.cc
  • src/GenPoly/module.mk

    r53bb8f1 r9d9a451  
    2222       GenPoly/FindFunction.cc \
    2323       GenPoly/InstantiateGeneric.cc
    24 
    25 SRCDEMANGLE += GenPoly/GenPoly.cc GenPoly/Lvalue.cc
    26 
  • src/InitTweak/FixInit.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Wed Jan 13 16:29:30 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 13 18:15:56 2019
    13 // Update Count     : 76
     12// Last Modified On : Wed Jun 21 17:35:05 2017
     13// Update Count     : 74
    1414//
    1515#include "FixInit.h"
  • src/InitTweak/module.mk

    r53bb8f1 r9d9a451  
    2020        InitTweak/InitTweak.cc
    2121
    22 SRCDEMANGLE += InitTweak/GenInit.cc \
    23         InitTweak/InitTweak.cc
    24 
  • src/MakeLibCfa.cc

    r53bb8f1 r9d9a451  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sat May 16 10:33:33 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Feb 17 21:08:09 2019
    13 // Update Count     : 41
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Fri Apr 22 13:54:15 2016
     13// Update Count     : 40
    1414//
    1515
     
    146146        } // namespace
    147147} // namespace LibCfa
    148 
    149 // Local Variables: //
    150 // tab-width: 4 //
    151 // End: //
  • src/Makefile.am

    r53bb8f1 r9d9a451  
    1010## Author           : Peter A. Buhr
    1111## Created On       : Sun May 31 08:51:46 2015
    12 ## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Fri Feb 15 09:44:09 2019
    14 ## Update Count     : 97
     12## Last Modified By : Andrew Beach
     13## Last Modified On : Tus Jul 25 10:34:00 2017
     14## Update Count     : 76
    1515###############################################################################
    1616
     
    2323      CompilationState.cc
    2424
    25 SRCDEMANGLE = CompilationState.cc
    26 
    2725MAINTAINERCLEANFILES =
    2826MOSTLYCLEANFILES =
     27
     28# Is there a way to use a variable for the directory names?
    2929
    3030include CodeGen/module.mk
     
    4343include Virtual/module.mk
    4444
    45 $(addprefix $(srcdir)/, ResolvExpr/ConversionCost.cc ResolvExpr/CommonType.cc SymTab/ManglerCommon.cc) : $(srcdir)/SynTree/Type.h
    46 
    47 $(srcdir)/SynTree/Type.h : BasicTypes-gen.cc
    48         ${AM_V_GEN}${CXXCOMPILE} $< -o BasicTypes-gen -Wall -Wextra
    49         @./BasicTypes-gen
    50         @rm BasicTypes-gen
    51 
    5245# put into lib for now
    5346cfa_cpplibdir = $(CFA_LIBDIR)
     
    6255demangler_SOURCES = SymTab/demangler.cc
    6356
    64 demangler_LDADD = libdemangle.a -ldl                    # yywrap
     57demangler_LDADD = libdemangle.a     # yywrap
    6558
    6659noinst_LIBRARIES = libdemangle.a
    67 libdemangle_a_SOURCES = $(SRCDEMANGLE)
     60libdemangle_a_SOURCES = SymTab/Demangle.cc SymTab/ManglerCommon.cc \
     61  SynTree/Type.cc \
     62  SynTree/VoidType.cc \
     63  SynTree/BasicType.cc \
     64  SynTree/PointerType.cc \
     65  SynTree/ArrayType.cc \
     66  SynTree/ReferenceType.cc \
     67  SynTree/FunctionType.cc \
     68  SynTree/ReferenceToType.cc \
     69  SynTree/TupleType.cc \
     70  SynTree/TypeofType.cc \
     71  SynTree/AttrType.cc \
     72  SynTree/VarArgsType.cc \
     73  SynTree/ZeroOneType.cc \
     74  SynTree/Constant.cc \
     75  SynTree/Expression.cc \
     76  SynTree/TupleExpr.cc \
     77  SynTree/CommaExpr.cc \
     78  SynTree/TypeExpr.cc \
     79  SynTree/ApplicationExpr.cc \
     80  SynTree/AddressExpr.cc \
     81  SynTree/Statement.cc \
     82  SynTree/CompoundStmt.cc \
     83  SynTree/DeclStmt.cc \
     84  SynTree/Declaration.cc \
     85  SynTree/DeclarationWithType.cc \
     86  SynTree/ObjectDecl.cc \
     87  SynTree/FunctionDecl.cc \
     88  SynTree/AggregateDecl.cc \
     89  SynTree/NamedTypeDecl.cc \
     90  SynTree/TypeDecl.cc \
     91  SynTree/Initializer.cc \
     92  SynTree/TypeSubstitution.cc \
     93  SynTree/Attribute.cc \
     94  SynTree/DeclReplacer.cc \
     95  CompilationState.cc \
     96  CodeGen/CodeGenerator.cc \
     97  CodeGen/FixMain.cc \
     98  CodeGen/GenType.cc \
     99  CodeGen/OperatorTable.cc \
     100  Common/Assert.cc \
     101  Common/Eval.cc \
     102  Common/SemanticError.cc \
     103  Common/UniqueName.cc \
     104  Concurrency/Keywords.cc \
     105  ControlStruct/ForExprMutator.cc \
     106  ControlStruct/LabelFixer.cc \
     107  ControlStruct/LabelGenerator.cc \
     108  ControlStruct/MLEMutator.cc \
     109  ControlStruct/Mutate.cc \
     110  GenPoly/GenPoly.cc \
     111  GenPoly/Lvalue.cc \
     112  InitTweak/GenInit.cc \
     113  InitTweak/InitTweak.cc \
     114  Parser/LinkageSpec.cc \
     115  ResolvExpr/AdjustExprType.cc \
     116  ResolvExpr/Alternative.cc \
     117  ResolvExpr/AlternativeFinder.cc \
     118  ResolvExpr/ExplodedActual.cc \
     119  ResolvExpr/CastCost.cc \
     120  ResolvExpr/CommonType.cc \
     121  ResolvExpr/ConversionCost.cc \
     122  ResolvExpr/CurrentObject.cc \
     123  ResolvExpr/FindOpenVars.cc \
     124  ResolvExpr/Occurs.cc \
     125  ResolvExpr/PolyCost.cc \
     126  ResolvExpr/PtrsAssignable.cc \
     127  ResolvExpr/PtrsCastable.cc \
     128  ResolvExpr/RenameVars.cc \
     129  ResolvExpr/ResolveAssertions.cc \
     130  ResolvExpr/Resolver.cc \
     131  ResolvExpr/ResolveTypeof.cc \
     132  ResolvExpr/SpecCost.cc \
     133  ResolvExpr/TypeEnvironment.cc \
     134  ResolvExpr/Unify.cc \
     135  SymTab/Autogen.cc \
     136  SymTab/FixFunction.cc \
     137  SymTab/Indexer.cc \
     138  SymTab/Mangler.cc \
     139  SymTab/Validate.cc \
     140  Tuples/Explode.cc \
     141  Tuples/TupleAssignment.cc \
     142  Tuples/TupleExpansion.cc \
     143  Validate/HandleAttributes.cc
    68144
    69145MAINTAINERCLEANFILES += ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}}
  • src/Makefile.in

    r53bb8f1 r9d9a451  
    162162libdemangle_a_LIBADD =
    163163am__dirstamp = $(am__leading_dot)dirstamp
    164 am__objects_1 = CodeGen/CodeGenerator.$(OBJEXT) \
    165         CodeGen/FixMain.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \
    166         CodeGen/OperatorTable.$(OBJEXT)
    167 am__objects_2 = Common/Assert.$(OBJEXT) Common/Eval.$(OBJEXT) \
    168         Common/PassVisitor.$(OBJEXT) Common/SemanticError.$(OBJEXT) \
    169         Common/Stats/Counter.$(OBJEXT) Common/Stats/Heap.$(OBJEXT) \
    170         Common/Stats/Stats.$(OBJEXT) Common/Stats/Time.$(OBJEXT) \
    171         Common/UniqueName.$(OBJEXT)
    172 am__objects_3 = ControlStruct/ForExprMutator.$(OBJEXT) \
     164am_libdemangle_a_OBJECTS = SymTab/Demangle.$(OBJEXT) \
     165        SymTab/ManglerCommon.$(OBJEXT) SynTree/Type.$(OBJEXT) \
     166        SynTree/VoidType.$(OBJEXT) SynTree/BasicType.$(OBJEXT) \
     167        SynTree/PointerType.$(OBJEXT) SynTree/ArrayType.$(OBJEXT) \
     168        SynTree/ReferenceType.$(OBJEXT) SynTree/FunctionType.$(OBJEXT) \
     169        SynTree/ReferenceToType.$(OBJEXT) SynTree/TupleType.$(OBJEXT) \
     170        SynTree/TypeofType.$(OBJEXT) SynTree/AttrType.$(OBJEXT) \
     171        SynTree/VarArgsType.$(OBJEXT) SynTree/ZeroOneType.$(OBJEXT) \
     172        SynTree/Constant.$(OBJEXT) SynTree/Expression.$(OBJEXT) \
     173        SynTree/TupleExpr.$(OBJEXT) SynTree/CommaExpr.$(OBJEXT) \
     174        SynTree/TypeExpr.$(OBJEXT) SynTree/ApplicationExpr.$(OBJEXT) \
     175        SynTree/AddressExpr.$(OBJEXT) SynTree/Statement.$(OBJEXT) \
     176        SynTree/CompoundStmt.$(OBJEXT) SynTree/DeclStmt.$(OBJEXT) \
     177        SynTree/Declaration.$(OBJEXT) \
     178        SynTree/DeclarationWithType.$(OBJEXT) \
     179        SynTree/ObjectDecl.$(OBJEXT) SynTree/FunctionDecl.$(OBJEXT) \
     180        SynTree/AggregateDecl.$(OBJEXT) \
     181        SynTree/NamedTypeDecl.$(OBJEXT) SynTree/TypeDecl.$(OBJEXT) \
     182        SynTree/Initializer.$(OBJEXT) \
     183        SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \
     184        SynTree/DeclReplacer.$(OBJEXT) CompilationState.$(OBJEXT) \
     185        CodeGen/CodeGenerator.$(OBJEXT) CodeGen/FixMain.$(OBJEXT) \
     186        CodeGen/GenType.$(OBJEXT) CodeGen/OperatorTable.$(OBJEXT) \
     187        Common/Assert.$(OBJEXT) Common/Eval.$(OBJEXT) \
     188        Common/SemanticError.$(OBJEXT) Common/UniqueName.$(OBJEXT) \
     189        Concurrency/Keywords.$(OBJEXT) \
     190        ControlStruct/ForExprMutator.$(OBJEXT) \
    173191        ControlStruct/LabelFixer.$(OBJEXT) \
    174192        ControlStruct/LabelGenerator.$(OBJEXT) \
    175193        ControlStruct/MLEMutator.$(OBJEXT) \
    176         ControlStruct/Mutate.$(OBJEXT)
    177 am__objects_4 = ResolvExpr/AdjustExprType.$(OBJEXT) \
     194        ControlStruct/Mutate.$(OBJEXT) GenPoly/GenPoly.$(OBJEXT) \
     195        GenPoly/Lvalue.$(OBJEXT) InitTweak/GenInit.$(OBJEXT) \
     196        InitTweak/InitTweak.$(OBJEXT) Parser/LinkageSpec.$(OBJEXT) \
     197        ResolvExpr/AdjustExprType.$(OBJEXT) \
    178198        ResolvExpr/Alternative.$(OBJEXT) \
    179199        ResolvExpr/AlternativeFinder.$(OBJEXT) \
     200        ResolvExpr/ExplodedActual.$(OBJEXT) \
    180201        ResolvExpr/CastCost.$(OBJEXT) ResolvExpr/CommonType.$(OBJEXT) \
    181202        ResolvExpr/ConversionCost.$(OBJEXT) \
    182203        ResolvExpr/CurrentObject.$(OBJEXT) \
    183         ResolvExpr/ExplodedActual.$(OBJEXT) \
    184204        ResolvExpr/FindOpenVars.$(OBJEXT) ResolvExpr/Occurs.$(OBJEXT) \
    185205        ResolvExpr/PolyCost.$(OBJEXT) \
     
    192212        ResolvExpr/SpecCost.$(OBJEXT) \
    193213        ResolvExpr/TypeEnvironment.$(OBJEXT) \
    194         ResolvExpr/Unify.$(OBJEXT)
    195 am__objects_5 = SymTab/Autogen.$(OBJEXT) SymTab/FixFunction.$(OBJEXT) \
     214        ResolvExpr/Unify.$(OBJEXT) SymTab/Autogen.$(OBJEXT) \
     215        SymTab/FixFunction.$(OBJEXT) SymTab/Indexer.$(OBJEXT) \
     216        SymTab/Mangler.$(OBJEXT) SymTab/Validate.$(OBJEXT) \
     217        Tuples/Explode.$(OBJEXT) Tuples/TupleAssignment.$(OBJEXT) \
     218        Tuples/TupleExpansion.$(OBJEXT) \
     219        Validate/HandleAttributes.$(OBJEXT)
     220libdemangle_a_OBJECTS = $(am_libdemangle_a_OBJECTS)
     221am__installdirs = "$(DESTDIR)$(cfa_cpplibdir)"
     222PROGRAMS = $(cfa_cpplib_PROGRAMS)
     223am__objects_1 = main.$(OBJEXT) MakeLibCfa.$(OBJEXT) \
     224        CompilationState.$(OBJEXT) CodeGen/Generate.$(OBJEXT) \
     225        CodeGen/CodeGenerator.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \
     226        CodeGen/FixNames.$(OBJEXT) CodeGen/FixMain.$(OBJEXT) \
     227        CodeGen/OperatorTable.$(OBJEXT) CodeTools/DeclStats.$(OBJEXT) \
     228        CodeTools/ResolvProtoDump.$(OBJEXT) \
     229        CodeTools/TrackLoc.$(OBJEXT) Concurrency/Keywords.$(OBJEXT) \
     230        Concurrency/Waitfor.$(OBJEXT) Common/SemanticError.$(OBJEXT) \
     231        Common/UniqueName.$(OBJEXT) Common/DebugMalloc.$(OBJEXT) \
     232        Common/Assert.$(OBJEXT) Common/Heap.$(OBJEXT) \
     233        Common/Eval.$(OBJEXT) ControlStruct/LabelGenerator.$(OBJEXT) \
     234        ControlStruct/LabelFixer.$(OBJEXT) \
     235        ControlStruct/MLEMutator.$(OBJEXT) \
     236        ControlStruct/Mutate.$(OBJEXT) \
     237        ControlStruct/ForExprMutator.$(OBJEXT) \
     238        ControlStruct/ExceptTranslate.$(OBJEXT) GenPoly/Box.$(OBJEXT) \
     239        GenPoly/GenPoly.$(OBJEXT) GenPoly/ScrubTyVars.$(OBJEXT) \
     240        GenPoly/Lvalue.$(OBJEXT) GenPoly/Specialize.$(OBJEXT) \
     241        GenPoly/FindFunction.$(OBJEXT) \
     242        GenPoly/InstantiateGeneric.$(OBJEXT) \
     243        InitTweak/GenInit.$(OBJEXT) InitTweak/FixInit.$(OBJEXT) \
     244        InitTweak/FixGlobalInit.$(OBJEXT) \
     245        InitTweak/InitTweak.$(OBJEXT) Parser/parser.$(OBJEXT) \
     246        Parser/lex.$(OBJEXT) Parser/TypedefTable.$(OBJEXT) \
     247        Parser/ParseNode.$(OBJEXT) Parser/DeclarationNode.$(OBJEXT) \
     248        Parser/ExpressionNode.$(OBJEXT) Parser/StatementNode.$(OBJEXT) \
     249        Parser/InitializerNode.$(OBJEXT) Parser/TypeData.$(OBJEXT) \
     250        Parser/LinkageSpec.$(OBJEXT) Parser/parserutility.$(OBJEXT) \
     251        ResolvExpr/AlternativeFinder.$(OBJEXT) \
     252        ResolvExpr/Alternative.$(OBJEXT) ResolvExpr/Unify.$(OBJEXT) \
     253        ResolvExpr/PtrsAssignable.$(OBJEXT) \
     254        ResolvExpr/CommonType.$(OBJEXT) \
     255        ResolvExpr/ConversionCost.$(OBJEXT) \
     256        ResolvExpr/CastCost.$(OBJEXT) \
     257        ResolvExpr/PtrsCastable.$(OBJEXT) \
     258        ResolvExpr/AdjustExprType.$(OBJEXT) \
     259        ResolvExpr/AlternativePrinter.$(OBJEXT) \
     260        ResolvExpr/Resolver.$(OBJEXT) \
     261        ResolvExpr/ResolveTypeof.$(OBJEXT) \
     262        ResolvExpr/RenameVars.$(OBJEXT) \
     263        ResolvExpr/FindOpenVars.$(OBJEXT) \
     264        ResolvExpr/PolyCost.$(OBJEXT) ResolvExpr/Occurs.$(OBJEXT) \
     265        ResolvExpr/TypeEnvironment.$(OBJEXT) \
     266        ResolvExpr/CurrentObject.$(OBJEXT) \
     267        ResolvExpr/ExplodedActual.$(OBJEXT) \
     268        ResolvExpr/SpecCost.$(OBJEXT) \
     269        ResolvExpr/ResolveAssertions.$(OBJEXT) \
    196270        SymTab/Indexer.$(OBJEXT) SymTab/Mangler.$(OBJEXT) \
    197         SymTab/ManglerCommon.$(OBJEXT) SymTab/Validate.$(OBJEXT)
    198 am__objects_6 = SynTree/Type.$(OBJEXT) SynTree/VoidType.$(OBJEXT) \
     271        SymTab/ManglerCommon.$(OBJEXT) SymTab/Validate.$(OBJEXT) \
     272        SymTab/FixFunction.$(OBJEXT) SymTab/Autogen.$(OBJEXT) \
     273        SynTree/Type.$(OBJEXT) SynTree/VoidType.$(OBJEXT) \
    199274        SynTree/BasicType.$(OBJEXT) SynTree/PointerType.$(OBJEXT) \
    200275        SynTree/ArrayType.$(OBJEXT) SynTree/ReferenceType.$(OBJEXT) \
     
    215290        SynTree/Initializer.$(OBJEXT) \
    216291        SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \
    217         SynTree/DeclReplacer.$(OBJEXT)
    218 am__objects_7 = CompilationState.$(OBJEXT) $(am__objects_1) \
    219         Concurrency/Keywords.$(OBJEXT) $(am__objects_2) \
    220         $(am__objects_3) GenPoly/GenPoly.$(OBJEXT) \
    221         GenPoly/Lvalue.$(OBJEXT) InitTweak/GenInit.$(OBJEXT) \
    222         InitTweak/InitTweak.$(OBJEXT) Parser/LinkageSpec.$(OBJEXT) \
    223         $(am__objects_4) $(am__objects_5) SymTab/Demangle.$(OBJEXT) \
    224         $(am__objects_6) Tuples/TupleAssignment.$(OBJEXT) \
    225         Tuples/TupleExpansion.$(OBJEXT) Tuples/Explode.$(OBJEXT) \
    226         Validate/HandleAttributes.$(OBJEXT)
    227 am_libdemangle_a_OBJECTS = $(am__objects_7)
    228 libdemangle_a_OBJECTS = $(am_libdemangle_a_OBJECTS)
    229 am__installdirs = "$(DESTDIR)$(cfa_cpplibdir)"
    230 PROGRAMS = $(cfa_cpplib_PROGRAMS)
    231 am__objects_8 = main.$(OBJEXT) MakeLibCfa.$(OBJEXT) \
    232         CompilationState.$(OBJEXT) $(am__objects_1) \
    233         CodeGen/Generate.$(OBJEXT) CodeGen/FixNames.$(OBJEXT) \
    234         CodeTools/DeclStats.$(OBJEXT) \
    235         CodeTools/ResolvProtoDump.$(OBJEXT) \
    236         CodeTools/TrackLoc.$(OBJEXT) Concurrency/Keywords.$(OBJEXT) \
    237         Concurrency/Waitfor.$(OBJEXT) $(am__objects_2) \
    238         Common/DebugMalloc.$(OBJEXT) $(am__objects_3) \
    239         ControlStruct/ExceptTranslate.$(OBJEXT) GenPoly/Box.$(OBJEXT) \
    240         GenPoly/GenPoly.$(OBJEXT) GenPoly/ScrubTyVars.$(OBJEXT) \
    241         GenPoly/Lvalue.$(OBJEXT) GenPoly/Specialize.$(OBJEXT) \
    242         GenPoly/FindFunction.$(OBJEXT) \
    243         GenPoly/InstantiateGeneric.$(OBJEXT) \
    244         InitTweak/GenInit.$(OBJEXT) InitTweak/FixInit.$(OBJEXT) \
    245         InitTweak/FixGlobalInit.$(OBJEXT) \
    246         InitTweak/InitTweak.$(OBJEXT) Parser/parser.$(OBJEXT) \
    247         Parser/lex.$(OBJEXT) Parser/TypedefTable.$(OBJEXT) \
    248         Parser/ParseNode.$(OBJEXT) Parser/DeclarationNode.$(OBJEXT) \
    249         Parser/ExpressionNode.$(OBJEXT) Parser/StatementNode.$(OBJEXT) \
    250         Parser/InitializerNode.$(OBJEXT) Parser/TypeData.$(OBJEXT) \
    251         Parser/LinkageSpec.$(OBJEXT) Parser/parserutility.$(OBJEXT) \
    252         $(am__objects_4) ResolvExpr/AlternativePrinter.$(OBJEXT) \
    253         $(am__objects_5) $(am__objects_6) \
     292        SynTree/DeclReplacer.$(OBJEXT) \
    254293        Tuples/TupleAssignment.$(OBJEXT) \
    255294        Tuples/TupleExpansion.$(OBJEXT) Tuples/Explode.$(OBJEXT) \
    256295        Validate/HandleAttributes.$(OBJEXT) \
    257296        Virtual/ExpandCasts.$(OBJEXT)
    258 am____driver_cfa_cpp_OBJECTS = $(am__objects_8)
     297am____driver_cfa_cpp_OBJECTS = $(am__objects_1)
    259298___driver_cfa_cpp_OBJECTS = $(am____driver_cfa_cpp_OBJECTS)
    260299___driver_cfa_cpp_DEPENDENCIES =
     
    377416DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    378417ACLOCAL = @ACLOCAL@
     418ALLOCA = @ALLOCA@
    379419AMTAR = @AMTAR@
    380420AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     
    524564AUTOMAKE_OPTIONS = foreign subdir-objects
    525565ACLOCAL_AMFLAGS = -I automake
    526 SRC = main.cc MakeLibCfa.cc CompilationState.cc $(SRC_CODEGEN) \
    527         CodeGen/Generate.cc CodeGen/FixNames.cc CodeTools/DeclStats.cc \
     566SRC = main.cc MakeLibCfa.cc CompilationState.cc CodeGen/Generate.cc \
     567        CodeGen/CodeGenerator.cc CodeGen/GenType.cc \
     568        CodeGen/FixNames.cc CodeGen/FixMain.cc \
     569        CodeGen/OperatorTable.cc CodeTools/DeclStats.cc \
    528570        CodeTools/ResolvProtoDump.cc CodeTools/TrackLoc.cc \
    529         Concurrency/Keywords.cc Concurrency/Waitfor.cc $(SRC_COMMON) \
    530         Common/DebugMalloc.cc $(SRC_CONTROLSTRUCT) \
     571        Concurrency/Keywords.cc Concurrency/Waitfor.cc \
     572        Common/SemanticError.cc Common/UniqueName.cc \
     573        Common/DebugMalloc.cc Common/Assert.cc Common/Heap.cc \
     574        Common/Eval.cc ControlStruct/LabelGenerator.cc \
     575        ControlStruct/LabelFixer.cc ControlStruct/MLEMutator.cc \
     576        ControlStruct/Mutate.cc ControlStruct/ForExprMutator.cc \
    531577        ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \
    532578        GenPoly/GenPoly.cc GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc \
     
    539585        Parser/StatementNode.cc Parser/InitializerNode.cc \
    540586        Parser/TypeData.cc Parser/LinkageSpec.cc \
    541         Parser/parserutility.cc $(SRC_RESOLVEXPR) \
    542         ResolvExpr/AlternativePrinter.cc $(SRC_SYMTAB) $(SRC_SYNTREE) \
     587        Parser/parserutility.cc ResolvExpr/AlternativeFinder.cc \
     588        ResolvExpr/Alternative.cc ResolvExpr/Unify.cc \
     589        ResolvExpr/PtrsAssignable.cc ResolvExpr/CommonType.cc \
     590        ResolvExpr/ConversionCost.cc ResolvExpr/CastCost.cc \
     591        ResolvExpr/PtrsCastable.cc ResolvExpr/AdjustExprType.cc \
     592        ResolvExpr/AlternativePrinter.cc ResolvExpr/Resolver.cc \
     593        ResolvExpr/ResolveTypeof.cc ResolvExpr/RenameVars.cc \
     594        ResolvExpr/FindOpenVars.cc ResolvExpr/PolyCost.cc \
     595        ResolvExpr/Occurs.cc ResolvExpr/TypeEnvironment.cc \
     596        ResolvExpr/CurrentObject.cc ResolvExpr/ExplodedActual.cc \
     597        ResolvExpr/SpecCost.cc ResolvExpr/ResolveAssertions.cc \
     598        SymTab/Indexer.cc SymTab/Mangler.cc SymTab/ManglerCommon.cc \
     599        SymTab/Validate.cc SymTab/FixFunction.cc SymTab/Autogen.cc \
     600        SynTree/Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \
     601        SynTree/PointerType.cc SynTree/ArrayType.cc \
     602        SynTree/ReferenceType.cc SynTree/FunctionType.cc \
     603        SynTree/ReferenceToType.cc SynTree/TupleType.cc \
     604        SynTree/TypeofType.cc SynTree/AttrType.cc \
     605        SynTree/VarArgsType.cc SynTree/ZeroOneType.cc \
     606        SynTree/Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \
     607        SynTree/CommaExpr.cc SynTree/TypeExpr.cc \
     608        SynTree/ApplicationExpr.cc SynTree/AddressExpr.cc \
     609        SynTree/Statement.cc SynTree/CompoundStmt.cc \
     610        SynTree/DeclStmt.cc SynTree/Declaration.cc \
     611        SynTree/DeclarationWithType.cc SynTree/ObjectDecl.cc \
     612        SynTree/FunctionDecl.cc SynTree/AggregateDecl.cc \
     613        SynTree/NamedTypeDecl.cc SynTree/TypeDecl.cc \
     614        SynTree/Initializer.cc SynTree/TypeSubstitution.cc \
     615        SynTree/Attribute.cc SynTree/DeclReplacer.cc \
    543616        Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \
    544617        Tuples/Explode.cc Validate/HandleAttributes.cc \
    545618        Virtual/ExpandCasts.cc
    546 SRCDEMANGLE = CompilationState.cc $(SRC_CODEGEN) \
    547         Concurrency/Keywords.cc $(SRC_COMMON) $(SRC_CONTROLSTRUCT) \
    548         GenPoly/GenPoly.cc GenPoly/Lvalue.cc InitTweak/GenInit.cc \
    549         InitTweak/InitTweak.cc Parser/LinkageSpec.cc $(SRC_RESOLVEXPR) \
    550         $(SRC_SYMTAB) SymTab/Demangle.cc $(SRC_SYNTREE) \
    551         Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \
    552         Tuples/Explode.cc Validate/HandleAttributes.cc
    553619MAINTAINERCLEANFILES = ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}}
    554 MOSTLYCLEANFILES = Parser/lex.cc Parser/parser.cc Parser/parser.hh \
    555         Parser/parser.output
    556 SRC_CODEGEN = \
    557         CodeGen/CodeGenerator.cc \
    558         CodeGen/FixMain.cc \
    559         CodeGen/GenType.cc \
    560         CodeGen/OperatorTable.cc
    561 
    562 SRC_COMMON = \
    563       Common/Assert.cc \
    564       Common/Eval.cc \
    565       Common/PassVisitor.cc \
    566       Common/SemanticError.cc \
    567       Common/Stats/Counter.cc \
    568       Common/Stats/Heap.cc \
    569       Common/Stats/Stats.cc \
    570       Common/Stats/Time.cc \
    571       Common/UniqueName.cc
    572 
    573 SRC_CONTROLSTRUCT = \
    574         ControlStruct/ForExprMutator.cc \
    575         ControlStruct/LabelFixer.cc \
    576         ControlStruct/LabelGenerator.cc \
    577         ControlStruct/MLEMutator.cc \
    578         ControlStruct/Mutate.cc
    579 
     620MOSTLYCLEANFILES = Parser/parser.hh Parser/parser.output
    580621BUILT_SOURCES = Parser/parser.hh
    581622AM_YFLAGS = -d -t -v
    582 SRC_RESOLVEXPR = \
    583       ResolvExpr/AdjustExprType.cc \
    584       ResolvExpr/Alternative.cc \
    585       ResolvExpr/AlternativeFinder.cc \
    586       ResolvExpr/CastCost.cc \
    587       ResolvExpr/CommonType.cc \
    588       ResolvExpr/ConversionCost.cc \
    589       ResolvExpr/CurrentObject.cc \
    590       ResolvExpr/ExplodedActual.cc \
    591       ResolvExpr/FindOpenVars.cc \
    592       ResolvExpr/Occurs.cc \
    593       ResolvExpr/PolyCost.cc \
    594       ResolvExpr/PtrsAssignable.cc \
    595       ResolvExpr/PtrsCastable.cc \
    596       ResolvExpr/RenameVars.cc \
    597       ResolvExpr/ResolveAssertions.cc \
    598       ResolvExpr/Resolver.cc \
    599       ResolvExpr/ResolveTypeof.cc \
    600       ResolvExpr/SpecCost.cc \
    601       ResolvExpr/TypeEnvironment.cc \
    602       ResolvExpr/Unify.cc
    603 
    604 SRC_SYMTAB = \
    605       SymTab/Autogen.cc \
    606       SymTab/FixFunction.cc \
    607       SymTab/Indexer.cc \
    608       SymTab/Mangler.cc \
    609       SymTab/ManglerCommon.cc \
    610       SymTab/Validate.cc
    611 
    612 SRC_SYNTREE = \
    613       SynTree/Type.cc \
    614       SynTree/VoidType.cc \
    615       SynTree/BasicType.cc \
    616       SynTree/PointerType.cc \
    617       SynTree/ArrayType.cc \
    618       SynTree/ReferenceType.cc \
    619       SynTree/FunctionType.cc \
    620       SynTree/ReferenceToType.cc \
    621       SynTree/TupleType.cc \
    622       SynTree/TypeofType.cc \
    623       SynTree/AttrType.cc \
    624       SynTree/VarArgsType.cc \
    625       SynTree/ZeroOneType.cc \
    626       SynTree/Constant.cc \
    627       SynTree/Expression.cc \
    628       SynTree/TupleExpr.cc \
    629       SynTree/CommaExpr.cc \
    630       SynTree/TypeExpr.cc \
    631       SynTree/ApplicationExpr.cc \
    632       SynTree/AddressExpr.cc \
    633       SynTree/Statement.cc \
    634       SynTree/CompoundStmt.cc \
    635       SynTree/DeclStmt.cc \
    636       SynTree/Declaration.cc \
    637       SynTree/DeclarationWithType.cc \
    638       SynTree/ObjectDecl.cc \
    639       SynTree/FunctionDecl.cc \
    640       SynTree/AggregateDecl.cc \
    641       SynTree/NamedTypeDecl.cc \
    642       SynTree/TypeDecl.cc \
    643       SynTree/Initializer.cc \
    644       SynTree/TypeSubstitution.cc \
    645       SynTree/Attribute.cc \
    646       SynTree/DeclReplacer.cc
    647 
     623
     624# Is there a way to use a variable for the directory names?
    648625
    649626# put into lib for now
     
    655632ARFLAGS = cr
    656633demangler_SOURCES = SymTab/demangler.cc
    657 demangler_LDADD = libdemangle.a -ldl                    # yywrap
     634demangler_LDADD = libdemangle.a     # yywrap
    658635noinst_LIBRARIES = libdemangle.a
    659 libdemangle_a_SOURCES = $(SRCDEMANGLE)
     636libdemangle_a_SOURCES = SymTab/Demangle.cc SymTab/ManglerCommon.cc \
     637  SynTree/Type.cc \
     638  SynTree/VoidType.cc \
     639  SynTree/BasicType.cc \
     640  SynTree/PointerType.cc \
     641  SynTree/ArrayType.cc \
     642  SynTree/ReferenceType.cc \
     643  SynTree/FunctionType.cc \
     644  SynTree/ReferenceToType.cc \
     645  SynTree/TupleType.cc \
     646  SynTree/TypeofType.cc \
     647  SynTree/AttrType.cc \
     648  SynTree/VarArgsType.cc \
     649  SynTree/ZeroOneType.cc \
     650  SynTree/Constant.cc \
     651  SynTree/Expression.cc \
     652  SynTree/TupleExpr.cc \
     653  SynTree/CommaExpr.cc \
     654  SynTree/TypeExpr.cc \
     655  SynTree/ApplicationExpr.cc \
     656  SynTree/AddressExpr.cc \
     657  SynTree/Statement.cc \
     658  SynTree/CompoundStmt.cc \
     659  SynTree/DeclStmt.cc \
     660  SynTree/Declaration.cc \
     661  SynTree/DeclarationWithType.cc \
     662  SynTree/ObjectDecl.cc \
     663  SynTree/FunctionDecl.cc \
     664  SynTree/AggregateDecl.cc \
     665  SynTree/NamedTypeDecl.cc \
     666  SynTree/TypeDecl.cc \
     667  SynTree/Initializer.cc \
     668  SynTree/TypeSubstitution.cc \
     669  SynTree/Attribute.cc \
     670  SynTree/DeclReplacer.cc \
     671  CompilationState.cc \
     672  CodeGen/CodeGenerator.cc \
     673  CodeGen/FixMain.cc \
     674  CodeGen/GenType.cc \
     675  CodeGen/OperatorTable.cc \
     676  Common/Assert.cc \
     677  Common/Eval.cc \
     678  Common/SemanticError.cc \
     679  Common/UniqueName.cc \
     680  Concurrency/Keywords.cc \
     681  ControlStruct/ForExprMutator.cc \
     682  ControlStruct/LabelFixer.cc \
     683  ControlStruct/LabelGenerator.cc \
     684  ControlStruct/MLEMutator.cc \
     685  ControlStruct/Mutate.cc \
     686  GenPoly/GenPoly.cc \
     687  GenPoly/Lvalue.cc \
     688  InitTweak/GenInit.cc \
     689  InitTweak/InitTweak.cc \
     690  Parser/LinkageSpec.cc \
     691  ResolvExpr/AdjustExprType.cc \
     692  ResolvExpr/Alternative.cc \
     693  ResolvExpr/AlternativeFinder.cc \
     694  ResolvExpr/ExplodedActual.cc \
     695  ResolvExpr/CastCost.cc \
     696  ResolvExpr/CommonType.cc \
     697  ResolvExpr/ConversionCost.cc \
     698  ResolvExpr/CurrentObject.cc \
     699  ResolvExpr/FindOpenVars.cc \
     700  ResolvExpr/Occurs.cc \
     701  ResolvExpr/PolyCost.cc \
     702  ResolvExpr/PtrsAssignable.cc \
     703  ResolvExpr/PtrsCastable.cc \
     704  ResolvExpr/RenameVars.cc \
     705  ResolvExpr/ResolveAssertions.cc \
     706  ResolvExpr/Resolver.cc \
     707  ResolvExpr/ResolveTypeof.cc \
     708  ResolvExpr/SpecCost.cc \
     709  ResolvExpr/TypeEnvironment.cc \
     710  ResolvExpr/Unify.cc \
     711  SymTab/Autogen.cc \
     712  SymTab/FixFunction.cc \
     713  SymTab/Indexer.cc \
     714  SymTab/Mangler.cc \
     715  SymTab/Validate.cc \
     716  Tuples/Explode.cc \
     717  Tuples/TupleAssignment.cc \
     718  Tuples/TupleExpansion.cc \
     719  Validate/HandleAttributes.cc
     720
    660721all: $(BUILT_SOURCES)
    661722        $(MAKE) $(AM_MAKEFLAGS) all-am
     
    696757clean-noinstLIBRARIES:
    697758        -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
     759SymTab/$(am__dirstamp):
     760        @$(MKDIR_P) SymTab
     761        @: > SymTab/$(am__dirstamp)
     762SymTab/$(DEPDIR)/$(am__dirstamp):
     763        @$(MKDIR_P) SymTab/$(DEPDIR)
     764        @: > SymTab/$(DEPDIR)/$(am__dirstamp)
     765SymTab/Demangle.$(OBJEXT): SymTab/$(am__dirstamp) \
     766        SymTab/$(DEPDIR)/$(am__dirstamp)
     767SymTab/ManglerCommon.$(OBJEXT): SymTab/$(am__dirstamp) \
     768        SymTab/$(DEPDIR)/$(am__dirstamp)
     769SynTree/$(am__dirstamp):
     770        @$(MKDIR_P) SynTree
     771        @: > SynTree/$(am__dirstamp)
     772SynTree/$(DEPDIR)/$(am__dirstamp):
     773        @$(MKDIR_P) SynTree/$(DEPDIR)
     774        @: > SynTree/$(DEPDIR)/$(am__dirstamp)
     775SynTree/Type.$(OBJEXT): SynTree/$(am__dirstamp) \
     776        SynTree/$(DEPDIR)/$(am__dirstamp)
     777SynTree/VoidType.$(OBJEXT): SynTree/$(am__dirstamp) \
     778        SynTree/$(DEPDIR)/$(am__dirstamp)
     779SynTree/BasicType.$(OBJEXT): SynTree/$(am__dirstamp) \
     780        SynTree/$(DEPDIR)/$(am__dirstamp)
     781SynTree/PointerType.$(OBJEXT): SynTree/$(am__dirstamp) \
     782        SynTree/$(DEPDIR)/$(am__dirstamp)
     783SynTree/ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \
     784        SynTree/$(DEPDIR)/$(am__dirstamp)
     785SynTree/ReferenceType.$(OBJEXT): SynTree/$(am__dirstamp) \
     786        SynTree/$(DEPDIR)/$(am__dirstamp)
     787SynTree/FunctionType.$(OBJEXT): SynTree/$(am__dirstamp) \
     788        SynTree/$(DEPDIR)/$(am__dirstamp)
     789SynTree/ReferenceToType.$(OBJEXT): SynTree/$(am__dirstamp) \
     790        SynTree/$(DEPDIR)/$(am__dirstamp)
     791SynTree/TupleType.$(OBJEXT): SynTree/$(am__dirstamp) \
     792        SynTree/$(DEPDIR)/$(am__dirstamp)
     793SynTree/TypeofType.$(OBJEXT): SynTree/$(am__dirstamp) \
     794        SynTree/$(DEPDIR)/$(am__dirstamp)
     795SynTree/AttrType.$(OBJEXT): SynTree/$(am__dirstamp) \
     796        SynTree/$(DEPDIR)/$(am__dirstamp)
     797SynTree/VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \
     798        SynTree/$(DEPDIR)/$(am__dirstamp)
     799SynTree/ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \
     800        SynTree/$(DEPDIR)/$(am__dirstamp)
     801SynTree/Constant.$(OBJEXT): SynTree/$(am__dirstamp) \
     802        SynTree/$(DEPDIR)/$(am__dirstamp)
     803SynTree/Expression.$(OBJEXT): SynTree/$(am__dirstamp) \
     804        SynTree/$(DEPDIR)/$(am__dirstamp)
     805SynTree/TupleExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     806        SynTree/$(DEPDIR)/$(am__dirstamp)
     807SynTree/CommaExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     808        SynTree/$(DEPDIR)/$(am__dirstamp)
     809SynTree/TypeExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     810        SynTree/$(DEPDIR)/$(am__dirstamp)
     811SynTree/ApplicationExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     812        SynTree/$(DEPDIR)/$(am__dirstamp)
     813SynTree/AddressExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     814        SynTree/$(DEPDIR)/$(am__dirstamp)
     815SynTree/Statement.$(OBJEXT): SynTree/$(am__dirstamp) \
     816        SynTree/$(DEPDIR)/$(am__dirstamp)
     817SynTree/CompoundStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
     818        SynTree/$(DEPDIR)/$(am__dirstamp)
     819SynTree/DeclStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
     820        SynTree/$(DEPDIR)/$(am__dirstamp)
     821SynTree/Declaration.$(OBJEXT): SynTree/$(am__dirstamp) \
     822        SynTree/$(DEPDIR)/$(am__dirstamp)
     823SynTree/DeclarationWithType.$(OBJEXT): SynTree/$(am__dirstamp) \
     824        SynTree/$(DEPDIR)/$(am__dirstamp)
     825SynTree/ObjectDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     826        SynTree/$(DEPDIR)/$(am__dirstamp)
     827SynTree/FunctionDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     828        SynTree/$(DEPDIR)/$(am__dirstamp)
     829SynTree/AggregateDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     830        SynTree/$(DEPDIR)/$(am__dirstamp)
     831SynTree/NamedTypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     832        SynTree/$(DEPDIR)/$(am__dirstamp)
     833SynTree/TypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     834        SynTree/$(DEPDIR)/$(am__dirstamp)
     835SynTree/Initializer.$(OBJEXT): SynTree/$(am__dirstamp) \
     836        SynTree/$(DEPDIR)/$(am__dirstamp)
     837SynTree/TypeSubstitution.$(OBJEXT): SynTree/$(am__dirstamp) \
     838        SynTree/$(DEPDIR)/$(am__dirstamp)
     839SynTree/Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
     840        SynTree/$(DEPDIR)/$(am__dirstamp)
     841SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \
     842        SynTree/$(DEPDIR)/$(am__dirstamp)
    698843CodeGen/$(am__dirstamp):
    699844        @$(MKDIR_P) CodeGen
     
    710855CodeGen/OperatorTable.$(OBJEXT): CodeGen/$(am__dirstamp) \
    711856        CodeGen/$(DEPDIR)/$(am__dirstamp)
    712 Concurrency/$(am__dirstamp):
    713         @$(MKDIR_P) Concurrency
    714         @: > Concurrency/$(am__dirstamp)
    715 Concurrency/$(DEPDIR)/$(am__dirstamp):
    716         @$(MKDIR_P) Concurrency/$(DEPDIR)
    717         @: > Concurrency/$(DEPDIR)/$(am__dirstamp)
    718 Concurrency/Keywords.$(OBJEXT): Concurrency/$(am__dirstamp) \
    719         Concurrency/$(DEPDIR)/$(am__dirstamp)
    720857Common/$(am__dirstamp):
    721858        @$(MKDIR_P) Common
     
    728865Common/Eval.$(OBJEXT): Common/$(am__dirstamp) \
    729866        Common/$(DEPDIR)/$(am__dirstamp)
    730 Common/PassVisitor.$(OBJEXT): Common/$(am__dirstamp) \
    731         Common/$(DEPDIR)/$(am__dirstamp)
    732867Common/SemanticError.$(OBJEXT): Common/$(am__dirstamp) \
    733868        Common/$(DEPDIR)/$(am__dirstamp)
    734 Common/Stats/$(am__dirstamp):
    735         @$(MKDIR_P) Common/Stats
    736         @: > Common/Stats/$(am__dirstamp)
    737 Common/Stats/$(DEPDIR)/$(am__dirstamp):
    738         @$(MKDIR_P) Common/Stats/$(DEPDIR)
    739         @: > Common/Stats/$(DEPDIR)/$(am__dirstamp)
    740 Common/Stats/Counter.$(OBJEXT): Common/Stats/$(am__dirstamp) \
    741         Common/Stats/$(DEPDIR)/$(am__dirstamp)
    742 Common/Stats/Heap.$(OBJEXT): Common/Stats/$(am__dirstamp) \
    743         Common/Stats/$(DEPDIR)/$(am__dirstamp)
    744 Common/Stats/Stats.$(OBJEXT): Common/Stats/$(am__dirstamp) \
    745         Common/Stats/$(DEPDIR)/$(am__dirstamp)
    746 Common/Stats/Time.$(OBJEXT): Common/Stats/$(am__dirstamp) \
    747         Common/Stats/$(DEPDIR)/$(am__dirstamp)
    748869Common/UniqueName.$(OBJEXT): Common/$(am__dirstamp) \
    749870        Common/$(DEPDIR)/$(am__dirstamp)
     871Concurrency/$(am__dirstamp):
     872        @$(MKDIR_P) Concurrency
     873        @: > Concurrency/$(am__dirstamp)
     874Concurrency/$(DEPDIR)/$(am__dirstamp):
     875        @$(MKDIR_P) Concurrency/$(DEPDIR)
     876        @: > Concurrency/$(DEPDIR)/$(am__dirstamp)
     877Concurrency/Keywords.$(OBJEXT): Concurrency/$(am__dirstamp) \
     878        Concurrency/$(DEPDIR)/$(am__dirstamp)
    750879ControlStruct/$(am__dirstamp):
    751880        @$(MKDIR_P) ControlStruct
     
    804933ResolvExpr/AlternativeFinder.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    805934        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     935ResolvExpr/ExplodedActual.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     936        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    806937ResolvExpr/CastCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    807938        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     
    812943ResolvExpr/CurrentObject.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    813944        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    814 ResolvExpr/ExplodedActual.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    815         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    816945ResolvExpr/FindOpenVars.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    817946        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     
    838967ResolvExpr/Unify.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    839968        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    840 SymTab/$(am__dirstamp):
    841         @$(MKDIR_P) SymTab
    842         @: > SymTab/$(am__dirstamp)
    843 SymTab/$(DEPDIR)/$(am__dirstamp):
    844         @$(MKDIR_P) SymTab/$(DEPDIR)
    845         @: > SymTab/$(DEPDIR)/$(am__dirstamp)
    846969SymTab/Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \
    847970        SymTab/$(DEPDIR)/$(am__dirstamp)
     
    852975SymTab/Mangler.$(OBJEXT): SymTab/$(am__dirstamp) \
    853976        SymTab/$(DEPDIR)/$(am__dirstamp)
    854 SymTab/ManglerCommon.$(OBJEXT): SymTab/$(am__dirstamp) \
    855         SymTab/$(DEPDIR)/$(am__dirstamp)
    856977SymTab/Validate.$(OBJEXT): SymTab/$(am__dirstamp) \
    857978        SymTab/$(DEPDIR)/$(am__dirstamp)
    858 SymTab/Demangle.$(OBJEXT): SymTab/$(am__dirstamp) \
    859         SymTab/$(DEPDIR)/$(am__dirstamp)
    860 SynTree/$(am__dirstamp):
    861         @$(MKDIR_P) SynTree
    862         @: > SynTree/$(am__dirstamp)
    863 SynTree/$(DEPDIR)/$(am__dirstamp):
    864         @$(MKDIR_P) SynTree/$(DEPDIR)
    865         @: > SynTree/$(DEPDIR)/$(am__dirstamp)
    866 SynTree/Type.$(OBJEXT): SynTree/$(am__dirstamp) \
    867         SynTree/$(DEPDIR)/$(am__dirstamp)
    868 SynTree/VoidType.$(OBJEXT): SynTree/$(am__dirstamp) \
    869         SynTree/$(DEPDIR)/$(am__dirstamp)
    870 SynTree/BasicType.$(OBJEXT): SynTree/$(am__dirstamp) \
    871         SynTree/$(DEPDIR)/$(am__dirstamp)
    872 SynTree/PointerType.$(OBJEXT): SynTree/$(am__dirstamp) \
    873         SynTree/$(DEPDIR)/$(am__dirstamp)
    874 SynTree/ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \
    875         SynTree/$(DEPDIR)/$(am__dirstamp)
    876 SynTree/ReferenceType.$(OBJEXT): SynTree/$(am__dirstamp) \
    877         SynTree/$(DEPDIR)/$(am__dirstamp)
    878 SynTree/FunctionType.$(OBJEXT): SynTree/$(am__dirstamp) \
    879         SynTree/$(DEPDIR)/$(am__dirstamp)
    880 SynTree/ReferenceToType.$(OBJEXT): SynTree/$(am__dirstamp) \
    881         SynTree/$(DEPDIR)/$(am__dirstamp)
    882 SynTree/TupleType.$(OBJEXT): SynTree/$(am__dirstamp) \
    883         SynTree/$(DEPDIR)/$(am__dirstamp)
    884 SynTree/TypeofType.$(OBJEXT): SynTree/$(am__dirstamp) \
    885         SynTree/$(DEPDIR)/$(am__dirstamp)
    886 SynTree/AttrType.$(OBJEXT): SynTree/$(am__dirstamp) \
    887         SynTree/$(DEPDIR)/$(am__dirstamp)
    888 SynTree/VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \
    889         SynTree/$(DEPDIR)/$(am__dirstamp)
    890 SynTree/ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \
    891         SynTree/$(DEPDIR)/$(am__dirstamp)
    892 SynTree/Constant.$(OBJEXT): SynTree/$(am__dirstamp) \
    893         SynTree/$(DEPDIR)/$(am__dirstamp)
    894 SynTree/Expression.$(OBJEXT): SynTree/$(am__dirstamp) \
    895         SynTree/$(DEPDIR)/$(am__dirstamp)
    896 SynTree/TupleExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    897         SynTree/$(DEPDIR)/$(am__dirstamp)
    898 SynTree/CommaExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    899         SynTree/$(DEPDIR)/$(am__dirstamp)
    900 SynTree/TypeExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    901         SynTree/$(DEPDIR)/$(am__dirstamp)
    902 SynTree/ApplicationExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    903         SynTree/$(DEPDIR)/$(am__dirstamp)
    904 SynTree/AddressExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    905         SynTree/$(DEPDIR)/$(am__dirstamp)
    906 SynTree/Statement.$(OBJEXT): SynTree/$(am__dirstamp) \
    907         SynTree/$(DEPDIR)/$(am__dirstamp)
    908 SynTree/CompoundStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
    909         SynTree/$(DEPDIR)/$(am__dirstamp)
    910 SynTree/DeclStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
    911         SynTree/$(DEPDIR)/$(am__dirstamp)
    912 SynTree/Declaration.$(OBJEXT): SynTree/$(am__dirstamp) \
    913         SynTree/$(DEPDIR)/$(am__dirstamp)
    914 SynTree/DeclarationWithType.$(OBJEXT): SynTree/$(am__dirstamp) \
    915         SynTree/$(DEPDIR)/$(am__dirstamp)
    916 SynTree/ObjectDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    917         SynTree/$(DEPDIR)/$(am__dirstamp)
    918 SynTree/FunctionDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    919         SynTree/$(DEPDIR)/$(am__dirstamp)
    920 SynTree/AggregateDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    921         SynTree/$(DEPDIR)/$(am__dirstamp)
    922 SynTree/NamedTypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    923         SynTree/$(DEPDIR)/$(am__dirstamp)
    924 SynTree/TypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    925         SynTree/$(DEPDIR)/$(am__dirstamp)
    926 SynTree/Initializer.$(OBJEXT): SynTree/$(am__dirstamp) \
    927         SynTree/$(DEPDIR)/$(am__dirstamp)
    928 SynTree/TypeSubstitution.$(OBJEXT): SynTree/$(am__dirstamp) \
    929         SynTree/$(DEPDIR)/$(am__dirstamp)
    930 SynTree/Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
    931         SynTree/$(DEPDIR)/$(am__dirstamp)
    932 SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \
    933         SynTree/$(DEPDIR)/$(am__dirstamp)
    934979Tuples/$(am__dirstamp):
    935980        @$(MKDIR_P) Tuples
     
    938983        @$(MKDIR_P) Tuples/$(DEPDIR)
    939984        @: > Tuples/$(DEPDIR)/$(am__dirstamp)
     985Tuples/Explode.$(OBJEXT): Tuples/$(am__dirstamp) \
     986        Tuples/$(DEPDIR)/$(am__dirstamp)
    940987Tuples/TupleAssignment.$(OBJEXT): Tuples/$(am__dirstamp) \
    941988        Tuples/$(DEPDIR)/$(am__dirstamp)
    942989Tuples/TupleExpansion.$(OBJEXT): Tuples/$(am__dirstamp) \
    943         Tuples/$(DEPDIR)/$(am__dirstamp)
    944 Tuples/Explode.$(OBJEXT): Tuples/$(am__dirstamp) \
    945990        Tuples/$(DEPDIR)/$(am__dirstamp)
    946991Validate/$(am__dirstamp):
     
    10251070        Concurrency/$(DEPDIR)/$(am__dirstamp)
    10261071Common/DebugMalloc.$(OBJEXT): Common/$(am__dirstamp) \
     1072        Common/$(DEPDIR)/$(am__dirstamp)
     1073Common/Heap.$(OBJEXT): Common/$(am__dirstamp) \
    10271074        Common/$(DEPDIR)/$(am__dirstamp)
    10281075ControlStruct/ExceptTranslate.$(OBJEXT):  \
     
    10951142        -rm -f CodeTools/*.$(OBJEXT)
    10961143        -rm -f Common/*.$(OBJEXT)
    1097         -rm -f Common/Stats/*.$(OBJEXT)
    10981144        -rm -f Concurrency/*.$(OBJEXT)
    10991145        -rm -f ControlStruct/*.$(OBJEXT)
     
    11261172@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/DebugMalloc.Po@am__quote@
    11271173@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/Eval.Po@am__quote@
    1128 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/PassVisitor.Po@am__quote@
     1174@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/Heap.Po@am__quote@
    11291175@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/SemanticError.Po@am__quote@
    11301176@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/UniqueName.Po@am__quote@
    1131 @AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Counter.Po@am__quote@
    1132 @AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Heap.Po@am__quote@
    1133 @AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Stats.Po@am__quote@
    1134 @AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Time.Po@am__quote@
    11351177@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/Keywords.Po@am__quote@
    11361178@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/Waitfor.Po@am__quote@
     
    13941436        -rm -f Common/$(DEPDIR)/$(am__dirstamp)
    13951437        -rm -f Common/$(am__dirstamp)
    1396         -rm -f Common/Stats/$(DEPDIR)/$(am__dirstamp)
    1397         -rm -f Common/Stats/$(am__dirstamp)
    13981438        -rm -f Concurrency/$(DEPDIR)/$(am__dirstamp)
    13991439        -rm -f Concurrency/$(am__dirstamp)
     
    14331473
    14341474distclean: distclean-am
    1435         -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Common/Stats/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)
     1475        -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)
    14361476        -rm -f Makefile
    14371477distclean-am: clean-am distclean-compile distclean-generic \
     
    14791519
    14801520maintainer-clean: maintainer-clean-am
    1481         -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Common/Stats/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)
     1521        -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)
    14821522        -rm -f Makefile
    14831523maintainer-clean-am: distclean-am maintainer-clean-generic
     
    15191559
    15201560
    1521 $(addprefix $(srcdir)/, ResolvExpr/ConversionCost.cc ResolvExpr/CommonType.cc SymTab/ManglerCommon.cc) : $(srcdir)/SynTree/Type.h
    1522 
    1523 $(srcdir)/SynTree/Type.h : BasicTypes-gen.cc
    1524         ${AM_V_GEN}${CXXCOMPILE} $< -o BasicTypes-gen -Wall -Wextra
    1525         @./BasicTypes-gen
    1526         @rm BasicTypes-gen
    1527 
    15281561# Tell versions [3.59,3.63) of GNU make to not export all variables.
    15291562# Otherwise a system limit (for SysV at least) may be exceeded.
  • src/Parser/DeclarationNode.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Feb  1 16:49:17 2019
    13 // Update Count     : 1113
     12// Last Modified On : Thu Nov  1 20:54:26 2018
     13// Update Count     : 1108
    1414//
    1515
     
    4141
    4242// These must harmonize with the corresponding DeclarationNode enumerations.
    43 const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "int128",
    44                                                                                                    "float", "double", "long double", "float80", "float128",
    45                                                                                                    "_float16", "_float32", "_float32x", "_float64", "_float64x", "_float128", "_float128x", "NoBasicTypeNames" };
    46 const char * DeclarationNode::complexTypeNames[] = { "_Complex", "NoComplexTypeNames", "_Imaginary" }; // Imaginary unsupported => parse, but make invisible and print error message
     43const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "int128", "float80", "float128", "NoBasicTypeNames" };
     44const char * DeclarationNode::complexTypeNames[] = { "_Complex", "_Imaginary", "NoComplexTypeNames" };
    4745const char * DeclarationNode::signednessNames[] = { "signed", "unsigned", "NoSignednessNames" };
    4846const char * DeclarationNode::lengthNames[] = { "short", "long", "long long", "NoLengthNames" };
  • src/Parser/ExpressionNode.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Mar 10 16:10:32 2019
    13 // Update Count     : 976
     12// Last Modified On : Mon Jun  4 21:24:45 2018
     13// Update Count     : 802
    1414//
    1515
     
    5151extern const Type::Qualifiers noQualifiers;                             // no qualifiers on constants
    5252
    53 // static inline bool checkH( char c ) { return c == 'h' || c == 'H'; }
    54 // static inline bool checkZ( char c ) { return c == 'z' || c == 'Z'; }
    55 // static inline bool checkU( char c ) { return c == 'u' || c == 'U'; }
     53static inline bool checkH( char c ) { return c == 'h' || c == 'H'; }
     54static inline bool checkL( char c ) { return c == 'l' || c == 'L'; }
     55static inline bool checkZ( char c ) { return c == 'z' || c == 'Z'; }
     56static inline bool checkU( char c ) { return c == 'u' || c == 'U'; }
    5657static inline bool checkF( char c ) { return c == 'f' || c == 'F'; }
    5758static inline bool checkD( char c ) { return c == 'd' || c == 'D'; }
    58 static inline bool checkF80( char c ) { return c == 'w' || c == 'W'; }
    59 static inline bool checkF128( char c ) { return c == 'q' || c == 'Q'; }
    60 static inline bool checkL( char c ) { return c == 'l' || c == 'L'; }
    6159static inline bool checkI( char c ) { return c == 'i' || c == 'I'; }
    6260static inline bool checkB( char c ) { return c == 'b' || c == 'B'; }
    6361static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }
    64 static inline bool checkN( char c ) { return c == 'n' || c == 'N'; }
    65 
    66 void lnthSuffix( string & str, int & type, int & ltype ) {
    67         string::size_type posn = str.find_last_of( "lL" );
    68 
    69         if ( posn == string::npos ) return;                                     // no suffix
    70         if ( posn == str.length() - 1 ) { type = 3; return; } // no length => long
    71 
    72         string::size_type next = posn + 1;                                      // advance to length
    73         if ( str[next] == '3' ) {                                                       // 32
    74                 type = ltype = 2;
    75         } else if ( str[next] == '6' ) {                                        // 64
    76                 type = ltype = 3;
    77         } else if ( str[next] == '8' ) {                                        // 8
    78                 type = ltype = 1;
    79         } else if ( str[next] == '1' ) {
    80                 if ( str[next + 1] == '6' ) {                                   // 16
    81                         type = ltype = 0;
     62
     63static const char * lnthsInt[2][6] = {
     64        { "int8_t", "int16_t", "int32_t", "int64_t", "size_t", },
     65        { "uint8_t", "uint16_t", "uint32_t", "uint64_t", "size_t", }
     66}; // lnthsInt
     67
     68static inline void checkLNInt( string & str, int & lnth, int & size ) {
     69        string::size_type posn = str.find_first_of( "lL" ), start = posn;
     70  if ( posn == string::npos ) return;
     71        size = 4;                                                                                       // assume largest size
     72        posn += 1;                                                                                      // advance to size
     73        if ( str[posn] == '8' ) {                                                       // 8
     74                lnth = 0;
     75        } else if ( str[posn] == '1' ) {
     76                posn += 1;
     77                if ( str[posn] == '6' ) {                                               // 16
     78                        lnth = 1;
    8279                } else {                                                                                // 128
    83                         type = 5; ltype = 6;
    84                 } // if
    85         } // if
    86         // remove "lL" for these cases because it may not imply long
    87         str.erase( posn );                                                                      // remove length
    88 } // lnthSuffix
    89 
    90 void valueToType( unsigned long long int & v, bool dec, int & type, bool & Unsigned ) {
    91         // use value to determine type
    92         if ( v <= INT_MAX ) {                                                           // signed int
    93                 type = 2;
    94         } else if ( v <= UINT_MAX && ! dec ) {                          // unsigned int
    95                 type = 2;
    96                 Unsigned = true;                                                                // unsigned
    97         } else if ( v <= LONG_MAX ) {                                           // signed long int
    98                 type = 3;
    99         } else if ( v <= ULONG_MAX && ( ! dec || LONG_MAX == LLONG_MAX ) ) { // signed long int
    100                 type = 3;
    101                 Unsigned = true;                                                                // unsigned long int
    102         } else if ( v <= LLONG_MAX ) {                                          // signed long long int
    103                 type = 4;
    104         } else {                                                                                        // unsigned long long int
    105                 type = 4;
    106                 Unsigned = true;                                                                // unsigned long long int
    107         } // if
    108 } // valueToType
     80                        posn += 1;
     81                        lnth = 5;
     82                } // if
     83        } else {
     84                if ( str[posn] == '3' ) {                                               // 32
     85                        lnth = 2;
     86                } else if ( str[posn] == '6' ) {                                // 64
     87                        lnth = 3;
     88                } else {
     89                        assertf( false, "internal error, bad integral length %s", str.c_str() );
     90                } // if
     91                posn += 1;
     92        } // if
     93        str.erase( start, posn - start + 1 );                           // remove length suffix
     94} // checkLNInt
    10995
    11096Expression * build_constantInteger( string & str ) {
    111         static const BasicType::Kind kind[2][7] = {
    112                 // short (h) must be before char (hh) because shorter type has the longer suffix
     97        static const BasicType::Kind kind[2][6] = {
     98                // short (h) must be before char (hh)
    11399                { BasicType::ShortSignedInt, BasicType::SignedChar, BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt, BasicType::SignedInt128, },
    114100                { BasicType::ShortUnsignedInt, BasicType::UnsignedChar, BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::UnsignedInt128, },
    115101        };
    116102
    117         static const char * lnthsInt[2][6] = {
    118                 { "int16_t",  "int8_t",  "int32_t",  "int64_t",  "size_t",  "uintptr_t", },
    119                 { "uint16_t", "uint8_t", "uint32_t", "uint64_t", "size_t",  "uintptr_t", },
    120         }; // lnthsInt
     103        bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
     104        int size;                                                                                       // 0 => short, 1 => char, 2 => int, 3 => long int, 4 => long long int, 5 => int128
     105        int lnth = -1;                                                                          // literal length
    121106
    122107        unsigned long long int v;                                                       // converted integral value
    123108        size_t last = str.length() - 1;                                         // last subscript of constant
    124109        Expression * ret;
    125         //string fred( str );
    126 
    127         int type = -1;                                                                          // 0 => short, 1 => char, 2 => int, 3 => long int, 4 => long long int, 5 => int128
    128         int ltype = -1;                                                                         // 0 => 16 bits, 1 => 8 bits, 2 => 32 bits, 3 => 64 bits, 4 => size_t, 5 => intptr, 6 => pointer
    129         bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
    130110
    131111        // special constants
     
    139119        } // if
    140120
    141         // Cannot be just "0"/"1"; sscanf stops at the suffix, if any; value goes over the wall => always generate
     121        // Cannot be "0"
    142122
    143123        if ( str[0] == '0' ) {                                                          // radix character ?
     
    147127                        //printf( "%llx %llu\n", v, v );
    148128                } else if ( checkB( str[1] ) ) {                                // binary constant ?
    149                         v = 0;                                                                          // compute value
    150                         for ( unsigned int i = 2;; ) {                          // ignore prefix
     129                        v = 0;
     130                        for ( unsigned int i = 2;; i += 1 ) {           // compute value
    151131                                if ( str[i] == '1' ) v |= 1;
    152                                 i += 1;
    153                           if ( i == last - 1 || (str[i] != '0' && str[i] != '1') ) break;
     132                          if ( i == last ) break;
    154133                                v <<= 1;
    155134                        } // for
    156                         //printf( "%#llx %llu\n", v, v );
     135                        //printf( "%llx %llu\n", v, v );
    157136                } else {                                                                                // octal constant
    158137                        sscanf( (char *)str.c_str(), "%llo", &v );
    159                         //printf( "%#llo %llu\n", v, v );
     138                        //printf( "%llo %llu\n", v, v );
    160139                } // if
    161140        } else {                                                                                        // decimal constant ?
    162141                sscanf( (char *)str.c_str(), "%llu", &v );
    163                 //printf( "%llu\n", v );
    164         } // if
    165 
    166         string::size_type posn;
    167 
    168         if ( isdigit( str[last] ) ) {                                           // no suffix ?
    169                 lnthSuffix( str, type, ltype );                                 // could have length suffix
    170                 if ( type == -1 ) {                                                             // no suffix
    171                         valueToType( v, dec, type, Unsigned );
    172                 } // if
    173         } else {
    174                 // At least one digit in integer constant, so safe to backup while looking for suffix.
    175 
    176                 posn = str.find_last_of( "pP" );
    177                 if ( posn != string::npos ) { valueToType( v, dec, type, Unsigned ); ltype = 5; str.erase( posn, 1 ); goto FINI; }
    178 
    179                 posn = str.find_last_of( "zZ" );
    180                 if ( posn != string::npos ) { Unsigned = true; type = 2; ltype = 4; str.erase( posn, 1 ); goto FINI; }
    181 
    182                 // 'u' can appear before or after length suffix
    183                 if ( str.find_last_of( "uU" ) != string::npos ) Unsigned = true;
    184 
    185                 posn = str.rfind( "hh" );
    186                 if ( posn != string::npos ) { type = 1; str.erase( posn, 2 ); goto FINI; }
    187 
    188                 posn = str.rfind( "HH" );
    189                 if ( posn != string::npos ) { type = 1; str.erase( posn, 2 ); goto FINI; }
    190 
    191                 posn = str.find_last_of( "hH" );
    192                 if ( posn != string::npos ) { type = 0; str.erase( posn, 1 ); goto FINI; }
    193 
    194                 posn = str.find_last_of( "nN" );
    195                 if ( posn != string::npos ) { type = 2; str.erase( posn, 1 ); goto FINI; }
    196 
    197                 if ( str.rfind( "ll" ) != string::npos || str.rfind( "LL" ) != string::npos ) { type = 4; goto FINI; }
    198 
    199                 lnthSuffix( str, type, ltype );                                 // must be after check for "ll"
    200                 if ( type == -1 ) {                                                             // only 'u' suffix ?
    201                         valueToType( v, dec, type, Unsigned );
    202                 } // if
    203           FINI: ;
    204         } // if
    205 
    206         //if ( !( 0 <= type && type <= 6 ) ) { printf( "%s %lu %d %s\n", fred.c_str(), fred.length(), type, str.c_str() ); }
    207         assert( 0 <= type && type <= 6 );
    208 
     142                //printf( "%llu %llu\n", v, v );
     143        } // if
     144
     145        if ( v <= INT_MAX ) {                                                           // signed int
     146                size = 2;
     147        } else if ( v <= UINT_MAX && ! dec ) {                          // unsigned int
     148                size = 2;
     149                Unsigned = true;                                                                // unsigned
     150        } else if ( v <= LONG_MAX ) {                                           // signed long int
     151                size = 3;
     152        } else if ( v <= ULONG_MAX && ( ! dec || LONG_MAX == LLONG_MAX ) ) { // signed long int
     153                size = 3;
     154                Unsigned = true;                                                                // unsigned long int
     155        } else if ( v <= LLONG_MAX ) {                                          // signed long long int
     156                size = 4;
     157        } else {                                                                                        // unsigned long long int
     158                size = 4;
     159                Unsigned = true;                                                                // unsigned long long int
     160        } // if
     161
     162        // At least one digit in integer constant, so safe to backup while looking for suffix.
     163
     164        if ( checkU( str[last] ) ) {                                            // suffix 'u' ?
     165                Unsigned = true;
     166                if ( checkL( str[last - 1] ) ) {                                // suffix 'l' ?
     167                        size = 3;
     168                        if ( checkL( str[last - 2] ) ) {                        // suffix "ll" ?
     169                                size = 4;
     170                        } // if
     171                } else if ( checkH( str[last - 1] ) ) {                 // suffix 'h' ?
     172                        size = 0;
     173                        if ( checkH( str[last - 2] ) ) {                        // suffix "hh" ?
     174                                size = 1;
     175                        } // if
     176                        str.erase( last - size - 1, size + 1 );         // remove 'h'/"hh"
     177                } else {                                                                                // suffix "ln" ?
     178                        checkLNInt( str, lnth, size );
     179                } // if
     180        } else if ( checkL( str[ last ] ) ) {                           // suffix 'l' ?
     181                size = 3;
     182                if ( checkL( str[last - 1] ) ) {                                // suffix 'll' ?
     183                        size = 4;
     184                        if ( checkU( str[last - 2] ) ) {                        // suffix 'u' ?
     185                                Unsigned = true;
     186                        } // if
     187                } else if ( checkU( str[last - 1] ) ) {                 // suffix 'u' ?
     188                        Unsigned = true;
     189                } // if
     190        } else if ( checkH( str[ last ] ) ) {                           // suffix 'h' ?
     191                size = 0;
     192                if ( checkH( str[last - 1] ) ) {                                // suffix "hh" ?
     193                        size = 1;
     194                        if ( checkU( str[last - 2] ) ) {                        // suffix 'u' ?
     195                                Unsigned = true;
     196                        } // if
     197                } else if ( checkU( str[last - 1] ) ) {                 // suffix 'u' ?
     198                        Unsigned = true;
     199                } // if
     200                str.erase( last - size, size + 1 );                             // remove 'h'/"hh"
     201        } else if ( checkZ( str[last] ) ) {                                     // suffix 'z' ?
     202                lnth = 4;
     203                str.erase( last, 1 );                                                   // remove 'z'
     204        } else {                                                                                        // suffix "ln" ?
     205                checkLNInt( str, lnth, size );
     206        } // if
     207
     208        assert( 0 <= size && size < 6 );
    209209        // Constant type is correct for overload resolving.
    210         ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][type] ), str, v ) );
    211         if ( Unsigned && type < 2 ) {                                           // hh or h, less than int ?
     210        ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );
     211        if ( Unsigned && size < 2 ) {                                           // hh or h, less than int ?
    212212                // int i = -1uh => 65535 not -1, so cast is necessary for unsigned, which unfortunately eliminates warnings for large values.
    213                 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][type] ), false );
    214         } else if ( ltype != -1 ) {                                                     // explicit length ?
    215                 if ( ltype == 6 ) {                                                             // int128, (int128)constant
    216                         ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][type] ), false );
    217                 } else {                                                                                // explicit length, (length_type)constant
    218                         ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), lnthsInt[Unsigned][ltype], false ), false );
    219                         if ( ltype == 5 ) {                                                     // pointer, intptr( (uintptr_t)constant )
    220                                 ret = build_func( new ExpressionNode( build_varref( new string( "intptr" ) ) ), new ExpressionNode( ret ) );                                                             
    221                         } // if
    222                 } // if
    223         } // if
    224 
    225   CLEANUP: ;
     213                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ), false );
     214        } else if ( lnth != -1 ) {                                                      // explicit length ?
     215                if ( lnth == 5 ) {                                                              // int128 ?
     216                        size = 5;
     217                        ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ), false );
     218                } else {
     219                        ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), lnthsInt[Unsigned][lnth], false ), false );
     220                } // if
     221        } // if
     222  CLEANUP:
     223
    226224        delete &str;                                                                            // created by lex
    227225        return ret;
     
    229227
    230228
    231 static inline void checkFnxFloat( string & str, size_t last, bool & explnth, int & type ) {
    232         string::size_type posn;
    233         // floating-point constant has minimum of 2 characters, 1. or .1, so safe to look ahead
    234         if ( str[1] == 'x' ) {                                                          // hex ?
    235                 posn = str.find_last_of( "pP" );                                // back for exponent (must have)
    236                 posn = str.find_first_of( "fF", posn + 1 );             // forward for size (fF allowed in hex constant)
    237         } else {
    238                 posn = str.find_last_of( "fF" );                                // back for size (fF not allowed)
    239         } // if
     229static inline void checkLNFloat( string & str, int & lnth, int & size ) {
     230        string::size_type posn = str.find_first_of( "lL" ), start = posn;
    240231  if ( posn == string::npos ) return;
    241         explnth = true;
     232        size = 2;                                                                                       // assume largest size
     233        lnth = 0;
    242234        posn += 1;                                                                                      // advance to size
    243235        if ( str[posn] == '3' ) {                                                       // 32
    244                 if ( str[last] != 'x' ) type = 6;
    245                 else type = 7;
     236                size = 0;
    246237        } else if ( str[posn] == '6' ) {                                        // 64
    247                 if ( str[last] != 'x' ) type = 8;
    248                 else type = 9;
    249         } else if ( str[posn] == '8' ) {                                        // 80
    250                 type = 3;
    251         } else if ( str[posn] == '1' ) {                                        // 16/128
    252                 if ( str[posn + 1] == '6' ) {                                   // 16
    253                         type = 5;
    254                 } else {                                                                                // 128
    255                         if ( str[last] != 'x' ) type = 10;
    256                         else type = 11;
    257                 } // if
     238                size = 1;
     239        } else if ( str[posn] == '8' || str[posn] == '1' ) { // 80, 128
     240                size = 2;
     241                if ( str[posn] == '1' ) posn += 1;
    258242        } else {
    259243                assertf( false, "internal error, bad floating point length %s", str.c_str() );
    260244        } // if
    261 } // checkFnxFloat
     245        posn += 1;
     246        str.erase( start, posn - start + 1 );                           // remove length suffix
     247} // checkLNFloat
    262248
    263249
    264250Expression * build_constantFloat( string & str ) {
    265         static const BasicType::Kind kind[2][12] = {
    266                 { BasicType::Float, BasicType::Double, BasicType::LongDouble, BasicType::uuFloat80, BasicType::uuFloat128, BasicType::uFloat16, BasicType::uFloat32, BasicType::uFloat32x, BasicType::uFloat64, BasicType::uFloat64x, BasicType::uFloat128, BasicType::uFloat128x },
    267                 { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex, (BasicType::Kind)-1, (BasicType::Kind)-1, BasicType::uFloat16Complex, BasicType::uFloat32Complex, BasicType::uFloat32xComplex, BasicType::uFloat64Complex, BasicType::uFloat64xComplex, BasicType::uFloat128Complex, BasicType::uFloat128xComplex },
     251        static const BasicType::Kind kind[2][3] = {
     252                { BasicType::Float, BasicType::Double, BasicType::LongDouble },
     253                { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex },
    268254        };
    269255
    270         // floating-point constant has minimum of 2 characters 1. or .1
     256        bool complx = false;                                                            // real, complex
     257        int size = 1;                                                                           // 0 => float, 1 => double, 2 => long double
     258        int lnth = -1;                                                                          // literal length
     259        // floating-point constant has minimum of 2 characters: 1. or .1
    271260        size_t last = str.length() - 1;
    272261        double v;
    273         int type;                                                                                       // 0 => float, 1 => double, 3 => long double, ...
    274         bool complx = false;                                                            // real, complex
    275         bool explnth = false;                                                           // explicit literal length
    276262
    277263        sscanf( str.c_str(), "%lg", &v );
     
    283269
    284270        if ( checkF( str[last] ) ) {                                            // float ?
    285                 type = 0;
     271                size = 0;
    286272        } else if ( checkD( str[last] ) ) {                                     // double ?
    287                 type = 1;
     273                size = 1;
    288274        } else if ( checkL( str[last] ) ) {                                     // long double ?
    289                 type = 2;
    290         } else if ( checkF80( str[last] ) ) {                           // __float80 ?
    291                 type = 3;
    292         } else if ( checkF128( str[last] ) ) {                          // __float128 ?
    293                 type = 4;
     275                size = 2;
    294276        } else {
    295                 type = 1;                                                                               // double (default if no suffix)
    296                 checkFnxFloat( str, last, explnth, type );
    297         } // if
    298 
     277                size = 1;                                                                               // double (default)
     278                checkLNFloat( str, lnth, size );
     279        } // if
    299280        if ( ! complx && checkI( str[last - 1] ) ) {            // imaginary ?
    300281                complx = true;
    301282        } // if
    302283
    303         assert( 0 <= type && type < 12 );
    304         Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][type] ), str, v ) );
    305         if ( explnth ) {                                                                        // explicit length ?
    306                 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][type] ), false );
     284        assert( 0 <= size && size < 3 );
     285        Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );
     286        if ( lnth != -1 ) {                                                                     // explicit length ?
     287                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][size] ), false );
    307288        } // if
    308289
  • src/Parser/ParseNode.h

    r53bb8f1 r9d9a451  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 13 17:36:49 2019
    13 // Update Count     : 867
     12// Last Modified On : Thu Nov  1 20:54:53 2018
     13// Update Count     : 854
    1414//
    1515
     
    206206class DeclarationNode : public ParseNode {
    207207  public:
    208         // These enumerations must harmonize with their names in DeclarationNode.cc.
    209         enum BasicType { Void, Bool, Char, Int, Int128,
    210                                          Float, Double, LongDouble, uuFloat80, uuFloat128,
    211                                          uFloat16, uFloat32, uFloat32x, uFloat64, uFloat64x, uFloat128, uFloat128x, NoBasicType };
     208        // These enumerations must harmonize with their names.
     209        enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, Int128, Float80, Float128, NoBasicType };
    212210        static const char * basicTypeNames[];
    213         enum ComplexType { Complex, NoComplexType, Imaginary }; // Imaginary unsupported => parse, but make invisible and print error message
     211        enum ComplexType { Complex, Imaginary, NoComplexType };
    214212        static const char * complexTypeNames[];
    215213        enum Signedness { Signed, Unsigned, NoSignedness };
  • src/Parser/TypeData.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 13 18:16:23 2019
    13 // Update Count     : 649
     12// Last Modified On : Fri Nov  2 07:54:26 2018
     13// Update Count     : 624
    1414//
    1515
     
    666666
    667667          case DeclarationNode::Float:
     668          case DeclarationNode::Float80:
     669          case DeclarationNode::Float128:
    668670          case DeclarationNode::Double:
    669671          case DeclarationNode::LongDouble:                                     // not set until below
    670           case DeclarationNode::uuFloat80:
    671           case DeclarationNode::uuFloat128:
    672           case DeclarationNode::uFloat16:
    673           case DeclarationNode::uFloat32:
    674           case DeclarationNode::uFloat32x:
    675           case DeclarationNode::uFloat64:
    676           case DeclarationNode::uFloat64x:
    677           case DeclarationNode::uFloat128:
    678           case DeclarationNode::uFloat128x:
    679                 static BasicType::Kind floattype[2][12] = {
    680                         { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex, (BasicType::Kind)-1, (BasicType::Kind)-1, BasicType::uFloat16Complex, BasicType::uFloat32Complex, BasicType::uFloat32xComplex, BasicType::uFloat64Complex, BasicType::uFloat64xComplex, BasicType::uFloat128Complex, BasicType::uFloat128xComplex, },
    681                         { BasicType::Float, BasicType::Double, BasicType::LongDouble, BasicType::uuFloat80, BasicType::uuFloat128, BasicType::uFloat16, BasicType::uFloat32, BasicType::uFloat32x, BasicType::uFloat64, BasicType::uFloat64x, BasicType::uFloat128, BasicType::uFloat128x, },
     672                static BasicType::Kind floattype[3][3] = {
     673                        { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex },
     674                        { BasicType::FloatImaginary, BasicType::DoubleImaginary, BasicType::LongDoubleImaginary },
     675                        { BasicType::Float, BasicType::Double, BasicType::LongDouble },
    682676                };
    683677
     
    692686                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    693687                } // if
    694                 if ( td->complextype == DeclarationNode::Imaginary ) {
    695                         genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
    696                 } // if
    697                 if ( (td->basictype == DeclarationNode::uuFloat80 || td->basictype == DeclarationNode::uuFloat128) && td->complextype == DeclarationNode::Complex ) { // gcc unsupported
    698                         genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
    699                 } // if
    700688                if ( td->length == DeclarationNode::Long ) {
    701689                        const_cast<TypeData *>(td)->basictype = DeclarationNode::LongDouble;
    702690                } // if
    703691
     692                if ( td->basictype == DeclarationNode::Float80 || td->basictype == DeclarationNode::Float128 ) {
     693                        // if ( td->complextype != DeclarationNode::NoComplexType ) {
     694                        //      genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
     695                        // }
     696                        if ( td->basictype == DeclarationNode::Float80 ) ret = BasicType::Float80;
     697                        else ret = BasicType::Float128;
     698                        break;
     699                }
     700
    704701                ret = floattype[ td->complextype ][ td->basictype - DeclarationNode::Float ];
    705                 //printf( "XXXX %d %d %d %d\n", td->complextype, td->basictype, DeclarationNode::Float, ret );
    706702                break;
    707703
  • src/Parser/TypeData.h

    r53bb8f1 r9d9a451  
    3131        struct Aggregate_t {
    3232                DeclarationNode::Aggregate kind;
    33                 const std::string * name = nullptr;
    34                 DeclarationNode * params = nullptr;
    35                 ExpressionNode * actuals = nullptr;                                             // holds actual parameters later applied to AggInst
    36                 DeclarationNode * fields = nullptr;
     33                const std::string * name;
     34                DeclarationNode * params;
     35                ExpressionNode * actuals;                                               // holds actual parameters later applied to AggInst
     36                DeclarationNode * fields;
    3737                bool body;
    3838                bool anon;
    3939
    4040                bool tagged;
    41                 const std::string * parent = nullptr;
     41                const std::string * parent;
    4242        };
    4343
    4444        struct AggInst_t {
    45                 TypeData * aggregate = nullptr;
    46                 ExpressionNode * params = nullptr;
     45                TypeData * aggregate;
     46                ExpressionNode * params;
    4747                bool hoistType;
    4848        };
    4949
    5050        struct Array_t {
    51                 ExpressionNode * dimension = nullptr;
     51                ExpressionNode * dimension;
    5252                bool isVarLen;
    5353                bool isStatic;
     
    5555
    5656        struct Enumeration_t {
    57                 const std::string * name = nullptr;
    58                 DeclarationNode * constants = nullptr;
     57                const std::string * name;
     58                DeclarationNode * constants;
    5959                bool body;
    6060                bool anon;
     
    6262
    6363        struct Function_t {
    64                 mutable DeclarationNode * params = nullptr;                             // mutables modified in buildKRFunction
    65                 mutable DeclarationNode * idList = nullptr;                             // old-style
    66                 mutable DeclarationNode * oldDeclList = nullptr;
    67                 StatementNode * body = nullptr;
    68                 ExpressionNode * withExprs = nullptr;                                           // expressions from function's with_clause
     64                mutable DeclarationNode * params;                               // mutables modified in buildKRFunction
     65                mutable DeclarationNode * idList;                               // old-style
     66                mutable DeclarationNode * oldDeclList;
     67                StatementNode * body;
     68                ExpressionNode * withExprs;                                             // expressions from function's with_clause
    6969        };
    7070
    7171        struct Symbolic_t {
    72                 const std::string * name = nullptr;
     72                const std::string * name;
    7373                bool isTypedef;                                                                 // false => TYPEGENname, true => TYPEDEFname
    74                 DeclarationNode * params = nullptr;
    75                 ExpressionNode * actuals = nullptr;
    76                 DeclarationNode * assertions = nullptr;
     74                DeclarationNode * params;
     75                ExpressionNode * actuals;
     76                DeclarationNode * assertions;
    7777        };
    7878
    7979        struct Qualified_t {                                                            // qualified type S.T
    80                 TypeData * parent = nullptr;
    81                 TypeData * child = nullptr;
     80                TypeData * parent;
     81                TypeData * child;
    8282        };
    8383
     
    9393
    9494        Type::Qualifiers qualifiers;
    95         DeclarationNode * forall = nullptr;
     95        DeclarationNode * forall;
    9696
    9797        Aggregate_t aggregate;
     
    102102        Symbolic_t symbolic;
    103103        Qualified_t qualified;
    104         DeclarationNode * tuple = nullptr;
    105         ExpressionNode * typeexpr = nullptr;
     104        DeclarationNode * tuple;
     105        ExpressionNode * typeexpr;
    106106
    107107        TypeData( Kind k = Unknown );
  • src/Parser/lex.ll

    r53bb8f1 r9d9a451  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sun Mar 10 09:13:09 2019
    13  * Update Count     : 706
     12 * Last Modified On : Thu Nov  1 20:57:35 2018
     13 * Update Count     : 687
    1414 */
    1515
     
    3939using namespace std;
    4040
    41 #include "config.h"                                                                             // configure info
    4241#include "ParseNode.h"
    4342#include "TypedefTable.h"
     
    6059#define IDENTIFIER_RETURN()     RETURN_VAL( typedefTable.isKind( yytext ) )
    6160#define ATTRIBUTE_RETURN()      RETURN_VAL( ATTR_IDENTIFIER )
    62 
    63 #ifdef HAVE_KEYWORDS_FLOATXX                                                            // GCC >= 7 => keyword, otherwise typedef
    64 #define FLOATXX(v) KEYWORD_RETURN(v);
    65 #else
    66 #define FLOATXX(v) IDENTIFIER_RETURN();
    67 #endif // HAVE_KEYWORDS_FLOATXX
    6861
    6962void rm_underscore() {
     
    9992hex_quad {hex}("_"?{hex}){3}
    10093size_opt (8|16|32|64|128)?
    101                                 // CFA: explicit l8/l16/l32/l64/l128, char 'hh', short 'h', int 'n'
    102 length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hHnN])
    103                                 // CFA: size_t 'z', pointer 'p', which define a sign and length
    104 integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]|[pP]))?
     94length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hH])
     95integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))?
    10596
    10697octal_digits ({octal})|({octal}({octal}|"_")*{octal})
     
    121112                                // GCC: D (double) and iI (imaginary) suffixes, and DL (long double)
    122113exponent "_"?[eE]"_"?[+-]?{decimal_digits}
    123 floating_size 16|32|32x|64|64x|80|128|128x
    124 floating_length ([fFdDlLwWqQ]|[fF]{floating_size})
     114floating_size 32|64|80|128
     115floating_length ([fFdDlL]|[lL]{floating_size})
    125116floating_suffix ({floating_length}?[iI]?)|([iI]{floating_length})
    126117floating_suffix_opt ("_"?({floating_suffix}|"DL"))?
     
    249240finally                 { KEYWORD_RETURN(FINALLY); }                    // CFA
    250241float                   { KEYWORD_RETURN(FLOAT); }
    251 __float80               { KEYWORD_RETURN(uuFLOAT80); }                  // GCC
    252 float80                 { KEYWORD_RETURN(uuFLOAT80); }                  // GCC
    253 __float128              { KEYWORD_RETURN(uuFLOAT128); }                 // GCC
    254 float128                { KEYWORD_RETURN(uuFLOAT128); }                 // GCC
    255 _Float16                { FLOATXX(uFLOAT16); }                                  // GCC
    256 _Float32                { FLOATXX(uFLOAT32); }                                  // GCC
    257 _Float32x               { FLOATXX(uFLOAT32X); }                                 // GCC
    258 _Float64                { FLOATXX(uFLOAT64); }                                  // GCC
    259 _Float64x               { FLOATXX(uFLOAT64X); }                                 // GCC
    260 _Float128               { FLOATXX(uFLOAT128); }                                 // GCC
    261 _Float128x              { FLOATXX(uFLOAT128); }                                 // GCC
     242_Float32                { KEYWORD_RETURN(FLOAT); }                              // GCC
     243_Float32x               { KEYWORD_RETURN(FLOAT); }                              // GCC
     244_Float64                { KEYWORD_RETURN(DOUBLE); }                             // GCC
     245_Float64x               { KEYWORD_RETURN(DOUBLE); }                             // GCC
     246__float80               { KEYWORD_RETURN(FLOAT80); }                    // GCC
     247float80                 { KEYWORD_RETURN(FLOAT80); }                    // GCC
     248_Float128               { KEYWORD_RETURN(FLOAT128); }                   // GCC
     249_Float128x              { KEYWORD_RETURN(FLOAT128); }                   // GCC
     250__float128              { KEYWORD_RETURN(FLOAT128); }                   // GCC
     251float128                { KEYWORD_RETURN(FLOAT128); }                   // GCC
    262252for                             { KEYWORD_RETURN(FOR); }
    263253forall                  { KEYWORD_RETURN(FORALL); }                             // CFA
  • src/Parser/module.mk

    r53bb8f1 r9d9a451  
    3131       Parser/parserutility.cc
    3232
    33 SRCDEMANGLE += \
    34         Parser/LinkageSpec.cc
    35 
    36 
    37 MOSTLYCLEANFILES += Parser/lex.cc Parser/parser.cc Parser/parser.hh Parser/parser.output
     33MOSTLYCLEANFILES += Parser/parser.hh Parser/parser.output
  • src/Parser/parser.yy

    r53bb8f1 r9d9a451  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 21 08:45:07 2019
    13 // Update Count     : 4232
     12// Last Modified On : Thu Nov  8 18:08:23 2018
     13// Update Count     : 4052
    1414//
    1515
     
    9999        // distribute declaration_specifier across all declared variables, e.g., static, const, __attribute__.
    100100        DeclarationNode * cur = declList, * cl = (new DeclarationNode)->addType( specifier );
    101         for ( cur = dynamic_cast<DeclarationNode *>( cur->get_next() ); cur != nullptr; cur = dynamic_cast<DeclarationNode *>( cur->get_next() ) ) {
     101        //cur->addType( specifier );
     102        for ( cur = dynamic_cast< DeclarationNode * >( cur->get_next() ); cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ) ) {
    102103                cl->cloneBaseType( cur );
    103104        } // for
    104105        declList->addType( cl );
     106//      delete cl;
    105107        return declList;
    106108} // distAttr
     
    191193        return new ForCtrl(
    192194                distAttr( DeclarationNode::newTypeof( type, true ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ),
    193                 // NULL comp/inc => leave blank
    194                 comp ? new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ) : 0,
    195                 inc ? new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto
    196                                                         OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) : 0 );
     195                new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ),
     196                new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto
     197                                                                                          OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) );
    197198} // forCtrl
    198199
     
    200201        if ( NameExpr * identifier = dynamic_cast<NameExpr *>(index->get_expr()) ) {
    201202                return forCtrl( type, new string( identifier->name ), start, compop, comp, inc );
    202         } else if ( CommaExpr * commaExpr = dynamic_cast<CommaExpr *>(index->get_expr()) ) {
    203                 if ( NameExpr * identifier = dynamic_cast<NameExpr *>(commaExpr->arg1 ) ) {
    204                         return forCtrl( type, new string( identifier->name ), start, compop, comp, inc );
    205                 } else {
    206                         SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); return nullptr;
    207                 } // if
    208203        } else {
    209204                SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); return nullptr;
     
    268263%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
    269264%token BOOL COMPLEX IMAGINARY                                                   // C99
    270 %token INT128 uuFLOAT80 uuFLOAT128                                              // GCC
    271 %token uFLOAT16 uFLOAT32 uFLOAT32X uFLOAT64 uFLOAT64X uFLOAT128 // GCC
     265%token INT128 FLOAT80 FLOAT128                                                  // GCC
    272266%token ZERO_T ONE_T                                                                             // CFA
    273267%token VALIST                                                                                   // GCC
     
    330324%type<en> argument_expression_list              argument_expression                     default_initialize_opt
    331325%type<ifctl> if_control_expression
    332 %type<fctl> for_control_expression              for_control_expression_list
     326%type<fctl> for_control_expression
    333327%type<compop> inclexcl
    334328%type<en> subrange
     
    990984                // labels cannot be identifiers 0 or 1 or ATTR_IDENTIFIER
    991985        identifier_or_type_name ':' attribute_list_opt statement
    992                 { $$ = $4->add_label( $1, $3 ); }
     986                {
     987                        $$ = $4->add_label( $1, $3 );
     988                }
    993989        ;
    994990
     
    10061002        statement_decl
    10071003        | statement_decl_list statement_decl
    1008                 { assert( $1 ); $1->set_last( $2 ); $$ = $1; }
     1004                { if ( $1 != 0 ) { $1->set_last( $2 ); $$ = $1; } }
    10091005        ;
    10101006
     
    10131009                { $$ = new StatementNode( $1 ); }
    10141010        | EXTENSION declaration                                                         // GCC
    1015                 { distExt( $2 ); $$ = new StatementNode( $2 ); }
     1011                {
     1012                        distExt( $2 );
     1013                        $$ = new StatementNode( $2 );
     1014                }
    10161015        | function_definition
    10171016                { $$ = new StatementNode( $1 ); }
    10181017        | EXTENSION function_definition                                         // GCC
    1019                 { distExt( $2 ); $$ = new StatementNode( $2 ); }
     1018                {
     1019                        distExt( $2 );
     1020                        $$ = new StatementNode( $2 );
     1021                }
    10201022        | statement
    10211023        ;
     
    10241026        statement
    10251027        | statement_list_nodecl statement
    1026                 { assert( $1 ); $1->set_last( $2 ); $$ = $1; }
     1028                { if ( $1 != 0 ) { $1->set_last( $2 ); $$ = $1; } }
    10271029        ;
    10281030
     
    11361138        | DO statement WHILE '(' ')' ';'                                        // CFA => do while( 1 )
    11371139                { $$ = new StatementNode( build_do_while( new ExpressionNode( build_constantInteger( *new string( "1" ) ) ), $2 ) ); }
    1138         | FOR '(' push for_control_expression_list ')' statement pop
     1140        | FOR '(' push for_control_expression ')' statement pop
    11391141                { $$ = new StatementNode( build_for( $4, $6 ) ); }
    11401142        | FOR '(' ')' statement                                                         // CFA => for ( ;; )
     
    11421144        ;
    11431145
    1144 for_control_expression_list:
    1145         for_control_expression
    1146         | for_control_expression_list ':' for_control_expression
    1147                 { $$ = $3; }
    1148         ;
    1149 
    11501146for_control_expression:
    1151         ';' comma_expression_opt ';' comma_expression_opt
    1152                 { $$ = new ForCtrl( (ExpressionNode * )nullptr, $2, $4 ); }
    1153         | comma_expression ';' comma_expression_opt ';' comma_expression_opt
    1154                 { $$ = new ForCtrl( $1, $3, $5 ); }
    1155         | declaration comma_expression_opt ';' comma_expression_opt // C99, declaration has ';'
    1156                 { $$ = new ForCtrl( $1, $2, $4 ); }
    1157         | comma_expression                                                                      // CFA
     1147        comma_expression                                                                        // CFA
    11581148                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    11591149                                                OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1160         | comma_expression inclexcl comma_expression            // CFA
     1150        | constant_expression inclexcl constant_expression      // CFA
    11611151                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1162         | comma_expression inclexcl comma_expression '~' comma_expression // CFA
     1152        | constant_expression inclexcl constant_expression '~' constant_expression // CFA
    11631153                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); }
    11641154        | comma_expression ';' comma_expression                         // CFA
    11651155                { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    11661156                                                OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1167         | comma_expression ';' comma_expression inclexcl comma_expression // CFA
     1157        | comma_expression ';' constant_expression inclexcl constant_expression // CFA
    11681158                { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1169         | comma_expression ';' comma_expression inclexcl comma_expression '~' comma_expression // CFA
     1159        | comma_expression ';' constant_expression inclexcl constant_expression '~' constant_expression // CFA
    11701160                { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, $7 ); }
    1171         | comma_expression ';' comma_expression '~' '@' '~' comma_expression // CFA
    1172                 { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, $7 ); }
    1173         | comma_expression ';' comma_expression ErangeDown '@' '~' comma_expression // CFA
    1174                 { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::GThan, nullptr, $7 ); }
    1175         | comma_expression ';' comma_expression '~' '@' '~' '@' // CFA
    1176                 { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, nullptr ); }
     1161        | comma_expression ';' comma_expression_opt ';' comma_expression_opt
     1162                { $$ = new ForCtrl( $1, $3, $5 ); }
     1163        | ';' comma_expression_opt ';' comma_expression_opt
     1164                { $$ = new ForCtrl( (ExpressionNode * )nullptr, $2, $4 ); }
     1165        | declaration comma_expression_opt ';' comma_expression_opt // C99, declaration has ';'
     1166                { $$ = new ForCtrl( $1, $2, $4 ); }
    11771167        ;
    11781168
     
    17811771        | FLOAT
    17821772                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float ); }
     1773        | FLOAT80
     1774                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float80 ); }
     1775        | FLOAT128
     1776                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float128 ); }
    17831777        | DOUBLE
    17841778                { $$ = DeclarationNode::newBasicType( DeclarationNode::Double ); }
    1785         | uuFLOAT80
    1786                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uuFloat80 ); }
    1787         | uuFLOAT128
    1788                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uuFloat128 ); }
    1789         | uFLOAT16
    1790                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat16 ); }
    1791         | uFLOAT32
    1792                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat32 ); }
    1793         | uFLOAT32X
    1794                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat32x ); }
    1795         | uFLOAT64
    1796                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat64 ); }
    1797         | uFLOAT64X
    1798                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat64x ); }
    1799         | uFLOAT128
    1800                 { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat128 ); }
    18011779        | COMPLEX                                                                                       // C99
    18021780                { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
  • src/ResolvExpr/AlternativeFinder.cc

    r53bb8f1 r9d9a451  
    474474                }
    475475
    476                 // specialization cost of return types can't be accounted for directly, it disables
    477                 // otherwise-identical calls, like this example based on auto-newline in the I/O lib:
    478                 //
    479                 //   forall(otype OS) {
    480                 //     void ?|?(OS&, int);  // with newline
    481                 //     OS&  ?|?(OS&, int);  // no newline, always chosen due to more specialization
    482                 //   }
     476                // mark specialization cost of return types
     477                for ( DeclarationWithType* returnVal : function->returnVals ) {
     478                        convCost.decSpec( specCost( returnVal->get_type() ) );
     479                }
    483480
    484481                // mark type variable and specialization cost of forall clause
     
    486483                for ( TypeDecl* td : function->forall ) {
    487484                        convCost.decSpec( td->assertions.size() );
     485                }
     486
     487                // xxx -- replace with new costs in resolver
     488                for ( InferredParams::const_iterator assert = appExpr->inferParams.begin(); assert != appExpr->inferParams.end(); ++assert ) {
     489                        convCost += computeConversionCost( assert->second.actualType, assert->second.formalType, indexer, alt.env );
    488490                }
    489491
     
    12271229                                Alternative newAlt{
    12281230                                        restructureCast( alt.expr->clone(), toType, castExpr->isGenerated ),
    1229                                         alt.env, openVars, needAssertions, alt.cost, alt.cost + thisCost };
     1231                                        alt.env, openVars, needAssertions, alt.cost + thisCost, thisCost };
    12301232                                inferParameters( newAlt, back_inserter( candidates ) );
    12311233                        } // if
  • src/ResolvExpr/CommonType.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Sun May 17 06:59:27 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 14 17:10:10 2019
    13 // Update Count     : 24
     12// Last Modified On : Mon Sep 25 15:18:17 2017
     13// Update Count     : 9
    1414//
    1515
     
    176176        }
    177177
    178         // GENERATED START, DO NOT EDIT
    179         // GENERATED BY BasicTypes-gen.cc
    180         #define BT BasicType::
    181         static const BasicType::Kind commonTypes[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // nearest common ancestor
    182                 /*                                      B                       C                      SC                      UC                      SI                     SUI
    183                                                         I                      UI                      LI                     LUI                     LLI                    LLUI
    184                                                        IB                     UIB                     _FH                     _FH                      _F                     _FC
    185                                                         F                      FC                     _FX                    _FXC                      FD                    _FDC
    186                                                         D                      DC                    F80X                   _FDXC                     F80                     _FB
    187                                                     _FLDC                      FB                      LD                     LDC                    _FBX                  _FLDXC
    188                                  */
    189                                   {
    190                 /*     B*/                BT Bool,                BT Char,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
    191                                              BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    192                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    193                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    194                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    195                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    196                                   },
    197                                   {
    198                 /*     C*/                BT Char,                BT Char,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
    199                                              BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    200                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    201                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    202                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    203                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    204                                   },
    205                                   {
    206                 /*    SC*/          BT SignedChar,          BT SignedChar,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
    207                                              BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    208                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    209                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    210                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    211                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    212                                   },
    213                                   {
    214                 /*    UC*/        BT UnsignedChar,        BT UnsignedChar,        BT UnsignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
    215                                              BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    216                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    217                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    218                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    219                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    220                                   },
    221                                   {
    222                 /*    SI*/      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,    BT ShortUnsignedInt,
    223                                              BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    224                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    225                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    226                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    227                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    228                                   },
    229                                   {
    230                 /*   SUI*/    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,
    231                                              BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    232                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    233                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    234                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    235                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    236                                   },
    237                                   {
    238                 /*     I*/           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,
    239                                              BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    240                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    241                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    242                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    243                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    244                                   },
    245                                   {
    246                 /*    UI*/         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,
    247                                            BT UnsignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    248                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    249                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    250                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    251                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    252                                   },
    253                                   {
    254                 /*    LI*/       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,
    255                                          BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    256                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    257                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    258                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    259                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    260                                   },
    261                                   {
    262                 /*   LUI*/     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,
    263                                        BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    264                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    265                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    266                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    267                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    268                                   },
    269                                   {
    270                 /*   LLI*/   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,
    271                                      BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
    272                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    273                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    274                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    275                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    276                                   },
    277                                   {
    278                 /*  LLUI*/ BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt,
    279                                    BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt,
    280                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    281                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    282                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    283                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    284                                   },
    285                                   {
    286                 /*    IB*/        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,
    287                                           BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,
    288                                           BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    289                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    290                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    291                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    292                                   },
    293                                   {
    294                 /*   UIB*/      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,
    295                                         BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,
    296                                         BT UnsignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    297                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    298                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    299                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    300                                   },
    301                                   {
    302                 /*   _FH*/            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,
    303                                               BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,
    304                                               BT uFloat16,            BT uFloat16,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
    305                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    306                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    307                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    308                                   },
    309                                   {
    310                 /*   _FH*/     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,
    311                                        BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,
    312                                        BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat32Complex,     BT uFloat32Complex,
    313                                           BT FloatComplex,        BT FloatComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,     BT uFloat64Complex,     BT uFloat64Complex,
    314                                          BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
    315                                       BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    316                                   },
    317                                   {
    318                 /*    _F*/            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,
    319                                               BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,
    320                                               BT uFloat32,            BT uFloat32,            BT uFloat32,     BT uFloat32Complex,            BT uFloat32,     BT uFloat32Complex,
    321                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    322                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    323                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    324                                   },
    325                                   {
    326                 /*   _FC*/     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,
    327                                        BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,
    328                                        BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,
    329                                           BT FloatComplex,        BT FloatComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,     BT uFloat64Complex,     BT uFloat64Complex,
    330                                          BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
    331                                       BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    332                                   },
    333                                   {
    334                 /*     F*/               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,
    335                                                  BT Float,               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,
    336                                                  BT Float,               BT Float,               BT Float,        BT FloatComplex,               BT Float,        BT FloatComplex,
    337                                                  BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    338                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    339                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    340                                   },
    341                                   {
    342                 /*    FC*/        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,
    343                                           BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,
    344                                           BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,
    345                                           BT FloatComplex,        BT FloatComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,     BT uFloat64Complex,     BT uFloat64Complex,
    346                                          BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
    347                                       BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    348                                   },
    349                                   {
    350                 /*   _FX*/           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,
    351                                              BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,
    352                                              BT uFloat32x,           BT uFloat32x,           BT uFloat32x,    BT uFloat32xComplex,           BT uFloat32x,    BT uFloat32xComplex,
    353                                              BT uFloat32x,    BT uFloat32xComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
    354                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    355                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    356                                   },
    357                                   {
    358                 /*  _FXC*/    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,
    359                                       BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,
    360                                       BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,
    361                                       BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,     BT uFloat64Complex,     BT uFloat64Complex,
    362                                          BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
    363                                       BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    364                                   },
    365                                   {
    366                 /*    FD*/            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,
    367                                               BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,
    368                                               BT uFloat64,            BT uFloat64,            BT uFloat64,     BT uFloat64Complex,            BT uFloat64,     BT uFloat64Complex,
    369                                               BT uFloat64,     BT uFloat64Complex,            BT uFloat64,     BT uFloat64Complex,            BT uFloat64,     BT uFloat64Complex,
    370                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    371                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    372                                   },
    373                                   {
    374                 /*  _FDC*/     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
    375                                        BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
    376                                        BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
    377                                        BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
    378                                          BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
    379                                       BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    380                                   },
    381                                   {
    382                 /*     D*/              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,
    383                                                 BT Double,              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,
    384                                                 BT Double,              BT Double,              BT Double,       BT DoubleComplex,              BT Double,       BT DoubleComplex,
    385                                                 BT Double,       BT DoubleComplex,              BT Double,       BT DoubleComplex,              BT Double,       BT DoubleComplex,
    386                                                 BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    387                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    388                                   },
    389                                   {
    390                 /*    DC*/       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
    391                                          BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
    392                                          BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
    393                                          BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
    394                                          BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
    395                                       BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    396                                   },
    397                                   {
    398                 /*  F80X*/           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,
    399                                              BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,
    400                                              BT uFloat64x,           BT uFloat64x,           BT uFloat64x,    BT uFloat64xComplex,           BT uFloat64x,    BT uFloat64xComplex,
    401                                              BT uFloat64x,    BT uFloat64xComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uFloat64x,    BT uFloat64xComplex,
    402                                              BT uFloat64x,    BT uFloat64xComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    403                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    404                                   },
    405                                   {
    406                 /* _FDXC*/    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
    407                                       BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
    408                                       BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
    409                                       BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
    410                                       BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
    411                                       BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    412                                   },
    413                                   {
    414                 /*   F80*/           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,
    415                                              BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,
    416                                              BT uuFloat80,           BT uuFloat80,           BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,    BT uFloat64xComplex,
    417                                              BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,    BT uFloat64xComplex,
    418                                              BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
    419                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    420                                   },
    421                                   {
    422                 /*   _FB*/           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,
    423                                              BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,
    424                                              BT uFloat128,           BT uFloat128,           BT uFloat128,    BT uFloat128Complex,           BT uFloat128,    BT uFloat128Complex,
    425                                              BT uFloat128,    BT uFloat128Complex,           BT uFloat128,    BT uFloat128Complex,           BT uFloat128,    BT uFloat128Complex,
    426                                              BT uFloat128,    BT uFloat128Complex,           BT uFloat128,    BT uFloat128Complex,           BT uFloat128,           BT uFloat128,
    427                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    428                                   },
    429                                   {
    430                 /* _FLDC*/    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
    431                                       BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
    432                                       BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
    433                                       BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
    434                                       BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
    435                                       BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    436                                   },
    437                                   {
    438                 /*    FB*/          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,
    439                                             BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,
    440                                             BT uuFloat128,          BT uuFloat128,          BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,    BT uFloat128Complex,
    441                                             BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,    BT uFloat128Complex,
    442                                             BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,          BT uuFloat128,
    443                                       BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    444                                   },
    445                                   {
    446                 /*    LD*/          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,
    447                                             BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,
    448                                             BT LongDouble,          BT LongDouble,          BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,   BT LongDoubleComplex,
    449                                             BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,   BT LongDoubleComplex,
    450                                             BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,          BT LongDouble,
    451                                      BT LongDoubleComplex,          BT LongDouble,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
    452                                   },
    453                                   {
    454                 /*   LDC*/   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
    455                                      BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
    456                                      BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
    457                                      BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
    458                                      BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
    459                                      BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    460                                   },
    461                                   {
    462                 /*  _FBX*/          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,
    463                                             BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,
    464                                             BT uFloat128x,          BT uFloat128x,          BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,
    465                                             BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,
    466                                             BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,          BT uFloat128x,
    467                                      BT uFloat128xComplex,          BT uFloat128x,          BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,
    468                                   },
    469                                   {
    470                 /*_FLDXC*/   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    471                                      BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    472                                      BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    473                                      BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    474                                      BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    475                                      BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
    476                                   },
    477         }; // commonTypes
    478         #undef BT
    479         // GENERATED END
     178        static const BasicType::Kind combinedType[][ BasicType::NUMBER_OF_BASIC_TYPES ] =
     179        {
     180/*              Bool            Char    SignedChar      UnsignedChar    ShortSignedInt  ShortUnsignedInt        SignedInt       UnsignedInt     LongSignedInt   LongUnsignedInt LongLongSignedInt       LongLongUnsignedInt     Float   Double  LongDouble      FloatComplex    DoubleComplex   LongDoubleComplex       FloatImaginary  DoubleImaginary LongDoubleImaginary   SignedInt128   UnsignedInt128   Float80   Float128 */
     181                /* Bool */      { BasicType::Bool,              BasicType::Char,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     182                /* Char */      { BasicType::Char,              BasicType::Char,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     183                /* SignedChar */        { BasicType::SignedChar,        BasicType::UnsignedChar,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     184                /* UnsignedChar */      { BasicType::UnsignedChar,      BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     185                /* ShortSignedInt */    { BasicType::ShortSignedInt,    BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     186                /* ShortUnsignedInt */  { BasicType::ShortUnsignedInt,  BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     187                /* SignedInt */         { BasicType::SignedInt,         BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     188                /* UnsignedInt */       { BasicType::UnsignedInt,               BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     189                /* LongSignedInt */     { BasicType::LongSignedInt,             BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     190                /* LongUnsignedInt */   { BasicType::LongUnsignedInt,   BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     191                /* LongLongSignedInt */         { BasicType::LongLongSignedInt, BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     192                /* LongLongUnsignedInt */       { BasicType::LongLongUnsignedInt,       BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     193                /* Float */     { BasicType::Float,     BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Float,       BasicType::Float, BasicType::Float80, BasicType::Float128 },
     194                /* Double */    { BasicType::Double,    BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::LongDouble,  BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Double,      BasicType::Double, BasicType::Float80, BasicType::Float128 },
     195                /* LongDouble */        { BasicType::LongDouble,                BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDouble,  BasicType::LongDouble, BasicType::BasicType::LongDouble, BasicType::Float128 },
     196                /* FloatComplex */      { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::FloatComplex, BasicType::LongDoubleComplex, BasicType::LongDoubleComplex, },
     197                /* DoubleComplex */     { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex, BasicType::LongDoubleComplex, BasicType::LongDoubleComplex },
     198                /* LongDoubleComplex */         { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex, BasicType::LongDoubleComplex, BasicType::LongDoubleComplex, },
     199                /* FloatImaginary */    { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatImaginary,      BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::FloatImaginary,      BasicType::FloatImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, },
     200                /* DoubleImaginary */   { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleImaginary,     BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::DoubleImaginary,     BasicType::DoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, },
     201                /* LongDoubleImaginary */       { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, },
     202                /* SignedInt128 */      { BasicType::SignedInt128,      BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128, },
     203                /* UnsignedInt128 */    { BasicType::UnsignedInt128,    BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::UnsignedInt128,      BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128, },
     204                /* Float80 */   { BasicType::Float80,   BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::Float80,     BasicType::Float80, BasicType::Float80, BasicType::Float128 },
     205                /* Float128 */  { BasicType::Float128,  BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::Float128,    BasicType::Float128, BasicType::Float128, BasicType::Float128 },
     206        };
    480207        static_assert(
    481                 sizeof(commonTypes)/sizeof(commonTypes[0][0]) == BasicType::NUMBER_OF_BASIC_TYPES*BasicType::NUMBER_OF_BASIC_TYPES,
     208                sizeof(combinedType)/sizeof(combinedType[0][0]) == BasicType::NUMBER_OF_BASIC_TYPES*BasicType::NUMBER_OF_BASIC_TYPES,
    482209                "Each basic type kind should have a corresponding row in the combined type matrix"
    483210        );
     
    491218        void CommonType::postvisit( BasicType *basicType ) {
    492219                if ( BasicType *otherBasic = dynamic_cast< BasicType* >( type2 ) ) {
    493                         BasicType::Kind newType = commonTypes[ basicType->get_kind() ][ otherBasic->get_kind() ];
     220                        BasicType::Kind newType = combinedType[ basicType->get_kind() ][ otherBasic->get_kind() ];
    494221                        if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= otherBasic->get_qualifiers() ) || widenFirst ) && ( ( newType == otherBasic->get_kind() && basicType->get_qualifiers() <= otherBasic->get_qualifiers() ) || widenSecond ) ) {
    495222                                result = new BasicType( basicType->get_qualifiers() | otherBasic->get_qualifiers(), newType );
     
    497224                } else if ( dynamic_cast< EnumInstType * > ( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) {
    498225                        // use signed int in lieu of the enum/zero/one type
    499                         BasicType::Kind newType = commonTypes[ basicType->get_kind() ][ BasicType::SignedInt ];
     226                        BasicType::Kind newType = combinedType[ basicType->get_kind() ][ BasicType::SignedInt ];
    500227                        if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= type2->get_qualifiers() ) || widenFirst ) && ( ( newType != basicType->get_kind() && basicType->get_qualifiers() <= type2->get_qualifiers() ) || widenSecond ) ) {
    501228                                result = new BasicType( basicType->get_qualifiers() | type2->get_qualifiers(), newType );
  • src/ResolvExpr/ConversionCost.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Sun May 17 07:06:19 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 14 17:04:31 2019
    13 // Update Count     : 23
     12// Last Modified On : Mon Sep 25 15:43:34 2017
     13// Update Count     : 10
    1414//
    1515
     
    2828
    2929namespace ResolvExpr {
    30         const Cost Cost::zero =      Cost{  0,  0,  0,  0,  0,  0,  0 };
    31         const Cost Cost::infinity =  Cost{ -1, -1, -1, -1, -1,  1, -1 };
    32         const Cost Cost::unsafe =    Cost{  1,  0,  0,  0,  0,  0,  0 };
    33         const Cost Cost::poly =      Cost{  0,  1,  0,  0,  0,  0,  0 };
    34         const Cost Cost::safe =      Cost{  0,  0,  1,  0,  0,  0,  0 };
    35         const Cost Cost::sign =      Cost{  0,  0,  0,  1,  0,  0,  0 };
    36         const Cost Cost::var =       Cost{  0,  0,  0,  0,  1,  0,  0 };
    37         const Cost Cost::spec =      Cost{  0,  0,  0,  0,  0, -1,  0 };
    38         const Cost Cost::reference = Cost{  0,  0,  0,  0,  0,  0,  1 };
     30        const Cost Cost::zero =      Cost{  0,  0,  0,  0,  0,  0 };
     31        const Cost Cost::infinity =  Cost{ -1, -1, -1, -1,  1, -1 };
     32        const Cost Cost::unsafe =    Cost{  1,  0,  0,  0,  0,  0 };
     33        const Cost Cost::poly =      Cost{  0,  1,  0,  0,  0,  0 };
     34        const Cost Cost::safe =      Cost{  0,  0,  1,  0,  0,  0 };
     35        const Cost Cost::var =       Cost{  0,  0,  0,  1,  0,  0 };
     36        const Cost Cost::spec =      Cost{  0,  0,  0,  0, -1,  0 };
     37        const Cost Cost::reference = Cost{  0,  0,  0,  0,  0,  1 };
    3938
    4039#if 0
     
    4342#define PRINT(x)
    4443#endif
    45 
    4644        Cost conversionCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
    4745                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
     
    181179        }
    182180
    183         // GENERATED START, DO NOT EDIT
    184         // GENERATED BY BasicTypes-gen.cc
    185         /* EXTENDED INTEGRAL RANK HIERARCHY (root to leaves)
    186                                  _Bool
    187         char                signed char         unsigned char       
    188                   signed short int         unsigned short int       
    189                   signed int               unsigned int             
    190                   signed long int          unsigned long int       
    191                   signed long long int     unsigned long long int   
    192                   __int128                 unsigned __int128       
    193                   _Float16                 _Float16 _Complex       
    194                   _Float32                 _Float32 _Complex       
    195                   float                    float _Complex           
    196                   _Float32x                _Float32x _Complex       
    197                   _Float64                 _Float64 _Complex       
    198                   double                   double _Complex         
    199                   _Float64x                _Float64x _Complex       
    200                              __float80
    201                   _Float128                _Float128 _Complex       
    202                             __float128
    203                   long double              long double _Complex     
    204                   _Float128x               _Float128x _Complex     
    205         */
    206         // GENERATED END
    207 
    208         // GENERATED START, DO NOT EDIT
    209         // GENERATED BY BasicTypes-gen.cc
    210         static const int costMatrix[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // path length from root to node
    211                 /*             B    C   SC   UC   SI  SUI    I   UI   LI  LUI  LLI LLUI   IB  UIB  _FH  _FH   _F  _FC    F   FC  _FX _FXC   FD _FDC    D   DC F80X_FDXC  F80  _FB_FLDC   FB   LD  LDC _FBX_FLDXC */
    212                 /*     B*/ {   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  14,  15,  15,  16,  17,  16,  18,  17, },
    213                 /*     C*/ {  -1,   0,   1,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  14,  15,  16,  15,  17,  16, },
    214                 /*    SC*/ {  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  14,  15,  16,  15,  17,  16, },
    215                 /*    UC*/ {  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  14,  15,  16,  15,  17,  16, },
    216                 /*    SI*/ {  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  15,  14,  16,  15, },
    217                 /*   SUI*/ {  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  15,  14,  16,  15, },
    218                 /*     I*/ {  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  14,  13,  15,  14, },
    219                 /*    UI*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  14,  13,  15,  14, },
    220                 /*    LI*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  13,  12,  14,  13, },
    221                 /*   LUI*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  11,  12,  13,  12,  14,  13, },
    222                 /*   LLI*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  12,  11,  13,  12, },
    223                 /*  LLUI*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,  12,  11,  13,  12, },
    224                 /*    IB*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  11,  10,  12,  11, },
    225                 /*   UIB*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  11,  10,  12,  11, },
    226                 /*   _FH*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   8,   9,  10,   9,  11,  10, },
    227                 /*   _FH*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,   2,  -1,   3,  -1,   4,  -1,   5,  -1,   6,  -1,  -1,   7,  -1,  -1,   8,  -1,   9, },
    228                 /*    _F*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,   9,   8,  10,   9, },
    229                 /*   _FC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,   2,  -1,   3,  -1,   4,  -1,   5,  -1,  -1,   6,  -1,  -1,   7,  -1,   8, },
    230                 /*     F*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   8,   7,   9,   8, },
    231                 /*    FC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,   2,  -1,   3,  -1,   4,  -1,  -1,   5,  -1,  -1,   6,  -1,   7, },
    232                 /*   _FX*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   7,   6,   8,   7, },
    233                 /*  _FXC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,   2,  -1,   3,  -1,  -1,   4,  -1,  -1,   5,  -1,   6, },
    234                 /*    FD*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   6,   5,   7,   6, },
    235                 /*  _FDC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,   2,  -1,  -1,   3,  -1,  -1,   4,  -1,   5, },
    236                 /*     D*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3,   4,   5,   4,   6,   5, },
    237                 /*    DC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1,  -1,  -1,   2,  -1,  -1,   3,  -1,   4, },
    238                 /*  F80X*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   4,   3,   5,   4, },
    239                 /* _FDXC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,  -1,   1,  -1,  -1,   2,  -1,   3, },
    240                 /*   F80*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   1,   0,   1,   2,   2,   3,   3,   4,   4, },
    241                 /*   _FB*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2,   2,   3,   3, },
    242                 /* _FLDC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,  -1,   1,  -1,   2, },
    243                 /*    FB*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   1,   0,   1,   2,   2,   3, },
    244                 /*    LD*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   1,   2, },
    245                 /*   LDC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   1, },
    246                 /*  _FBX*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1, },
    247                 /*_FLDXC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0, },
    248         }; // costMatrix
    249         // GENERATED END
     181/*
     182            Old
     183            ===
     184           Double
     185             |
     186           Float
     187             |
     188           ULong
     189           /   \
     190        UInt    Long
     191           \   /
     192            Int
     193             |
     194           Ushort
     195             |
     196           Short
     197             |
     198           Uchar
     199           /   \
     200        Schar   Char
     201
     202                                New
     203                                ===
     204                       +-----LongDoubleComplex--+
     205           LongDouble--+          |             +-LongDoubleImag
     206             |         +---DoubleComplex---+         |
     207           Double------+        |          +----DoubleImag
     208             |           +-FloatComplex-+            |
     209           Float---------+              +-------FloatImag
     210             |
     211          ULongLong
     212             |
     213          LongLong
     214             |
     215           ULong
     216           /   \
     217        UInt    Long
     218           \   /
     219            Int
     220             |
     221           Ushort
     222             |
     223           Short
     224             |
     225           Uchar
     226           /   \
     227        Schar   Char
     228           \   /
     229            Bool
     230*/
     231
     232        static const int costMatrix[][ BasicType::NUMBER_OF_BASIC_TYPES ] = {
     233        /* Src \ Dest:  Bool    Char    SChar   UChar   Short   UShort  Int     UInt    Long    ULong   LLong   ULLong  Float   Double  LDbl    FCplex  DCplex  LDCplex FImag   DImag   LDImag  I128,   U128, F80, F128 */
     234                /* Bool */      { 0,    1,              1,              2,              3,              4,              5,              6,              6,              7,              8,              9,              12,             13,             14,             12,             13,             14,             -1,             -1,             -1,             10,             11,       14,   15},
     235                /* Char */      { -1,   0,              -1,             1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,       13,   14},
     236                /* SChar */ { -1,       -1,             0,              1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,       13,   14},
     237                /* UChar */ { -1,       -1,             -1,             0,              1,              2,              3,              4,              4,              5,              6,              7,              10,             11,             12,             10,             11,             12,             -1,             -1,             -1,             8,              9,        12,   13},
     238                /* Short */ { -1,       -1,             -1,             -1,             0,              1,              2,              3,              3,              4,              5,              6,              9,              10,             11,             9,              10,             11,             -1,             -1,             -1,             7,              8,        11,   12},
     239                /* UShort */{ -1,       -1,             -1,             -1,             -1,             0,              1,              2,              2,              3,              4,              5,              8,              9,              10,             8,              9,              10,             -1,             -1,             -1,             6,              7,        10,   11},
     240                /* Int */       { -1,   -1,             -1,             -1,             -1,             -1,             0,              1,              1,              2,              3,              4,              7,              8,              9,              7,              8,              9,              -1,             -1,             -1,             5,              6,        9,    10},
     241                /* UInt */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,        8,    9},
     242                /* Long */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,        8,    9},
     243                /* ULong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              5,              6,              7,              5,              6,              7,              -1,             -1,             -1,             3,              4,        7,    8},
     244                /* LLong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              4,              5,              6,              4,              5,              6,              -1,             -1,             -1,             2,              3,        6,    7},
     245                /* ULLong */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              3,              4,              5,              3,              4,              5,              -1,             -1,             -1,             1,              2,        5,    6},
     246
     247                /* Float */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              1,              2,              3,              -1,             -1,             -1,             -1,             -1,       2,    3},
     248                /* Double */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             1,              2,              -1,             -1,             -1,             -1,             -1,       1,    2},
     249                /* LDbl */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             1,              -1,             -1,             -1,             -1,             -1,       -1,   1},
     250                /* FCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              -1,             -1,             -1,             -1,             -1,       -1,   -1},
     251                /* DCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             -1,             -1,             -1,             -1,       -1,   -1},
     252                /* LDCplex */{ -1,      -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             -1,             -1,             -1,       -1,   -1},
     253                /* FImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              0,              1,              2,              -1,             -1,       -1,   -1},
     254                /* DImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              -1,             0,              1,              -1,             -1,       -1,   -1},
     255                /* LDImag */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             0,              -1,             -1,       -1,   -1},
     256
     257                /* I128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             2,              3,              4,              3,              4,              5,              -1,             -1,             -1,             0,              1,        4,    4},
     258                /* U128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              2,              3,              4,              -1,             -1,             -1,             -1,             0,        3,    3},
     259
     260                /* F80 */       { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             1,              -1,             -1,             -1,             -1,             -1,       0,    1},
     261                /* F128 */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             -1,             -1,             -1,       -1,   0},
     262        };
    250263        static_assert(
    251264                sizeof(costMatrix)/sizeof(costMatrix[0][0]) == BasicType::NUMBER_OF_BASIC_TYPES*BasicType::NUMBER_OF_BASIC_TYPES,
    252                 "Missing row in the cost matrix"
     265                "Each basic type kind should have a corresponding row in the cost matrix"
    253266        );
    254267
    255         // GENERATED START, DO NOT EDIT
    256         // GENERATED BY BasicTypes-gen.cc
    257         static const int signMatrix[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // number of sign changes in safe conversion
    258                 /*             B    C   SC   UC   SI  SUI    I   UI   LI  LUI  LLI LLUI   IB  UIB  _FH  _FH   _F  _FC    F   FC  _FX _FXC   FD _FDC    D   DC F80X_FDXC  F80  _FB_FLDC   FB   LD  LDC _FBX_FLDXC */
    259                 /*     B*/ {   0,   0,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    260                 /*     C*/ {  -1,   0,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    261                 /*    SC*/ {  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    262                 /*    UC*/ {  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    263                 /*    SI*/ {  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    264                 /*   SUI*/ {  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    265                 /*     I*/ {  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    266                 /*    UI*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    267                 /*    LI*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    268                 /*   LUI*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    269                 /*   LLI*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    270                 /*  LLUI*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    271                 /*    IB*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    272                 /*   UIB*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    273                 /*   _FH*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    274                 /*   _FH*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    275                 /*    _F*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    276                 /*   _FC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    277                 /*     F*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    278                 /*    FC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    279                 /*   _FX*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    280                 /*  _FXC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    281                 /*    FD*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    282                 /*  _FDC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    283                 /*     D*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    284                 /*    DC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    285                 /*  F80X*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    286                 /* _FDXC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    287                 /*   F80*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0,   0,   0, },
    288                 /*   _FB*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0,   0, },
    289                 /* _FLDC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,  -1,   0,  -1,   0, },
    290                 /*    FB*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0,   0,   0, },
    291                 /*    LD*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0,   0,   0, },
    292                 /*   LDC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,  -1,   0, },
    293                 /*  _FBX*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0,   0, },
    294                 /*_FLDXC*/ {  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   0, },
    295         }; // signMatrix
    296         // GENERATED END
    297         static_assert(
    298                 sizeof(signMatrix)/sizeof(signMatrix[0][0]) == BasicType::NUMBER_OF_BASIC_TYPES*BasicType::NUMBER_OF_BASIC_TYPES,
    299                 "Missing row in the sign matrix"
    300         );
    301268
    302269        void ConversionCost::postvisit( VoidType * ) {
     
    312279                                cost = Cost::zero;
    313280                                cost.incSafe( tableResult );
    314                                 cost.incSign( signMatrix[ basicType->get_kind() ][ destAsBasic->get_kind() ] );
    315281                        } // if
    316282                } else if ( dynamic_cast< EnumInstType *>( dest ) ) {
     
    334300                                        // types are the same, except otherPointer has more qualifiers
    335301                                        cost = Cost::safe;
    336                                 } // if
     302                                }
    337303                        } else {
    338304                                int assignResult = ptrsAssignable( pointerType->base, destAsPtr->base, env );
     
    456422                                cost = Cost::zero;
    457423                                cost.incSafe( tableResult + 1 );
    458                                 cost.incSign( signMatrix[ BasicType::SignedInt ][ destAsBasic->get_kind() ] );
    459                         } // if
     424                        }
    460425                } else if ( dynamic_cast< PointerType* >( dest ) ) {
    461426                        cost = Cost::safe;
    462                 } // if
     427                }
    463428        }
    464429
     
    474439                                cost = Cost::zero;
    475440                                cost.incSafe( tableResult + 1 );
    476                                 cost.incSign( signMatrix[ BasicType::SignedInt ][ destAsBasic->get_kind() ] );
    477                         } // if
    478                 } // if
     441                        }
     442                }
    479443        }
    480444} // namespace ResolvExpr
  • src/ResolvExpr/Cost.h

    r53bb8f1 r9d9a451  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 09:39:50 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  7 20:54:29 2019
    13 // Update Count     : 8
     11// Last Modified By : Aaron B. Moss
     12// Last Modified On : Fri Oct 05 14:32:00 2018
     13// Update Count     : 7
    1414//
    1515
     
    2121        class Cost {
    2222          private:
    23                 Cost( int unsafeCost, int polyCost, int safeCost, int signCost,
    24                         int varCost, int specCost, int referenceCost );
     23                Cost( int unsafeCost, int polyCost, int safeCost, int varCost, int specCost,
     24                        int referenceCost );
     25
    2526          public:
    2627                Cost & incUnsafe( int inc = 1 );
    2728                Cost & incPoly( int inc = 1 );
    2829                Cost & incSafe( int inc = 1 );
    29                 Cost & incSign( int inc = 1 );
    3030                Cost & incVar( int inc = 1 );
    3131                Cost & decSpec( int inc = 1 );
     
    3535                int get_polyCost() const { return polyCost; }
    3636                int get_safeCost() const { return safeCost; }
    37                 int get_signCost() const { return signCost; }
    3837                int get_varCost() const { return varCost; }
    3938                int get_specCost() const { return specCost; }
     
    4140
    4241                Cost operator+( const Cost &other ) const;
     42                Cost operator-( const Cost &other ) const;
    4343                Cost &operator+=( const Cost &other );
    4444                bool operator<( const Cost &other ) const;
     
    5555                static const Cost poly;
    5656                static const Cost safe;
    57                 static const Cost sign;
    5857                static const Cost var;
    5958                static const Cost spec;
     
    6463                int polyCost;       ///< Count of parameters and return values bound to some poly type
    6564                int safeCost;       ///< Safe (widening) conversions
    66                 int signCost;       ///< Count of safe sign conversions
    6765                int varCost;        ///< Count of polymorphic type variables
    6866                int specCost;       ///< Polymorphic type specializations (type assertions), negative cost
     
    7068        };
    7169
    72         inline Cost::Cost( int unsafeCost, int polyCost, int safeCost, int signCost,
    73                         int varCost, int specCost, int referenceCost )
    74                 : unsafeCost( unsafeCost ), polyCost( polyCost ), safeCost( safeCost ), signCost( signCost ),
    75                   varCost( varCost ), specCost( specCost ), referenceCost( referenceCost ) {}
     70        inline Cost::Cost( int unsafeCost, int polyCost, int safeCost, int varCost, int specCost,
     71                        int referenceCost )
     72                : unsafeCost( unsafeCost ), polyCost( polyCost ), safeCost( safeCost ), varCost( varCost ),
     73                  specCost( specCost ), referenceCost( referenceCost ) {}
    7674
    7775        inline Cost & Cost::incUnsafe( int inc ) {
     
    9088                if ( *this == infinity ) return *this;
    9189                safeCost += inc;
    92                 return *this;
    93         }
    94 
    95         inline Cost & Cost::incSign( int inc ) {
    96                 if ( *this == infinity ) return *this;
    97                 signCost += inc;
    9890                return *this;
    9991        }
     
    119111        inline Cost Cost::operator+( const Cost &other ) const {
    120112                if ( *this == infinity || other == infinity ) return infinity;
    121                 return Cost{
    122                         unsafeCost + other.unsafeCost, polyCost + other.polyCost, safeCost + other.safeCost,
    123                         signCost + other.signCost, varCost + other.varCost, specCost + other.specCost,
     113                return Cost{ 
     114                        unsafeCost + other.unsafeCost, polyCost + other.polyCost, safeCost + other.safeCost, 
     115                        varCost + other.varCost, specCost + other.specCost,
    124116                        referenceCost + other.referenceCost };
     117        }
     118
     119        inline Cost Cost::operator-( const Cost &other ) const {
     120                if ( *this == infinity || other == infinity ) return infinity;
     121                return Cost{
     122                        unsafeCost - other.unsafeCost, polyCost - other.polyCost, safeCost - other.safeCost,
     123                        varCost - other.varCost, specCost - other.specCost,
     124                        referenceCost - other.referenceCost };
    125125        }
    126126
     
    134134                polyCost += other.polyCost;
    135135                safeCost += other.safeCost;
    136                 signCost += other.signCost;
    137136                varCost += other.varCost;
    138137                specCost += other.specCost;
     
    157156                } else if ( safeCost < other.safeCost ) {
    158157                        return true;
    159                 } else if ( signCost > other.signCost ) {
    160                         return false;
    161                 } else if ( signCost < other.signCost ) {
    162                         return true;
    163158                } else if ( varCost > other.varCost ) {
    164159                        return false;
     
    185180                c = polyCost - other.polyCost; if ( c ) return c;
    186181                c = safeCost - other.safeCost; if ( c ) return c;
    187                 c = signCost - other.signCost; if ( c ) return c;
    188182                c = varCost - other.varCost; if ( c ) return c;
    189183                c = specCost - other.specCost; if ( c ) return c;
     
    195189                        && polyCost == other.polyCost
    196190                        && safeCost == other.safeCost
    197                         && signCost == other.signCost
    198191                        && varCost == other.varCost
    199192                        && specCost == other.specCost
     
    206199
    207200        inline std::ostream &operator<<( std::ostream &os, const Cost &cost ) {
    208                 return os << "( " << cost.unsafeCost << ", " << cost.polyCost << ", "
    209                           << cost.safeCost << ", " << cost.signCost << ", "
    210                                   << cost.varCost << ", " << cost.specCost << ", "
     201                return os << "( " << cost.unsafeCost << ", " << cost.polyCost << ", "
     202                          << cost.safeCost << ", " << cost.varCost << ", " << cost.specCost << ", "
    211203                          << cost.referenceCost << " )";
    212204        }
  • src/ResolvExpr/ResolveAssertions.cc

    r53bb8f1 r9d9a451  
    2020#include <list>                     // for list
    2121#include <memory>                   // for unique_ptr
    22 #include <string>
    2322#include <unordered_map>            // for unordered_map, unordered_multimap
    2423#include <utility>                  // for move
     
    5655        using CandidateList = std::vector<AssnCandidate>;
    5756
    58         /// Unique identifier for a yet-to-be-resolved assertion
    59         struct AssnId {
    60                 DeclarationWithType* decl;  ///< Declaration of assertion
    61                 AssertionSetValue info;     ///< Information about assertion
    62 
    63                 AssnId(DeclarationWithType* decl, const AssertionSetValue& info) : decl(decl), info(info) {}
    64         };
    65 
    66         /// Cached assertion items
    67         struct AssnCacheItem {
    68                 CandidateList matches;         ///< Possible matches for this assertion
    69                 std::vector<AssnId> deferIds;  ///< Deferred assertions which resolve to this item
    70 
    71                 AssnCacheItem( CandidateList&& m ) : matches(std::move(m)), deferIds() {}
    72         };
    73 
    74         /// Cache of resolved assertions
    75         using AssnCache = std::unordered_map<std::string, AssnCacheItem>;
    76 
    7757        /// Reference to single deferred item
    7858        struct DeferRef {
    79                 const AssnCacheItem& item;
     59                const DeclarationWithType* decl;
     60                const AssertionSetValue& info;
    8061                const AssnCandidate& match;
    8162        };
     
    8465        /// Acts like indexed list of DeferRef
    8566        struct DeferItem {
    86                 const AssnCache* cache;     ///< Cache storing assertion item
    87                 std::string key;            ///< Key into cache
    88                
    89                 DeferItem( const AssnCache& cache, const std::string& key ) : cache(&cache), key(key) {}
    90 
    91                 bool empty() const { return cache->at(key).matches.empty(); }
    92 
    93                 CandidateList::size_type size() const { return cache->at(key).matches.size(); }
    94 
    95                 DeferRef operator[] ( unsigned i ) const {
    96                         const AssnCacheItem& item = cache->at(key);
    97                         return { item, item.matches[i] };
    98                 }
    99 
    100                 // sortable by key
    101                 // TODO look into optimizing combination process with other sort orders (e.g. by number
    102                 // of matches in candidate)
    103                 bool operator< ( const DeferItem& o ) const { return key < o.key; }
    104                 bool operator== ( const DeferItem& o ) const { return key == o.key; }
     67                DeclarationWithType* decl;
     68                AssertionSetValue info;
     69                CandidateList matches;
     70
     71                DeferItem( DeclarationWithType* decl, const AssertionSetValue& info,
     72                        CandidateList&& matches )
     73                : decl(decl), info(info), matches(std::move(matches)) {}
     74
     75                bool empty() const { return matches.empty(); }
     76
     77                CandidateList::size_type size() const { return matches.size(); }
     78
     79                DeferRef operator[] ( unsigned i ) const { return { decl, info, matches[i] }; }
    10580        };
    10681
     
    177152                                for ( const auto& assn : x.assns ) {
    178153                                        k += computeConversionCost(
    179                                                 assn.match.adjType, assn.item.deferIds[0].decl->get_type(), indexer,
    180                                                 x.env );
     154                                                assn.match.adjType, assn.decl->get_type(), indexer, x.env );
    181155                                }
    182156                                it = cache.emplace_hint( it, &x, k );
     
    234208                                candidate->get_uniqueId(), match.adjType->clone(), decl->get_type()->clone(),
    235209                                varExpr };
     210
     211                // // follow the current assertion's ID chain to find the correct set of inferred parameters
     212                // // to add the candidate o (i.e. the set of inferred parameters belonging to the entity
     213                // // which requested the assertion parameter)
     214                // InferredParams* inferParams = &alt.expr->inferParams;
     215                // for ( UniqueId id : info.idChain ) {
     216                //      inferParams = (*inferParams)[ id ].inferParams.get();
     217                // }
     218
     219                // (*inferParams)[ decl->get_uniqueId() ] = ParamEntry{
     220                //              candidate->get_uniqueId(), match.adjType, decl->get_type()->clone(), varExpr };
    236221        }
    237222
    238223        /// Adds a captured assertion to the symbol table
    239224        void addToIndexer( AssertionSet &assertSet, SymTab::Indexer &indexer ) {
    240                 for ( auto&  i : assertSet ) {
    241                         if ( i.second.isUsed ) {
    242                                 indexer.addId( i.first );
     225                for ( AssertionSet::iterator i = assertSet.begin(); i != assertSet.end(); ++i ) {
     226                        if ( i->second.isUsed ) {
     227                                indexer.addId( i->first );
    243228                        }
    244229                }
     
    249234
    250235        /// Resolve a single assertion, in context
    251         bool resolveAssertion( AssertionItem& assn, ResnState& resn, AssnCache& cache ) {
     236        bool resolveAssertion( AssertionItem& assn, ResnState& resn ) {
    252237                // skip unused assertions
    253238                if ( ! assn.info.isUsed ) return true;
    254239
    255                 // check cache for this assertion
    256                 std::string assnKey = SymTab::Mangler::mangleAssnKey( assn.decl, resn.alt.env );
    257                 auto it = cache.find( assnKey );
    258 
    259                 // attempt to resolve assertion if this is the first time seen
    260                 if ( it == cache.end() ) {
    261                         // lookup candidates for this assertion
    262                         std::list< SymTab::Indexer::IdData > candidates;
    263                         resn.indexer.lookupId( assn.decl->name, candidates );
    264 
    265                         // find the candidates that unify with the desired type
    266                         CandidateList matches;
    267                         for ( const auto& cdata : candidates ) {
    268                                 DeclarationWithType* candidate = cdata.id;
    269 
    270                                 // build independent unification context for candidate
    271                                 AssertionSet have, newNeed;
    272                                 TypeEnvironment newEnv{ resn.alt.env };
    273                                 OpenVarSet newOpenVars{ resn.alt.openVars };
    274                                 Type* adjType = candidate->get_type()->clone();
    275                                 adjustExprType( adjType, newEnv, resn.indexer );
    276                                 renameTyVars( adjType );
    277 
    278                                 // keep unifying candidates
    279                                 if ( unify( assn.decl->get_type(), adjType, newEnv, newNeed, have, newOpenVars,
    280                                                 resn.indexer ) ) {
    281                                         // set up binding slot for recursive assertions
    282                                         UniqueId crntResnSlot = 0;
    283                                         if ( ! newNeed.empty() ) {
    284                                                 crntResnSlot = ++globalResnSlot;
    285                                                 for ( auto& a : newNeed ) {
    286                                                         a.second.resnSlot = crntResnSlot;
    287                                                 }
     240                // lookup candidates for this assertion
     241                std::list< SymTab::Indexer::IdData > candidates;
     242                resn.indexer.lookupId( assn.decl->name, candidates );
     243
     244                // find the candidates that unify with the desired type
     245                CandidateList matches;
     246                for ( const auto& cdata : candidates ) {
     247                        DeclarationWithType* candidate = cdata.id;
     248
     249                        // build independent unification context for candidate
     250                        AssertionSet have, newNeed;
     251                        TypeEnvironment newEnv{ resn.alt.env };
     252                        OpenVarSet newOpenVars{ resn.alt.openVars };
     253                        Type* adjType = candidate->get_type()->clone();
     254                        adjustExprType( adjType, newEnv, resn.indexer );
     255                        renameTyVars( adjType );
     256
     257                        // keep unifying candidates
     258                        if ( unify( assn.decl->get_type(), adjType, newEnv, newNeed, have, newOpenVars,
     259                                        resn.indexer ) ) {
     260                                // set up binding slot for recursive assertions
     261                                UniqueId crntResnSlot = 0;
     262                                if ( ! newNeed.empty() ) {
     263                                        crntResnSlot = ++globalResnSlot;
     264                                        for ( auto& a : newNeed ) {
     265                                                a.second.resnSlot = crntResnSlot;
    288266                                        }
    289 
    290                                         matches.emplace_back( cdata, adjType, std::move(newEnv), std::move(have),
    291                                                 std::move(newNeed), std::move(newOpenVars), crntResnSlot );
    292                                 } else {
    293                                         delete adjType;
    294                                 }
     267                                }
     268                                // // set up idChain on new assertions
     269                                // for ( auto& a : newNeed ) {
     270                                //      a.second.idChain = assn.info.idChain;
     271                                //      a.second.idChain.push_back( assn.decl->get_uniqueId() );
     272                                // }
     273
     274                                matches.emplace_back( cdata, adjType, std::move(newEnv), std::move(have),
     275                                        std::move(newNeed), std::move(newOpenVars), crntResnSlot );
     276                        } else {
     277                                delete adjType;
    295278                        }
    296 
    297                         it = cache.emplace_hint( it, assnKey, AssnCacheItem{ std::move(matches) } );
    298                 }
    299 
    300                 CandidateList& matches = it->second.matches;
     279                }
    301280
    302281                // break if no suitable assertion
     
    305284                // defer if too many suitable assertions
    306285                if ( matches.size() > 1 ) {
    307                         it->second.deferIds.emplace_back( assn.decl, assn.info );
    308                         resn.deferred.emplace_back( cache, assnKey );
     286                        resn.deferred.emplace_back( assn.decl, assn.info, std::move(matches) );
    309287                        return true;
    310288                }
     
    314292                addToIndexer( match.have, resn.indexer );
    315293                resn.newNeed.insert( match.need.begin(), match.need.end() );
    316                 resn.alt.env = match.env;
    317                 resn.alt.openVars = match.openVars;
     294                resn.alt.env = std::move(match.env);
     295                resn.alt.openVars = std::move(match.openVars);
    318296
    319297                bindAssertion( assn.decl, assn.info, resn.alt, match, resn.inferred );
     
    376354                ResnList resns{ ResnState{ alt, root_indexer } };
    377355                ResnList new_resns{};
    378                 AssnCache assnCache;
    379356
    380357                // resolve assertions in breadth-first-order up to a limited number of levels deep
     
    385362                                for ( auto& assn : resn.need ) {
    386363                                        // fail early if any assertion is not resolvable
    387                                         if ( ! resolveAssertion( assn, resn, assnCache ) ) goto nextResn;
     364                                        if ( ! resolveAssertion( assn, resn ) ) goto nextResn;
    388365                                }
    389366
     
    396373                                        }
    397374                                } else {
    398                                         // only resolve each deferred assertion once
    399                                         std::sort( resn.deferred.begin(), resn.deferred.end() );
    400                                         auto last = std::unique( resn.deferred.begin(), resn.deferred.end() );
    401                                         resn.deferred.erase( last, resn.deferred.end() );
    402375                                        // resolve deferred assertions by mutual compatibility
    403376                                        std::vector<CandidateEnvMerger::OutType> compatible = filterCombos(
     
    407380                                        CandidateCost coster{ resn.indexer };
    408381                                        std::sort( compatible.begin(), compatible.end(), coster );
     382                                        // // sort by cost if pruning
     383                                        // if ( pruneAssertions ) {
     384                                        //      auto lmin = sort_mins( compatible.begin(), compatible.end(),
     385                                        //              CandidateCost{resn.indexer} );
     386                                        //      compatible.erase( lmin, compatible.end() );
     387                                        // }
    409388
    410389                                        // keep map of detected options
     
    429408                                                        new_resn.newNeed.insert( match.need.begin(), match.need.end() );
    430409
    431                                                         // for each deferred assertion with the same form
    432                                                         for ( AssnId id : r.item.deferIds ) {
    433                                                                 bindAssertion(
    434                                                                         id.decl, id.info, new_resn.alt, match, new_resn.inferred );
    435                                                         }
     410                                                        bindAssertion( r.decl, r.info, new_resn.alt, match, new_resn.inferred );
    436411                                                }
    437412
  • src/ResolvExpr/Resolver.cc

    r53bb8f1 r9d9a451  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 12:17:01 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb 19 18:09:56 2019
    13 // Update Count     : 240
     11// Last Modified By : Aaron B. Moss
     12// Last Modified On : Fri Oct 05 09:43:00 2018
     13// Update Count     : 214
    1414//
    1515
     
    5353                }
    5454
    55                 void previsit( FunctionDecl * functionDecl );
    56                 void postvisit( FunctionDecl * functionDecl );
    57                 void previsit( ObjectDecl * objectDecll );
     55                void previsit( FunctionDecl *functionDecl );
     56                void postvisit( FunctionDecl *functionDecl );
     57                void previsit( ObjectDecl *objectDecll );
    5858                void previsit( EnumDecl * enumDecl );
    5959                void previsit( StaticAssertDecl * assertDecl );
     
    6262                void previsit( PointerType * at );
    6363
    64                 void previsit( ExprStmt * exprStmt );
    65                 void previsit( AsmExpr * asmExpr );
    66                 void previsit( AsmStmt * asmStmt );
    67                 void previsit( IfStmt * ifStmt );
    68                 void previsit( WhileStmt * whileStmt );
    69                 void previsit( ForStmt * forStmt );
    70                 void previsit( SwitchStmt * switchStmt );
    71                 void previsit( CaseStmt * caseStmt );
    72                 void previsit( BranchStmt * branchStmt );
    73                 void previsit( ReturnStmt * returnStmt );
    74                 void previsit( ThrowStmt * throwStmt );
    75                 void previsit( CatchStmt * catchStmt );
     64                void previsit( ExprStmt *exprStmt );
     65                void previsit( AsmExpr *asmExpr );
     66                void previsit( AsmStmt *asmStmt );
     67                void previsit( IfStmt *ifStmt );
     68                void previsit( WhileStmt *whileStmt );
     69                void previsit( ForStmt *forStmt );
     70                void previsit( SwitchStmt *switchStmt );
     71                void previsit( CaseStmt *caseStmt );
     72                void previsit( BranchStmt *branchStmt );
     73                void previsit( ReturnStmt *returnStmt );
     74                void previsit( ThrowStmt *throwStmt );
     75                void previsit( CatchStmt *catchStmt );
    7676                void previsit( WaitForStmt * stmt );
    7777
    78                 void previsit( SingleInit * singleInit );
    79                 void previsit( ListInit * listInit );
    80                 void previsit( ConstructorInit * ctorInit );
     78                void previsit( SingleInit *singleInit );
     79                void previsit( ListInit *listInit );
     80                void previsit( ConstructorInit *ctorInit );
    8181          private:
    8282                typedef std::list< Initializer * >::iterator InitIterator;
     
    104104        }
    105105
    106         void resolveDecl( Declaration * decl, const SymTab::Indexer & indexer ) {
     106        void resolveDecl( Declaration * decl, const SymTab::Indexer &indexer ) {
    107107                PassVisitor<Resolver> resolver( indexer );
    108108                maybeAccept( decl, resolver );
     
    148148                };
    149149
    150                 void finishExpr( Expression *& expr, const TypeEnvironment & env, TypeSubstitution * oldenv = nullptr ) {
     150                void finishExpr( Expression *&expr, const TypeEnvironment &env, TypeSubstitution * oldenv = nullptr ) {
    151151                        expr->env = oldenv ? oldenv->clone() : new TypeSubstitution;
    152152                        env.makeSubstitution( *expr->env );
     
    279279
    280280        // used in resolveTypeof
    281         Expression * resolveInVoidContext( Expression * expr, const SymTab::Indexer & indexer ) {
     281        Expression * resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer ) {
    282282                TypeEnvironment env;
    283283                return resolveInVoidContext( expr, indexer, env );
    284284        }
    285285
    286         Expression * resolveInVoidContext( Expression * expr, const SymTab::Indexer & indexer, TypeEnvironment & env ) {
     286        Expression * resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env ) {
    287287                // it's a property of the language that a cast expression has either 1 or 0 interpretations; if it has 0
    288288                // interpretations, an exception has already been thrown.
    289289                assertf( expr, "expected a non-null expression." );
    290290
    291                 CastExpr * untyped = new CastExpr( expr ); // cast to void
    292                 untyped->location = expr->location;
     291                static CastExpr untyped( nullptr ); // cast to void
     292                untyped.location = expr->location;
    293293
    294294                // set up and resolve expression cast to void
     295                untyped.arg = expr;
    295296                Alternative choice;
    296                 findUnfinishedKindExpression( untyped, choice, indexer, "", standardAlternativeFilter, ResolvMode::withAdjustment() );
     297                findUnfinishedKindExpression( &untyped, choice, indexer, "", standardAlternativeFilter, ResolvMode::withAdjustment() );
    297298                CastExpr * castExpr = strict_dynamic_cast< CastExpr * >( choice.expr );
    298                 assert( castExpr );
    299299                env = std::move( choice.env );
    300300
     
    304304
    305305                // unlink the arg so that it isn't deleted twice at the end of the program
    306                 untyped->arg = nullptr;
     306                untyped.arg = nullptr;
    307307                return ret;
    308308        }
    309309
    310         void findVoidExpression( Expression *& untyped, const SymTab::Indexer & indexer ) {
     310        void findVoidExpression( Expression *& untyped, const SymTab::Indexer &indexer ) {
    311311                resetTyVarRenaming();
    312312                TypeEnvironment env;
     
    317317        }
    318318
    319         void findSingleExpression( Expression *& untyped, const SymTab::Indexer & indexer ) {
     319        void findSingleExpression( Expression *&untyped, const SymTab::Indexer &indexer ) {
    320320                findKindExpression( untyped, indexer, "", standardAlternativeFilter );
    321321        }
     
    336336                        if ( dynamic_cast< EnumInstType * >( type ) ) {
    337337                                return true;
    338                         } else if ( BasicType * bt = dynamic_cast< BasicType * >( type ) ) {
     338                        } else if ( BasicType *bt = dynamic_cast< BasicType * >( type ) ) {
    339339                                return bt->isInteger();
    340340                        } else if ( dynamic_cast< ZeroType* >( type ) != nullptr || dynamic_cast< OneType* >( type ) != nullptr ) {
     
    345345                }
    346346
    347                 void findIntegralExpression( Expression *& untyped, const SymTab::Indexer & indexer ) {
     347                void findIntegralExpression( Expression *& untyped, const SymTab::Indexer &indexer ) {
    348348                        findKindExpression( untyped, indexer, "condition", isIntegralType );
    349349                }
     
    401401        }
    402402
    403         void Resolver::previsit( ObjectDecl * objectDecl ) {
     403        void Resolver::previsit( ObjectDecl *objectDecl ) {
    404404                // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that
    405405                // class-variable initContext is changed multiple time because the LHS is analysed twice.
     
    431431        }
    432432
    433         void Resolver::previsit( FunctionDecl * functionDecl ) {
     433        void Resolver::previsit( FunctionDecl *functionDecl ) {
    434434#if 0
    435435                std::cerr << "resolver visiting functiondecl ";
     
    441441        }
    442442
    443         void Resolver::postvisit( FunctionDecl * functionDecl ) {
     443        void Resolver::postvisit( FunctionDecl *functionDecl ) {
    444444                // default value expressions have an environment which shouldn't be there and trips up
    445445                // later passes.
     
    466466        }
    467467
    468         void Resolver::previsit( ExprStmt * exprStmt ) {
     468        void Resolver::previsit( ExprStmt *exprStmt ) {
    469469                visit_children = false;
    470470                assertf( exprStmt->expr, "ExprStmt has null Expression in resolver" );
     
    472472        }
    473473
    474         void Resolver::previsit( AsmExpr * asmExpr ) {
     474        void Resolver::previsit( AsmExpr *asmExpr ) {
    475475                visit_children = false;
    476476                findVoidExpression( asmExpr->operand, indexer );
     
    480480        }
    481481
    482         void Resolver::previsit( AsmStmt * asmStmt ) {
     482        void Resolver::previsit( AsmStmt *asmStmt ) {
    483483                visit_children = false;
    484484                acceptAll( asmStmt->get_input(), *visitor );
     
    486486        }
    487487
    488         void Resolver::previsit( IfStmt * ifStmt ) {
     488        void Resolver::previsit( IfStmt *ifStmt ) {
    489489                findIntegralExpression( ifStmt->condition, indexer );
    490490        }
    491491
    492         void Resolver::previsit( WhileStmt * whileStmt ) {
     492        void Resolver::previsit( WhileStmt *whileStmt ) {
    493493                findIntegralExpression( whileStmt->condition, indexer );
    494494        }
    495495
    496         void Resolver::previsit( ForStmt * forStmt ) {
     496        void Resolver::previsit( ForStmt *forStmt ) {
    497497                if ( forStmt->condition ) {
    498498                        findIntegralExpression( forStmt->condition, indexer );
     
    504504        }
    505505
    506         void Resolver::previsit( SwitchStmt * switchStmt ) {
     506        void Resolver::previsit( SwitchStmt *switchStmt ) {
    507507                GuardValue( currentObject );
    508508                findIntegralExpression( switchStmt->condition, indexer );
     
    511511        }
    512512
    513         void Resolver::previsit( CaseStmt * caseStmt ) {
     513        void Resolver::previsit( CaseStmt *caseStmt ) {
    514514                if ( caseStmt->condition ) {
    515515                        std::list< InitAlternative > initAlts = currentObject.getOptions();
     
    530530        }
    531531
    532         void Resolver::previsit( BranchStmt * branchStmt ) {
     532        void Resolver::previsit( BranchStmt *branchStmt ) {
    533533                visit_children = false;
    534534                // must resolve the argument for a computed goto
     
    541541        }
    542542
    543         void Resolver::previsit( ReturnStmt * returnStmt ) {
     543        void Resolver::previsit( ReturnStmt *returnStmt ) {
    544544                visit_children = false;
    545545                if ( returnStmt->expr ) {
     
    548548        }
    549549
    550         void Resolver::previsit( ThrowStmt * throwStmt ) {
     550        void Resolver::previsit( ThrowStmt *throwStmt ) {
    551551                visit_children = false;
    552552                // TODO: Replace *exception type with &exception type.
     
    560560        }
    561561
    562         void Resolver::previsit( CatchStmt * catchStmt ) {
     562        void Resolver::previsit( CatchStmt *catchStmt ) {
    563563                if ( catchStmt->cond ) {
    564564                        findSingleExpression( catchStmt->cond, new BasicType( noQualifiers, BasicType::Bool ), indexer );
     
    724724
    725725                                                }
    726                                                 catch( SemanticErrorException & e ) {
     726                                                catch( SemanticErrorException &e ) {
    727727                                                        errors.append( e );
    728728                                                }
    729729                                        }
    730730                                }
    731                                 catch( SemanticErrorException & e ) {
     731                                catch( SemanticErrorException &e ) {
    732732                                        errors.append( e );
    733733                                }
     
    781781        }
    782782
    783         void Resolver::previsit( SingleInit * singleInit ) {
     783        void Resolver::previsit( SingleInit *singleInit ) {
    784784                visit_children = false;
    785785                // resolve initialization using the possibilities as determined by the currentObject cursor
     
    813813                                if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) {
    814814                                        if ( isCharType( pt->get_base() ) ) {
    815                                                 if ( CastExpr * ce = dynamic_cast< CastExpr * >( newExpr ) ) {
     815                                                if ( CastExpr *ce = dynamic_cast< CastExpr * >( newExpr ) ) {
    816816                                                        // strip cast if we're initializing a char[] with a char *,
    817817                                                        // e.g.  char x[] = "hello";
     
    893893        }
    894894
    895         void Resolver::previsit( ConstructorInit * ctorInit ) {
     895        void Resolver::previsit( ConstructorInit *ctorInit ) {
    896896                visit_children = false;
    897897                // xxx - fallback init has been removed => remove fallbackInit function and remove complexity from FixInit and remove C-init from ConstructorInit
  • src/ResolvExpr/Resolver.h

    r53bb8f1 r9d9a451  
    1010// Created On       : Sun May 17 12:18:34 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Feb 18 20:40:38 2019
    13 // Update Count     : 4
     12// Last Modified On : Sat Jul 22 09:36:57 2017
     13// Update Count     : 3
    1414//
    1515
     
    2929        /// Checks types and binds syntactic constructs to typed representations
    3030        void resolve( std::list< Declaration * > translationUnit );
    31         void resolveDecl( Declaration *, const SymTab::Indexer & indexer );
    32         Expression *resolveInVoidContext( Expression * expr, const SymTab::Indexer & indexer );
    33         void findVoidExpression( Expression *& untyped, const SymTab::Indexer & indexer );
    34         void findSingleExpression( Expression *& untyped, const SymTab::Indexer & indexer );
    35         void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer & indexer );
     31        void resolveDecl( Declaration *, const SymTab::Indexer &indexer );
     32        Expression *resolveInVoidContext( Expression * expr, const SymTab::Indexer &indexer );
     33        void findVoidExpression( Expression *& untyped, const SymTab::Indexer &indexer );
     34        void findSingleExpression( Expression *& untyped, const SymTab::Indexer &indexer );
     35        void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer &indexer );
    3636        void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer );
    3737        void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer );
  • src/ResolvExpr/module.mk

    r53bb8f1 r9d9a451  
    1515###############################################################################
    1616
    17 SRC_RESOLVEXPR = \
    18       ResolvExpr/AdjustExprType.cc \
    19       ResolvExpr/Alternative.cc \
    20       ResolvExpr/AlternativeFinder.cc \
    21       ResolvExpr/CastCost.cc \
    22       ResolvExpr/CommonType.cc \
    23       ResolvExpr/ConversionCost.cc \
    24       ResolvExpr/CurrentObject.cc \
    25       ResolvExpr/ExplodedActual.cc \
    26       ResolvExpr/FindOpenVars.cc \
    27       ResolvExpr/Occurs.cc \
    28       ResolvExpr/PolyCost.cc \
    29       ResolvExpr/PtrsAssignable.cc \
    30       ResolvExpr/PtrsCastable.cc \
    31       ResolvExpr/RenameVars.cc \
    32       ResolvExpr/ResolveAssertions.cc \
    33       ResolvExpr/Resolver.cc \
    34       ResolvExpr/ResolveTypeof.cc \
    35       ResolvExpr/SpecCost.cc \
    36       ResolvExpr/TypeEnvironment.cc \
    37       ResolvExpr/Unify.cc
    38 
    39 SRC += $(SRC_RESOLVEXPR) ResolvExpr/AlternativePrinter.cc
    40 SRCDEMANGLE += $(SRC_RESOLVEXPR)
     17SRC += ResolvExpr/AlternativeFinder.cc \
     18       ResolvExpr/Alternative.cc \
     19       ResolvExpr/Unify.cc \
     20       ResolvExpr/PtrsAssignable.cc \
     21       ResolvExpr/CommonType.cc \
     22       ResolvExpr/ConversionCost.cc \
     23       ResolvExpr/CastCost.cc \
     24       ResolvExpr/PtrsCastable.cc \
     25       ResolvExpr/AdjustExprType.cc \
     26       ResolvExpr/AlternativePrinter.cc \
     27       ResolvExpr/Resolver.cc \
     28       ResolvExpr/ResolveTypeof.cc \
     29       ResolvExpr/RenameVars.cc \
     30       ResolvExpr/FindOpenVars.cc \
     31       ResolvExpr/PolyCost.cc \
     32       ResolvExpr/Occurs.cc \
     33       ResolvExpr/TypeEnvironment.cc \
     34       ResolvExpr/CurrentObject.cc \
     35       ResolvExpr/ExplodedActual.cc \
     36       ResolvExpr/SpecCost.cc \
     37       ResolvExpr/ResolveAssertions.cc
  • src/ResolvExpr/typeops.h

    r53bb8f1 r9d9a451  
    1010// Created On       : Sun May 17 07:28:22 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Feb  8 09:30:34 2019
    13 // Update Count     : 4
     12// Last Modified On : Sat Jul 22 09:36:18 2017
     13// Update Count     : 3
    1414//
    1515
     
    101101
    102102        // in CommonType.cc
    103         Type * commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars );
     103        Type *commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars );
    104104
    105105        // in PolyCost.cc
  • src/SymTab/Indexer.cc

    r53bb8f1 r9d9a451  
    2626#include "Common/SemanticError.h"  // for SemanticError
    2727#include "Common/utility.h"        // for cloneAll
    28 #include "Common/Stats/Counter.h" // for counters
    2928#include "GenPoly/GenPoly.h"
    3029#include "InitTweak/InitTweak.h"   // for isConstructor, isCopyFunction, isC...
     
    4241
    4342namespace SymTab {
    44 
    45         // Statistics block
    46         namespace {
    47 
    48                 static inline auto stats_idtable() {
    49                         using namespace Stats::Counters;
    50                         static auto group = build<CounterGroup>("IdTable");
    51                         static struct {
    52                                 SimpleCounter * find;
    53                                 AverageCounter<double> * size;
    54                                 AverageCounter<double> * key;
    55                         } ret = {
    56                                 .find = build<SimpleCounter>("Find calls", group),
    57                                 .size = build<AverageCounter<double>>("Average Size", group),
    58                                 .key  = build<AverageCounter<double>>("Average Key Size", group),
    59                         };
    60                         return ret;
    61                 }
    62 
    63                 static inline auto stats_indexers() {
    64                         using namespace Stats::Counters;
    65                         static auto group   = build<CounterGroup>("Indexers");
    66                         static struct {
    67                                 SimpleCounter * count;
    68                                 AverageCounter<double> * size;
    69                                 AverageCounter<double> * depth_a;
    70                                 MaxCounter<size_t> * depth_m;
    71                         } ret = {
    72                                 .count   = build<SimpleCounter>("Count", group),
    73                                 .size    = build<AverageCounter<double>>("Average Size", group),
    74                                 .depth_a = build<AverageCounter<double>>("Average Depth", group),
    75                                 .depth_m = build<MaxCounter<size_t>>("Max Depth", group),
    76                         };
    77                         return ret;
    78                 }
    79         }
    80 
    8143        std::ostream & operator<<( std::ostream & out, const Indexer::IdData & data ) {
    8244                return out << "(" << data.id << "," << data.baseExpr << ")";
     
    235197        }
    236198
    237         Indexer::Indexer() : tables( 0 ), scope( 0 ) {
    238                 (*stats_indexers().count)++;
    239         }
    240 
    241         Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {
    242                 (*stats_indexers().count)++;
    243         }
     199        Indexer::Indexer() : tables( 0 ), scope( 0 ) {}
     200
     201        Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {}
    244202
    245203        Indexer::Indexer( Indexer &&that ) : doDebug( that.doDebug ), tables( that.tables ), scope( that.scope ) {
     
    248206
    249207        Indexer::~Indexer() {
    250                 if(tables) {
    251                         stats_indexers().size->push( tables->idTable.size() );
    252                         size_t depth = 1;
    253                         for( auto crnt = tables->base.tables; crnt; crnt = crnt->base.tables ) {
    254                                 ++depth;
    255                         }
    256                         stats_indexers().depth_a->push( depth );
    257                         stats_indexers().depth_m->push( depth );
    258                 }
    259208                deleteRef( tables );
    260209        }
     
    288237                while ( searchTables ) {
    289238
    290                         (*stats_idtable().find)++;
    291                         stats_idtable().key->push( id.size() );
    292                         stats_idtable().size->push( searchTables->idTable.size() );
    293239                        IdTable::const_iterator decls = searchTables->idTable.find( id );
    294240                        if ( decls != searchTables->idTable.end() ) {
     
    367313                if ( tables->scope < scope ) return nullptr;
    368314
    369                 (*stats_idtable().find)++;
    370                 stats_idtable().key->push( id.size() );
    371                 stats_idtable().size->push( tables->idTable.size() );
    372315                IdTable::const_iterator decls = tables->idTable.find( id );
    373316                if ( decls != tables->idTable.end() ) {
     
    388331                if ( tables->scope < scope ) return false;
    389332
    390                 (*stats_idtable().find)++;
    391                 stats_idtable().key->push( id.size() );
    392                 stats_idtable().size->push( tables->idTable.size() );
    393333                IdTable::const_iterator decls = tables->idTable.find( id );
    394334                if ( decls != tables->idTable.end() ) {
     
    407347                if ( tables->scope < scope ) return false;
    408348
    409                 (*stats_idtable().find)++;
    410                 stats_idtable().key->push( id.size() );
    411                 stats_idtable().size->push( tables->idTable.size() );
    412349                IdTable::const_iterator decls = tables->idTable.find( id );
    413350                if ( decls != tables->idTable.end() ) {
  • src/SymTab/Mangler.cc

    r53bb8f1 r9d9a451  
    1515#include "Mangler.h"
    1616
    17 #include <algorithm>                     // for copy, transform
    18 #include <cassert>                       // for assert, assertf
    19 #include <functional>                    // for const_mem_fun_t, mem_fun
    20 #include <iterator>                      // for ostream_iterator, back_insert_ite...
    21 #include <list>                          // for _List_iterator, list, _List_const...
    22 #include <string>                        // for string, char_traits, operator<<
    23 
    24 #include "CodeGen/OperatorTable.h"       // for OperatorInfo, operatorLookup
     17#include <algorithm>                // for copy, transform
     18#include <cassert>                  // for assert, assertf
     19#include <functional>               // for const_mem_fun_t, mem_fun
     20#include <iterator>                 // for ostream_iterator, back_insert_ite...
     21#include <list>                     // for _List_iterator, list, _List_const...
     22#include <string>                   // for string, char_traits, operator<<
     23
     24#include "CodeGen/OperatorTable.h"  // for OperatorInfo, operatorLookup
    2525#include "Common/PassVisitor.h"
    26 #include "Common/SemanticError.h"        // for SemanticError
    27 #include "Common/utility.h"              // for toString
    28 #include "Parser/LinkageSpec.h"          // for Spec, isOverridable, AutoGen, Int...
    29 #include "ResolvExpr/TypeEnvironment.h"  // for TypeEnvironment
    30 #include "SynTree/Declaration.h"         // for TypeDecl, DeclarationWithType
    31 #include "SynTree/Expression.h"          // for TypeExpr, Expression, operator<<
    32 #include "SynTree/Type.h"                // for Type, ReferenceToType, Type::Fora...
     26#include "Common/SemanticError.h"   // for SemanticError
     27#include "Common/utility.h"         // for toString
     28#include "Parser/LinkageSpec.h"     // for Spec, isOverridable, AutoGen, Int...
     29#include "SynTree/Declaration.h"    // for TypeDecl, DeclarationWithType
     30#include "SynTree/Expression.h"     // for TypeExpr, Expression, operator<<
     31#include "SynTree/Type.h"           // for Type, ReferenceToType, Type::Fora...
    3332
    3433namespace SymTab {
     
    3837                        struct Mangler : public WithShortCircuiting, public WithVisitorRef<Mangler>, public WithGuards {
    3938                                Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams );
    40                                 Mangler( const ResolvExpr::TypeEnvironment& env );
    4139                                Mangler( const Mangler & ) = delete;
    4240
     
    6765                          private:
    6866                                std::ostringstream mangleName;  ///< Mangled name being constructed
    69                                 typedef std::map< std::string, std::pair< std::string, int > > VarMapType;
     67                                typedef std::map< std::string, std::pair< int, int > > VarMapType;
    7068                                VarMapType varNums;             ///< Map of type variables to indices
    7169                                int nextVarNum;                 ///< Next type variable index
    72                                 const ResolvExpr::TypeEnvironment* env;  ///< optional environment for substitutions
    7370                                bool isTopLevel;                ///< Is the Mangler at the top level
    7471                                bool mangleOverridable;         ///< Specially mangle overridable built-in methods
     
    7875                                bool inQualifiedType = false;   ///< Add start/end delimiters around qualified type
    7976
    80                           public:
    81                                 Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams,
    82                                         int nextVarNum, const ResolvExpr::TypeEnvironment* env,
    83                                         const VarMapType& varNums );
    84 
    85                           private:
    8677                                void mangleDecl( DeclarationWithType *declaration );
    8778                                void mangleRef( ReferenceToType *refType, std::string prefix );
     
    109100                }
    110101
    111                 std::string mangleAssnKey( DeclarationWithType* decl,
    112                                 const ResolvExpr::TypeEnvironment& env ) {
    113                         PassVisitor<Mangler> mangler( env );
    114                         maybeAccept( decl, mangler );
    115                         return mangler.pass.get_mangleName();
    116                 }
    117 
    118102                namespace {
    119103                        Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams )
    120                                 : nextVarNum( 0 ), env(nullptr), isTopLevel( true ),
    121                                 mangleOverridable( mangleOverridable ), typeMode( typeMode ),
    122                                 mangleGenericParams( mangleGenericParams ) {}
    123                        
    124                         Mangler::Mangler( const ResolvExpr::TypeEnvironment& env )
    125                                 : nextVarNum( 0 ), env( &env ), isTopLevel( true ), mangleOverridable( false ),
    126                                 typeMode( false ), mangleGenericParams( true ) {}
    127                        
    128                         Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams,
    129                                 int nextVarNum, const ResolvExpr::TypeEnvironment* env,
    130                                 const VarMapType& varNums )
    131                                 : varNums( varNums ), nextVarNum( nextVarNum ), env( env ), isTopLevel( false ),
    132                                 mangleOverridable( mangleOverridable ), typeMode( typeMode ),
    133                                 mangleGenericParams( mangleGenericParams ) {}
     104                                : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ), typeMode( typeMode ), mangleGenericParams( mangleGenericParams ) {}
    134105
    135106                        void Mangler::mangleDecl( DeclarationWithType * declaration ) {
     
    358329                                                        assert( false );
    359330                                                } // switch
    360                                                 std::string varName;
    361                                                 // replace type with substitution name if environment is available and bound
    362                                                 if ( env ) {
    363                                                         const ResolvExpr::EqvClass* varClass = env->lookup( (*i)->name );
    364                                                         if ( varClass && varClass->type ) {
    365                                                                 PassVisitor<Mangler> sub_mangler(
    366                                                                         mangleOverridable, typeMode, mangleGenericParams, nextVarNum,
    367                                                                         env, varNums );
    368                                                                 varClass->type->accept( sub_mangler );
    369                                                                 varName = std::string{"%"} + sub_mangler.pass.get_mangleName();
    370                                                         }
    371                                                 }
    372                                                 // otherwise just give type numeric name
    373                                                 if ( varName.empty() ) {
    374                                                         varName = std::to_string( nextVarNum++ );
    375                                                 }
    376                                                 varNums[ (*i)->name ] = std::make_pair( varName, (int)(*i)->get_kind() );
     331                                                varNums[ (*i)->name ] = std::pair< int, int >( nextVarNum++, (int)(*i)->get_kind() );
    377332                                                for ( std::list< DeclarationWithType* >::iterator assert = (*i)->assertions.begin(); assert != (*i)->assertions.end(); ++assert ) {
    378                                                         PassVisitor<Mangler> sub_mangler(
    379                                                                 mangleOverridable, typeMode, mangleGenericParams, nextVarNum, env,
    380                                                                 varNums );
     333                                                        PassVisitor<Mangler> sub_mangler( mangleOverridable, typeMode, mangleGenericParams );
     334                                                        sub_mangler.pass.nextVarNum = nextVarNum;
     335                                                        sub_mangler.pass.isTopLevel = false;
     336                                                        sub_mangler.pass.varNums = varNums;
    381337                                                        (*assert)->accept( sub_mangler );
    382                                                         assertionNames.push_back( sub_mangler.pass.get_mangleName() );
     338                                                        assertionNames.push_back( sub_mangler.pass.mangleName.str() );
    383339                                                        acount++;
    384340                                                } // for
  • src/SymTab/Mangler.h

    r53bb8f1 r9d9a451  
    3131// * Currently name compression is not implemented.
    3232
    33 namespace ResolvExpr {
    34         class TypeEnvironment;
    35 }
    36 
    3733namespace SymTab {
    3834        namespace Mangler {
     
    4440                /// Mangle ignoring generic type parameters
    4541                std::string mangleConcrete( Type* ty );
    46                 /// Mangle for assertion key
    47                 std::string mangleAssnKey( DeclarationWithType* decl,
    48                         const ResolvExpr::TypeEnvironment& env );
    4942
    5043                namespace Encoding {
  • src/SymTab/ManglerCommon.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Sun May 17 21:44:03 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 14 17:06:37 2019
    13 // Update Count     : 26
     12// Last Modified On : Sat Jul 22 09:45:30 2017
     13// Update Count     : 15
    1414//
    1515
     
    2323                        const std::string manglePrefix = "_X";
    2424
    25                         // GENERATED START, DO NOT EDIT
    26                         // GENERATED BY BasicTypes-gen.cc
    27                         // NOTES ON MANGLING:
    28                         // * Itanium spec says that Float80 encodes to "e" (like LongDouble), but the distinct lengths cause resolution problems.
    29                         // * Float128 is supposed to encode to "g", but I wanted it to mangle equal to LongDouble.
    30                         // * Mangling for non-standard complex types is by best guess
    31                         // * _FloatN is supposed to encode as "DF"N"_"; modified for same reason as above.
    32                         // * unused mangling identifiers:
    33                         //   - "z" ellipsis
    34                         //   - "Dd" IEEE 754r 64-bit decimal floating point (borrowed for _Float32x)
    35                         //   - "De" IEEE 754r 128-bit decimal floating point
    36                         //   - "Df" IEEE 754r 32-bit decimal floating point
    37                         //   - "Dh" IEEE 754r 16-bit decimal floating point (borrowed for _Float16)
    38                         //   - "DF"N"_" ISO/IEC TS 18661 N-bit binary floating point (_FloatN)
    39                         //   - "Di" char32_t
    40                         //   - "Ds" char16_t
    41                         const std::string basicTypes[BasicType::NUMBER_OF_BASIC_TYPES] = {
    42                                 "b",        // _Bool
    43                                 "c",        // char
    44                                 "a",        // signed char
    45                                 "h",        // unsigned char
    46                                 "s",        // signed short int
    47                                 "t",        // unsigned short int
    48                                 "i",        // signed int
    49                                 "j",        // unsigned int
    50                                 "l",        // signed long int
    51                                 "m",        // unsigned long int
    52                                 "x",        // signed long long int
    53                                 "y",        // unsigned long long int
    54                                 "n",        // __int128
    55                                 "o",        // unsigned __int128
    56                                 "DF16_",    // _Float16
    57                                 "CDF16_",   // _Float16 _Complex
    58                                 "DF32_",    // _Float32
    59                                 "CDF32_",   // _Float32 _Complex
    60                                 "f",        // float
    61                                 "Cf",       // float _Complex
    62                                 "DF32x_",   // _Float32x
    63                                 "CDF32x_",  // _Float32x _Complex
    64                                 "DF64_",    // _Float64
    65                                 "CDF64_",   // _Float64 _Complex
    66                                 "d",        // double
    67                                 "Cd",       // double _Complex
    68                                 "DF64x_",   // _Float64x
    69                                 "CDF64x_",  // _Float64x _Complex
    70                                 "Dq",       // __float80
    71                                 "DF128_",   // _Float128
    72                                 "CDF128_",  // _Float128 _Complex
    73                                 "g",        // __float128
    74                                 "e",        // long double
    75                                 "Ce",       // long double _Complex
    76                                 "DF128x_",  // _Float128x
    77                                 "CDF128x_", // _Float128x _Complex
    78                         }; // basicTypes
    79                         // GENERATED END
     25                        const std::string basicTypes[] = {
     26                                "b",  // Bool
     27                                "c",  // Char
     28                                "a",  // SignedChar
     29                                "h",  // UnsignedChar
     30                                "s",  // ShortSignedInt
     31                                "t",  // ShortUnsignedInt
     32                                "i",  // SignedInt
     33                                "j",  // UnsignedInt
     34                                "l",  // LongSignedInt
     35                                "m",  // LongUnsignedInt
     36                                "x",  // LongLongSignedInt
     37                                "y",  // LongLongUnsignedInt
     38                                "f",  // Float
     39                                "d",  // Double
     40                                "e",  // LongDouble
     41                                "Cf", // FloatComplex
     42                                "Cd", // DoubleComplex
     43                                "Ce", // LongDoubleComplex
     44                                // Note: imaginary is not an overloadable type in C++
     45                                "If", // FloatImaginary
     46                                "Id", // DoubleImaginary
     47                                "Ie", // LongDoubleImaginary
     48                                "n",  // SignedInt128
     49                                "o",  // UnsignedInt128
     50                                "Dq",  // Float80 -- TODO: itanium says Float80 and LongDouble both encode to "e", but doing this causes problems with constructing long double, because the cost tables are incorrect
     51                                "g",  // Float128
     52                                // "z", // ellipsis
     53                                // "Dd" // # IEEE 754r decimal floating point (64 bits)
     54                                // "De" // # IEEE 754r decimal floating point (128 bits)
     55                                // "Df" // # IEEE 754r decimal floating point (32 bits)
     56                                // "Dh" // # IEEE 754r half-precision floating point (16 bits)
     57                                // "DF"N_ // # ISO/IEC TS 18661 binary floating point type _FloatN (N bits)
     58                                // "Di" // char32_t
     59                                // "Ds" // char16_t
     60                        };
    8061                        static_assert(
    8162                                sizeof(basicTypes)/sizeof(basicTypes[0]) == BasicType::NUMBER_OF_BASIC_TYPES,
  • src/SymTab/Validate.cc

    r53bb8f1 r9d9a451  
    4949#include "CodeGen/OperatorTable.h"     // for isCtorDtor, isCtorDtorAssign
    5050#include "ControlStruct/Mutate.h"      // for ForExprMutator
    51 #include "Common/Stats.h"              // for Stats::Heap
    5251#include "Common/PassVisitor.h"        // for PassVisitor, WithDeclsToAdd
    5352#include "Common/ScopedMap.h"          // for ScopedMap
     
    304303                PassVisitor<FixQualifiedTypes> fixQual;
    305304
    306                 {
    307                         Stats::Heap::newPass("validate-A");
    308                         Stats::Time::BlockGuard guard("validate-A");
    309                         acceptAll( translationUnit, hoistDecls );
    310                         ReplaceTypedef::replaceTypedef( translationUnit );
    311                         ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    312                         acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
    313                 }
    314                 {
    315                         Stats::Heap::newPass("validate-B");
    316                         Stats::Time::BlockGuard guard("validate-B");
    317                         Stats::Time::TimeBlock("Link Reference To Types", [&]() {
    318                                 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    319                         });
    320                         Stats::Time::TimeBlock("Fix Qualified Types", [&]() {
    321                                 mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
    322                         });
    323                         Stats::Time::TimeBlock("Hoist Structs", [&]() {
    324                                 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    325                         });
    326                         Stats::Time::TimeBlock("Eliminate Typedefs", [&]() {
    327                                 EliminateTypedef::eliminateTypedef( translationUnit ); //
    328                         });
    329                 }
    330                 {
    331                         Stats::Heap::newPass("validate-C");
    332                         Stats::Time::BlockGuard guard("validate-C");
    333                         acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
    334                         VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
    335                         ReturnChecker::checkFunctionReturns( translationUnit );
    336                         InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
    337                 }
    338                 {
    339                         Stats::Heap::newPass("validate-D");
    340                         Stats::Time::BlockGuard guard("validate-D");
    341                         Stats::Time::TimeBlock("Apply Concurrent Keywords", [&]() {
    342                                 Concurrency::applyKeywords( translationUnit );
    343                         });
    344                         Stats::Time::TimeBlock("Forall Pointer Decay", [&]() {
    345                                 acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
    346                         });
    347                         Stats::Time::TimeBlock("Hoist Control Declarations", [&]() {
    348                                 ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
    349                         });
    350                         Stats::Time::TimeBlock("Generate Autogen routines", [&]() {
    351                                 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
    352                         });
    353                 }
    354                 {
    355                         Stats::Heap::newPass("validate-E");
    356                         Stats::Time::BlockGuard guard("validate-E");
    357                         Stats::Time::TimeBlock("Implement Mutex Func", [&]() {
    358                                 Concurrency::implementMutexFuncs( translationUnit );
    359                         });
    360                         Stats::Time::TimeBlock("Implement Thread Start", [&]() {
    361                                 Concurrency::implementThreadStarter( translationUnit );
    362                         });
    363                         Stats::Time::TimeBlock("Compound Literal", [&]() {
    364                                 mutateAll( translationUnit, compoundliteral );
    365                         });
    366                         Stats::Time::TimeBlock("Resolve With Expressions", [&]() {
    367                                 ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
    368                         });
    369                 }
    370                 {
    371                         Stats::Heap::newPass("validate-F");
    372                         Stats::Time::BlockGuard guard("validate-F");
    373                         Stats::Time::TimeBlock("Fix Object Type", [&]() {
    374                                 FixObjectType::fix( translationUnit );
    375                         });
    376                         Stats::Time::TimeBlock("Array Length", [&]() {
    377                                 ArrayLength::computeLength( translationUnit );
    378                         });
    379                         Stats::Time::TimeBlock("Find Special Declarations", [&]() {
    380                                 acceptAll( translationUnit, finder ); // xxx - remove this pass soon
    381                         });
    382                         Stats::Time::TimeBlock("Fix Label Address", [&]() {
    383                                 mutateAll( translationUnit, labelAddrFixer );
    384                         });
    385                         Stats::Time::TimeBlock("Handle Attributes", [&]() {
    386                                 Validate::handleAttributes( translationUnit );
    387                         });
    388                 }
     305                acceptAll( translationUnit, hoistDecls );
     306                ReplaceTypedef::replaceTypedef( translationUnit );
     307                ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
     308                acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
     309                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
     310                mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
     311                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
     312                EliminateTypedef::eliminateTypedef( translationUnit ); //
     313                acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
     314                VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
     315                ReturnChecker::checkFunctionReturns( translationUnit );
     316                InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
     317                Concurrency::applyKeywords( translationUnit );
     318                acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
     319                ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
     320                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
     321                Concurrency::implementMutexFuncs( translationUnit );
     322                Concurrency::implementThreadStarter( translationUnit );
     323                mutateAll( translationUnit, compoundliteral );
     324                ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
     325                FixObjectType::fix( translationUnit );
     326                ArrayLength::computeLength( translationUnit );
     327                acceptAll( translationUnit, finder ); // xxx - remove this pass soon
     328                mutateAll( translationUnit, labelAddrFixer );
     329                Validate::handleAttributes( translationUnit );
    389330        }
    390331
  • src/SymTab/module.mk

    r53bb8f1 r9d9a451  
    1515###############################################################################
    1616
    17 SRC_SYMTAB = \
    18       SymTab/Autogen.cc \
    19       SymTab/FixFunction.cc \
    20       SymTab/Indexer.cc \
    21       SymTab/Mangler.cc \
    22       SymTab/ManglerCommon.cc \
    23       SymTab/Validate.cc
    24 
    25 SRC += $(SRC_SYMTAB)
    26 SRCDEMANGLE += $(SRC_SYMTAB) SymTab/Demangle.cc
     17SRC += SymTab/Indexer.cc \
     18       SymTab/Mangler.cc \
     19       SymTab/ManglerCommon.cc \
     20       SymTab/Validate.cc \
     21       SymTab/FixFunction.cc \
     22       SymTab/Autogen.cc
  • src/SynTree/AddressExpr.cc

    r53bb8f1 r9d9a451  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 23:54:44 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 28 13:13:38 2019
    13 // Update Count     : 10
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Apr 26 12:35:13 2016
     13// Update Count     : 6
    1414//
    1515
     
    4747                } else {
    4848                        // taking address of non-lvalue -- must be a reference, loses one layer of reference
    49                         if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( arg->result ) ) {
    50                                 set_result( addrType( refType->base ) );
    51                         } else {
    52                                 SemanticError( arg->result, "Attempt to take address of non-lvalue expression: " );
    53                         } // if
     49                        ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->result );
     50                        set_result( addrType( refType->base ) );
    5451                }
    5552                // result of & is never an lvalue
  • src/SynTree/BasicType.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan 31 21:37:36 2019
    13 // Update Count     : 12
     12// Last Modified On : Mon Sep 25 14:14:03 2017
     13// Update Count     : 11
    1414//
    1515
     
    3030
    3131bool BasicType::isInteger() const {
    32         return kind <= UnsignedInt128;
    33 #if 0
    3432        switch ( kind ) {
    3533          case Bool:
     
    6563        assert( false );
    6664        return false;
    67 #endif
    6865}
    6966
  • src/SynTree/Constant.cc

    r53bb8f1 r9d9a451  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 13 18:11:22 2019
    13 // Update Count     : 32
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Spt 28 14:49:00 2018
     13// Update Count     : 30
    1414//
    1515
  • src/SynTree/Expression.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb 19 18:10:55 2019
    13 // Update Count     : 60
     12// Last Modified On : Tue Jul 25 14:15:47 2017
     13// Update Count     : 54
    1414//
    1515
     
    3333#include "GenPoly/Lvalue.h"
    3434
    35 void printInferParams( const InferredParams & inferParams, std::ostream & os, Indenter indent, int level ) {
     35void printInferParams( const InferredParams & inferParams, std::ostream &os, Indenter indent, int level ) {
    3636        if ( ! inferParams.empty() ) {
    3737                os << indent << "with inferred parameters " << level << ":" << std::endl;
     
    4747Expression::Expression() : result( 0 ), env( 0 ) {}
    4848
    49 Expression::Expression( const Expression & other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), extension( other.extension ), inferParams( other.inferParams ), resnSlots( other.resnSlots ) {}
     49Expression::Expression( const Expression &other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), extension( other.extension ), inferParams( other.inferParams ), resnSlots( other.resnSlots ) {}
    5050
    5151void Expression::spliceInferParams( Expression * other ) {
     
    6262}
    6363
    64 void Expression::print( std::ostream & os, Indenter indent ) const {
     64void Expression::print( std::ostream &os, Indenter indent ) const {
    6565        printInferParams( inferParams, os, indent+1, 0 );
    6666
     
    7979}
    8080
    81 ConstantExpr::ConstantExpr( const ConstantExpr & other) : Expression( other ), constant( other.constant ) {
     81ConstantExpr::ConstantExpr( const ConstantExpr &other) : Expression( other ), constant( other.constant ) {
    8282}
    8383
    8484ConstantExpr::~ConstantExpr() {}
    8585
    86 void ConstantExpr::print( std::ostream & os, Indenter indent ) const {
     86void ConstantExpr::print( std::ostream &os, Indenter indent ) const {
    8787        os << "constant expression " ;
    8888        constant.print( os );
     
    124124}
    125125
    126 VariableExpr::VariableExpr( const VariableExpr & other ) : Expression( other ), var( other.var ) {
     126VariableExpr::VariableExpr( const VariableExpr &other ) : Expression( other ), var( other.var ) {
    127127}
    128128
     
    137137}
    138138
    139 void VariableExpr::print( std::ostream & os, Indenter indent ) const {
     139void VariableExpr::print( std::ostream &os, Indenter indent ) const {
    140140        os << "Variable Expression: ";
    141141        var->printShort(os, indent);
     
    143143}
    144144
    145 SizeofExpr::SizeofExpr( Expression * expr_ ) :
     145SizeofExpr::SizeofExpr( Expression *expr_ ) :
    146146                Expression(), expr(expr_), type(0), isType(false) {
    147147        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    148148}
    149149
    150 SizeofExpr::SizeofExpr( Type * type_ ) :
     150SizeofExpr::SizeofExpr( Type *type_ ) :
    151151                Expression(), expr(0), type(type_), isType(true) {
    152152        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    153153}
    154154
    155 SizeofExpr::SizeofExpr( const SizeofExpr & other ) :
     155SizeofExpr::SizeofExpr( const SizeofExpr &other ) :
    156156        Expression( other ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) {
    157157}
     
    162162}
    163163
    164 void SizeofExpr::print( std::ostream & os, Indenter indent) const {
     164void SizeofExpr::print( std::ostream &os, Indenter indent) const {
    165165        os << "Sizeof Expression on: ";
    166166        if (isType) type->print(os, indent+1);
     
    169169}
    170170
    171 AlignofExpr::AlignofExpr( Expression * expr_ ) :
     171AlignofExpr::AlignofExpr( Expression *expr_ ) :
    172172                Expression(), expr(expr_), type(0), isType(false) {
    173173        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    174174}
    175175
    176 AlignofExpr::AlignofExpr( Type * type_ ) :
     176AlignofExpr::AlignofExpr( Type *type_ ) :
    177177                Expression(), expr(0), type(type_), isType(true) {
    178178        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    179179}
    180180
    181 AlignofExpr::AlignofExpr( const AlignofExpr & other ) :
     181AlignofExpr::AlignofExpr( const AlignofExpr &other ) :
    182182        Expression( other ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) {
    183183}
     
    188188}
    189189
    190 void AlignofExpr::print( std::ostream & os, Indenter indent) const {
     190void AlignofExpr::print( std::ostream &os, Indenter indent) const {
    191191        os << "Alignof Expression on: ";
    192192        if (isType) type->print(os, indent+1);
     
    195195}
    196196
    197 UntypedOffsetofExpr::UntypedOffsetofExpr( Type * type, const std::string & member ) :
     197UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type, const std::string &member ) :
    198198                Expression(), type(type), member(member) {
    199199        assert( type );
     
    201201}
    202202
    203 UntypedOffsetofExpr::UntypedOffsetofExpr( const UntypedOffsetofExpr & other ) :
     203UntypedOffsetofExpr::UntypedOffsetofExpr( const UntypedOffsetofExpr &other ) :
    204204        Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {}
    205205
     
    208208}
    209209
    210 void UntypedOffsetofExpr::print( std::ostream & os, Indenter indent) const {
     210void UntypedOffsetofExpr::print( std::ostream &os, Indenter indent) const {
    211211        os << "Untyped Offsetof Expression on member " << member << " of ";
    212212        type->print(os, indent+1);
     
    214214}
    215215
    216 OffsetofExpr::OffsetofExpr( Type * type, DeclarationWithType * member ) :
     216OffsetofExpr::OffsetofExpr( Type *type, DeclarationWithType *member ) :
    217217                Expression(), type(type), member(member) {
    218218        assert( member );
     
    221221}
    222222
    223 OffsetofExpr::OffsetofExpr( const OffsetofExpr & other ) :
     223OffsetofExpr::OffsetofExpr( const OffsetofExpr &other ) :
    224224        Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {}
    225225
     
    228228}
    229229
    230 void OffsetofExpr::print( std::ostream & os, Indenter indent) const {
     230void OffsetofExpr::print( std::ostream &os, Indenter indent) const {
    231231        os << "Offsetof Expression on member " << member->name << " of ";
    232232        type->print(os, indent+1);
     
    234234}
    235235
    236 OffsetPackExpr::OffsetPackExpr( StructInstType * type ) : Expression(), type( type ) {
     236OffsetPackExpr::OffsetPackExpr( StructInstType *type ) : Expression(), type( type ) {
    237237        assert( type );
    238238        set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
    239239}
    240240
    241 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr & other ) : Expression( other ), type( maybeClone( other.type ) ) {}
     241OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {}
    242242
    243243OffsetPackExpr::~OffsetPackExpr() { delete type; }
    244244
    245 void OffsetPackExpr::print( std::ostream & os, Indenter indent ) const {
     245void OffsetPackExpr::print( std::ostream &os, Indenter indent ) const {
    246246        os << "Offset pack expression on ";
    247247        type->print(os, indent+1);
     
    249249}
    250250
    251 AttrExpr::AttrExpr( Expression * attr, Expression * expr_ ) :
     251AttrExpr::AttrExpr( Expression *attr, Expression *expr_ ) :
    252252                Expression(), attr( attr ), expr(expr_), type(0), isType(false) {
    253253}
    254254
    255 AttrExpr::AttrExpr( Expression * attr, Type * type_ ) :
     255AttrExpr::AttrExpr( Expression *attr, Type *type_ ) :
    256256                Expression(), attr( attr ), expr(0), type(type_), isType(true) {
    257257}
    258258
    259 AttrExpr::AttrExpr( const AttrExpr & other ) :
     259AttrExpr::AttrExpr( const AttrExpr &other ) :
    260260                Expression( other ), attr( maybeClone( other.attr ) ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) {
    261261}
     
    267267}
    268268
    269 void AttrExpr::print( std::ostream & os, Indenter indent) const {
     269void AttrExpr::print( std::ostream &os, Indenter indent) const {
    270270        os << "Attr ";
    271271        attr->print( os, indent+1);
     
    278278}
    279279
    280 CastExpr::CastExpr( Expression * arg, Type * toType, bool isGenerated ) : arg(arg), isGenerated( isGenerated ) {
     280CastExpr::CastExpr( Expression *arg, Type *toType, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
    281281        set_result(toType);
    282282}
    283283
    284 CastExpr::CastExpr( Expression * arg, bool isGenerated ) : arg(arg), isGenerated( isGenerated ) {
     284CastExpr::CastExpr( Expression *arg, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
    285285        set_result( new VoidType( Type::Qualifiers() ) );
    286286}
    287287
    288 CastExpr::CastExpr( const CastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
     288CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
    289289}
    290290
     
    293293}
    294294
    295 void CastExpr::print( std::ostream & os, Indenter indent ) const {
    296         os << (isGenerated ? "Generated " : "Explicit ") << "Cast of:" << std::endl << indent+1;
     295void CastExpr::print( std::ostream &os, Indenter indent ) const {
     296        os << "Cast of:" << std::endl << indent+1;
    297297        arg->print(os, indent+1);
    298298        os << std::endl << indent << "... to:";
     
    306306}
    307307
    308 KeywordCastExpr::KeywordCastExpr( Expression * arg, Target target ) : Expression(), arg(arg), target( target ) {
    309 }
    310 
    311 KeywordCastExpr::KeywordCastExpr( const KeywordCastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ), target( other.target ) {
     308KeywordCastExpr::KeywordCastExpr( Expression *arg, Target target ) : Expression(), arg(arg), target( target ) {
     309}
     310
     311KeywordCastExpr::KeywordCastExpr( const KeywordCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), target( other.target ) {
    312312}
    313313
     
    327327}
    328328
    329 void KeywordCastExpr::print( std::ostream & os, Indenter indent ) const {
     329void KeywordCastExpr::print( std::ostream &os, Indenter indent ) const {
    330330        os << "Keyword Cast of:" << std::endl << indent+1;
    331331        arg->print(os, indent+1);
     
    335335}
    336336
    337 VirtualCastExpr::VirtualCastExpr( Expression * arg_, Type * toType ) : Expression(), arg(arg_) {
     337VirtualCastExpr::VirtualCastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
    338338        set_result(toType);
    339339}
    340340
    341 VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
     341VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
    342342}
    343343
     
    346346}
    347347
    348 void VirtualCastExpr::print( std::ostream & os, Indenter indent ) const {
     348void VirtualCastExpr::print( std::ostream &os, Indenter indent ) const {
    349349        os << "Virtual Cast of:" << std::endl << indent+1;
    350350        arg->print(os, indent+1);
     
    359359}
    360360
    361 UntypedMemberExpr::UntypedMemberExpr( Expression * member, Expression * aggregate ) :
     361UntypedMemberExpr::UntypedMemberExpr( Expression * member, Expression *aggregate ) :
    362362                Expression(), member(member), aggregate(aggregate) {
    363363        assert( aggregate );
    364364}
    365365
    366 UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr & other ) :
     366UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr &other ) :
    367367                Expression( other ), member( maybeClone( other.member ) ), aggregate( maybeClone( other.aggregate ) ) {
    368368}
     
    373373}
    374374
    375 void UntypedMemberExpr::print( std::ostream & os, Indenter indent ) const {
     375void UntypedMemberExpr::print( std::ostream &os, Indenter indent ) const {
    376376        os << "Untyped Member Expression, with field: " << std::endl << indent+1;
    377377        member->print(os, indent+1 );
     
    381381}
    382382
    383 MemberExpr::MemberExpr( DeclarationWithType * member, Expression * aggregate ) :
     383MemberExpr::MemberExpr( DeclarationWithType *member, Expression *aggregate ) :
    384384                Expression(), member(member), aggregate(aggregate) {
    385385        assert( member );
     
    395395}
    396396
    397 MemberExpr::MemberExpr( const MemberExpr & other ) :
     397MemberExpr::MemberExpr( const MemberExpr &other ) :
    398398                Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) {
    399399}
     
    404404}
    405405
    406 void MemberExpr::print( std::ostream & os, Indenter indent ) const {
     406void MemberExpr::print( std::ostream &os, Indenter indent ) const {
    407407        os << "Member Expression, with field:" << std::endl;
    408408        os << indent+1;
     
    413413}
    414414
    415 UntypedExpr::UntypedExpr( Expression * function, const std::list<Expression *> & args ) :
     415UntypedExpr::UntypedExpr( Expression *function, const std::list<Expression *> &args ) :
    416416                Expression(), function(function), args(args) {}
    417417
    418 UntypedExpr::UntypedExpr( const UntypedExpr & other ) :
     418UntypedExpr::UntypedExpr( const UntypedExpr &other ) :
    419419                Expression( other ), function( maybeClone( other.function ) ) {
    420420        cloneAll( other.args, args );
     
    455455
    456456
    457 void UntypedExpr::print( std::ostream & os, Indenter indent ) const {
     457void UntypedExpr::print( std::ostream &os, Indenter indent ) const {
    458458        os << "Applying untyped:" << std::endl;
    459459        os << indent+1;
     
    469469}
    470470
    471 NameExpr::NameExpr( const NameExpr & other ) : Expression( other ), name( other.name ) {
     471NameExpr::NameExpr( const NameExpr &other ) : Expression( other ), name( other.name ) {
    472472}
    473473
    474474NameExpr::~NameExpr() {}
    475475
    476 void NameExpr::print( std::ostream & os, Indenter indent ) const {
     476void NameExpr::print( std::ostream &os, Indenter indent ) const {
    477477        os << "Name: " << get_name();
    478478        Expression::print( os, indent );
    479479}
    480480
    481 LogicalExpr::LogicalExpr( Expression * arg1_, Expression * arg2_, bool andp ) :
     481LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp ) :
    482482                Expression(), arg1(arg1_), arg2(arg2_), isAnd(andp) {
    483483        set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    484484}
    485485
    486 LogicalExpr::LogicalExpr( const LogicalExpr & other ) :
     486LogicalExpr::LogicalExpr( const LogicalExpr &other ) :
    487487                Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), isAnd( other.isAnd ) {
    488488}
     
    493493}
    494494
    495 void LogicalExpr::print( std::ostream & os, Indenter indent )const {
     495void LogicalExpr::print( std::ostream &os, Indenter indent )const {
    496496        os << "Short-circuited operation (" << (isAnd ? "and" : "or") << ") on: ";
    497497        arg1->print(os);
     
    504504                Expression(), arg1(arg1), arg2(arg2), arg3(arg3) {}
    505505
    506 ConditionalExpr::ConditionalExpr( const ConditionalExpr & other ) :
     506ConditionalExpr::ConditionalExpr( const ConditionalExpr &other ) :
    507507                Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), arg3( maybeClone( other.arg3 ) ) {
    508508}
     
    514514}
    515515
    516 void ConditionalExpr::print( std::ostream & os, Indenter indent ) const {
     516void ConditionalExpr::print( std::ostream &os, Indenter indent ) const {
    517517        os << "Conditional expression on: " << std::endl << indent+1;
    518518        arg1->print( os, indent+1 );
     
    527527
    528528
    529 void AsmExpr::print( std::ostream & os, Indenter indent ) const {
     529void AsmExpr::print( std::ostream &os, Indenter indent ) const {
    530530        os << "Asm Expression: " << std::endl;
    531531        if ( inout ) inout->print( os, indent+1 );
     
    555555}
    556556
    557 void ImplicitCopyCtorExpr::print( std::ostream & os, Indenter indent ) const {
     557void ImplicitCopyCtorExpr::print( std::ostream &os, Indenter indent ) const {
    558558        os <<  "Implicit Copy Constructor Expression: " << std::endl << indent+1;
    559559        callExpr->print( os, indent+1 );
     
    581581}
    582582
    583 void ConstructorExpr::print( std::ostream & os, Indenter indent ) const {
     583void ConstructorExpr::print( std::ostream &os, Indenter indent ) const {
    584584        os <<  "Constructor Expression: " << std::endl << indent+1;
    585585        callExpr->print( os, indent + 2 );
     
    594594}
    595595
    596 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr & other ) : Expression( other ), initializer( other.initializer->clone() ) {}
     596CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), initializer( other.initializer->clone() ) {}
    597597
    598598CompoundLiteralExpr::~CompoundLiteralExpr() {
     
    600600}
    601601
    602 void CompoundLiteralExpr::print( std::ostream & os, Indenter indent ) const {
     602void CompoundLiteralExpr::print( std::ostream &os, Indenter indent ) const {
    603603        os << "Compound Literal Expression: " << std::endl << indent+1;
    604604        result->print( os, indent+1 );
     
    608608}
    609609
    610 RangeExpr::RangeExpr( Expression * low, Expression * high ) : low( low ), high( high ) {}
    611 RangeExpr::RangeExpr( const RangeExpr & other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {}
    612 void RangeExpr::print( std::ostream & os, Indenter indent ) const {
     610RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {}
     611RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {}
     612void RangeExpr::print( std::ostream &os, Indenter indent ) const {
    613613        os << "Range Expression: ";
    614614        low->print( os, indent );
     
    618618}
    619619
    620 StmtExpr::StmtExpr( CompoundStmt * statements ) : statements( statements ) {
     620StmtExpr::StmtExpr( CompoundStmt *statements ) : statements( statements ) {
    621621        computeResult();
    622622}
    623 StmtExpr::StmtExpr( const StmtExpr & other ) : Expression( other ), statements( other.statements->clone() ) {
     623StmtExpr::StmtExpr( const StmtExpr &other ) : Expression( other ), statements( other.statements->clone() ) {
    624624        cloneAll( other.returnDecls, returnDecls );
    625625        cloneAll( other.dtors, dtors );
     
    650650        }
    651651}
    652 void StmtExpr::print( std::ostream & os, Indenter indent ) const {
     652void StmtExpr::print( std::ostream &os, Indenter indent ) const {
    653653        os << "Statement Expression: " << std::endl << indent+1;
    654654        statements->print( os, indent+1 );
     
    666666
    667667long long UniqueExpr::count = 0;
    668 UniqueExpr::UniqueExpr( Expression * expr, long long idVal ) : expr( expr ), object( nullptr ), var( nullptr ), id( idVal ) {
     668UniqueExpr::UniqueExpr( Expression *expr, long long idVal ) : expr( expr ), object( nullptr ), var( nullptr ), id( idVal ) {
    669669        assert( expr );
    670670        assert( count != -1 );
     
    674674        }
    675675}
    676 UniqueExpr::UniqueExpr( const UniqueExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), object( maybeClone( other.object ) ), var( maybeClone( other.var ) ), id( other.id ) {
     676UniqueExpr::UniqueExpr( const UniqueExpr &other ) : Expression( other ), expr( maybeClone( other.expr ) ), object( maybeClone( other.object ) ), var( maybeClone( other.var ) ), id( other.id ) {
    677677}
    678678UniqueExpr::~UniqueExpr() {
     
    681681        delete var;
    682682}
    683 void UniqueExpr::print( std::ostream & os, Indenter indent ) const {
     683void UniqueExpr::print( std::ostream &os, Indenter indent ) const {
    684684        os << "Unique Expression with id:" << id << std::endl << indent+1;
    685685        expr->print( os, indent+1 );
  • src/SynTree/Expression.h

    r53bb8f1 r9d9a451  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Feb 18 18:29:51 2019
    13 // Update Count     : 49
     12// Last Modified On : Sun Sep  3 19:23:46 2017
     13// Update Count     : 48
    1414//
    1515
     
    195195  public:
    196196        Expression * arg;
    197         bool isGenerated = true; // cast generated implicitly by code generation or explicit in program
     197        bool isGenerated = true; // whether this cast appeared in the source program
    198198
    199199        CastExpr( Expression * arg, bool isGenerated = true );
  • src/SynTree/Type.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan 31 21:54:16 2019
    13 // Update Count     : 43
     12// Last Modified On : Fri Jun 22 10:17:19 2018
     13// Update Count     : 39
    1414//
    1515#include "Type.h"
     
    2525
    2626const char *BasicType::typeNames[] = {
    27 #if 0
    2827        "_Bool",
    2928        "char",
     
    5049        "unsigned __int128",
    5150        "__float80",
    52         "__float128",
    53         "_Float16",
    54         "_Float32",
    55         "_Float32x",
    56         "_Float64",
    57         "_Float64x",
    58         "_Float128",
    59         "_Float128x",
    60         "_Float16 _Complex",
    61         "_Float32 _Complex",
    62         "_Float32x _Complex",
    63         "_Float64 _Complex",
    64         "_Float64x _Complex",
    65         "_Float128 _Complex",
    66         "_Float128x _Complex",
    67 #endif
    68         "_Bool",
    69         "char",
    70         "signed char",
    71         "unsigned char",
    72         "signed short int",
    73         "unsigned short int",
    74         "signed int",
    75         "unsigned int",
    76         "signed long int",
    77         "unsigned long int",
    78         "signed long long int",
    79         "unsigned long long int",
    80         "__int128",
    81         "unsigned __int128",
    82         "_Float16",
    83         "_Float16 _Complex",
    84         "_Float32",
    85         "_Float32 _Complex",
    86         "float",
    87         "float _Complex",
    88         //"float _Imaginary",
    89         "_Float32x",
    90         "_Float32x _Complex",
    91         "_Float64",
    92         "_Float64 _Complex",
    93         "double",
    94         "double _Complex",
    95         //"double _Imaginary",
    96         "_Float64x",
    97         "_Float64x _Complex",
    98         "__float80",
    99         "_Float128",
    100         "_Float128 _Complex",
    101         "__float128",
    102         "long double",
    103         "long double _Complex",
    104         //"long double _Imaginary",
    105         "_Float128x",
    106         "_Float128x _Complex",
     51        "__float128"
    10752};
    10853static_assert(
  • src/SynTree/Type.h

    r53bb8f1 r9d9a451  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 14 17:11:24 2019
    13 // Update Count     : 169
     12// Last Modified On : Mon Sep 25 14:14:01 2017
     13// Update Count     : 154
    1414//
    1515
     
    207207class BasicType : public Type {
    208208  public:
    209         // GENERATED START, DO NOT EDIT
    210         // GENERATED BY BasicTypes-gen.cc
    211209        enum Kind {
    212210                Bool,
     
    222220                LongLongSignedInt,
    223221                LongLongUnsignedInt,
     222                Float,
     223                Double,
     224                LongDouble,
     225                FloatComplex,
     226                DoubleComplex,
     227                LongDoubleComplex,
     228                FloatImaginary,
     229                DoubleImaginary,
     230                LongDoubleImaginary,
    224231                SignedInt128,
    225232                UnsignedInt128,
    226                 uFloat16,
    227                 uFloat16Complex,
    228                 uFloat32,
    229                 uFloat32Complex,
    230                 Float,
    231                 FloatComplex,
    232                 uFloat32x,
    233                 uFloat32xComplex,
    234                 uFloat64,
    235                 uFloat64Complex,
    236                 Double,
    237                 DoubleComplex,
    238                 uFloat64x,
    239                 uFloat64xComplex,
    240                 uuFloat80,
    241                 uFloat128,
    242                 uFloat128Complex,
    243                 uuFloat128,
    244                 LongDouble,
    245                 LongDoubleComplex,
    246                 uFloat128x,
    247                 uFloat128xComplex,
     233                Float80,
     234                Float128,
    248235                NUMBER_OF_BASIC_TYPES
    249236        } kind;
    250         // GENERATED END
    251237
    252238        static const char *typeNames[];                                         // string names for basic types, MUST MATCH with Kind
  • src/SynTree/module.mk

    r53bb8f1 r9d9a451  
    1515###############################################################################
    1616
    17 SRC_SYNTREE = \
    18       SynTree/Type.cc \
    19       SynTree/VoidType.cc \
    20       SynTree/BasicType.cc \
    21       SynTree/PointerType.cc \
    22       SynTree/ArrayType.cc \
    23       SynTree/ReferenceType.cc \
    24       SynTree/FunctionType.cc \
    25       SynTree/ReferenceToType.cc \
    26       SynTree/TupleType.cc \
    27       SynTree/TypeofType.cc \
    28       SynTree/AttrType.cc \
    29       SynTree/VarArgsType.cc \
    30       SynTree/ZeroOneType.cc \
    31       SynTree/Constant.cc \
    32       SynTree/Expression.cc \
    33       SynTree/TupleExpr.cc \
    34       SynTree/CommaExpr.cc \
    35       SynTree/TypeExpr.cc \
    36       SynTree/ApplicationExpr.cc \
    37       SynTree/AddressExpr.cc \
    38       SynTree/Statement.cc \
    39       SynTree/CompoundStmt.cc \
    40       SynTree/DeclStmt.cc \
    41       SynTree/Declaration.cc \
    42       SynTree/DeclarationWithType.cc \
    43       SynTree/ObjectDecl.cc \
    44       SynTree/FunctionDecl.cc \
    45       SynTree/AggregateDecl.cc \
    46       SynTree/NamedTypeDecl.cc \
    47       SynTree/TypeDecl.cc \
    48       SynTree/Initializer.cc \
    49       SynTree/TypeSubstitution.cc \
    50       SynTree/Attribute.cc \
    51       SynTree/DeclReplacer.cc
     17SRC += SynTree/Type.cc \
     18       SynTree/VoidType.cc \
     19       SynTree/BasicType.cc \
     20       SynTree/PointerType.cc \
     21       SynTree/ArrayType.cc \
     22       SynTree/ReferenceType.cc \
     23       SynTree/FunctionType.cc \
     24       SynTree/ReferenceToType.cc \
     25       SynTree/TupleType.cc \
     26       SynTree/TypeofType.cc \
     27       SynTree/AttrType.cc \
     28       SynTree/VarArgsType.cc \
     29       SynTree/ZeroOneType.cc \
     30       SynTree/Constant.cc \
     31       SynTree/Expression.cc \
     32       SynTree/TupleExpr.cc \
     33       SynTree/CommaExpr.cc \
     34       SynTree/TypeExpr.cc \
     35       SynTree/ApplicationExpr.cc \
     36       SynTree/AddressExpr.cc \
     37       SynTree/Statement.cc \
     38       SynTree/CompoundStmt.cc \
     39       SynTree/DeclStmt.cc \
     40       SynTree/Declaration.cc \
     41       SynTree/DeclarationWithType.cc \
     42       SynTree/ObjectDecl.cc \
     43       SynTree/FunctionDecl.cc \
     44       SynTree/AggregateDecl.cc \
     45       SynTree/NamedTypeDecl.cc \
     46       SynTree/TypeDecl.cc \
     47       SynTree/Initializer.cc \
     48       SynTree/TypeSubstitution.cc \
     49       SynTree/Attribute.cc \
     50       SynTree/DeclReplacer.cc
    5251
    53 SRC += $(SRC_SYNTREE)
    54 SRCDEMANGLE += $(SRC_SYNTREE)
  • src/Tuples/TupleExpansion.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 13 18:14:12 2019
    13 // Update Count     : 21
     12// Last Modified On : Wed Jun 21 17:35:04 2017
     13// Update Count     : 19
    1414//
    1515
  • src/Tuples/module.mk

    r53bb8f1 r9d9a451  
    1515###############################################################################
    1616
    17 SRC += Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc Tuples/Explode.cc
    18 SRCDEMANGLE += Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc Tuples/Explode.cc
     17SRC +=  Tuples/TupleAssignment.cc \
     18        Tuples/TupleExpansion.cc \
     19        Tuples/Explode.cc
  • src/Validate/module.mk

    r53bb8f1 r9d9a451  
    1616
    1717SRC += Validate/HandleAttributes.cc
    18 SRCDEMANGLE += Validate/HandleAttributes.cc
  • src/cfa.make

    r53bb8f1 r9d9a451  
    3232am__v_GOC_1 =
    3333
    34 UPPCC = u++
     34
    3535UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
    3636
  • src/config.h.in

    r53bb8f1 r9d9a451  
    5252#undef CFA_VERSION_SHORT
    5353
    54 /* Have compiler warning cast-function-type. */
    55 #undef HAVE_CAST_FUNCTION_TYPE
     54/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
     55   systems. This function is required for `alloca.c' support on those systems.
     56   */
     57#undef CRAY_STACKSEG_END
     58
     59/* Define to 1 if using `alloca.c'. */
     60#undef C_ALLOCA
     61
     62/* Define to 1 if you have `alloca', as a function or macro. */
     63#undef HAVE_ALLOCA
     64
     65/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
     66   */
     67#undef HAVE_ALLOCA_H
    5668
    5769/* Define to 1 if you have the <dlfcn.h> header file. */
    5870#undef HAVE_DLFCN_H
    5971
     72/* Define to 1 if you have the <fenv.h> header file. */
     73#undef HAVE_FENV_H
     74
     75/* Define to 1 if you have the <float.h> header file. */
     76#undef HAVE_FLOAT_H
     77
    6078/* Define to 1 if you have the <inttypes.h> header file. */
    6179#undef HAVE_INTTYPES_H
    6280
    63 /* Have keywords _FloatXX. */
    64 #undef HAVE_KEYWORDS_FLOATXX
    65 
    6681/* Define to 1 if you have the <libintl.h> header file. */
    6782#undef HAVE_LIBINTL_H
    6883
     84/* Define to 1 if you have the <limits.h> header file. */
     85#undef HAVE_LIMITS_H
     86
    6987/* Define to 1 if you have the <malloc.h> header file. */
    7088#undef HAVE_MALLOC_H
     
    7391#undef HAVE_MEMORY_H
    7492
     93/* Define to 1 if you have the `memset' function. */
     94#undef HAVE_MEMSET
     95
     96/* Define to 1 if you have the `putenv' function. */
     97#undef HAVE_PUTENV
     98
     99/* Define to 1 if stdbool.h conforms to C99. */
     100#undef HAVE_STDBOOL_H
     101
     102/* Define to 1 if you have the <stddef.h> header file. */
     103#undef HAVE_STDDEF_H
     104
    75105/* Define to 1 if you have the <stdint.h> header file. */
    76106#undef HAVE_STDINT_H
     
    79109#undef HAVE_STDLIB_H
    80110
     111/* Define to 1 if you have the `strchr' function. */
     112#undef HAVE_STRCHR
     113
    81114/* Define to 1 if you have the <strings.h> header file. */
    82115#undef HAVE_STRINGS_H
     
    85118#undef HAVE_STRING_H
    86119
     120/* Define to 1 if you have the `strtol' function. */
     121#undef HAVE_STRTOL
     122
    87123/* Define to 1 if you have the <sys/stat.h> header file. */
    88124#undef HAVE_SYS_STAT_H
     
    94130#undef HAVE_UNISTD_H
    95131
    96 /* Define to 1 if the system has the type `_Float32'. */
    97 #undef HAVE__FLOAT32
     132/* Define to 1 if the system has the type `_Bool'. */
     133#undef HAVE__BOOL
    98134
    99135/* Define to the sub-directory where libtool stores uninstalled libraries. */
     
    120156/* Define to the version of this package. */
    121157#undef PACKAGE_VERSION
     158
     159/* If using the C implementation of alloca, define if you know the
     160   direction of stack growth for your system; otherwise it will be
     161   automatically deduced at runtime.
     162        STACK_DIRECTION > 0 => grows toward higher addresses
     163        STACK_DIRECTION < 0 => grows toward lower addresses
     164        STACK_DIRECTION = 0 => direction of growth unknown */
     165#undef STACK_DIRECTION
    122166
    123167/* Define to 1 if you have the ANSI C header files. */
     
    136180   `char[]'. */
    137181#undef YYTEXT_POINTER
     182
     183/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
     184   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
     185   #define below would cause a syntax error. */
     186#undef _UINT32_T
     187
     188/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
     189   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
     190   #define below would cause a syntax error. */
     191#undef _UINT8_T
     192
     193/* Define to `__inline__' or `__inline' if that's what the C compiler
     194   calls it, or to nothing if 'inline' is not supported under any name.  */
     195#ifndef __cplusplus
     196#undef inline
     197#endif
     198
     199/* Define to the type of a signed integer type of width exactly 16 bits if
     200   such a type exists and the standard includes do not define it. */
     201#undef int16_t
     202
     203/* Define to the type of a signed integer type of width exactly 32 bits if
     204   such a type exists and the standard includes do not define it. */
     205#undef int32_t
     206
     207/* Define to the type of a signed integer type of width exactly 8 bits if such
     208   a type exists and the standard includes do not define it. */
     209#undef int8_t
     210
     211/* Define to the equivalent of the C99 'restrict' keyword, or to
     212   nothing if this is not supported.  Do not define if restrict is
     213   supported directly.  */
     214#undef restrict
     215/* Work around a bug in Sun C++: it does not support _Restrict or
     216   __restrict__, even though the corresponding Sun C compiler ends up with
     217   "#define restrict _Restrict" or "#define restrict __restrict__" in the
     218   previous line.  Perhaps some future version of Sun C++ will work with
     219   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
     220#if defined __SUNPRO_CC && !defined __RESTRICT
     221# define _Restrict
     222# define __restrict__
     223#endif
     224
     225/* Define to `unsigned int' if <sys/types.h> does not define. */
     226#undef size_t
     227
     228/* Define to the type of an unsigned integer type of width exactly 16 bits if
     229   such a type exists and the standard includes do not define it. */
     230#undef uint16_t
     231
     232/* Define to the type of an unsigned integer type of width exactly 32 bits if
     233   such a type exists and the standard includes do not define it. */
     234#undef uint32_t
     235
     236/* Define to the type of an unsigned integer type of width exactly 8 bits if
     237   such a type exists and the standard includes do not define it. */
     238#undef uint8_t
  • src/main.cc

    r53bb8f1 r9d9a451  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Feb 16 09:14:04 2019
    13 // Update Count     : 500
     12// Last Modified On : Wed Jun  6 15:51:47 2018
     13// Update Count     : 498
    1414//
    1515
     
    3737#include "CodeTools/TrackLoc.h"             // for fillLocations
    3838#include "Common/CompilerError.h"           // for CompilerError
    39 #include "Common/Stats.h"
     39#include "Common/Heap.h"
    4040#include "Common/PassVisitor.h"
    4141#include "Common/SemanticError.h"           // for SemanticError
     
    6565using namespace std;
    6666
    67 
    68 void NewPass(const char * const name) {
    69         Stats::Heap::newPass(name);
    70         using namespace Stats::Counters;
    71         static auto pass_visitor_group = build<CounterGroup>("Pass Visitor");
    72         auto pass = build<CounterGroup>(name, pass_visitor_group);
    73         pass_visitor_stats.depth = 0;
    74         pass_visitor_stats.avg = build<AverageCounter<double>>("Average Depth", pass);
    75         pass_visitor_stats.max = build<MaxCounter<double>>("Max Depth", pass);
    76 }
    77 
    78 #define PASS(name, pass)                  \
     67#define PASS(name, pass)                   \
    7968        if ( errorp ) { cerr << name << endl; } \
    80         NewPass(name);                          \
    81         Stats::Time::StartBlock(name);          \
    82         pass;                                   \
    83         Stats::Time::StopBlock();
     69        HeapStats::newPass(name);               \
     70        pass;
    8471
    8572LinkageSpec::Spec linkage = LinkageSpec::Cforall;
     
    155142        backtrace( 6 );                                                                         // skip first 6 stack frames
    156143        signal( SIGABRT, SIG_DFL);                                                      // reset default signal handler
    157                 raise( SIGABRT );                                                                       // reraise SIGABRT
     144    raise( SIGABRT );                                                                   // reraise SIGABRT
    158145} // sigAbortHandler
    159146
     
    161148int main( int argc, char * argv[] ) {
    162149        FILE * input;                                                                           // use FILE rather than istream because yyin is FILE
    163         ostream * output = & cout;
    164         const char * filename = nullptr;
     150        ostream *output = & cout;
     151        const char *filename = nullptr;
    165152        list< Declaration * > translationUnit;
    166153
     
    194181                } // if
    195182
    196                 Stats::Time::StartGlobal();
    197                 NewPass("Parse");
    198                 Stats::Time::StartBlock("Parse");
    199 
    200183                // read in the builtins, extras, and the prelude
    201184                if ( ! nopreludep ) {                                                   // include gcc builtins
     
    248231                // works okay for now.
    249232                CodeTools::fillLocations( translationUnit );
    250                 Stats::Time::StopBlock();
    251233
    252234                // add the assignment statement after the initialization of a type parameter
    253                 PASS( "Validate", SymTab::validate( translationUnit, symtabp ) );
     235                PASS( "validate", SymTab::validate( translationUnit, symtabp ) );
    254236                if ( symtabp ) {
    255237                        deleteAll( translationUnit );
     
    268250                } // if
    269251
    270                 PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) );
    271                 PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
    272                 PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
    273                 PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
     252                PASS( "fixLabels", ControlStruct::fixLabels( translationUnit ) );
     253                PASS( "fixNames", CodeGen::fixNames( translationUnit ) );
     254                PASS( "genInit", InitTweak::genInit( translationUnit ) );
     255                PASS( "expandMemberTuples" , Tuples::expandMemberTuples( translationUnit ) );
    274256                if ( libcfap ) {
    275257                        // generate the bodies of cfa library functions
     
    295277                }
    296278
    297                 PASS( "Resolve", ResolvExpr::resolve( translationUnit ) );
     279                PASS( "resolve", ResolvExpr::resolve( translationUnit ) );
    298280                if ( exprp ) {
    299281                        dump( translationUnit );
     
    302284
    303285                // fix ObjectDecl - replaces ConstructorInit nodes
    304                 PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) );
     286                PASS( "fixInit", InitTweak::fix( translationUnit, buildingLibrary() ) );
    305287                if ( ctorinitp ) {
    306288                        dump ( translationUnit );
     
    308290                } // if
    309291
    310                 PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
    311 
    312                 PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) );
    313 
    314                 PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) );
    315 
    316                 PASS( "Convert Specializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
    317 
    318                 PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
     292                PASS( "expandUniqueExpr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
     293
     294                PASS( "translateEHM" , ControlStruct::translateEHM( translationUnit ) );
     295
     296                PASS( "generateWaitfor" , Concurrency::generateWaitFor( translationUnit ) );
     297
     298                PASS( "convertSpecializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
     299
     300                PASS( "expandTuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
    319301
    320302                if ( tuplep ) {
     
    323305                }
    324306
    325                 PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
    326 
    327                 PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) );
     307                PASS( "virtual expandCasts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
     308
     309                PASS( "instantiateGenerics", GenPoly::instantiateGeneric( translationUnit ) );
    328310                if ( genericsp ) {
    329311                        dump( translationUnit );
    330312                        return 0;
    331313                }
    332                 PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) );
     314                PASS( "convertLvalue", GenPoly::convertLvalue( translationUnit ) );
    333315
    334316
     
    337319                        return 0;
    338320                } // if
    339                 PASS( "Box", GenPoly::box( translationUnit ) );
     321                PASS( "box", GenPoly::box( translationUnit ) );
    340322
    341323                if ( bcodegenp ) {
     
    349331
    350332                CodeTools::fillLocations( translationUnit );
    351                 PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
     333                PASS( "codegen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
    352334
    353335                CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() );
     
    389371                        }
    390372                } catch(const std::exception& e) {
    391                         std::cerr << "Uncaught Exception \"" << e.what() << "\"\n";
     373                        std::cerr << "Unaught Exception \"" << e.what() << "\"\n";
    392374                }
    393375                return 1;
     
    395377
    396378        deleteAll( translationUnit );
    397         Stats::print();
    398 
     379        if(!libcfap && !treep) HeapStats::printStats();
    399380        return 0;
    400381} // main
    401382
    402383void parse_cmdline( int argc, char * argv[], const char *& filename ) {
    403         enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, PreludeDir, Prototypes, Resolver, ResolvProto, Stats, Symbol, Tree, TupleExpansion, Validate};
     384        enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, PreludeDir, Prototypes, Resolver, ResolvProto, Symbol, Tree, TupleExpansion, Validate, };
    404385
    405386        static struct option long_opts[] = {
     
    421402                { "resolver", no_argument, 0, Resolver },
    422403                { "resolv-proto", no_argument, 0, ResolvProto },
    423                 { "stats", required_argument, 0, Stats },
    424404                { "symbol", no_argument, 0, Symbol },
    425405                { "tree", no_argument, 0, Tree },
     
    436416        while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrRstTvwW:yzZD:F:", long_opts, &long_index )) != -1 ) {
    437417                switch ( c ) {
    438                         case Ast:
    439                         case 'a':                                                                               // dump AST
     418                  case Ast:
     419                  case 'a':                                                                             // dump AST
    440420                        astp = true;
    441421                        break;
    442                         case Bresolver:
    443                         case 'b':                                                                               // print before resolver steps
     422                  case Bresolver:
     423                  case 'b':                                                                             // print before resolver steps
    444424                        bresolvep = true;
    445425                        break;
    446                         case 'B':                                                                               // print before box steps
     426                  case 'B':                                                                             // print before box steps
    447427                        bboxp = true;
    448428                        break;
    449                         case CtorInitFix:
    450                         case 'c':                                                                               // print after constructors and destructors are replaced
     429                  case CtorInitFix:
     430                  case 'c':                                                                             // print after constructors and destructors are replaced
    451431                        ctorinitp = true;
    452432                        break;
    453                         case 'C':                                                                               // print before code generation
     433                  case 'C':                                                                             // print before code generation
    454434                        bcodegenp = true;
    455435                        break;
    456                         case DeclStats:
    457                         case 'd':
    458                                 declstatsp = true;
    459                         break;
    460                         case Expr:
    461                         case 'e':                                                                               // dump AST after expression analysis
     436                  case DeclStats:
     437                  case 'd':
     438                    declstatsp = true;
     439                        break;
     440                  case Expr:
     441                  case 'e':                                                                             // dump AST after expression analysis
    462442                        exprp = true;
    463443                        break;
    464                         case ExprAlt:
    465                         case 'f':                                                                               // print alternatives for expressions
     444                  case ExprAlt:
     445                  case 'f':                                                                             // print alternatives for expressions
    466446                        expraltp = true;
    467447                        break;
    468                         case Grammar:
    469                         case 'g':                                                                               // bison debugging info (grammar rules)
     448                  case Grammar:
     449                  case 'g':                                                                             // bison debugging info (grammar rules)
    470450                        yydebug = true;
    471451                        break;
    472                         case 'G':                                                                               // dump AST after instantiate generics
     452                  case 'G':                                                                             // dump AST after instantiate generics
    473453                        genericsp = true;
    474454                        break;
    475                         case LibCFA:
    476                         case 'l':                                                                               // generate libcfa.c
     455                  case LibCFA:
     456                  case 'l':                                                                             // generate libcfa.c
    477457                        libcfap = true;
    478458                        break;
    479                         case Linemarks:
    480                         case 'L':                                                                               // print lines marks
     459                  case Linemarks:
     460                  case 'L':                                                                             // print lines marks
    481461                        linemarks = true;
    482462                        break;
    483                         case Nopreamble:
    484                         case 'n':                                                                               // do not read preamble
     463                  case Nopreamble:
     464                  case 'n':                                                                             // do not read preamble
    485465                        nopreludep = true;
    486466                        break;
    487                         case Nolinemarks:
    488                         case 'N':                                                                               // suppress line marks
     467                  case Nolinemarks:
     468                  case 'N':                                                                             // suppress line marks
    489469                        linemarks = false;
    490470                        break;
    491                         case Prototypes:
    492                         case 'p':                                                                               // generate prototypes for preamble functions
     471                  case Prototypes:
     472                  case 'p':                                                                             // generate prototypes for preamble functions
    493473                        noprotop = true;
    494474                        break;
    495                         case PreludeDir:
    496                                 PreludeDirector = optarg;
    497                         break;
    498                         case 'm':                                                                               // don't replace the main
    499                                 nomainp = true;
    500                         break;
    501                         case Parse:
    502                         case 'q':                                                                               // dump parse tree
     475                  case PreludeDir:
     476                        PreludeDirector = optarg;
     477                        break;
     478                  case 'm':                                                                             // don't replace the main
     479                        nomainp = true;
     480                        break;
     481                  case Parse:
     482                  case 'q':                                                                             // dump parse tree
    503483                        parsep = true;
    504484                        break;
    505                         case Resolver:
    506                         case 'r':                                                                               // print resolver steps
     485                  case Resolver:
     486                  case 'r':                                                                             // print resolver steps
    507487                        resolvep = true;
    508488                        break;
    509                         case 'R':                                                                               // dump resolv-proto instance
     489                  case 'R':                                                                             // dump resolv-proto instance
    510490                        resolvprotop = true;
    511491                        break;
    512                         case Stats:
    513                                 Stats::parse_params(optarg);
    514                         break;
    515                         case Symbol:
    516                         case 's':                                                                               // print symbol table events
     492                  case Symbol:
     493                  case 's':                                                                             // print symbol table events
    517494                        symtabp = true;
    518495                        break;
    519                         case Tree:
    520                         case 't':                                                                               // build in tree
     496                  case Tree:
     497                  case 't':                                                                             // build in tree
    521498                        treep = true;
    522499                        break;
    523                         case TupleExpansion:
    524                         case 'T':                                                                               // print after tuple expansion
     500                  case TupleExpansion:
     501                  case 'T':                                                                             // print after tuple expansion
    525502                        tuplep = true;
    526503                        break;
    527                         case 'v':                                                                               // dump AST after decl validation pass
     504                  case 'v':                                                                             // dump AST after decl validation pass
    528505                        validp = true;
    529506                        break;
    530                         case 'w':
     507                  case 'w':
    531508                        Wsuppress = true;
    532509                        break;
    533                         case 'W':
     510                  case 'W':
    534511                        if ( strcmp( optarg, "all" ) == 0 ) {
    535512                                SemanticWarning_EnableAll();
     
    548525                        } // if
    549526                        break;
    550                         case 'y':                                                                               // dump AST on error
     527                  case 'y':                                                                             // dump AST on error
    551528                        errorp = true;
    552529                        break;
    553                         case 'z':                                                                               // dump as codegen rather than AST
     530                  case 'z':                                                                             // dump as codegen rather than AST
    554531                        codegenp = true;
    555532                        break;
     
    557534                        prettycodegenp = true;
    558535                        break;
    559                         case 'D':                                                                               // ignore -Dxxx
    560                         break;
    561                         case 'F':                                                                               // source file-name without suffix
     536                  case 'D':                                                                             // ignore -Dxxx
     537                        break;
     538                  case 'F':                                                                             // source file-name without suffix
    562539                        filename = optarg;
    563540                        break;
    564                         case '?':
     541                  case '?':
    565542                        if ( optopt ) {                                                         // short option ?
    566543                                assertf( false, "Unknown option: -%c\n", (char)optopt );
     
    571548                                __attribute__((fallthrough));
    572549                        #endif
    573                         default:
     550                  default:
    574551                        abort();
    575552                } // switch
  • tests/.expect/castError.txt

    r53bb8f1 r9d9a451  
    1 castError.cfa:21:1 error: Cannot choose between 3 alternatives for expression
    2 Explicit Cast of:
     1castError.cfa:7:1 error: Cannot choose between 3 alternatives for expression
     2Cast of:
    33  Name: f
    44... to:
    55  char Alternatives are:
    6 Cost ( 1, 0, 0, 0, 0, 0, 0 ): Explicit Cast of:
     6Cost ( 1, 0, 0, 0, 0, 0 ): Cast of:
    77     Variable Expression: f: function
    88       accepting unspecified arguments
     
    1616 Environment:
    1717
    18 Cost ( 1, 0, 0, 0, 0, 0, 0 ): Explicit Cast of:
     18Cost ( 1, 0, 0, 0, 0, 0 ): Cast of:
    1919     Variable Expression: f: double
    2020   ... to:
     
    2525 Environment:
    2626
    27 Cost ( 1, 0, 0, 0, 0, 0, 0 ): Explicit Cast of:
     27Cost ( 1, 0, 0, 0, 0, 0 ): Cast of:
    2828     Variable Expression: f: signed int
    2929   ... to:
     
    3535
    3636
    37 castError.cfa:26:1 error: Cannot choose between 2 alternatives for expression
    38 Generated Cast of:
    39   Comma Expression:
    40     constant expression (3 3: signed int)
    41     Name: v
    42 ... to: nothing Alternatives are:
    43 Cost ( 0, 0, 2, 0, 0, 0, 0 ): Generated Cast of:
    44      Comma Expression:
    45        constant expression (3 3: signed int)
    46        Variable Expression: v: unsigned char
    47    ... to: nothing
    48  (types:
    49    void
    50  )
    51  Environment:
    52 
    53 Cost ( 0, 0, 2, 0, 0, 0, 0 ): Generated Cast of:
    54      Comma Expression:
    55        constant expression (3 3: signed int)
    56        Variable Expression: v: signed short int
    57    ... to: nothing
    58  (types:
    59    void
    60  )
    61  Environment:
    62 
    63 
  • tests/.expect/completeTypeError.txt

    r53bb8f1 r9d9a451  
    4545
    4646Alternatives with failing assertions are:
    47 Cost ( 0, 1, 0, 0, 1, -5, 0 ): Application of
     47Cost ( 0, 1, 0, 1, -5, 0 ): Application of
    4848     Variable Expression: baz: forall
    4949       T: sized object type
     
    8787   void
    8888 )
    89  Environment:( _74_0_T ) -> instance of type T (not function type) (no widening)
     89 Environment:( _73_0_T ) -> instance of type T (not function type) (no widening)
    9090
    9191
  • tests/.expect/declarationSpecifier.x64.txt

    r53bb8f1 r9d9a451  
    689689signed int _X4mainFi_iPPKc__1(signed int _X4argci_1, const char **_X4argvPPKc_1){
    690690    __attribute__ ((unused)) signed int _X12_retval_maini_1;
    691     ((void)(_X12_retval_maini_1=0) /* ?{} */);
     691    ((void)(_X12_retval_maini_1=((signed int )0)) /* ?{} */);
    692692    return _X12_retval_maini_1;
    693693    ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/declarationSpecifier.x86.txt

    r53bb8f1 r9d9a451  
    689689signed int _X4mainFi_iPPKc__1(signed int _X4argci_1, const char **_X4argvPPKc_1){
    690690    __attribute__ ((unused)) signed int _X12_retval_maini_1;
    691     ((void)(_X12_retval_maini_1=0) /* ?{} */);
     691    ((void)(_X12_retval_maini_1=((signed int )0)) /* ?{} */);
    692692    return _X12_retval_maini_1;
    693693    ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/gccExtensions.x64.txt

    r53bb8f1 r9d9a451  
    162162    signed int _X2m2A0A0i_2[((unsigned long int )10)][((unsigned long int )10)];
    163163    signed int _X2m3A0A0i_2[((unsigned long int )10)][((unsigned long int )10)];
    164     ((void)(_X12_retval_maini_1=0) /* ?{} */);
     164    ((void)(_X12_retval_maini_1=((signed int )0)) /* ?{} */);
    165165    return _X12_retval_maini_1;
    166166    ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/gccExtensions.x86.txt

    r53bb8f1 r9d9a451  
    162162    signed int _X2m2A0A0i_2[((unsigned int )10)][((unsigned int )10)];
    163163    signed int _X2m3A0A0i_2[((unsigned int )10)][((unsigned int )10)];
    164     ((void)(_X12_retval_maini_1=0) /* ?{} */);
     164    ((void)(_X12_retval_maini_1=((signed int )0)) /* ?{} */);
    165165    return _X12_retval_maini_1;
    166166    ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/io1.txt

    r53bb8f1 r9d9a451  
    119 6 28 0 7 1 2
    2 0 1 2 3
    3 0123
    4 0123
     21 2 3
     3123
     4123
    55
    66opening delimiters
  • tests/.expect/loopctrl.txt

    r53bb8f1 r9d9a451  
    191910 8 6 4 2
    2020
    21 2 4 6 8 10
    22 2.1 3.8 5.5 7.2 8.9
    23 10 8 6 4 2 0
    24 12.1 10.4 8.7 7 5.3 3.6
    2521
    2622N N N N N N N N N N
     
    282410 9 8 7 6 5 4 3 2 1
    2925
     26
    30273 6 9
     28
    3129
    3230(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)
  • tests/.expect/sum.txt

    r53bb8f1 r9d9a451  
    1 sum from 5 to 15 is 95, check 95
    2 sum from 5 to 15 is 95, check 95
    31sum from 5 to 15 is 95, check 95
    42sum from 5 to 15 is 95, check 95
  • tests/Makefile.in

    r53bb8f1 r9d9a451  
    186186DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    187187ACLOCAL = @ACLOCAL@
     188ALLOCA = @ALLOCA@
    188189AMTAR = @AMTAR@
    189190AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     
    349350am__v_GOC_0 = @echo "  GOC     " $@;
    350351am__v_GOC_1 =
    351 UPPCC = u++
    352352UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
    353353AM_V_UPP = $(am__v_UPP_@AM_V@)
  • tests/array.cfa

    r53bb8f1 r9d9a451  
    1 //                               -*- Mode: C -*-
    2 //
    3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    4 //
    5 // The contents of this file are covered under the licence agreement in the
    6 // file "LICENCE" distributed with Cforall.
    7 //
    8 // array.cfa -- test array declarations
    9 //
    10 // Author           : Peter A. Buhr
    11 // Created On       : Tue Feb 19 21:18:06 2019
    12 // Last Modified By : Peter A. Buhr
    13 // Last Modified On : Tue Feb 19 21:18:46 2019
    14 // Update Count     : 1
    15 //
    16 
     1//Testing array declarations
    172int a1[];
    183//int a2[*];
     
    4934}
    5035
    51 int main() {}
    52 
    53 // Local Variables: //
    54 // tab-width: 4 //
    55 // compile-command: "cfa array.cfa" //
    56 // End: //
     36//Dummy main
     37int main(int argc, char const *argv[])
     38{
     39        return 0;
     40}
  • tests/castError.cfa

    r53bb8f1 r9d9a451  
    1 //
    2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    3 //
    4 // The contents of this file are covered under the licence agreement in the
    5 // file "LICENCE" distributed with Cforall.
    6 //
    7 // castError.cfa -- test invalid casts
    8 //
    9 // Author           : Peter A. Buhr
    10 // Created On       : Tue Feb 19 21:15:39 2019
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb 19 21:16:44 2019
    13 // Update Count     : 1
    14 //
    15 
     1//Testing some of the invalid casts of chars
    162int f;
    173
     
    217        (char)f;
    228        (int(*)())f;
    23 
    24         unsigned char v;
    25         short int v;
    26         3, v;           // implicit void cast
    279}
    2810
    29 int main() {}
    30 
    31 // Local Variables: //
    32 // tab-width: 4 //
    33 // compile-command: "cfa castError.cfa" //
    34 // End: //
     11//Dummy main
     12int main(int argc, char const *argv[])
     13{
     14        return 0;
     15}
  • tests/concurrent/examples/boundedBufferEXT.cfa

    r53bb8f1 r9d9a451  
    11//
    2 // Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
    3 //
    42// The contents of this file are covered under the licence agreement in the
    53// file "LICENCE" distributed with Cforall.
     
    108// Created On       : Wed Apr 18 22:52:12 2018
    119// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 20 08:36:45 2019
    13 // Update Count     : 11
     10// Last Modified On : Tue Dec 11 21:55:02 2018
     11// Update Count     : 9
    1412//
    1513
    16 #include <stdlib.hfa>                                                                   // random
     14#include <stdlib.hfa>                                                                           // random
    1715#include <fstream.hfa>
    1816#include <kernel.hfa>
  • tests/concurrent/examples/boundedBufferINT.cfa

    r53bb8f1 r9d9a451  
    11//
    2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
    3 //
    42// The contents of this file are covered under the licence agreement in the
    53// file "LICENCE" distributed with Cforall.
     
    108// Created On       : Mon Oct 30 12:45:13 2017
    119// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 20 08:37:24 2019
    13 // Update Count     : 87
     10// Last Modified On : Tue Dec 11 21:55:45 2018
     11// Update Count     : 84
    1412//
    1513
    16 #include <stdlib.hfa>                                                                   // random
     14#include <stdlib.hfa>                                                                           // random
    1715#include <fstream.hfa>
    1816#include <kernel.hfa>
  • tests/concurrent/examples/datingService.cfa

    r53bb8f1 r9d9a451  
    11//
    2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
    3 //
    42// The contents of this file are covered under the licence agreement in the
    53// file "LICENCE" distributed with Cforall.
     
    108// Created On       : Mon Oct 30 12:56:20 2017
    119// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 20 08:37:12 2019
    13 // Update Count     : 30
     10// Last Modified On : Tue Dec 11 21:55:34 2018
     11// Update Count     : 28
    1412//
    1513
    16 #include <stdlib.hfa>                                                                   // random
     14#include <stdlib.hfa>                                                                           // random
    1715#include <fstream.hfa>
    1816#include <kernel.hfa>
  • tests/concurrent/examples/matrixSum.cfa

    r53bb8f1 r9d9a451  
     1//                               -*- Mode: C -*-
    12//
    23// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     
    1011// Created On       : Mon Oct  9 08:29:28 2017
    1112// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 20 08:37:53 2019
    13 // Update Count     : 16
     13// Last Modified On : Tue Dec 11 21:54:55 2018
     14// Update Count     : 15
    1415//
    1516
  • tests/concurrent/examples/quickSort.cfa

    r53bb8f1 r9d9a451  
    1 //
    2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
    31//
    42// The contents of this file are covered under the licence agreement in the
     
    119// Created On       : Wed Dec  6 12:15:52 2017
    1210// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Wed Feb 20 08:38:24 2019
    14 // Update Count     : 169
     11// Last Modified On : Sat Dec 22 08:44:27 2018
     12// Update Count     : 168
    1513//
    1614
  • tests/io1.cfa

    r53bb8f1 r9d9a451  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  4 21:42:47 2019
    13 // Update Count     : 115
     12// Last Modified On : Fri Dec 21 16:02:55 2018
     13// Update Count     : 114
    1414//
    1515
     
    1919        int x = 3, y = 5, z = 7;
    2020        sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2);
    21         sout | 0 | 1 | 2 | 3;
    22         sout | '0' | '1' | '2' | '3';
    23         sout | 0 | "" | 1 | "" | 2 | "" | 3;
     21        sout | 1 | 2 | 3;
     22        sout | '1' | '2' | '3';
     23        sout | 1 | "" | 2 | "" | 3;
    2424        sout | nl;
    2525
  • tests/literals.cfa

    r53bb8f1 r9d9a451  
    1010// Created On       : Sat Sep  9 16:34:38 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb 12 08:07:39 2019
    13 // Update Count     : 224
    14 //
    15 
    16 #include <features.h>                                                                   // __GNUC_PREREQ
     12// Last Modified On : Tue Dec  4 21:44:01 2018
     13// Update Count     : 139
     14//
     15
    1716#ifdef __CFA__
     17#include <stdint.h>
    1818#include <fstream.hfa>
    1919
     
    151151        -0X0123456789.0123456789P-09;  -0X0123456789.0123456789P-09f;  -0X0123456789.0123456789P-09l;  -0X0123456789.0123456789P-09F;  -0X0123456789.0123456789P-09L;
    152152
    153 #if defined(__GNUC__) && __GNUC_PREREQ(7,0)                             // gcc version >= 7
    154 // floating with length, gcc f16/f128x unsupported and no prelude code for any _FloatXXx, so they work by conversion to long double
    155 
    156         /*  0123456789.f16; */   0123456789.f32;   0123456789.f32x;   0123456789.f64;   0123456789.f64x;   0123456789.W;   0123456789.f128;   0123456789.q;  /*  0123456789.f128x; */
    157         /* +0123456789.f16; */  +0123456789.f32;  +0123456789.f32x;  +0123456789.f64;  +0123456789.f64x;  +0123456789.w;  +0123456789.f128;  +0123456789.Q;  /* +0123456789.f128x; */
    158         /* -0123456789.f16; */  -0123456789.f32;  -0123456789.f32x;  -0123456789.f64;  -0123456789.f64x;  -0123456789.W;  -0123456789.f128;  -0123456789.q;  /* -0123456789.f128x; */
    159 
    160         /*  0123456789.e09F16; */    0123456789.e09F32;    0123456789.e09F32x;    0123456789.e09F64;    0123456789.e09F64x;    0123456789.e09W;    0123456789.e09F128;    0123456789.e09q;   /*  .0123456789e09q; */
    161         /* +0123456789.e+09F16; */  +0123456789.e+09F32;  +0123456789.e+09F32x;  +0123456789.e+09F64;  +0123456789.e+09F64x;  +0123456789.e+09w;  +0123456789.e+09F128;  +0123456789.e+09Q;  /* +.0123456789E+09Q; */
    162         /* -0123456789.e-09F16; */  -0123456789.e-09F32;  -0123456789.e-09F32x;  -0123456789.e-09F64;  -0123456789.e-09F64x;  -0123456789.e-09W;  -0123456789.e-09F128;  -0123456789.e-09q;  /* -.0123456789E-09q; */
    163 
    164         /*  .0123456789e09F16; */    .0123456789e09F32;    .0123456789e09F32x;    .0123456789e09F64;    .0123456789e09F64x;    .0123456789e09W;    .0123456789e09F128;    .0123456789e09q;   /*  .0123456789e09q; */
    165         /* +.0123456789e+09F16; */  +.0123456789e+09F32;  +.0123456789e+09F32x;  +.0123456789e+09F64;  +.0123456789e+09F64x;  +.0123456789e+09w;  +.0123456789e+09F128;  +.0123456789e+09Q;  /* +.0123456789E+09Q; */
    166         /* -.0123456789e-09F16; */  -.0123456789e-09F32;  -.0123456789e-09F32x;  -.0123456789e-09F64;  -.0123456789e-09F64x;  -.0123456789e-09W;  -.0123456789e-09F128;  -.0123456789e-09q;  /* -.0123456789E-09q; */
    167 
    168         /*  0123456789.0123456789F16; */   0123456789.0123456789F32;   0123456789.0123456789F32x;   0123456789.0123456789F64;   0123456789.0123456789F64x;   0123456789.0123456789W;   0123456789.0123456789F128;   0123456789.0123456789q;  /*  0123456789.0123456789q; */
    169         /* +0123456789.0123456789F16; */  +0123456789.0123456789F32;  +0123456789.0123456789F32x;  +0123456789.0123456789F64;  +0123456789.0123456789F64x;  +0123456789.0123456789w;  +0123456789.0123456789F128;  +0123456789.0123456789Q;  /* +0123456789.0123456789Q; */
    170         /* -0123456789.0123456789F16; */  -0123456789.0123456789F32;  -0123456789.0123456789F32x;  -0123456789.0123456789F64;  -0123456789.0123456789F64x;  -0123456789.0123456789W;  -0123456789.0123456789F128;  -0123456789.0123456789q;  /* -0123456789.0123456789q; */
    171 
    172         /*  0123456789.0123456789E09F16; */    0123456789.0123456789E09F32;    0123456789.0123456789E09F32x;    0123456789.0123456789E09F64;    0123456789.0123456789E09F64x;    0123456789.0123456789E09W;    0123456789.0123456789E09F128;    0123456789.0123456789E09q;   /*  0123456789.0123456789E09q; */
    173         /* +0123456789.0123456789E+09F16; */  +0123456789.0123456789E+09F32;  +0123456789.0123456789E+09F32x;  +0123456789.0123456789E+09F64;  +0123456789.0123456789E+09F64x;  +0123456789.0123456789E+09w;  +0123456789.0123456789E+09F128;  +0123456789.0123456789E+09Q;  /* +0123456789.0123456789E+09Q; */
    174         /* -0123456789.0123456789E-09F16; */  -0123456789.0123456789E-09F32;  -0123456789.0123456789E-09F32x;  -0123456789.0123456789E-09F64;  -0123456789.0123456789E-09F64x;  -0123456789.0123456789E-09W;  -0123456789.0123456789E-09F128;  -0123456789.0123456789E-09q;  /* -0123456789.0123456789E-09q; */
    175 
    176         /*  0x123456789.p09f16; */    0x123456789.p09f32;    0x123456789.p09f32x;    0x123456789.p09f64;    0x123456789.p09f64x;    0x123456789.p09W;    0x123456789.p09f128;    0x123456789.p09q;   /*  0x123456789.p09f128x; */
    177         /* +0x123456789.P+09f16; */  +0x123456789.P+09f32;  +0x123456789.P+09f32x;  +0x123456789.P+09f64;  +0x123456789.P+09f64x;  +0x123456789.P+09w;  +0x123456789.P+09f128;  +0x123456789.P+09Q;  /* +0x123456789.P+09f128x; */
    178         /* -0x123456789.P-09f16; */  -0x123456789.P-09f32;  -0x123456789.P-09f32x;  -0x123456789.P-09f64;  -0x123456789.P-09f64x;  -0x123456789.P-09W;  -0x123456789.P-09f128;  -0x123456789.P-09q;  /* -0x123456789.P-09f128x; */
    179 
    180         /*  0x123456789.p09F16; */    0x123456789.p09F32;    0x123456789.p09F32x;    0x123456789.p09F64;    0x123456789.p09F64x;    0x123456789.p09W;    0x123456789.p09F128;    0x123456789.p09q;   /*  .0123456789p09q; */
    181         /* +0x123456789.p+09F16; */  +0x123456789.p+09F32;  +0x123456789.p+09F32x;  +0x123456789.p+09F64;  +0x123456789.p+09F64x;  +0x123456789.p+09w;  +0x123456789.p+09F128;  +0x123456789.p+09Q;  /* +.0123456789p+09Q; */
    182         /* -0x123456789.p-09F16; */  -0x123456789.p-09F32;  -0x123456789.p-09F32x;  -0x123456789.p-09F64;  -0x123456789.p-09F64x;  -0x123456789.p-09W;  -0x123456789.p-09F128;  -0x123456789.p-09q;  /* -.0123456789P-09q; */
    183 
    184         /*  0X.0123456789p09F16; */    0X.0123456789p09F32;    0X.0123456789p09F32x;    0X.0123456789p09F64;    0X.0123456789p09F64x;    0X.0123456789p09W;    0X.0123456789p09F128;    0X.0123456789p09q;   /*  0X.0123456789p09q; */
    185         /* +0X.0123456789p+09F16; */  +0X.0123456789p+09F32;  +0X.0123456789p+09F32x;  +0X.0123456789p+09F64;  +0X.0123456789p+09F64x;  +0X.0123456789p+09w;  +0X.0123456789p+09F128;  +0X.0123456789p+09Q;  /* +0X.0123456789p+09Q; */
    186         /* -0X.0123456789p-09F16; */  -0X.0123456789p-09F32;  -0X.0123456789p-09F32x;  -0X.0123456789p-09F64;  -0X.0123456789p-09F64x;  -0X.0123456789p-09W;  -0X.0123456789p-09F128;  -0X.0123456789p-09q;  /* -0X.0123456789P-09q; */
    187 
    188         /*  0x123456789.0123456789P09F16; */    0x123456789.0123456789P09F32;    0x123456789.0123456789P09F32x;    0x123456789.0123456789P09F64;    0x123456789.0123456789P09F64x;    0x123456789.0123456789P09W;    0x123456789.0123456789P09F128;    0x123456789.0123456789P09q;   /*  0x123456789.0123456789P09q; */
    189         /* +0x123456789.0123456789P+09F16; */  +0x123456789.0123456789P+09F32;  +0x123456789.0123456789P+09F32x;  +0x123456789.0123456789P+09F64;  +0x123456789.0123456789P+09F64x;  +0x123456789.0123456789P+09w;  +0x123456789.0123456789P+09F128;  +0x123456789.0123456789P+09Q;  /* +0x123456789.0123456789P+09Q; */
    190         /* -0x123456789.0123456789p-09F16; */  -0x123456789.0123456789p-09F32;  -0x123456789.0123456789p-09F32x;  -0x123456789.0123456789p-09F64;  -0x123456789.0123456789p-09F64x;  -0x123456789.0123456789p-09W;  -0x123456789.0123456789p-09F128;  -0x123456789.0123456789p-09q;  /* -0x123456789.0123456789p-09q; */
    191 
    192         /*  0x123456789.0123456789P09F16; */    0x123456789.0123456789P09F32;    0x123456789.0123456789P09F32x;    0x123456789.0123456789P09F64;    0x123456789.0123456789P09F64x;    0x123456789.0123456789P09W;    0x123456789.0123456789P09F128;    0x123456789.0123456789P09q;   /*  0x123456789.0123456789P09q; */
    193         /* +0x123456789.0123456789p+09F16; */  +0x123456789.0123456789p+09F32;  +0x123456789.0123456789p+09F32x;  +0x123456789.0123456789p+09F64;  +0x123456789.0123456789p+09F64x;  +0x123456789.0123456789p+09w;  +0x123456789.0123456789p+09F128;  +0x123456789.0123456789p+09Q;  /* +0x123456789.0123456789p+09Q; */
    194         /* -0x123456789.0123456789P-09F16; */  -0x123456789.0123456789P-09F32;  -0x123456789.0123456789P-09F32x;  -0x123456789.0123456789P-09F64;  -0x123456789.0123456789P-09F64x;  -0x123456789.0123456789P-09W;  -0x123456789.0123456789P-09F128;  -0x123456789.0123456789P-09q;  /* -0x123456789.0123456789P-09q; */
    195 #endif // __GNUC_PREREQ(7,0)
    196 
    197153#ifdef __CFA__
    198154// fixed-size length
     
    211167        // octal
    212168         01234567_l8;   01234567_l16;   01234567_l32;   01234567_l64;   01234567_l8u;   01234567_ul16;   01234567_l32u;   01234567_ul64;
    213         +01234567_l8;  +01234567_l16;  +01234567_l32;  +01234567_l64;  +01234567_ul8;  +01234567_ul16;  +01234567_l32u;  +01234567_ul64;
     169        +01234567_l8;  +01234567_l16;  +01234567_l32;  +01234567_l64;  +01234567_l8u;  +01234567_ul16;  +01234567_l32u;  +01234567_ul64;
    214170        -01234567_l8;  -01234567_l16;  -01234567_l32;  -01234567_l64;  -01234567_l8u;  -01234567_ul16;  -01234567_l32u;  -01234567_ul64;
    215171
     
    247203        +0X0123456789ABCDEF_l8;  +0X0123456789ABCDEF_l16;  +0X0123456789ABCDEFl32;  +0X0123456789ABCDEFl64;  +0X0123456789ABCDEF_ul8;  +0X0123456789ABCDEF_l16u;  +0X0123456789ABCDEFul32;  +0X0123456789ABCDEFl64u;
    248204        -0X0123456789ABCDEF_l8;  -0X0123456789ABCDEF_l16;  -0X0123456789ABCDEFl32;  -0X0123456789ABCDEFl64;  -0X0123456789ABCDEF_ul8;  -0X0123456789ABCDEF_l16u;  -0X0123456789ABCDEFul32;  -0X0123456789ABCDEFl64u;
     205
     206        // floating
     207         0123456789.l32;   0123456789.l64;   0123456789.l80;   0123456789.l128;
     208        +0123456789.l32;  +0123456789.l64;  +0123456789.l80;  +0123456789.l128;
     209        -0123456789.l32;  -0123456789.l64;  -0123456789.l80;  -0123456789.l128;
     210
     211         0123456789.e09L32;    0123456789.e09L64;    0123456789.e09L80;    0123456789.e09L128;
     212        +0123456789.e+09L32;  +0123456789.e+09L64;  +0123456789.e+09L80;  +0123456789.e+09L128;
     213        -0123456789.e-09L32;  -0123456789.e-09L64;  -0123456789.e-09L80;  -0123456789.e-09L128;
     214
     215         .0123456789e09L32;    .0123456789e09L64;    .0123456789e09L80;    .0123456789e09L128;
     216        +.0123456789E+09L32;  +.0123456789E+09L64;  +.0123456789E+09L80;  +.0123456789E+09L128;
     217        -.0123456789E-09L32;  -.0123456789E-09L64;  -.0123456789E-09L80;  -.0123456789E-09L128;
     218
     219         0123456789.0123456789L32;       0123456789.0123456789L64;       0123456789.0123456789L80;       0123456789.0123456789L128;
     220        +0123456789.0123456789E09L32;   +0123456789.0123456789E09L64;   +0123456789.0123456789E09L80;   +0123456789.0123456789E09L128;
     221        -0123456789.0123456789E+09L32;  -0123456789.0123456789E+09L64;  -0123456789.0123456789E+09L80;  -0123456789.0123456789E+09L128;
     222         0123456789.0123456789E-09L32;   0123456789.0123456789E-09L64;   0123456789.0123456789E-09L80;   0123456789.0123456789E-09L128;
     223
     224         0x0123456789.p09l32;   0x0123456789.p09l64;   0x0123456789.p09l80;   0x0123456789.p09l128;
     225        +0x0123456789.p09l32;  +0x0123456789.p09l64;  +0x0123456789.p09l80;  +0x0123456789.p09l128;
     226        -0x0123456789.p09l32;  -0x0123456789.p09l64;  -0x0123456789.p09l80;  -0x0123456789.p09l128;
     227
     228         0x0123456789.p+09l32;   0x0123456789.p+09L64;   0x0123456789.p+09L80;   0x0123456789.p+09L128;
     229        +0x0123456789.p-09l32;  +0x0123456789.p-09L64;  +0x0123456789.p-09L80;  +0x0123456789.p-09L128;
     230        -0x.0123456789p09l32;   -0x.0123456789p09L64;   -0x.0123456789p09L80;   -0x.0123456789p09L128;
    249231
    250232// char, short, int suffix overloading
  • tests/loopctrl.cfa

    r53bb8f1 r9d9a451  
    1010// Created On       : Wed Aug  8 18:32:59 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 21 08:54:47 2019
    13 // Update Count     : 86
     12// Last Modified On : Sun Dec 23 23:00:29 2018
     13// Update Count     : 79
    1414//
    1515
     
    5454        for ( i; 5.5 -~ 0.5 ) { sout | i; }                                     sout | nl;
    5555        for ( ui; 2u ~= 10u ~ 2u ) { sout | ui; }                       sout | nl;
    56         for ( ui; 10u -~= 2u ~ 2u ) { sout | ui; }                      sout | nl | nl;
     56        for ( ui; 10u -~= 2u ~ 2u ) { sout | ui; }                      sout | nl | nl | nl;
    5757
    58         for ( i; 2 ~ @ ~ 2 ) {
    59           if ( i > 10 ) break;
    60                 sout | i;
    61         }                                                                                                       sout | nl;
    62         for ( i; 2.1 ~ @ ~ @ ) {
    63           if ( i > 10.5 ) break;
    64                 sout | i;
    65                 i += 1.7;
    66         }                                                                                                       sout | nl;
    67         for ( i; 10 -~ @ ~ 2 ) {
    68           if ( i < 0 ) break;
    69                 sout | i;
    70         }                                                                                                       sout | nl;
    71         for ( i; 12.1 ~ @ ~ @ ) {
    72           if ( i < 2.5 ) break;
    73                 sout | i;
    74                 i -= 1.7;
    75         }                                                                                                       sout | nl | nl;
    76        
    7758        enum { N = 10 };
    7859        for ( N ) { sout | "N"; }                                                       sout | nl;
    7960        for ( i; N ) { sout | i; }                                                      sout | nl;
    80         for ( i; N -~ 0 ) { sout | i; }                                         sout | nl | nl;
     61        for ( i; N -~ 0 ) { sout | i; }                                         sout | nl | nl | nl;
    8162
    8263        const int start = 3, comp = 10, inc = 2;
    8364        for ( i; start ~ comp ~ inc + 1 ) { sout | i; }         sout | nl | nl;
    8465
     66        sout | nl;
    8567        for ( S s = (S){0}; s < (S){10,10}; s += (S){1} ) { sout | s; } sout | nl;
    8668        for ( s; (S){10,10} ) { sout | s; } sout | nl;
  • tests/numericConstants.cfa

    r53bb8f1 r9d9a451  
    1010// Created On       : Wed May 24 22:10:36 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  5 08:58:16 2019
    13 // Update Count     : 5
     12// Last Modified On : Tue Nov  6 17:59:53 2018
     13// Update Count     : 3
    1414//
    1515
     
    6767// Local Variables: //
    6868// tab-width: 4 //
    69 // compile-command: "cfa numericConstants.cfa" //
     69// compile-command: "cfa minmax.cfa" //
    7070// End: //
  • tests/preempt_longrun/Makefile.in

    r53bb8f1 r9d9a451  
    334334DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    335335ACLOCAL = @ACLOCAL@
     336ALLOCA = @ALLOCA@
    336337AMTAR = @AMTAR@
    337338AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
  • tests/pybin/tools.py

    r53bb8f1 r9d9a451  
    33import __main__
    44import argparse
    5 import fileinput
    65import multiprocessing
    76import os
    87import re
    9 import resource
    108import signal
    119import stat
    1210import sys
    13 import time
     11import fileinput
    1412
    1513from pybin import settings
     
    133131
    134132    return None
    135 
    136 def run(exe, output, input):
    137         ret, _ = sh("timeout %d %s > %s 2>&1" % (settings.timeout.single, exe, output), input = input)
    138         return ret
    139 
    140133################################################################################
    141134#               file handling
    142135################################################################################
    143 # move a file
    144 def mv(source, dest):
    145         ret, _ = sh("mv %s %s" % (source, dest))
    146         return ret
    147 
    148 # cat one file into the other
    149 def cat(source, dest):
    150         ret, _ = sh("cat %s > %s" % (source, dest))
    151         return ret
    152136
    153137# helper function to replace patterns in a file
     
    246230                signal.signal(signal.SIGINT, signal.SIG_IGN)
    247231
    248 
    249 # enable core dumps for all the test children
    250 resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
    251 
    252232################################################################################
    253233#               misc
     
    271251        else:
    272252                print(text)
    273 
    274 
    275 def coreInfo(path):
    276         cmd   = os.path.join(settings.SRCDIR, "pybin/print-core.gdb")
    277         if not os.path.isfile(cmd):
    278                 return 1, "ERR Printing format for core dumps not found"
    279 
    280         dname = os.path.dirname(path)
    281         core  = os.path.join(dname, "core" )
    282         if not os.path.isfile(path):
    283                 return 1, "ERR Executable path is wrong"
    284 
    285         if not os.path.isfile(core):
    286                 return 1, "ERR No core dump"
    287 
    288         return sh("gdb -n %s %s -batch -x %s" % (path, core, cmd), print2stdout=False)
    289 
    290 class Timed:
    291     def __enter__(self):
    292         self.start = time.time()
    293         return self
    294 
    295     def __exit__(self, *args):
    296         self.end = time.time()
    297         self.duration = self.end - self.start
  • tests/raii/.expect/ctor-autogen-ERR1.txt

    r53bb8f1 r9d9a451  
    1 raii/ctor-autogen.cfa:102:1 error: Unique best alternative includes deleted identifier in Generated Cast of:
     1raii/ctor-autogen.cfa:102:1 error: Unique best alternative includes deleted identifier in Cast of:
    22  Application of
    33    Deleted Expression
     
    2727
    2828            ... to arguments
    29               Generated Cast of:
     29              Cast of:
    3030                Member Expression, with field:
    3131                  x: signed int
    3232                ... from aggregate:
    33                   Generated Cast of:
     33                  Cast of:
    3434                    Variable Expression: m: reference to instance of struct Managed with body 1
    3535                  ... to:
     
    3737              ... to:
    3838                reference to signed int
    39               Generated Cast of:
     39              Cast of:
    4040                constant expression (0 0: zero_t)
    4141              ... to:
     
    4848
    4949  ... to arguments
    50     Generated Cast of:
     50    Cast of:
    5151      Variable Expression: x: instance of struct Managed with body 1
    5252    ... to:
  • tests/sum.cfa

    r53bb8f1 r9d9a451  
    1111// Created On       : Wed May 27 17:56:53 2015
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Wed Feb 20 08:32:46 2019
    14 // Update Count     : 329
     13// Last Modified On : Sun Dec 23 23:00:38 2018
     14// Update Count     : 287
    1515//
    1616
    1717#include <fstream.hfa>
    1818#include <stdlib.hfa>
     19
     20void ?{}( int & c, zero_t ) { c = 0; }                                  // not in prelude
    1921
    2022trait sumable( otype T ) {
     
    3436} // sum
    3537
     38// Not in prelude.
     39unsigned char ?+?( unsigned char t1, unsigned char t2 ) { return (int)t1 + t2; } // cast forces integer addition, otherwise recursion
     40unsigned char ?+=?( unsigned char & t1, unsigned char t2 ) { t1 = t1 + t2; return t1; }
     41unsigned char ++?( unsigned char & t ) { t += 1; return t; }
     42unsigned char ?++( unsigned char & t ) { unsigned char temp = t; t += 1; return temp; }
     43
     44// Not in prelude.
     45void ?{}( unsigned char & c, zero_t ) { c = 0; }
     46void ?{}( float & f, zero_t ) { f = 0.0; }
     47void ?{}( double & d, zero_t ) { d = 0.0; }
     48
    3649int main( void ) {
    3750        const int low = 5, High = 15, size = High - low;
    3851
    39         signed char s = 0, a[size], v = (char)low;
    40         for ( int i = 0; i < size; i += 1, v += 1hh ) {
     52        unsigned char s = 0, a[size], v = (char)low;
     53        for ( int i = 0; i < size; i += 1, v += 1 ) {
    4154                s += v;
    4255                a[i] = v;
    4356        } // for
    4457        sout | "sum from" | low | "to" | High | "is"
    45                  | sum( size, (signed char *)a ) | ", check" | (signed char)s;
    46 
    47         unsigned char s = 0, a[size], v = low;
    48         for ( int i = 0; i < size; i += 1, v += 1hhu ) {
    49                 s += (unsigned char)v;
    50                 a[i] = (unsigned char)v;
    51         } // for
    52         sout | "sum from" | low | "to" | High | "is"
    53                  | sum( size, (unsigned char *)a ) | ", check" | (unsigned char)s;
    54 
    55         short int s = 0, a[size], v = low;
    56         for ( int i = 0; i < size; i += 1, v += 1h ) {
    57                 s += (short int)v;
    58                 a[i] = (short int)v;
    59         } // for
    60         sout | "sum from" | low | "to" | High | "is"
    61                  | sum( size, (short int *)a ) | ", check" | (short int)s;
     58                 | sum( size, (unsigned char *)a ) | ", check" | (int)s;
    6259
    6360        int s = 0, a[size], v = low;
  • tests/test.py

    r53bb8f1 r9d9a451  
    121121#               running test functions
    122122################################################################################
    123 def success(val):
    124         return val == 0 or settings.dry_run
    125 
    126 def isExe(file):
    127         return settings.dry_run or fileIsExecutable(file)
    128 
    129 def noRule(file, target):
    130         return not settings.dry_run and fileContainsOnly(file, "make: *** No rule to make target `%s'.  Stop." % target)
     123# fix the absolute paths in the output
     124def fixoutput( fname ):
     125        if not is_ascii(fname):
     126                return
     127
     128        file_replace(fname, "%s/" % settings.SRCDIR, "")
     129
    131130
    132131# logic to run a single test and return the result (No handling of printing or other test framework logic)
     
    144143
    145144        # build, skipping to next test on error
    146         with Timed() as comp_dur:
    147                 make_ret, _ = make( test.target(),      redirects  = ("2> %s 1> /dev/null" % out_file), error_file = err_file )
     145        before = time.time()
     146        make_ret, _ = make( test.target(),
     147                redirects  = "2> %s 1> /dev/null" % out_file,
     148                error_file = err_file
     149        )
     150        after = time.time()
     151
     152        comp_dur = after - before
     153
     154        run_dur = None
    148155
    149156        # if the make command succeds continue otherwise skip to diff
    150         run_dur = None
    151         if success(make_ret):
    152                 with Timed() as run_dur:
    153                         if isExe(exe_file):
    154                                 # run test
    155                                 retcode = run(exe_file, out_file, in_file)
    156                         else :
    157                                 # simply cat the result into the output
    158                                 retcode = cat(exe_file, out_file)
     157        if make_ret == 0 or settings.dry_run:
     158                before = time.time()
     159                if settings.dry_run or fileIsExecutable(exe_file) :
     160                        # run test
     161                        retcode, _ = sh("timeout %d %s > %s 2>&1" % (settings.timeout.single, exe_file, out_file), input = in_file)
     162                else :
     163                        # simply cat the result into the output
     164                        retcode, _ = sh("cat %s > %s" % (exe_file, out_file))
     165
     166                after = time.time()
     167                run_dur = after - before
    159168        else:
    160                 retcode = mv(err_file, out_file)
    161 
    162         if success(retcode):
     169                retcode, _ = sh("mv %s %s" % (err_file, out_file))
     170
     171
     172        if retcode == 0:
     173                # fixoutput(out_file)
    163174                if settings.generating :
    164175                        # if we are ounly generating the output we still need to check that the test actually exists
    165                         if noRule(out_file, test.target()) :
    166                                 retcode = 1
     176                        if not settings.dry_run and fileContainsOnly(out_file, "make: *** No rule to make target `%s'.  Stop." % test.target()) :
     177                                retcode = 1;
    167178                                error = "\t\tNo make target for test %s!" % test.target()
    168                                 rm(out_file)
     179                                sh("rm %s" % out_file, False)
    169180                        else:
    170181                                error = None
     
    177188                        error = myfile.read()
    178189
    179                 ret, info = coreInfo(exe_file)
    180                 error = error + info
    181 
    182 
    183190
    184191        # clean the executable
    185         rm(exe_file)
    186 
    187         return retcode, error, [comp_dur.duration, run_dur.duration if run_dur else None]
     192        sh("rm -f %s > /dev/null 2>&1" % test.target())
     193
     194        return retcode, error, [comp_dur, run_dur]
    188195
    189196# run a single test and handle the errors, outputs, printing, exception handling, etc.
     
    192199        with SignalHandling():
    193200                # print formated name
    194                 name_txt = "%24s  " % t.name
     201                name_txt = "%20s  " % t.name
    195202
    196203                retcode, error, duration = run_single_test(t)
     
    256263        allTests = listTests( options.include, options.exclude )
    257264
    258 
    259265        # if user wants all tests than no other treatement of the test list is required
    260266        if options.all or options.list or options.list_comp or options.include :
  • tests/warnings/.expect/self-assignment.txt

    r53bb8f1 r9d9a451  
    1 warnings/self-assignment.cfa:29:1 warning: self assignment of expression: Generated Cast of:
     1warnings/self-assignment.cfa:29:1 warning: self assignment of expression: Cast of:
    22  Variable Expression: j: signed int
    33... to:
    44  reference to signed int
    5 warnings/self-assignment.cfa:30:1 warning: self assignment of expression: Generated Cast of:
     5warnings/self-assignment.cfa:30:1 warning: self assignment of expression: Cast of:
    66  Variable Expression: s: instance of struct S with body 1
    77... to:
    88  reference to instance of struct S with body 1
    9 warnings/self-assignment.cfa:31:1 warning: self assignment of expression: Generated Cast of:
     9warnings/self-assignment.cfa:31:1 warning: self assignment of expression: Cast of:
    1010  Member Expression, with field:
    1111    i: signed int
     
    1414... to:
    1515  reference to signed int
    16 warnings/self-assignment.cfa:32:1 warning: self assignment of expression: Generated Cast of:
     16warnings/self-assignment.cfa:32:1 warning: self assignment of expression: Cast of:
    1717  Member Expression, with field:
    1818    i: signed int
  • tests/warnings/self-assignment.cfa

    r53bb8f1 r9d9a451  
    99// Author           : Rob Schluntz
    1010// Created On       : Thu Mar 1 13:53:57 2018
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 20 07:56:17 2019
    13 // Update Count     : 3
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Thu Mar 1 13:53:57 2018
     13// Update Count     : 2
    1414//
    1515
    1616struct S {
    17         int i;
     17  int i;
    1818};
    1919
    2020struct T {
    21         S s;
     21  S s;
    2222};
    2323
    2424int main() {
    25         int j = 0;
    26         S s = { 0 };
    27         T t = { { 0 } };
     25  int j = 0;
     26  S s = { 0 };
     27  T t = { { 0 } };
    2828
    29         j = j;
    30         s = s;
    31         s.i = s.i;
    32         t.s.i = t.s.i;
     29  j = j;
     30  s = s;
     31  s.i = s.i;
     32  t.s.i = t.s.i;
    3333}
    3434
  • tools/Makefile.in

    r53bb8f1 r9d9a451  
    194194DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    195195ACLOCAL = @ACLOCAL@
     196ALLOCA = @ALLOCA@
    196197AMTAR = @AMTAR@
    197198AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
  • tools/PrettyGitLogs.sh

    r53bb8f1 r9d9a451  
    33set -e
    44
    5 GIT="git --git-dir=$1/.git"
    6 
    7 GIT_UPDATE="$2/GIT_UPDATE"
    8 GIT_LOG="$2/GIT_LOG"
    9 GIT_DIFF="$2/GIT_DIFF"
     5GIT_UPDATE="$1/GIT_UPDATE"
     6GIT_LOG="$1/GIT_LOG"
     7GIT_DIFF="$1/GIT_DIFF"
    108
    119rm -f ${GIT_UPDATE}  ${GIT_LOG}  ${GIT_DIFF}
    1210
    13 GitOldRef=$3
    14 GitNewRef=$4
     11GitOldRef=$2
     12GitNewRef=$3
    1513
    1614
  • tools/prettyprinter/Makefile.in

    r53bb8f1 r9d9a451  
    223223DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    224224ACLOCAL = @ACLOCAL@
     225ALLOCA = @ALLOCA@
    225226AMTAR = @AMTAR@
    226227AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
Note: See TracChangeset for help on using the changeset viewer.