From b2442a226809691661bc96d409a8cc0dec8cbe5e Mon Sep 17 00:00:00 2001 From: Arkshine Date: Thu, 14 Aug 2014 17:21:03 +0200 Subject: [PATCH] Compiler: Ignore #pragma tabsize with non-positive argument. Imported from SA-MP: https://github.com/Zeex/pawn/commit/7f30a03f9411d2169ee9e413ceb8f5b9c07dc120. --- compiler/libpc300/sc1.c | 6 +++++- compiler/libpc300/sc2.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/libpc300/sc1.c b/compiler/libpc300/sc1.c index 8a43a125..6fc5aaa3 100755 --- a/compiler/libpc300/sc1.c +++ b/compiler/libpc300/sc1.c @@ -1108,7 +1108,11 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam skipinput=atoi(option_value(ptr)); break; case 't': - sc_tabsize=atoi(option_value(ptr)); + i=atoi(option_value(ptr)); + if (i>0) + sc_tabsize=i; + else + about(); break; case 'v': verbosity= isdigit(*option_value(ptr)) ? atoi(option_value(ptr)) : 2; diff --git a/compiler/libpc300/sc2.c b/compiler/libpc300/sc2.c index bb48e71e..2017d4a4 100755 --- a/compiler/libpc300/sc2.c +++ b/compiler/libpc300/sc2.c @@ -1131,7 +1131,8 @@ static int command(void) } else if (strcmp(str,"tabsize")==0) { cell val; preproc_expr(&val,NULL); - sc_tabsize=(int)val; + if (val>0) + sc_tabsize=(int)val; } else if (strcmp(str,"align")==0) { sc_alignnext=TRUE; } else if (strcmp(str,"unused")==0) {