diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-10-02 12:19:29 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-10-02 12:20:10 -0700 |
commit | 024f101e97197d1001cb9dd3403eee4a2e4c35bf (patch) | |
tree | d43e499646c9055042e1cd2a1531591d5f42d2b7 /lib.h | |
parent | b6f162c99e664b0deeb78b0c1c18eee3b0015267 (diff) | |
download | txr-024f101e97197d1001cb9dd3403eee4a2e4c35bf.tar.gz txr-024f101e97197d1001cb9dd3403eee4a2e4c35bf.tar.bz2 txr-024f101e97197d1001cb9dd3403eee4a2e4c35bf.zip |
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!)
Diffstat (limited to 'lib.h')
-rw-r--r-- | lib.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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) |