shithub: scc

Download patch

ref: 0252c2debe6b62c840af38dfdb3b973f0e6d8c02
parent: 3e1d484b33d59c87095ce175ac7fa180bc422132
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu May 26 11:06:17 EDT 2016

[cc2] Update the number of cases per switch

This is a very important field because it will determinate
which of the possible implementation will be used for the
switch.

--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -337,15 +337,18 @@
 waft(Node *np)
 {
 	Node *p;
+	struct swtch *cur;
 
 	if (swp == swtbl)
 		error(EWTACKU);
-	p = swp[-1].last;
 
+	cur = swp - 1;
+	p = cur->last;
 	np->next = p->next;
 	np->prev = p;
 	p->next = np;
-	swp[-1].last = np;
+	cur->last = np;
+	cur->nr++;
 }
 
 static void