From 7c01031fda34b64fb2ca5e73838d860bf3f0d78d Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sat, 30 May 2020 15:24:27 -0700 Subject: fix: preprocessor elif changed to goto to correctly handle the skip --- sys/cmd/cc/pp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/cmd/cc/pp.c b/sys/cmd/cc/pp.c index 494f293..4d7c643 100644 --- a/sys/cmd/cc/pp.c +++ b/sys/cmd/cc/pp.c @@ -943,6 +943,7 @@ ppif(Lexer *lx, int f) string s; int c, l, b; +Eval: if (f == 0) { b = evalmacro(lx, 1); if (b) { @@ -992,8 +993,10 @@ Skip: if (!s) continue; - if (l == 0 && (strcmp(s, "elif") == 0)) - ppif(lx, 0); + if (l == 0 && (strcmp(s, "elif") == 0)) { + f = 0; + goto Eval; + } if (strcmp(s, "endif") == 0) { if (l) { -- cgit v1.2.1