Getting rid of varbrace
Daniel Jour <[email protected]>
| Newsgroups | gmane.lisp.clisp.devel |
|---|---|
| Message-ID | <CACZHyTOnQckx-tbV7yO7cOOBaHshjJVK7Yf8KGY+nuKNhqekfg@mail.gmail.com> |
The following two patches remove varbrace from the build and fix some
compilation errors due to that removal. My configuration built with those
two patches works fine (according to make check).
I didn't do an exhaustive test of different configurations, so this
definitively needs more testing. Also the patches:
- Contain no comment what the #define var does and why its there.
- Don't mention any change in the change log.
- Remove an (hopefully!) unused variable. This should probably be a
separate commit.
- Manually add a pairs of braces at two places; I couldn't figure out what
exactly the code there does, so I went the safe route.
- Don't remove the varbrace util yet; it's just not built / used.
Most of the compilation errors complained about having only a declaration
following an (goto) label. I solved this by adding a semicolon behind each
such label ("label:" becomse "label:;").
Is this a viable approach at getting rid of varbrace soon? If so then I can
"polish" those patches further.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
varbrace-removed-1.patch
(application/octet-stream, 1.5 KB)
# HG changeset patch # User Daniel Jour <[email protected]> # Date 1490054468 -3600 # Tue Mar 21 01:01:08 2017 +0100 # Node ID 20f0113e4e42bb02c2aa5f2f0ada4d0030c3ae41 # Parent 997b057aa4abd497c54746235a594886ae56e9a1 remove varbrace from build diff -r 997b057aa4ab -r 20f0113e4e42 src/lispbibl.d --- a/src/lispbibl.d Mon Mar 20 13:38:23 2017 -0400 +++ b/src/lispbibl.d Tue Mar 21 01:01:08 2017 +0100 @@ -150,6 +150,8 @@ */ +#define var + /* this machine: WIN32 or GENERIC_UNIX */ #if (defined(__unix) || defined(__unix__) || defined(_AIX) || defined(sinix) || defined(__MACH__) || defined(__POSIX__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__BEOS__)) && !defined(unix) #define unix diff -r 997b057aa4ab -r 20f0113e4e42 src/makemake.in --- a/src/makemake.in Mon Mar 20 13:38:23 2017 -0400 +++ b/src/makemake.in Tue Mar 21 01:01:08 2017 +0100 @@ -2164,11 +2164,10 @@ else NEED_CCPAUX=false fi -XDECL_FILTER="| \$(GCTRIGGER) | \$(VARBRACE)" -XDECL_DEPENDENCIES=" gctrigger${HEXE} varbrace${HEXE}" +XDECL_FILTER="| \$(GCTRIGGER)" +XDECL_DEPENDENCIES=" gctrigger${HEXE}" echol "GCTRIGGER = ${HERE}gctrigger" -echol "VARBRACE = ${HERE}varbrace" if [ $XASM_NEED_CCPAUX = true ] ; then XASMCCPAUX='ccpaux'$HEXE XASMCCPAUX_FILTER=' | '$HERE'ccpaux' @@ -2318,7 +2317,6 @@ test $NEED_CCPAUX = true && UTILS=$UTILS' ccpaux' UTILS=$UTILS' comment5' UTILS=$UTILS' gctrigger' -UTILS=$UTILS' varbrace' test $XCC_NEED_DEEMA = true -a $HOS != unix && UTILS=$UTILS' deema' UTILS=$UTILS' txt2c' UTILS=$UTILS' ccmp2c' # needed by clx module
varbrace-removed-2.patch
(application/octet-stream, 9.3 KB)
# HG changeset patch # User Daniel Jour <[email protected]> # Date 1490057011 -3600 # Tue Mar 21 01:43:31 2017 +0100 # Node ID 2b074d8962af9334f35a2ba1aa3d31401acf6ce0 # Parent 20f0113e4e42bb02c2aa5f2f0ada4d0030c3ae41 fix compilation errors due to removal of varbrace diff -r 20f0113e4e42 -r 2b074d8962af src/array.d --- a/src/array.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/array.d Tue Mar 21 01:43:31 2017 +0100 @@ -5156,7 +5156,6 @@ LISPFUNN(make_bit_vector,1) { /* (SYS::MAKE-BIT-VECTOR size) returns a Bit-Vector with size bits. */ - var uintL size; if (!posfixnump(STACK_0)) { bad_size: /* STACK_0 = size, TYPE-ERROR slot DATUM */ diff -r 20f0113e4e42 -r 2b074d8962af src/comptran.d --- a/src/comptran.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/comptran.d Tue Mar 21 01:43:31 2017 +0100 @@ -416,7 +416,7 @@ } } else { if (C_rationalp(x)) { - complex_rational: /* x in Q(i) */ + complex_rational:; /* x in Q(i) */ var uintL k = I_power2p(TheRatio(y)->rt_den); if (!(k==0)) { /* n powers of two = 2^(k-1). n>1, so k>1 */ diff -r 20f0113e4e42 -r 2b074d8962af src/foreign.d --- a/src/foreign.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/foreign.d Tue Mar 21 01:43:31 2017 +0100 @@ -684,7 +684,7 @@ LISPFUN(foreign_function,seclass_read,2,0,norest,key,1,(kw(name)) ) { STACK_1 = check_foreign_function_type(STACK_1); - foreign_function_restart: + foreign_function_restart:; var object fa = STACK_2; if (ffunctionp(fa)) { if (missingp(STACK_0)) @@ -2538,7 +2538,7 @@ /* (FFI:FOREIGN-VARIABLE address c-type &key name) constructor */ LISPFUN(foreign_variable,seclass_read,2,0,norest,key,1,(kw(name)) ) { - foreign_variable_restart: + foreign_variable_restart:; var object fa = STACK_2; if (fvariablep(fa)) { fa = TheFvariable(fa)->fv_address; } diff -r 20f0113e4e42 -r 2b074d8962af src/intgcd.d --- a/src/intgcd.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/intgcd.d Tue Mar 21 01:43:31 2017 +0100 @@ -764,7 +764,7 @@ } } if (false) { - divide: # Ersetze (a,b) := (b , a mod b). + divide:; # Ersetze (a,b) := (b , a mod b). var uintD* old_a_LSDptr = a_LSDptr; var DS q; var DS r; @@ -1185,7 +1185,7 @@ } } if (false) { - divide: # Ersetze (a,b) := (b , a mod b). + divide:; # Ersetze (a,b) := (b , a mod b). var uintD* old_a_LSDptr = a_LSDptr; var DS q; var DS r; diff -r 20f0113e4e42 -r 2b074d8962af src/intlog.d --- a/src/intlog.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/intlog.d Tue Mar 21 01:43:31 2017 +0100 @@ -721,7 +721,7 @@ local maygc object I_logcount_I (object x) { if (I_fixnump(x)) { - var uint16 x16; /* auxiliary variable */ + var uint16 x16; /* auxiliary variable */ { var uintV x32 = FN_to_V(x); /* x as intVsize-bit-number */ if (FN_V_minusp(x,(sintV)x32)) x32 = ~ x32; /* if <0, make 1-complement */ @@ -730,7 +730,7 @@ #else logcount_32(); /* count bits of x32 */ #endif - return fixnum((uintL)x16); + return fixnum((uintL)x16); } } else { var uintD* MSDptr; var uintC len; @@ -748,11 +748,11 @@ #endif #if (intDsize==32) dotimespC(len,len, { - var uint16 x16; /* auxiliary variable */ + var uint16 x16; /* auxiliary variable */ { var uintD x32 = (*ptr++) ^ sign; /* next intDsize-bit-package, */ /* negative numbers are complemented */ /* count bits of x32, increase total counter: */ - bitcount += (uintL)(logcount_32(), x16); + bitcount += (uintL)(logcount_32(), x16); } }); #endif /* 0 <= bitcount < intDsize*2^intWCsize, fits poss. into a fixnum. */ diff -r 20f0113e4e42 -r 2b074d8962af src/io.d --- a/src/io.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/io.d Tue Mar 21 01:43:31 2017 +0100 @@ -744,7 +744,7 @@ can trigger GC */ local maygc object test_disp_sub_char (gcv_object_t* argsp) { var object sub_ch = check_char(*(argsp STACKop 0)); /* sub-char */ - retry_disp_ch: + retry_disp_ch:; var object disp_ch = check_char(*(argsp STACKop 1)); /* disp-char */ var chart disp_c = char_code(disp_ch); var object entry = @@ -806,7 +806,7 @@ LISPFUNN(set_readtable_case,2) { /* (SYSTEM::SET-READTABLE-CASE readtable value), CLTL2 p. 549 */ var object value = popSTACK(); - retry_readtable_case: + retry_readtable_case:; /* convert symbol value into an index by searching in table O(rtcase..): */ var const gcv_object_t* ptr = &O(rtcase_0); var uintC rtcase = 0; @@ -828,7 +828,7 @@ value = value1; } goto retry_readtable_case; - found: /* found in table */ + found:; /* found in table */ var object readtable = check_readtable(popSTACK()); /* readtable */ TheReadtable(readtable)->readtable_case = fixnum(rtcase); VALUES1(*ptr); diff -r 20f0113e4e42 -r 2b074d8962af src/list.d --- a/src/list.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/list.d Tue Mar 21 01:43:31 2017 +0100 @@ -765,7 +765,7 @@ var object list = check_list(popSTACK()); /* Optimisation of the two most common cases count=1 and count=0: */ switch (count) { - case 0: { last_0_restart: + case 0: { last_0_restart:; var object slow = list; while (consp(list)) { list = Cdr(list); @@ -778,7 +778,7 @@ slow = Cdr(slow); } } break; - case 1: { last_1_restart: + case 1: { last_1_restart:; var object list2; var object slow = list; if (consp(list)) { @@ -795,7 +795,7 @@ } } break; - default: { last_default_restart: + default: { last_default_restart:; var object list2 = list; var object slow = list; var uintL ii = count; diff -r 20f0113e4e42 -r 2b074d8962af src/misc.d --- a/src/misc.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/misc.d Tue Mar 21 01:43:31 2017 +0100 @@ -536,8 +536,8 @@ pushSTACK(S(or)); pushSTACK(S(integer)); pushSTACK(STACK_2); /* (member [nil] l_const ...) */ - var object tmp=listof(3); - STACK_0 = tmp; /* replace (member ...) with (or integer (member ...)) */ + var object tmp2=listof(3); + STACK_0 = tmp2; /* replace (member ...) with (or integer (member ...)) */ pushSTACK(map_to_alist(map)); pushSTACK(asciz_to_string(map->name,O(misc_encoding))); pushSTACK(STACK_3/*obj*/); pushSTACK(TheSubr(subr_self)->name); diff -r 20f0113e4e42 -r 2b074d8962af src/pathname.d --- a/src/pathname.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/pathname.d Tue Mar 21 01:43:31 2017 +0100 @@ -6446,7 +6446,7 @@ break; default: return; /* PROBE: nothing to check */ } - check_file_reopen_restart_search: + check_file_reopen_restart_search:; var object bad_stream = nullobj; var struct file_id fi; var os_error_code_t status; diff -r 20f0113e4e42 -r 2b074d8962af src/stream.d --- a/src/stream.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/stream.d Tue Mar 21 01:43:31 2017 +0100 @@ -4792,7 +4792,7 @@ pollfd_bag[0].events = POLLIN; pollfd_bag[0].revents = 0; begin_system_call(); - restart_poll: + restart_poll:; var int result = poll(&pollfd_bag[0],1,0); if (result<0) { if (errno==EINTR) @@ -5092,7 +5092,7 @@ /* READ-BYTE - Pseudo-Function for Handle-Streams, Type au, bitsize = 8 : */ local maygc object rd_by_iau8_unbuffered (object stream) { - rd_by_iau8_unbuffered_retry: + rd_by_iau8_unbuffered_retry:; var sintL b = UnbufferedStreamLow_read(stream)(stream); if (b < 0) return eof_value; @@ -6617,7 +6617,7 @@ READ-CHAR - Pseudo-Function for File-Streams of Characters */ local maygc object rd_ch_buffered (const gcv_object_t* stream_) { - rd_ch_buffered_retry: + rd_ch_buffered_retry:; var uintB* bufferptr = buffered_nextbyte(*stream_,persev_partial); var object stream = *stream_; if (bufferptr == (uintB*)NULL) /* EOF ? */ @@ -7456,7 +7456,7 @@ /* READ-BYTE - Pseudo-Function for File-Streams of Integers, Type au, bitsize = 8 : */ local maygc object rd_by_iau8_buffered (object stream) { pushSTACK(stream); - rd_by_iau8_buffered_retry: + rd_by_iau8_buffered_retry:; var uintB* ptr = buffered_nextbyte(stream,persev_partial); stream = STACK_0; if (!(ptr == (uintB*)NULL)) { diff -r 20f0113e4e42 -r 2b074d8962af src/symbol.d --- a/src/symbol.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/symbol.d Tue Mar 21 01:43:31 2017 +0100 @@ -326,7 +326,7 @@ goto string_arg_supplied; /* skip next "if (stringp(STACK_0))" */ } if (stringp(STACK_0)) { /* have string - use *gensym-counter* */ - string_arg_supplied: + string_arg_supplied:; /* with MT if *gensym-counter* is bound in calling thread there is no need to lock. however this should be extremely rare case and checking for it will eat more cycles overall */ diff -r 20f0113e4e42 -r 2b074d8962af src/unixaux.d --- a/src/unixaux.d Tue Mar 21 01:01:08 2017 +0100 +++ b/src/unixaux.d Tue Mar 21 01:43:31 2017 +0100 @@ -192,7 +192,7 @@ pollfd_bag[0].fd = fd; pollfd_bag[0].events = POLLIN; pollfd_bag[0].revents = 0; - restart_poll: + restart_poll:; var int result = poll(&pollfd_bag[0],1,0); if (result<0) { if (errno==EINTR) @@ -341,7 +341,7 @@ pollfd_bag[0].fd = fd; pollfd_bag[0].events = POLLOUT; pollfd_bag[0].revents = 0; - restart_poll: + restart_poll:; var int result = poll(&pollfd_bag[0],1,0); if (result<0) { if (errno==EINTR)