diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | lib.h | 8 | ||||
-rw-r--r-- | match.c | 16 |
3 files changed, 31 insertions, 6 deletions
@@ -1,3 +1,16 @@ +2011-10-02 Kaz Kylheku <kaz@kylheku.com> + + Compiles as C++ again. + + * lib.h (cons_set): New macro. + + * match.c (match_line, match_files): In collect clause handlers, + move variable declarations above goto, and initialize with + cons_set, instead of declaring and initializing with cons_bind. + This eliminates the stupid C++ error that goto skips a variable + initialization (which happens even when it can be trivially + proven that the has no next use at the goto site!) + 2011-10-01 Kaz Kylheku <kaz@kylheku.com> Version 038 @@ -445,6 +445,14 @@ INLINE val eq(val a, val b) { return ((a) == (b) ? t : nil); } obj_t *CAR = car(c_o_n_s ## CAR ## CDR); \ obj_t *CDR = cdr(c_o_n_s ## CAR ## CDR) +#define cons_set(CAR, CDR, CONS) \ + do { \ + obj_t *c_o_n_s ## CAR ## CDR = CONS; \ + CAR = car(c_o_n_s ## CAR ## CDR); \ + CDR = cdr(c_o_n_s ## CAR ## CDR); \ + } while (0) + + #define zero num_fast(0) #define one num_fast(1) #define two num_fast(2) @@ -495,6 +495,8 @@ static val match_line(val bindings, val specline, val dataline, break; for (;;) { + val new_bindings = nil, new_pos = nil; + if ((gap || min) && mincounter < cmin) goto next_coll; @@ -502,9 +504,9 @@ static val match_line(val bindings, val specline, val dataline, break; { - cons_bind (new_bindings, new_pos, - match_line(bindings, coll_specline, dataline, pos, - spec_lineno, data_lineno, file)); + cons_set (new_bindings, new_pos, + match_line(bindings, coll_specline, dataline, pos, + spec_lineno, data_lineno, file)); if (until_specline) { cons_bind (until_bindings, until_pos, @@ -1499,6 +1501,8 @@ repeat_spec_same_data: result = t; while (data) { + val new_bindings = nil, success = nil; + if ((gap || min) && mincounter < cmin) goto next_collect; @@ -1506,9 +1510,9 @@ repeat_spec_same_data: break; { - cons_bind (new_bindings, success, - match_files(coll_spec, files, bindings, - data, num(data_lineno))); + cons_set (new_bindings, success, + match_files(coll_spec, files, bindings, + data, num(data_lineno))); /* Until clause sees un-collated bindings from collect. */ if (until_spec) |