Compiler: Add #warning directive.
Basically same as error but as warning.
Imported from SA-MP: 1bd6be93e0
Example:
#warning don't eat egg.
Result:
warning.sma(1) : warning 234: user warning: don't eat egg.
This commit is contained in:
parent
92255bcdc3
commit
fcdeea683b
|
@ -286,7 +286,7 @@ typedef struct s_stringpair {
|
||||||
*/
|
*/
|
||||||
#define tFIRST 256 /* value of first multi-character operator */
|
#define tFIRST 256 /* value of first multi-character operator */
|
||||||
#define tMIDDLE 280 /* value of last multi-character operator */
|
#define tMIDDLE 280 /* value of last multi-character operator */
|
||||||
#define tLAST 325 /* value of last multi-character match-able token */
|
#define tLAST 326 /* value of last multi-character match-able token */
|
||||||
/* multi-character operators */
|
/* multi-character operators */
|
||||||
#define taMULT 256 /* *= */
|
#define taMULT 256 /* *= */
|
||||||
#define taDIV 257 /* /= */
|
#define taDIV 257 /* /= */
|
||||||
|
@ -360,17 +360,18 @@ typedef struct s_stringpair {
|
||||||
#define tpPRAGMA 323
|
#define tpPRAGMA 323
|
||||||
#define tpTRYINCLUDE 324
|
#define tpTRYINCLUDE 324
|
||||||
#define tpUNDEF 325
|
#define tpUNDEF 325
|
||||||
|
#define tpWARNING 326
|
||||||
/* semicolon is a special case, because it can be optional */
|
/* semicolon is a special case, because it can be optional */
|
||||||
#define tTERM 326 /* semicolon or newline */
|
#define tTERM 327 /* semicolon or newline */
|
||||||
#define tENDEXPR 327 /* forced end of expression */
|
#define tENDEXPR 328 /* forced end of expression */
|
||||||
/* other recognized tokens */
|
/* other recognized tokens */
|
||||||
#define tNUMBER 328 /* integer number */
|
#define tNUMBER 329 /* integer number */
|
||||||
#define tRATIONAL 329 /* rational number */
|
#define tRATIONAL 330 /* rational number */
|
||||||
#define tSYMBOL 330
|
#define tSYMBOL 331
|
||||||
#define tLABEL 331
|
#define tLABEL 332
|
||||||
#define tSTRING 332
|
#define tSTRING 333
|
||||||
#define tEXPR 333 /* for assigment to "lastst" only */
|
#define tEXPR 334 /* for assigment to "lastst" only */
|
||||||
#define tEMPTYBLOCK 334 /* empty blocks for AM bug 4825 */
|
#define tEMPTYBLOCK 335 /* empty blocks for AM bug 4825 */
|
||||||
|
|
||||||
/* (reversed) evaluation of staging buffer */
|
/* (reversed) evaluation of staging buffer */
|
||||||
#define sSTARTREORDER 0x01
|
#define sSTARTREORDER 0x01
|
||||||
|
|
|
@ -1351,6 +1351,14 @@ static int command(void)
|
||||||
if (!SKIPPING)
|
if (!SKIPPING)
|
||||||
error(111,lptr); /* user error */
|
error(111,lptr); /* user error */
|
||||||
break;
|
break;
|
||||||
|
case tpWARNING:
|
||||||
|
while (*lptr<=' ' && *lptr!='\0')
|
||||||
|
lptr++;
|
||||||
|
if (!SKIPPING) {
|
||||||
|
str=strtok((char*)lptr, "\n");
|
||||||
|
error(234, str != NULL ? str : lptr); /* user warning, and remove unnecessary newline */
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
error(31); /* unknown compiler directive */
|
error(31); /* unknown compiler directive */
|
||||||
ret=SKIPPING ? CMD_CONDFALSE : CMD_NONE; /* process as normal line */
|
ret=SKIPPING ? CMD_CONDFALSE : CMD_NONE; /* process as normal line */
|
||||||
|
@ -1831,7 +1839,7 @@ char *sc_tokens[] = {
|
||||||
"sleep", "state", "static", "stock", "switch", "tagof", "while",
|
"sleep", "state", "static", "stock", "switch", "tagof", "while",
|
||||||
"#assert", "#define", "#else", "#elseif", "#emit", "#endif", "#endinput",
|
"#assert", "#define", "#else", "#elseif", "#emit", "#endif", "#endinput",
|
||||||
"#endscript", "#error", "#file", "#if", "#include", "#line", "#pragma",
|
"#endscript", "#error", "#file", "#if", "#include", "#line", "#pragma",
|
||||||
"#tryinclude", "#undef",
|
"#tryinclude", "#undef", "#warning",
|
||||||
";", ";", "-integer value-", "-rational value-", "-identifier-",
|
";", ";", "-integer value-", "-rational value-", "-identifier-",
|
||||||
"-label-", "-string-"
|
"-label-", "-string-"
|
||||||
};
|
};
|
||||||
|
|
|
@ -238,7 +238,7 @@ static char *fatalmsg[] = {
|
||||||
/*108*/ "codepage mapping file not found\n",
|
/*108*/ "codepage mapping file not found\n",
|
||||||
/*109*/ "invalid path: \"%s\"\n",
|
/*109*/ "invalid path: \"%s\"\n",
|
||||||
/*110*/ "assertion failed: %s\n",
|
/*110*/ "assertion failed: %s\n",
|
||||||
/*111*/ "user error: %s\n",
|
/*111*/ "user error: %s\n"
|
||||||
#else
|
#else
|
||||||
"c\224\241\222a\206from \327le\335",
|
"c\224\241\222a\206from \327le\335",
|
||||||
"c\224\241writ\200\277 \327le\335",
|
"c\224\241writ\200\277 \327le\335",
|
||||||
|
@ -291,6 +291,7 @@ static char *warnmsg[] = {
|
||||||
/*231*/ "state specification on forward declaration is ignored\n",
|
/*231*/ "state specification on forward declaration is ignored\n",
|
||||||
/*232*/ "output file is written, but with compact encoding disabled\n"
|
/*232*/ "output file is written, but with compact encoding disabled\n"
|
||||||
/*233*/ "symbol \"%s\" is marked as deprecated: %s\n",
|
/*233*/ "symbol \"%s\" is marked as deprecated: %s\n",
|
||||||
|
/*234*/ "user warning: %s\n"
|
||||||
#else
|
#else
|
||||||
"\345 \274tr\240\226\233\277 %\206\273\337c\367\305",
|
"\345 \274tr\240\226\233\277 %\206\273\337c\367\305",
|
||||||
"\222\323i\231\300\344\224t/\314cr\375\364",
|
"\222\323i\231\300\344\224t/\314cr\375\364",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user