From 39eb1c58a81c584836c128e0a800e460a4019b78 Mon Sep 17 00:00:00 2001 From: alex-eg Date: Wed, 22 Oct 2025 18:20:12 +0300 Subject: [PATCH] fix fmt-c while without body --- fmt-c.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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