sourcemod/sourcepawn/compiler/sc5.cpp

244 lines
7.1 KiB
C++
Raw Normal View History

2014-09-03 20:04:25 +02:00
// vim: set ts=8 sts=2 sw=2 tw=99 et:
/* Pawn compiler - Error message system
* In fact a very simple system, using only 'panic mode'.
*
* Copyright (c) ITB CompuPhase, 1997-2006
*
* This software is provided "as-is", without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software in
* a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
* Version: $Id$
*/
#include <assert.h>
#if defined __WIN32__ || defined _WIN32 || defined __MSDOS__
#include <io.h>
#endif
#if defined LINUX || defined __GNUC__
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h> /* ANSI standardized variable argument list functions */
#include <string.h>
#if defined FORTIFY
#include <alloc/fortify.h>
#endif
#include "sc.h"
#if defined _MSC_VER
#pragma warning(push)
#pragma warning(disable:4125) /* decimal digit terminates octal escape sequence */
#endif
#include <sc5.scp>
#if defined _MSC_VER
#pragma warning(pop)
#endif
#define NUM_WARNINGS (sizeof warnmsg / sizeof warnmsg[0])
static unsigned char warndisable[(NUM_WARNINGS + 7) / 8]; /* 8 flags in a char */
static int errflag;
Introduce basic methodmaps (PR #38). commit 1e5213d43fdd170bb0c30af914a4e40610014b2b Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 04:09:27 2014 -0700 Quell MSVC C99 bugs. commit f2e166c5925fda49b5abeadc0aa0f9156b99cf11 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:59:23 2014 -0700 Fix varying levels of stupid memory errors. commit b0773d7be45345351ab1c1738681d5215a97f3f3 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:36:39 2014 -0700 Fix memory leak in parsing some control flow structures. commit 5aca55713cfc2dd09c5900132fc4a6be51e3e309 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:35:17 2014 -0700 Fix memory leak in struct parsing. commit b46ec5cd281b46177e83c4f0a4acac9cc1065c53 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:32:03 2014 -0700 Fix build. commit 17bbbb9a46bfc00862adca7d3e15369a48e9ac0f Merge: c083409 2107599 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 01:26:27 2014 -0700 Merge branch 'master' into methodmaps commit c083409b569abff13f24d3b8c47f8ff199036840 Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 23:49:36 2014 -0700 Add VS2k13 support. commit b7993778494d538cb1c1965116030142a7f7765b Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 01:28:08 2014 -0700 Implement destructors. commit 1a340dec260d079ed1b79351ed7b50b58a997cea Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 00:08:04 2014 -0700 Add some tests. commit 12db52ee64eb009ead9294495e9034c63ab75b09 Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 00:05:49 2014 -0700 Initial implementation of constructors. commit 074669a658caa2822aa864164b615a244c00a0bc Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:42:35 2014 -0700 Add simple test harness. commit 27c1e3cf14e1e6c5cf35c80c792cce2744b804d7 Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:15:42 2014 -0700 Big refactoring for new syntax. commit f3c37fdc919e76ee0815e2394cbe8d221f9fc0ca Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:12:54 2014 -0700 Refactor tests for the new syntax. commit 6211f392f8e722b907474cf380cfac4347e46b8e Author: David Anderson <dvander@alliedmods.net> Date: Wed Jun 18 22:25:48 2014 -0700 Make lexer tokens an enum. commit 5210b013756b0b00de3a61c6490685c768ff8cbd Author: David Anderson <dvander@alliedmods.net> Date: Tue Jun 17 06:48:15 2014 -0700 Add comment. commit 06688ff4aced14077dd21a9cc1db4c26c7420ff3 Author: David Anderson <dvander@alliedmods.net> Date: Tue Jun 17 06:46:10 2014 -0700 Allow |this| to be a base type of the methodmap. commit 05cf3682020e0e6d9f47b1a0a6727b9edbfe7622 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 22:11:58 2014 -0700 Unify duplicate typesymbol checking. commit 09161bf2691c8c1ed25b9b70fda01c336f21aa0b Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 19:53:36 2014 -0700 Close loophole that allowed methodmaps for enums. commit 5bb4aeba89fec47a4de7a7532d27830999d1fcb4 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:50:42 2014 -0700 Add tests and dbi/handle changes. commit b9203e2491daec2a8073874d6375949483778d14 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:38:29 2014 -0700 Ensure methodmap tags are fixed. commit 878b80fd87a2ea500d3a28ce2d53f616d1efe5e8 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:36:04 2014 -0700 Implement inheritance. commit 6ba9e004fbae18ad68056368ddd0affdc78659f1 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:31:00 2014 -0700 Refactor matchtag() to not be insane. commit 4ede6343b0682c6df98fa869153828e92f891bcc Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:20:50 2014 -0700 Fix indenting. commit e3ddef8916e3dd5f4ff0fe571d6e1c3acd163352 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:20:27 2014 -0700 Initial prototype.
2014-06-21 13:10:15 +02:00
static int errstart; /* line number at which the instruction started */
static int sErrLine; /* forced line number for the error message */
/* error
*
* Outputs an error message (note: msg is passed optionally).
* If an error is found, the variable "errflag" is set and subsequent
* errors are ignored until lex() finds a semicolumn or a keyword
* (lex() resets "errflag" in that case).
*
* Global references: inpfname (reffered to only)
* fline (reffered to only)
* fcurrent (reffered to only)
* errflag (altered)
*/
2014-08-22 09:53:47 +02:00
int error(int number,...)
{
2014-08-22 09:09:28 +02:00
static const char *prefix[3]={ "error", "fatal error", "warning" };
static int lastline,errorcount;
static short lastfile;
2014-08-22 09:09:28 +02:00
const char *msg,*pre;
va_list argptr;
Introduce basic methodmaps (PR #38). commit 1e5213d43fdd170bb0c30af914a4e40610014b2b Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 04:09:27 2014 -0700 Quell MSVC C99 bugs. commit f2e166c5925fda49b5abeadc0aa0f9156b99cf11 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:59:23 2014 -0700 Fix varying levels of stupid memory errors. commit b0773d7be45345351ab1c1738681d5215a97f3f3 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:36:39 2014 -0700 Fix memory leak in parsing some control flow structures. commit 5aca55713cfc2dd09c5900132fc4a6be51e3e309 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:35:17 2014 -0700 Fix memory leak in struct parsing. commit b46ec5cd281b46177e83c4f0a4acac9cc1065c53 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:32:03 2014 -0700 Fix build. commit 17bbbb9a46bfc00862adca7d3e15369a48e9ac0f Merge: c083409 2107599 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 01:26:27 2014 -0700 Merge branch 'master' into methodmaps commit c083409b569abff13f24d3b8c47f8ff199036840 Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 23:49:36 2014 -0700 Add VS2k13 support. commit b7993778494d538cb1c1965116030142a7f7765b Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 01:28:08 2014 -0700 Implement destructors. commit 1a340dec260d079ed1b79351ed7b50b58a997cea Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 00:08:04 2014 -0700 Add some tests. commit 12db52ee64eb009ead9294495e9034c63ab75b09 Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 00:05:49 2014 -0700 Initial implementation of constructors. commit 074669a658caa2822aa864164b615a244c00a0bc Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:42:35 2014 -0700 Add simple test harness. commit 27c1e3cf14e1e6c5cf35c80c792cce2744b804d7 Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:15:42 2014 -0700 Big refactoring for new syntax. commit f3c37fdc919e76ee0815e2394cbe8d221f9fc0ca Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:12:54 2014 -0700 Refactor tests for the new syntax. commit 6211f392f8e722b907474cf380cfac4347e46b8e Author: David Anderson <dvander@alliedmods.net> Date: Wed Jun 18 22:25:48 2014 -0700 Make lexer tokens an enum. commit 5210b013756b0b00de3a61c6490685c768ff8cbd Author: David Anderson <dvander@alliedmods.net> Date: Tue Jun 17 06:48:15 2014 -0700 Add comment. commit 06688ff4aced14077dd21a9cc1db4c26c7420ff3 Author: David Anderson <dvander@alliedmods.net> Date: Tue Jun 17 06:46:10 2014 -0700 Allow |this| to be a base type of the methodmap. commit 05cf3682020e0e6d9f47b1a0a6727b9edbfe7622 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 22:11:58 2014 -0700 Unify duplicate typesymbol checking. commit 09161bf2691c8c1ed25b9b70fda01c336f21aa0b Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 19:53:36 2014 -0700 Close loophole that allowed methodmaps for enums. commit 5bb4aeba89fec47a4de7a7532d27830999d1fcb4 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:50:42 2014 -0700 Add tests and dbi/handle changes. commit b9203e2491daec2a8073874d6375949483778d14 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:38:29 2014 -0700 Ensure methodmap tags are fixed. commit 878b80fd87a2ea500d3a28ce2d53f616d1efe5e8 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:36:04 2014 -0700 Implement inheritance. commit 6ba9e004fbae18ad68056368ddd0affdc78659f1 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:31:00 2014 -0700 Refactor matchtag() to not be insane. commit 4ede6343b0682c6df98fa869153828e92f891bcc Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:20:50 2014 -0700 Fix indenting. commit e3ddef8916e3dd5f4ff0fe571d6e1c3acd163352 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:20:27 2014 -0700 Initial prototype.
2014-06-21 13:10:15 +02:00
// sErrLine is used to temporarily change the line number of reported errors.
// Pawn has an upstream bug where this is not reset on early-return, which
// can lead to broken line numbers in error messages.
int errline = sErrLine;
sErrLine = -1;
2014-09-03 20:04:25 +02:00
bool is_warning = (number >= 200 && !sc_warnings_are_errors);
/* errflag is reset on each semicolon.
* In a two-pass compiler, an error should not be reported twice. Therefore
* the error reporting is enabled only in the second pass (and only when
* actually producing output). Fatal errors may never be ignored.
*/
int not_fatal = (number < FIRST_FATAL_ERROR || number >= 200);
2014-07-13 06:21:07 +02:00
if (errflag && not_fatal)
return 0;
2014-07-13 06:21:07 +02:00
if (sc_status != statWRITE && not_fatal) {
if (!sc_err_status)
return 0;
}
/* also check for disabled warnings */
if (number>=200) {
int index=(number-200)/8;
int mask=1 << ((number-200)%8);
if ((warndisable[index] & mask)!=0)
return 0;
} /* if */
if (number<FIRST_FATAL_ERROR) {
msg=errmsg[number-1];
pre=prefix[0];
errflag=TRUE; /* set errflag (skip rest of erroneous expression) */
errnum++;
} else if (number<200){
msg=fatalmsg[number-FIRST_FATAL_ERROR];
pre=prefix[1];
errnum++; /* a fatal error also counts as an error */
} else {
msg=warnmsg[number-200];
2014-09-03 20:04:25 +02:00
if (sc_warnings_are_errors) {
pre=prefix[0];
errnum++;
} else {
pre=prefix[2];
warnnum++;
}
} /* if */
assert(errstart<=fline);
if (errline>0)
errstart=errline;
else
errline=fline;
assert(errstart<=errline);
va_start(argptr,number);
if (strlen(errfname)==0) {
int start= (errstart==errline) ? -1 : errstart;
if (pc_error(number,msg,inpfname,start,errline,argptr)) {
if (outf!=NULL) {
pc_closeasm(outf,TRUE);
outf=NULL;
} /* if */
longjmp(errbuf,3); /* user abort */
} /* if */
} else {
FILE *fp=fopen(errfname,"a");
if (fp!=NULL) {
if (errstart>=0 && errstart!=errline)
fprintf(fp,"%s(%d -- %d) : %s %03d: ",inpfname,errstart,errline,pre,number);
else
fprintf(fp,"%s(%d) : %s %03d: ",inpfname,errline,pre,number);
vfprintf(fp,msg,argptr);
fclose(fp);
} /* if */
} /* if */
va_end(argptr);
if ((number>=FIRST_FATAL_ERROR && number<200) || errnum>25){
if (strlen(errfname)==0) {
va_start(argptr,number);
pc_error(0,"\nCompilation aborted.",NULL,0,0,argptr);
va_end(argptr);
} /* if */
if (outf!=NULL) {
pc_closeasm(outf,TRUE);
outf=NULL;
} /* if */
longjmp(errbuf,2); /* fatal error, quit */
} /* if */
/* check whether we are seeing many errors on the same line */
if ((errstart<0 && lastline!=fline) || lastline<errstart || lastline>fline || fcurrent!=lastfile)
errorcount=0;
lastline=fline;
lastfile=fcurrent;
2014-09-03 20:04:25 +02:00
if (!is_warning)
errorcount++;
if (errorcount>=3)
error(FATAL_ERROR_OVERWHELMED_BY_BAD);
return 0;
}
2014-08-22 09:53:47 +02:00
void errorset(int code,int line)
{
switch (code) {
case sRESET:
errflag=FALSE; /* start reporting errors */
break;
case sFORCESET:
errflag=TRUE; /* stop reporting errors */
break;
case sEXPRMARK:
errstart=fline; /* save start line number */
break;
case sEXPRRELEASE:
errstart=-1; /* forget start line number */
Introduce basic methodmaps (PR #38). commit 1e5213d43fdd170bb0c30af914a4e40610014b2b Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 04:09:27 2014 -0700 Quell MSVC C99 bugs. commit f2e166c5925fda49b5abeadc0aa0f9156b99cf11 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:59:23 2014 -0700 Fix varying levels of stupid memory errors. commit b0773d7be45345351ab1c1738681d5215a97f3f3 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:36:39 2014 -0700 Fix memory leak in parsing some control flow structures. commit 5aca55713cfc2dd09c5900132fc4a6be51e3e309 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:35:17 2014 -0700 Fix memory leak in struct parsing. commit b46ec5cd281b46177e83c4f0a4acac9cc1065c53 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:32:03 2014 -0700 Fix build. commit 17bbbb9a46bfc00862adca7d3e15369a48e9ac0f Merge: c083409 2107599 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 01:26:27 2014 -0700 Merge branch 'master' into methodmaps commit c083409b569abff13f24d3b8c47f8ff199036840 Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 23:49:36 2014 -0700 Add VS2k13 support. commit b7993778494d538cb1c1965116030142a7f7765b Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 01:28:08 2014 -0700 Implement destructors. commit 1a340dec260d079ed1b79351ed7b50b58a997cea Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 00:08:04 2014 -0700 Add some tests. commit 12db52ee64eb009ead9294495e9034c63ab75b09 Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 00:05:49 2014 -0700 Initial implementation of constructors. commit 074669a658caa2822aa864164b615a244c00a0bc Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:42:35 2014 -0700 Add simple test harness. commit 27c1e3cf14e1e6c5cf35c80c792cce2744b804d7 Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:15:42 2014 -0700 Big refactoring for new syntax. commit f3c37fdc919e76ee0815e2394cbe8d221f9fc0ca Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:12:54 2014 -0700 Refactor tests for the new syntax. commit 6211f392f8e722b907474cf380cfac4347e46b8e Author: David Anderson <dvander@alliedmods.net> Date: Wed Jun 18 22:25:48 2014 -0700 Make lexer tokens an enum. commit 5210b013756b0b00de3a61c6490685c768ff8cbd Author: David Anderson <dvander@alliedmods.net> Date: Tue Jun 17 06:48:15 2014 -0700 Add comment. commit 06688ff4aced14077dd21a9cc1db4c26c7420ff3 Author: David Anderson <dvander@alliedmods.net> Date: Tue Jun 17 06:46:10 2014 -0700 Allow |this| to be a base type of the methodmap. commit 05cf3682020e0e6d9f47b1a0a6727b9edbfe7622 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 22:11:58 2014 -0700 Unify duplicate typesymbol checking. commit 09161bf2691c8c1ed25b9b70fda01c336f21aa0b Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 19:53:36 2014 -0700 Close loophole that allowed methodmaps for enums. commit 5bb4aeba89fec47a4de7a7532d27830999d1fcb4 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:50:42 2014 -0700 Add tests and dbi/handle changes. commit b9203e2491daec2a8073874d6375949483778d14 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:38:29 2014 -0700 Ensure methodmap tags are fixed. commit 878b80fd87a2ea500d3a28ce2d53f616d1efe5e8 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:36:04 2014 -0700 Implement inheritance. commit 6ba9e004fbae18ad68056368ddd0affdc78659f1 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:31:00 2014 -0700 Refactor matchtag() to not be insane. commit 4ede6343b0682c6df98fa869153828e92f891bcc Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:20:50 2014 -0700 Fix indenting. commit e3ddef8916e3dd5f4ff0fe571d6e1c3acd163352 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:20:27 2014 -0700 Initial prototype.
2014-06-21 13:10:15 +02:00
sErrLine=-1;
break;
case sSETPOS:
Introduce basic methodmaps (PR #38). commit 1e5213d43fdd170bb0c30af914a4e40610014b2b Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 04:09:27 2014 -0700 Quell MSVC C99 bugs. commit f2e166c5925fda49b5abeadc0aa0f9156b99cf11 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:59:23 2014 -0700 Fix varying levels of stupid memory errors. commit b0773d7be45345351ab1c1738681d5215a97f3f3 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:36:39 2014 -0700 Fix memory leak in parsing some control flow structures. commit 5aca55713cfc2dd09c5900132fc4a6be51e3e309 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:35:17 2014 -0700 Fix memory leak in struct parsing. commit b46ec5cd281b46177e83c4f0a4acac9cc1065c53 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 03:32:03 2014 -0700 Fix build. commit 17bbbb9a46bfc00862adca7d3e15369a48e9ac0f Merge: c083409 2107599 Author: David Anderson <dvander@alliedmods.net> Date: Sat Jun 21 01:26:27 2014 -0700 Merge branch 'master' into methodmaps commit c083409b569abff13f24d3b8c47f8ff199036840 Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 23:49:36 2014 -0700 Add VS2k13 support. commit b7993778494d538cb1c1965116030142a7f7765b Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 01:28:08 2014 -0700 Implement destructors. commit 1a340dec260d079ed1b79351ed7b50b58a997cea Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 00:08:04 2014 -0700 Add some tests. commit 12db52ee64eb009ead9294495e9034c63ab75b09 Author: David Anderson <dvander@alliedmods.net> Date: Fri Jun 20 00:05:49 2014 -0700 Initial implementation of constructors. commit 074669a658caa2822aa864164b615a244c00a0bc Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:42:35 2014 -0700 Add simple test harness. commit 27c1e3cf14e1e6c5cf35c80c792cce2744b804d7 Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:15:42 2014 -0700 Big refactoring for new syntax. commit f3c37fdc919e76ee0815e2394cbe8d221f9fc0ca Author: David Anderson <dvander@alliedmods.net> Date: Thu Jun 19 22:12:54 2014 -0700 Refactor tests for the new syntax. commit 6211f392f8e722b907474cf380cfac4347e46b8e Author: David Anderson <dvander@alliedmods.net> Date: Wed Jun 18 22:25:48 2014 -0700 Make lexer tokens an enum. commit 5210b013756b0b00de3a61c6490685c768ff8cbd Author: David Anderson <dvander@alliedmods.net> Date: Tue Jun 17 06:48:15 2014 -0700 Add comment. commit 06688ff4aced14077dd21a9cc1db4c26c7420ff3 Author: David Anderson <dvander@alliedmods.net> Date: Tue Jun 17 06:46:10 2014 -0700 Allow |this| to be a base type of the methodmap. commit 05cf3682020e0e6d9f47b1a0a6727b9edbfe7622 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 22:11:58 2014 -0700 Unify duplicate typesymbol checking. commit 09161bf2691c8c1ed25b9b70fda01c336f21aa0b Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 19:53:36 2014 -0700 Close loophole that allowed methodmaps for enums. commit 5bb4aeba89fec47a4de7a7532d27830999d1fcb4 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:50:42 2014 -0700 Add tests and dbi/handle changes. commit b9203e2491daec2a8073874d6375949483778d14 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:38:29 2014 -0700 Ensure methodmap tags are fixed. commit 878b80fd87a2ea500d3a28ce2d53f616d1efe5e8 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:36:04 2014 -0700 Implement inheritance. commit 6ba9e004fbae18ad68056368ddd0affdc78659f1 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:31:00 2014 -0700 Refactor matchtag() to not be insane. commit 4ede6343b0682c6df98fa869153828e92f891bcc Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:20:50 2014 -0700 Fix indenting. commit e3ddef8916e3dd5f4ff0fe571d6e1c3acd163352 Author: David Anderson <dvander@alliedmods.net> Date: Mon Jun 16 01:20:27 2014 -0700 Initial prototype.
2014-06-21 13:10:15 +02:00
sErrLine=line;
break;
} /* switch */
}
/* sc_enablewarning()
* Enables or disables a warning (errors cannot be disabled).
* Initially all warnings are enabled. The compiler does this by setting bits
* for the *disabled* warnings and relying on the array to be zero-initialized.
*
* Parameter enable can be:
* o 0 for disable
* o 1 for enable
* o 2 for toggle
*/
int pc_enablewarning(int number,int enable)
{
int index;
unsigned char mask;
if (number<200)
return FALSE; /* errors and fatal errors cannot be disabled */
number -= 200;
if (number>=NUM_WARNINGS)
return FALSE;
index=number/8;
mask=(unsigned char)(1 << (number%8));
switch (enable) {
case 0:
warndisable[index] |= mask;
break;
case 1:
warndisable[index] &= (unsigned char)~mask;
break;
case 2:
warndisable[index] ^= mask;
break;
} /* switch */
return TRUE;
}
#undef SCPACK_TABLE