shithub: scc

Download patch

ref: cb444f385bf3ba8a4939844473be02af6ad69b95
parent: 8be6d800e600783495e7c5783c128ae81e02b5b9
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Apr 21 16:29:01 EDT 2015

Makes setsafe to put the recovery point

These functions are going to be called always together so the
best option is to include in setsafe the recovery point.

--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -4,7 +4,7 @@
 extern void warn(char *fmt, ...);
 extern void unexpected(void);
 extern void softerror(char *fmt, ...);
-extern void setsafe(uint8_t type);
+extern bool setsafe(uint8_t type);
 
 enum {
 	END_DECL
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -1,6 +1,5 @@
 
 #include <inttypes.h>
-#include <setjmp.h>
 #include <string.h>
 
 #include "../inc/sizes.h"
@@ -493,10 +492,8 @@
 	int8_t sclass;
 	Symbol *sym;
 	extern Symbol *curfun;
-	extern jmp_buf recover;
 
-	setsafe(END_DECL);
-	if (setjmp(recover))
+	if (!setsafe(END_DECL))
 		return;
 
 	switch (yytoken) {
--- a/cc1/error.c
+++ b/cc1/error.c
@@ -39,10 +39,13 @@
 	va_end(va);
 }
 
-void
+bool
 setsafe(uint8_t type)
 {
 	safe = type;
+	if (setjmp(recover))
+		return 0;
+	return 1;
 }
 
 void
--