Skip to content

Commit 74004e4

Browse files
committed
Merge remote-tracking branch 'remotes/Daniel-Cortez/fix-398' into dev
2 parents 85814e7 + 74bb2b3 commit 74004e4

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

source/compiler/sc5.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static short lastfile;
246246
char *msg,*pre;
247247
va_list argptr;
248248
char string[128];
249-
int notice;
249+
int notice,start;
250250

251251
/* split the error field between the real error/warning number and an optional
252252
* "notice" number
@@ -303,15 +303,15 @@ static short lastfile;
303303
} /* if */
304304

305305
assert(errstart<=fline);
306+
start=errstart;
306307
if (errline>0)
307-
errstart=errline;
308+
start=errline;
308309
else
309310
errline=fline;
310-
assert(errstart<=errline);
311+
assert(start<=errline);
311312
va_start(argptr,number);
312313
if (errfname[0]=='\0') {
313-
int start=(errstart==errline) ? -1 : errstart;
314-
if (pc_error((int)number,msg,inpfname,start,errline,argptr)) {
314+
if (pc_error((int)number,msg,inpfname,((start==errline) ? -1 : start),errline,argptr)) {
315315
if (outf!=NULL) {
316316
pc_closeasm(outf,TRUE);
317317
outf=NULL;
@@ -321,8 +321,8 @@ static short lastfile;
321321
} else {
322322
FILE *fp=fopen(errfname,"a");
323323
if (fp!=NULL) {
324-
if (errstart>=0 && errstart!=errline)
325-
fprintf(fp,"%s(%d -- %d) : %s %03d: ",inpfname,errstart,errline,pre,(int)number);
324+
if (start>=0 && start!=errline)
325+
fprintf(fp,"%s(%d -- %d) : %s %03d: ",inpfname,start,errline,pre,(int)number);
326326
else
327327
fprintf(fp,"%s(%d) : %s %03d: ",inpfname,errline,pre,(int)number);
328328
vfprintf(fp,msg,argptr);
@@ -346,7 +346,7 @@ static short lastfile;
346346

347347
errline=-1;
348348
/* check whether we are seeing many errors on the same line */
349-
if ((errstart<0 && lastline!=fline) || lastline<errstart || lastline>fline || fcurrent!=lastfile)
349+
if ((start<0 && lastline!=fline) || lastline<start || lastline>fline || fcurrent!=lastfile)
350350
errorcount=0;
351351
lastline=fline;
352352
lastfile=fcurrent;

source/compiler/tests/__pragma.meta

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ __pragma.pwn(67) : warning 207: unknown #pragma
1414
__pragma.pwn(68) : warning 207: unknown #pragma
1515
__pragma.pwn(33) : warning 203: symbol is never used: "f"
1616
__pragma.pwn(29) : warning 204: symbol is assigned a value that is never used: "e"
17-
__pragma.pwn(29 -- 70) : warning 203: symbol is never used: "operator~(Tag:)"
17+
__pragma.pwn(70) : warning 203: symbol is never used: "operator~(Tag:)"
1818
"""
1919
}

source/compiler/tests/gh_398.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* 3 empty lines */
2+
3+
4+
new a, b;// <= line 4

source/compiler/tests/gh_398.meta

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
'test_type': 'output_check',
3+
'errors': """
4+
gh_398.pwn(4) : warning 203: symbol is never used: "a"
5+
gh_398.pwn(4) : warning 203: symbol is never used: "b"
6+
"""
7+
}

source/compiler/tests/gh_398.pwn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include "gh_398.inc"
2+
main(){}

0 commit comments

Comments
 (0)