diff --git a/fmt-c.scm b/fmt-c.scm index a0e4e16..f4ccd56 100644 --- a/fmt-c.scm +++ b/fmt-c.scm @@ -607,9 +607,11 @@ (define (c-while check . body) (c-reset-newline - (cat (c-block (cat "while (" (c-in-test (c-expr check)) ")") - (c-in-stmt (apply c-begin body))) - fl))) + (if (null? body) + (cat "while (" (c-in-test (c-expr check)) ");") + (cat (c-block (cat "while (" (c-in-test (c-expr check)) ")") + (c-in-stmt (apply c-begin body))) + fl)))) (define (c-for init check update . body) (c-reset-newline