scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit cb444f385bf3ba8a4939844473be02af6ad69b95
parent 8be6d800e600783495e7c5783c128ae81e02b5b9
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 21 Apr 2015 20:29:01 +0200

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.

Diffstat:
Mcc1/cc1.h | 2+-
Mcc1/decl.c | 5+----
Mcc1/error.c | 5++++-
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cc1/cc1.h b/cc1/cc1.h @@ -4,7 +4,7 @@ extern void error(char *fmt, ...); 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 diff --git 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 @@ extdecl(void) 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) { diff --git a/cc1/error.c b/cc1/error.c @@ -39,10 +39,13 @@ warn(char *fmt, ...) va_end(va); } -void +bool setsafe(uint8_t type) { safe = type; + if (setjmp(recover)) + return 0; + return 1; } void