[hackers] [scc] [cc1] Fix #elif clauses || Roberto E. Vargas Caballero
commit 12d32d40a8be1d7c133aa5d6ab0032efc1a42345
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Dec 15 07:19:34 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Dec 15 07:22:15 2016 +0100
[cc1] Fix #elif clauses
The implmentation of elif was evaluating the if part always, even
when due to the else part it was disabled, and it was generating
that the current state of the preprocessor was corrupted.
diff --git a/cc1/cpp.c b/cc1/cpp.c
index 0d100ce..f123cf6 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -657,8 +657,9 @@ elseclause(void)
return;
}
- status = (ifstatus[cppctx-1] ^= 1);
- cppoff += (status) ? -1 : 1;
+ status = ifstatus[cppctx-1];
+ ifstatus[cppctx-1] = !status;
+ cppoff += (status) ? 1 : -1;
}
static void
_AT_@ -672,8 +673,10 @@ static void
elif(void)
{
elseclause();
- --cppctx;
- cppif();
+ if (ifstatus[cppctx-1]) {
+ --cppctx;
+ cppif();
+ }
}
static void
Received on Thu Dec 15 2016 - 07:22:44 CET
This archive was generated by hypermail 2.3.0
: Thu Dec 15 2016 - 07:24:19 CET