Fix empty warnings causing crashes (#369)
* Fix empty warnings causing crashes * Add tests ...fix tests
This commit is contained in:
parent
0c9adcff18
commit
35fa8d4485
@ -1538,8 +1538,6 @@ static int command(void)
|
||||
#endif
|
||||
case tpERROR:
|
||||
case tpWARNING:
|
||||
while (*lptr<=' ' && *lptr!='\0')
|
||||
lptr++;
|
||||
while (*lptr<=' ' && *lptr!='\0')
|
||||
lptr++;
|
||||
if (!SKIPPING) {
|
||||
@ -1547,7 +1545,7 @@ static int command(void)
|
||||
if (usermsg!=NULL) {
|
||||
char *ptr=usermsg+strlen(usermsg)-1;
|
||||
/* remove trailing whitespace and newlines */
|
||||
while (*ptr<=' ')
|
||||
while (ptr >= usermsg && *ptr<=' ')
|
||||
*ptr--='\0';
|
||||
if (tok==tpERROR)
|
||||
error(111,usermsg); /* user error */
|
||||
|
6
source/compiler/tests/empty_warning_crash_gh_339.meta
Normal file
6
source/compiler/tests/empty_warning_crash_gh_339.meta
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
'test_type': 'output_check',
|
||||
'errors': """
|
||||
empty_warning_crash_gh_339.pwn(1) : warning 237: user warning:
|
||||
"""
|
||||
}
|
3
source/compiler/tests/empty_warning_crash_gh_339.pwn
Normal file
3
source/compiler/tests/empty_warning_crash_gh_339.pwn
Normal file
@ -0,0 +1,3 @@
|
||||
#warning
|
||||
|
||||
main () {}
|
Loading…
x
Reference in New Issue
Block a user