Refactor #warning and #pragma deprecated
This commit is contained in:
parent
3c6be803d7
commit
76507598f8
@ -1112,12 +1112,17 @@ static int command(void)
|
|||||||
sc_ctrlchar=(char)val;
|
sc_ctrlchar=(char)val;
|
||||||
} /* if */
|
} /* if */
|
||||||
} else if (strcmp(str,"deprecated")==0) {
|
} else if (strcmp(str,"deprecated")==0) {
|
||||||
|
/* remove leading whitespace */
|
||||||
while (*lptr<=' ' && *lptr!='\0')
|
while (*lptr<=' ' && *lptr!='\0')
|
||||||
lptr++;
|
lptr++;
|
||||||
pc_deprecate=(char*)malloc(strlen((char*)lptr)+1);
|
pc_deprecate=strdup((const char *)lptr);
|
||||||
if (pc_deprecate!=NULL) {
|
if (pc_deprecate!=NULL) {
|
||||||
strcpy(pc_deprecate,(const char *)lptr);
|
char *ptr=pc_deprecate+strlen(pc_deprecate)-1;
|
||||||
pc_deprecate[strcspn(pc_deprecate,"\r\n")]='\0';
|
/* remove trailing whitespace */
|
||||||
|
while (*ptr<= ' ')
|
||||||
|
*ptr--='\0';
|
||||||
|
} else {
|
||||||
|
error(103); /* insufficient memory */
|
||||||
} /* if */
|
} /* if */
|
||||||
lptr=(unsigned char*)strchr((char*)lptr,'\0'); /* skip to end (ignore "extra characters on line") */
|
lptr=(unsigned char*)strchr((char*)lptr,'\0'); /* skip to end (ignore "extra characters on line") */
|
||||||
} else if (strcmp(str,"dynamic")==0) {
|
} else if (strcmp(str,"dynamic")==0) {
|
||||||
@ -1488,23 +1493,25 @@ static int command(void)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case tpERROR:
|
case tpERROR:
|
||||||
while (*lptr<=' ' && *lptr!='\0')
|
|
||||||
lptr++;
|
|
||||||
if (!SKIPPING)
|
|
||||||
error(111,lptr); /* user error */
|
|
||||||
break;
|
|
||||||
case tpWARNING:
|
case tpWARNING:
|
||||||
|
while (*lptr<=' ' && *lptr!='\0')
|
||||||
|
lptr++;
|
||||||
while (*lptr<=' ' && *lptr!='\0')
|
while (*lptr<=' ' && *lptr!='\0')
|
||||||
lptr++;
|
lptr++;
|
||||||
if (!SKIPPING) {
|
if (!SKIPPING) {
|
||||||
char *usermsg=(char*)malloc(strlen((const char *)lptr)+1);
|
char *usermsg=strdup((const char *)lptr);
|
||||||
if (usermsg!=NULL) {
|
if (usermsg!=NULL) {
|
||||||
strcpy(usermsg,(const char *)lptr);
|
char *ptr=usermsg+strlen(usermsg)-1;
|
||||||
usermsg[strcspn(usermsg,"\r\n")]='\0';
|
/* remove trailing whitespace and newlines */
|
||||||
|
while (*ptr<=' ')
|
||||||
|
*ptr--='\0';
|
||||||
|
if (tok==tpERROR)
|
||||||
|
error(111,usermsg); /* user error */
|
||||||
|
else
|
||||||
error(237,usermsg); /* user warning */
|
error(237,usermsg); /* user warning */
|
||||||
free(usermsg);
|
free(usermsg);
|
||||||
} else {
|
} else {
|
||||||
error(237,lptr);
|
error(103); /* insufficient memory */
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user