From 27825963f60950101ae0def9e797ecef19dd8eb7 Mon Sep 17 00:00:00 2001 From: Arkshine Date: Sun, 17 Aug 2014 11:14:15 +0200 Subject: [PATCH] Compiler: Fix indentation. --- compiler/libpc300/sc1.c | 118 ++++++++++++++++++------------------- compiler/libpc300/sc2.c | 90 ++++++++++++++-------------- compiler/libpc300/sc3.c | 17 +++--- compiler/libpc300/sc5.c | 4 +- compiler/libpc300/sclist.c | 62 ++++++++++--------- 5 files changed, 144 insertions(+), 147 deletions(-) diff --git a/compiler/libpc300/sc1.c b/compiler/libpc300/sc1.c index 6599cc23..e28eea2b 100755 --- a/compiler/libpc300/sc1.c +++ b/compiler/libpc300/sc1.c @@ -29,7 +29,7 @@ #include #include -#if defined __WIN32__ || defined _WIN32 || defined __MSDOS__ +#if defined __WIN32__ || defined _WIN32 || defined __MSDOS__ #include #include #define snprintf _snprintf @@ -146,7 +146,7 @@ static int *wqptr; /* pointer to next entry */ #if !defined SC_LIGHT static char *sc_documentation=NULL;/* main documentation */ #endif -#if defined __WIN32__ || defined _WIN32 || defined _Windows +#if defined __WIN32__ || defined _WIN32 || defined _Windows static HWND hwndFinish = 0; #endif @@ -510,7 +510,7 @@ int pc_compile(int argc, char *argv[]) char *tname,*sname; FILE *ftmp,*fsrc; int fidx; - #if defined __WIN32__ || defined _WIN32 + #if defined __WIN32__ || defined _WIN32 tname=_tempnam(NULL,"pawn"); #elif defined __MSDOS__ || defined _Windows tname=tempnam(NULL,"pawn"); @@ -590,7 +590,7 @@ int pc_compile(int argc, char *argv[]) #if !defined NO_DEFINE delete_substtable(); inst_datetime_defines(); - inst_binary_name(binfname); + inst_binary_name(binfname); #endif resetglobals(); sc_ctrlchar=sc_ctrlchar_org; @@ -655,7 +655,7 @@ int pc_compile(int argc, char *argv[]) #if !defined NO_DEFINE delete_substtable(); inst_datetime_defines(); - inst_binary_name(binfname); + inst_binary_name(binfname); #endif resetglobals(); sc_ctrlchar=sc_ctrlchar_org; @@ -777,7 +777,7 @@ cleanup: if (retcode==0 && verbosity>=2) pc_printf("\nDone.\n"); } /* if */ - #if defined __WIN32__ || defined _WIN32 || defined _Windows + #if defined __WIN32__ || defined _WIN32 || defined _Windows if (IsWindow(hwndFinish)) PostMessage(hwndFinish,RegisterWindowMessage("PawnNotify"),retcode,0L); #endif @@ -1044,7 +1044,7 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam strncpy(ename,option_value(ptr),_MAX_PATH); /* set name of error file */ ename[_MAX_PATH-1]='\0'; break; -#if defined __WIN32__ || defined _WIN32 || defined _Windows +#if defined __WIN32__ || defined _WIN32 || defined _Windows case 'H': hwndFinish=(HWND)atoi(option_value(ptr)); if (!IsWindow(hwndFinish)) @@ -1111,10 +1111,10 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam break; case 't': i=atoi(option_value(ptr)); - if (i>0) - sc_tabsize=i; - else - about(); + if (i>0) + sc_tabsize=i; + else + about(); break; case 'v': verbosity= isdigit(*option_value(ptr)) ? atoi(option_value(ptr)) : 2; @@ -1376,7 +1376,7 @@ static void about(void) pc_printf(" -d2 full debug information and dynamic checking\n"); pc_printf(" -d3 full debug information, dynamic checking, no optimization\n"); pc_printf(" -e set name of error file (quiet compile)\n"); -#if defined __WIN32__ || defined _WIN32 || defined _Windows +#if defined __WIN32__ || defined _WIN32 || defined _Windows pc_printf(" -H window handle to send a notification message on finish\n"); #endif pc_printf(" -i path for include files\n"); @@ -1398,7 +1398,7 @@ static void about(void) pc_printf(" -([+/-] require parantheses for function invocation (default=%c)\n", optproccall ? '-' : '+'); pc_printf(" sym=val define constant \"sym\" with value \"val\"\n"); pc_printf(" sym= define constant \"sym\" with value 0\n"); -#if defined __WIN32__ || defined _WIN32 || defined _Windows || defined __MSDOS__ +#if defined __WIN32__ || defined _WIN32 || defined _Windows || defined __MSDOS__ pc_printf("\nOptions may start with a dash or a slash; the options \"-d0\" and \"/d0\" are\n"); pc_printf("equivalent.\n"); #endif @@ -1994,10 +1994,10 @@ static int declloc(int fstatic) /* Although valid, a local variable whose name is equal to that * of a global variable or to that of a local variable at a lower * level might indicate a bug. - * NOTE - don't bother with the error if there's no valid function! + * NOTE - don't bother with the error if there's no valid function! */ if (((sym=findloc(name))!=NULL && sym->compound!=nestlevel) || findglb(name)!=NULL) - if (curfunc!=NULL && (curfunc->usage & uNATIVE)) + if (curfunc!=NULL && (curfunc->usage & uNATIVE)) error(219,name); /* variable shadows another symbol */ while (matchtoken('[')){ ident=iARRAY; @@ -2250,7 +2250,7 @@ static void initials(int ident,int tag,cell *size,int dim[],int numdim, err++; } /* if */ } /* for */ - if (numdim>1 && dim[numdim-1]==0 && !errorfound && err==0) { + if (numdim>1 && dim[numdim-1]==0 && !errorfound && err==0) { /* also look whether, by any chance, all "counted" final dimensions are * the same value; if so, we can store this */ @@ -2803,7 +2803,7 @@ SC_FUNC symbol *fetchfunc(char *name,int tag) } /* if */ if (pc_deprecate!=NULL) { assert(sym!=NULL); - sym->flags |= flgDEPRECATED; + sym->flags |= flgDEPRECATED; if (sc_status==statWRITE) { if (sym->documentation!=NULL) { free(sym->documentation); @@ -3101,7 +3101,7 @@ static void funcstub(int native) litidx=0; /* clear the literal pool */ assert(loctab.next==NULL); /* local symbol table should be empty */ - tag=pc_addtag(NULL); /* get the tag of the return value */ + tag=pc_addtag(NULL); /* get the tag of the return value */ numdim=0; while (matchtoken('[')) { /* the function returns an array, get this tag for the index and the array @@ -3286,7 +3286,7 @@ static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int stoc if ((sym->usage & (uPROTOTYPED | uREAD))==uREAD && sym->tag!=0) { int curstatus=sc_status; sc_status=statWRITE; /* temporarily set status to WRITE, so the warning isn't blocked */ - //error(208); //this is silly, it should be caught the first pass + //error(208); //this is silly, it should be caught the first pass sc_status=curstatus; sc_reparse=TRUE; /* must add another pass to "initial scan" phase */ } /* if */ @@ -3319,8 +3319,8 @@ static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int stoc glbdecl=glb_declared; } /* if */ if ((sym->flags & flgDEPRECATED) != 0 && (sym->usage & uSTOCK) == 0) { - char *ptr = (sym->documentation != NULL) ? sym->documentation : ""; - error(233, symbolname, ptr); /* deprecated (probably a public function) */ + char *ptr = (sym->documentation != NULL) ? sym->documentation : ""; + error(233, symbolname, ptr); /* deprecated (probably a public function) */ } /* if */ begcseg(); sym->usage|=uDEFINE; /* set the definition flag */ @@ -4252,9 +4252,9 @@ static long max_stacksize_recurse(symbol *sourcesym, symbol *sym, long basesize, if (sym->refer[i]!=NULL) { assert(sym->refer[i]->ident==iFUNCTN); assert((sym->refer[i]->usage & uNATIVE)==0); /* a native function cannot refer to a user-function */ - if (sym->refer[i] == sourcesym) - return -1; /* recursion detection */ - size = max_stacksize_recurse(sourcesym, sym->refer[i], sym->x.stacksize, pubfuncparams); + if (sym->refer[i] == sourcesym) + return -1; /* recursion detection */ + size = max_stacksize_recurse(sourcesym, sym->refer[i], sym->x.stacksize, pubfuncparams); if (size<0) return size; /* recursion was detected, quit */ if (maxsizeusage & uDEFINE)==0) { error(19,sym->name); /* not a label: ... */ } else if ((sym->usage & uREAD)==0) { - errorset(sSETFILE,sym->fnumber); - errorset(sSETLINE,sym->lnumber); + errorset(sSETFILE,sym->fnumber); + errorset(sSETLINE,sym->lnumber); error(203,sym->name); /* symbol isn't used: ... */ - } /* if */ + } /* if */ } /* if */ break; case iFUNCTN: if ((sym->usage & (uDEFINE | uREAD | uNATIVE | uSTOCK))==uDEFINE) { funcdisplayname(symname,sym->name); if (strlen(symname)>0) { - errorset(sSETFILE,sym->fnumber); - errorset(sSETLINE,sym->lnumber); + errorset(sSETFILE,sym->fnumber); + errorset(sSETLINE,sym->lnumber); error(203,symname); /* symbol isn't used ... (and not native/stock) */ - } /* if */ + } /* if */ } /* if */ if ((sym->usage & uPUBLIC)!=0 || strcmp(sym->name,uMAINFUNC)==0) entry=TRUE; /* there is an entry point */ @@ -4372,30 +4372,30 @@ static int testsymbols(symbol *root,int level,int testlabs,int testconst) break; case iCONSTEXPR: if (testconst && (sym->usage & uREAD)==0) { - errorset(sSETFILE,sym->fnumber); - errorset(sSETLINE,sym->lnumber); + errorset(sSETFILE,sym->fnumber); + errorset(sSETLINE,sym->lnumber); error(203,sym->name); /* symbol isn't used: ... */ - } /* if */ + } /* if */ break; default: /* a variable */ if (sym->parent!=NULL) break; /* hierarchical data type */ if ((sym->usage & (uWRITTEN | uREAD | uSTOCK))==0) { - errorset(sSETFILE,sym->fnumber); - errorset(sSETLINE,sym->lnumber); + errorset(sSETFILE,sym->fnumber); + errorset(sSETLINE,sym->lnumber); error(203,sym->name,sym->lnumber); /* symbol isn't used (and not stock) */ } else if ((sym->usage & (uREAD | uSTOCK | uPUBLIC))==0) { - errorset(sSETFILE,sym->fnumber); - errorset(sSETLINE,sym->lnumber); + errorset(sSETFILE,sym->fnumber); + errorset(sSETLINE,sym->lnumber); error(204,sym->name); /* value assigned to symbol is never used */ #if 0 // ??? not sure whether it is a good idea to force people use "const" - } else if ((sym->usage & (uWRITTEN | uPUBLIC | uCONST))==0 && sym->ident==iREFARRAY) { - errorset(sSETFILE,sym->fnumber); - errorset(sSETLINE,sym->lnumber); + } else if ((sym->usage & (uWRITTEN | uPUBLIC | uCONST))==0 && sym->ident==iREFARRAY) { + errorset(sSETFILE,sym->fnumber); + errorset(sSETLINE,sym->lnumber); error(214,sym->name); /* make array argument "const" */ #endif - } /* if */ + } /* if */ /* also mark the variable (local or global) to the debug information */ if ((sym->usage & (uWRITTEN | uREAD))!=0 && (sym->usage & uNATIVE)==0) insert_dbgsymbol(sym); @@ -4651,13 +4651,13 @@ static void statement(int *lastindent,int allow_decl) break; case '{': tok=fline; - if (!matchtoken('}')) { /* {} is the empty statement */ + if (!matchtoken('}')) { /* {} is the empty statement */ compound(tok==fline); } else { - lastst = tEMPTYBLOCK; - } - /* lastst (for "last statement") does not change - you're not my father, don't tell me what to do */ + lastst = tEMPTYBLOCK; + } + /* lastst (for "last statement") does not change + you're not my father, don't tell me what to do */ break; case ';': error(36); /* empty statement */ @@ -4947,7 +4947,7 @@ static int doif(void) if (matchtoken(tELSE)==0){ /* if...else ? */ setlabel(flab1); /* no, simple if..., print false label */ } else { - lastst_true=lastst; + lastst_true=lastst; /* to avoid the "dangling else" error, we want a warning if the "else" * has a lower indent than the matching "if" */ if (stmtindent0) @@ -4958,12 +4958,12 @@ static int doif(void) setlabel(flab1); /* print false label */ statement(NULL,FALSE); /* do "else" clause */ setlabel(flab2); /* print true label */ - /* if both the "true" branch and the "false" branch ended with the same - * kind of statement, set the last statement id to that kind, rather than - * to the generic tIF; this allows for better "unreachable code" checking - */ - if (lastst == lastst_true) - return lastst; + /* if both the "true" branch and the "false" branch ended with the same + * kind of statement, set the last statement id to that kind, rather than + * to the generic tIF; this allows for better "unreachable code" checking + */ + if (lastst == lastst_true) + return lastst; } /* endif */ return tIF; } @@ -5343,11 +5343,11 @@ static void doreturn(void) error(78); /* mix "return;" and "return value;" */ ident=doexpr(TRUE,FALSE,TRUE,TRUE,&tag,&sym,TRUE); needtoken(tTERM); - if (ident == iARRAY && sym == NULL) { - /* returning a literal string is not supported (it must be a variable) */ - error(39); - ident = iCONSTEXPR; /* avoid handling an "array" case */ - } /* if */ + if (ident == iARRAY && sym == NULL) { + /* returning a literal string is not supported (it must be a variable) */ + error(39); + ident = iCONSTEXPR; /* avoid handling an "array" case */ + } /* if */ /* see if this function already has a sub type (an array attached) */ sub=finddepend(curfunc); assert(sub==NULL || sub->ident==iREFARRAY); @@ -5546,7 +5546,7 @@ static void dostate(void) pc_docexpr=TRUE; /* attach expression as a documentation string */ test(flabel,FALSE,FALSE); /* get expression, branch to flabel if false */ pc_docexpr=FALSE; - pc_deprecate=NULL; + pc_deprecate=NULL; needtoken(')'); } else { flabel=-1; diff --git a/compiler/libpc300/sc2.c b/compiler/libpc300/sc2.c index 42a12e04..46ba78e0 100755 --- a/compiler/libpc300/sc2.c +++ b/compiler/libpc300/sc2.c @@ -156,17 +156,17 @@ static char *extensions[] = { ".inc", ".p", ".pawn" }; PUSHSTK_I(fline); inpfname=duplicatestring(name);/* set name of include file */ if (inpfname==NULL) - error(103); /* insufficient memory */ - inpf=fp; /* set input file pointer to include file */ + error(103); /* insufficient memory */ + inpf=fp; /* set input file pointer to include file */ fnumber++; - fline=0; /* set current line number to 0 */ + fline=0; /* set current line number to 0 */ fcurrent=fnumber; - icomment=0; /* not in a comment */ - insert_dbgfile(inpfname); /* attach to debug information */ + icomment=0; /* not in a comment */ + insert_dbgfile(inpfname); /* attach to debug information */ insert_inputfile(inpfname); /* save for the error system */ assert(sc_status == statFIRST || strcmp(get_inputfile(fcurrent), inpfname) == 0); setfiledirect(inpfname); /* (optionally) set in the list file */ - listline=-1; /* force a #line directive when changing the file */ + listline=-1; /* force a #line directive when changing the file */ sc_is_utf8=(short)scan_utf8(inpf,name); return TRUE; } @@ -322,7 +322,7 @@ static void readline(unsigned char *line) inpf=(FILE *)POPSTK_P(); insert_dbgfile(inpfname); setfiledirect(inpfname); - assert(sc_status==statFIRST || strcmp(get_inputfile(fcurrent),inpfname)==0); + assert(sc_status==statFIRST || strcmp(get_inputfile(fcurrent),inpfname)==0); listline=-1; /* force a #line directive when changing the file */ } /* if */ @@ -596,7 +596,7 @@ static int htoi(cell *val,const unsigned char *curptr) #if defined __APPLE__ static double pow10(double d) { - return pow(10, d); + return pow(10, d); } #endif @@ -914,7 +914,7 @@ static int command(void) if ((ifstack[iflevel-1] & PARSEMODE)==PARSEMODE) { /* there has been a parse mode already on this level, so skip the rest */ ifstack[iflevel-1] |= (char)SKIPMODE; - /* if we were already skipping this section, allow expressions with + /* if we were already skipping this section, allow expressions with * undefined symbols; otherwise check the expression to catch errors */ if (tok==tpELSEIF) { @@ -1027,27 +1027,27 @@ static int command(void) error(27); /* invalid character constant */ sc_ctrlchar=(char)val; } /* if */ - } - else if (strcmp(str, "deprecated") == 0) { - while (*lptr <= ' ' && *lptr != '\0') - lptr++; - len = strlen((char*)lptr); - pc_deprecate = (char*)malloc(len + 1); - if (pc_deprecate != NULL) - { - strcpy(pc_deprecate, (char*)lptr); - if (pc_deprecate[len - 1] == '\n') /* remove extra \n as already appended in .scp file */ - pc_deprecate[len-1] = '\0'; - } - lptr = (unsigned char*)strchr((char*)lptr, '\0'); /* skip to end (ignore "extra characters on line") */ + } + else if (strcmp(str, "deprecated") == 0) { + while (*lptr <= ' ' && *lptr != '\0') + lptr++; + len = strlen((char*)lptr); + pc_deprecate = (char*)malloc(len + 1); + if (pc_deprecate != NULL) + { + strcpy(pc_deprecate, (char*)lptr); + if (pc_deprecate[len - 1] == '\n') /* remove extra \n as already appended in .scp file */ + pc_deprecate[len-1] = '\0'; + } + lptr = (unsigned char*)strchr((char*)lptr, '\0'); /* skip to end (ignore "extra characters on line") */ } else if (strcmp(str,"dynamic")==0) { preproc_expr(&sc_stksize,NULL); - } else if ( !strcmp(str,"library") || + } else if ( !strcmp(str,"library") || !strcmp(str, "reqlib") || !strcmp(str, "reqclass") || !strcmp(str, "loadlib") || - !strcmp(str, "explib") || - !strcmp(str, "expclass") || + !strcmp(str, "explib") || + !strcmp(str, "expclass") || !strcmp(str, "defclasslib") ) { char name[sNAMEMAX+1],sname[sNAMEMAX+1]; const char *prefix = ""; @@ -1087,7 +1087,7 @@ static int command(void) } else { sname[0] = '_'; } - } + } } /* if */ if (strlen(name)==0) { curlibrary=NULL; @@ -1097,20 +1097,20 @@ static int command(void) /* add the name if it does not yet exist in the table */ char newname[sNAMEMAX+1]; if (strlen(name) + strlen(prefix) + strlen(sname) <= sNAMEMAX) - { + { strcpy(newname, prefix); strcat(newname, name); strcat(newname, sname); if (newname[0] != '?') - { + { if (find_constval(&libname_tab,newname,0)==NULL) - { + { curlibrary=append_constval(&libname_tab,newname,0,0); - } - } else { + } + } else { exporttag(pc_addtag(newname)); - } - } + } + } } /* if */ } else if (strcmp(str,"pack")==0) { cell val; @@ -1154,8 +1154,8 @@ static int command(void) } else if (strcmp(str,"tabsize")==0) { cell val; preproc_expr(&val,NULL); - if (val>0) - 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) { @@ -1289,7 +1289,7 @@ static int command(void) } /* while */ end=lptr; /* check pattern to match */ - if (!alpha(*start)) { + if (!alpha(*start)) { error(74); /* pattern must start with an alphabetic character */ break; } /* if */ @@ -1371,7 +1371,7 @@ static int command(void) case tpERROR: while (*lptr<=' ' && *lptr!='\0') lptr++; - if (!SKIPPING) + if (!SKIPPING) error(111,lptr); /* user error */ break; default: @@ -1450,7 +1450,7 @@ static const unsigned char *skippgroup(const unsigned char *string) break; default: assert(0); - close='\0'; /* only to avoid a compiler warning */ + close='\0'; /* only to avoid a compiler warning */ }/* switch */ string++; @@ -1531,7 +1531,7 @@ static int substpattern(unsigned char *line,size_t buffersize,char *pattern,char /* store the parameter (overrule any earlier) */ if (args[arg]!=NULL) free(args[arg]); - else + else argsnum++; len=(int)(e-s); args[arg]=(unsigned char*)malloc(len+1); @@ -1674,7 +1674,7 @@ static void substallpatterns(unsigned char *line,int buffersize) while ((*start<=' ' && *start!='\0') || *start=='(') start++; /* skip the symbol behind it */ - while (alphanum(*start)) + while (alphanum(*start)) start++; /* drop back into the main loop */ continue; @@ -1682,7 +1682,7 @@ static void substallpatterns(unsigned char *line,int buffersize) /* get the prefix (length), look for a matching definition */ prefixlen=0; end=start; - while (alphanum(*end)) { + while (alphanum(*end)) { prefixlen++; end++; } /* while */ @@ -2447,7 +2447,7 @@ SC_FUNC int get_actual_compound(symbol *sym) while (sym->parent) sym = sym->parent; } - + return sym->compound; } @@ -2461,7 +2461,7 @@ SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_ * specified nesting level */ while (root->next!=NULL) { sym=root->next; - if (get_actual_compound(sym)ident) { case iLABEL: @@ -2551,7 +2551,7 @@ static symbol *find_symbol(const symbol *root,const char *name,int fnumber,int i while (ptr!=NULL) { if (hash==ptr->hash && strcmp(name,ptr->name)==0 && (ptr->parent==NULL || includechildren) - && (fnumber<0 || (ptr->fnumber<0 || ptr->fnumber==fnumber))) + && (fnumber<0 || (ptr->fnumber<0 || ptr->fnumber==fnumber))) return ptr; ptr=ptr->next; } /* while */ @@ -2620,7 +2620,7 @@ SC_FUNC void markusage(symbol *sym,int usage) assert(sym!=NULL); sym->usage |= (char)usage; if ((usage & uWRITTEN) != 0) - sym->lnumber=fline; + sym->lnumber=fline; /* check if (global) reference must be added to the symbol */ if ((usage & (uREAD | uWRITTEN))!=0) { /* only do this for global symbols */ diff --git a/compiler/libpc300/sc3.c b/compiler/libpc300/sc3.c index bbd3e6fa..ee02b69e 100755 --- a/compiler/libpc300/sc3.c +++ b/compiler/libpc300/sc3.c @@ -288,8 +288,7 @@ SC_FUNC int matchtag(int formaltag,int actualtag,int allowcoerce) * tag is "coerced" to zero */ if (!allowcoerce || formaltag!=0 || (actualtag & FIXEDTAG)!=0) - return FALSE; - + return FALSE; } /* if */ return TRUE; } @@ -505,9 +504,9 @@ static int plnge_rel(int *opstr,int opoff,int (*hier)(value *lval),value *lval) error(212); if (count>0) { relop_prefix(); - boolresult = lval->boolresult; + boolresult = lval->boolresult; *lval=lval2; /* copy right hand expression of the previous iteration */ - lval->boolresult = boolresult; + lval->boolresult = boolresult; } /* if */ opidx+=opoff; plnge2(op1[opidx],hier,lval,&lval2); @@ -1040,13 +1039,13 @@ static int hier13(value *lval) lval->ident=iREFARRAY; /* iARRAY becomes iREFARRAY */ else if (lval->ident!=iREFARRAY) lval->ident=iEXPRESSION; /* iREFARRAY stays iREFARRAY, rest becomes iEXPRESSION */ - if (orig_heap!=decl_heap) { - diff2=abs(decl_heap-orig_heap); - decl_heap=orig_heap; - } + if (orig_heap!=decl_heap) { + diff2=abs(decl_heap-orig_heap); + decl_heap=orig_heap; + } if (diff1==diff2) { decl_heap+=(diff1/2); - } else { + } else { decl_heap+=(diff1+diff2); } return FALSE; /* conditional expression is no lvalue */ diff --git a/compiler/libpc300/sc5.c b/compiler/libpc300/sc5.c index 83cbb3f8..e5f74c90 100755 --- a/compiler/libpc300/sc5.c +++ b/compiler/libpc300/sc5.c @@ -21,7 +21,7 @@ */ #include -#if defined __WIN32__ || defined _WIN32 || defined __MSDOS__ +#if defined __WIN32__ || defined _WIN32 || defined __MSDOS__ #include #endif #if defined LINUX || defined __APPLE__ || defined __GNUC__ @@ -187,7 +187,7 @@ SC_FUNC void errorset(int code,int line) case sEXPRRELEASE: errstart=-1; /* forget start line number */ errline=-1; - errfile=-1; + errfile=-1; break; case sSETLINE: errstart=-1; /* force error line number, forget start line */ diff --git a/compiler/libpc300/sclist.c b/compiler/libpc300/sclist.c index 54658e04..7d60226c 100755 --- a/compiler/libpc300/sclist.c +++ b/compiler/libpc300/sclist.c @@ -278,23 +278,23 @@ SC_FUNC stringpair *insert_subst(char *pattern,char *substitution,int prefixlen) adjustindex(*pattern); if (pc_deprecate != NULL) { - assert(cur != NULL); - cur->flags |= flgDEPRECATED; - if (sc_status == statWRITE) { - if (cur->documentation != NULL) { - free(cur->documentation); - cur->documentation = NULL; - } /* if */ - cur->documentation = pc_deprecate; - } - else { - free(pc_deprecate); - } /* if */ - pc_deprecate = NULL; + assert(cur != NULL); + cur->flags |= flgDEPRECATED; + if (sc_status == statWRITE) { + if (cur->documentation != NULL) { + free(cur->documentation); + cur->documentation = NULL; + } /* if */ + cur->documentation = pc_deprecate; + } + else { + free(pc_deprecate); + } /* if */ + pc_deprecate = NULL; } else { - cur->flags = 0; - cur->documentation = NULL; + cur->flags = 0; + cur->documentation = NULL; } /* if */ return cur; } @@ -309,22 +309,20 @@ SC_FUNC stringpair *find_subst(char *name,int length) if (item!=NULL) item=find_stringpair(item,name,length); - if (item && (item->flags & flgDEPRECATED) != 0) - { - static char macro[128]; - char *rem, *msg = (item->documentation != NULL) ? item->documentation : ""; - strncpy(macro, item->first, sizeof(macro)); - macro[sizeof(macro) - 1] = '\0'; + if (item && (item->flags & flgDEPRECATED) != 0) { + static char macro[128]; + char *rem, *msg = (item->documentation != NULL) ? item->documentation : ""; + strncpy(macro, item->first, sizeof(macro)); + macro[sizeof(macro) - 1] = '\0'; - /* If macro contains an opening parentheses and a percent sign, then assume that - * it takes arguments and remove them from the warning message. - */ - if ((rem = strchr(macro, '(')) != NULL && strchr(macro, '%') > rem) - { - *rem = '\0'; - } + /* If macro contains an opening parentheses and a percent sign, then assume that + * it takes arguments and remove them from the warning message. + */ + if ((rem = strchr(macro, '(')) != NULL && strchr(macro, '%') > rem) { + *rem = '\0'; + } - error(233, macro, msg); /* deprecated (macro/constant) */ + error(233, macro, msg); /* deprecated (macro/constant) */ } return item; } @@ -475,9 +473,9 @@ SC_FUNC stringlist *insert_dbgline(int linenr) } #ifdef WIN32 -#define LONGCAST long +#define LONGCAST long #else -#define LONGCAST cell +#define LONGCAST cell #endif SC_FUNC stringlist *insert_dbgsymbol(symbol *sym) @@ -510,7 +508,7 @@ SC_FUNC stringlist *insert_dbgsymbol(symbol *sym) if (sym->ident==iARRAY || sym->ident==iREFARRAY) { symbol *sub; #if !defined NDEBUG - count = sym->dim.array.level; + count = sym->dim.array.level; #endif strcat(string," [ "); for (sub=sym; sub!=NULL; sub=finddepend(sub)) {