From 137932f4ebae040881df39d0c64b9e17faf936e1 Mon Sep 17 00:00:00 2001 From: borutr Date: Sun, 5 Oct 2003 17:34:58 +0000 Subject: [PATCH] Fixed bug #816692: introduced new ERROR_LEVEL_PEDANTIC warning message "unmatched #pragma SAVE and #pragma RESTORE" git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2922 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 6 ++++++ src/SDCC.lex | 41 +++++++++++++++-------------------------- support/Util/SDCCerr.c | 2 ++ support/Util/SDCCerr.h | 1 + 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca302623..ed814cb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-10-05 Borut Razem + + * src/SDCC.lex, support/Util/SDCCerr.c, sdcc/support/Util/SDCCerr.h: + Fixed bug #816692: introduced new ERROR_LEVEL_PEDANTIC warning + message "unmatched #pragma SAVE and #pragma RESTORE" + 2003-10-04 Frieder Ferlemann * doc/sdccman.lyx: various additions and updates (interrupts, inline diff --git a/src/SDCC.lex b/src/SDCC.lex index 0ac4356e..367ff42a 100644 --- a/src/SDCC.lex +++ b/src/SDCC.lex @@ -22,8 +22,6 @@ what you give them. Help stamp out software-hoarding! -------------------------------------------------------------------------*/ -%option noyywrap - D [0-9] L [a-zA-Z_] H [a-fA-F0-9] @@ -47,32 +45,10 @@ extern char *filename; int mylineno = 1; static void count(void); static int process_pragma(char *); -#undef yywrap - -#ifndef YYPROTO - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -#endif - -int yywrap YY_PROTO((void)) -{ - return(1); -} - -static void yyunput (int, char *); - -static void my_unput(char c) -{ - yyunput(c, (yytext_ptr)); -} +static void my_unput(char c); #define TKEYWORD(token) return (isTargetKeyword(yytext) ? token :\ - check_type()) + check_type()) char *asmbuff=NULL; int asmbuffSize=0; char *asmp ; @@ -665,6 +641,19 @@ static int isTargetKeyword(char *s) return 0; } +static void my_unput(char c) +{ + yyunput(c, (yytext_ptr)); +} + +int yywrap(void) +{ + if (!STACK_EMPTY(options_stack) || !STACK_EMPTY(optimize_stack)) + werror(W_SAVE_RESTORE); + + return 1; +} + int yyerror(char *s) { fflush(stdout); diff --git a/support/Util/SDCCerr.c b/support/Util/SDCCerr.c index b28bd7db..f7b4a282 100644 --- a/support/Util/SDCCerr.c +++ b/support/Util/SDCCerr.c @@ -395,6 +395,8 @@ struct "ignoring declarator of 0 length bitfield" }, { E_FUNC_ATTR, ERROR_LEVEL_ERROR, "function attribute following non-function declaration"}, +{ W_SAVE_RESTORE, ERROR_LEVEL_PEDANTIC, + "unmatched #pragma SAVE and #pragma RESTORE" }, }; /* diff --git a/support/Util/SDCCerr.h b/support/Util/SDCCerr.h index a2ed448d..ffc7bb27 100644 --- a/support/Util/SDCCerr.h +++ b/support/Util/SDCCerr.h @@ -185,6 +185,7 @@ SDCCERR - SDCC Standard error handler #define E_INT_BAD_INTNO 167 /* invalid interrupt number */ #define W_BITFLD_NAMED 168 /* declarator used with 0 length bitfield */ #define E_FUNC_ATTR 169 /* function attribute without function */ +#define W_SAVE_RESTORE 170 /* unmatched #pragma SAVE and #pragma RESTORE */ /** Describes the maximum error level that will be logged. Any level * includes all of the levels listed after it. -- 2.30.2