aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-05-30 15:24:27 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-05-30 15:24:27 -0700
commit7c01031fda34b64fb2ca5e73838d860bf3f0d78d (patch)
tree2b85819b9b086a889b2ecf361bfd56f630f3f860
parentcf65141f154651115028d6456a1d7582d30b2083 (diff)
fix: preprocessor elif changed to goto to correctly handle the skip
-rw-r--r--sys/cmd/cc/pp.c7
1 files 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) {