summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-12-07 06:07:16 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-12-07 06:07:16 -0800
commit0a97556f505334bcf48987129b3d35c48efdbb62 (patch)
tree9b44233eabe35d20ceb828f8298aa035962383be
parent600f1bda2366b82d1492eb04a7419d12f199349b (diff)
downloadtxr-0a97556f505334bcf48987129b3d35c48efdbb62.tar.gz
txr-0a97556f505334bcf48987129b3d35c48efdbb62.tar.bz2
txr-0a97556f505334bcf48987129b3d35c48efdbb62.zip
C++ regression in printer.
* lib.c (obj_print_impl): The recent change for unquote-related read/print consistency introduced initializing declarations which are crossed by a label. They are not actually used past the label, so we can put in a block to delimit their scope to get rid of the compiler error. diff --git a/lib.c b/lib.c index dd599d2..1ca1790 100644 --- a/lib.c +++ b/lib.c @@ -9663,29 +9663,31 @@ val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx) for (iter = obj; consp(iter); iter = cdr(iter)) { val d; - val a = car(iter); - val unq = nil; - - if (a == sys_unquote_s) - unq = lit(". ,"); - else if (a == sys_splice_s) - unq = lit(". ,*"); - - if (unq) { - val d = cdr(iter); - val ad = car(d); - - if (consp(d) && !cdr(d)) { - put_string(unq, out); - if (a == sys_unquote_s && unquote_star_check(ad, pretty)) - put_char(chr(' '), out); - obj_print_impl(ad, out, pretty, ctx); - put_char(closepar, out); - break; + { + val a = car(iter); + val unq = nil; + + if (a == sys_unquote_s) + unq = lit(". ,"); + else if (a == sys_splice_s) + unq = lit(". ,*"); + + if (unq) { + val d = cdr(iter); + val ad = car(d); + + if (consp(d) && !cdr(d)) { + put_string(unq, out); + if (a == sys_unquote_s && unquote_star_check(ad, pretty)) + put_char(chr(' '), out); + obj_print_impl(ad, out, pretty, ctx); + put_char(closepar, out); + break; + } } - } - obj_print_impl(a, out, pretty, ctx); + obj_print_impl(a, out, pretty, ctx); + } finish: d = cdr(iter); if (nilp(d)) {
-rw-r--r--lib.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/lib.c b/lib.c
index dd599d22..1ca1790c 100644
--- a/lib.c
+++ b/lib.c
@@ -9663,29 +9663,31 @@ val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx)
for (iter = obj; consp(iter); iter = cdr(iter)) {
val d;
- val a = car(iter);
- val unq = nil;
-
- if (a == sys_unquote_s)
- unq = lit(". ,");
- else if (a == sys_splice_s)
- unq = lit(". ,*");
-
- if (unq) {
- val d = cdr(iter);
- val ad = car(d);
-
- if (consp(d) && !cdr(d)) {
- put_string(unq, out);
- if (a == sys_unquote_s && unquote_star_check(ad, pretty))
- put_char(chr(' '), out);
- obj_print_impl(ad, out, pretty, ctx);
- put_char(closepar, out);
- break;
+ {
+ val a = car(iter);
+ val unq = nil;
+
+ if (a == sys_unquote_s)
+ unq = lit(". ,");
+ else if (a == sys_splice_s)
+ unq = lit(". ,*");
+
+ if (unq) {
+ val d = cdr(iter);
+ val ad = car(d);
+
+ if (consp(d) && !cdr(d)) {
+ put_string(unq, out);
+ if (a == sys_unquote_s && unquote_star_check(ad, pretty))
+ put_char(chr(' '), out);
+ obj_print_impl(ad, out, pretty, ctx);
+ put_char(closepar, out);
+ break;
+ }
}
- }
- obj_print_impl(a, out, pretty, ctx);
+ obj_print_impl(a, out, pretty, ctx);
+ }
finish:
d = cdr(iter);
if (nilp(d)) {