From 4ec2532ad597552560e7bba4e76ce34b881bf2d3 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 23 Jul 2017 23:04:00 +0200 Subject: [PATCH] mescc: Tinycc support: multiple statements in default case. * module/language/c99/compiler.mes (clause->info): Support multiple statements in default case. --- module/language/c99/compiler.mes | 2 ++ scaffold/tests/44-switch.c | 1 + 2 files changed, 3 insertions(+) diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index f271ace6..0be21182 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -1295,6 +1295,8 @@ (loop statement (append cases (list (test->text test))) clause)) ((default ,statement) (loop statement cases clause)) + ((default . ,statements) + (loop `(compd-stmt (block-item-list ,@statements)) cases clause)) ((compd-stmt (block-item-list)) (loop '() cases clause)) ((compd-stmt (block-item-list . ,elements)) diff --git a/scaffold/tests/44-switch.c b/scaffold/tests/44-switch.c index 5fefb581..a90c58f3 100644 --- a/scaffold/tests/44-switch.c +++ b/scaffold/tests/44-switch.c @@ -51,6 +51,7 @@ swits (int c) x = 1; break; default: + x = 2; x = 2; break; }