Merge branch 'master' into calli-5
Conflicts: public/amtl/am-utility.h
This commit is contained in:
@@ -74,7 +74,7 @@ static const char *prefix[3]={ "error", "fatal error", "warning" };
|
||||
if (number!=0) {
|
||||
int idx;
|
||||
|
||||
if (number < 160)
|
||||
if (number < 160 || (number >= 200 && sc_warnings_are_errors))
|
||||
idx = 0;
|
||||
else if (number < 200)
|
||||
idx = 1;
|
||||
|
||||
@@ -432,6 +432,7 @@ enum TokenKind {
|
||||
tTAGOF,
|
||||
tTHEN,
|
||||
tTYPEDEF,
|
||||
tUNION,
|
||||
tVOID,
|
||||
tWHILE,
|
||||
/* compiler directives */
|
||||
@@ -904,6 +905,7 @@ extern int pc_tag_nullfunc_t; /* the null function type */
|
||||
extern int pc_anytag; /* global any tag */
|
||||
extern int glbstringread; /* last global string read */
|
||||
extern int sc_require_newdecls; /* only newdecls are allowed */
|
||||
extern bool sc_warnings_are_errors;
|
||||
|
||||
extern constvalue sc_automaton_tab; /* automaton table */
|
||||
extern constvalue sc_state_tab; /* state table */
|
||||
|
||||
@@ -144,6 +144,7 @@ static void dolabel(void);
|
||||
static void doreturn(void);
|
||||
static void dofuncenum(int listmode);
|
||||
static void dotypedef();
|
||||
static void dounion();
|
||||
static void domethodmap(LayoutSpec spec);
|
||||
static void dobreak(void);
|
||||
static void docont(void);
|
||||
@@ -914,6 +915,9 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam
|
||||
case 'e':
|
||||
strlcpy(ename,option_value(ptr),_MAX_PATH); /* set name of error file */
|
||||
break;
|
||||
case 'E':
|
||||
sc_warnings_are_errors = true;
|
||||
break;
|
||||
#if defined __WIN32__ || defined _WIN32 || defined _Windows
|
||||
case 'H':
|
||||
hwndFinish=(HWND)atoi(option_value(ptr));
|
||||
@@ -1282,6 +1286,7 @@ static void about(void)
|
||||
pc_printf(" -t<num> TAB indent size (in character positions, default=%d)\n",sc_tabsize);
|
||||
pc_printf(" -v<num> verbosity level; 0=quiet, 1=normal, 2=verbose (default=%d)\n",verbosity);
|
||||
pc_printf(" -w<num> disable a specific warning by its number\n");
|
||||
pc_printf(" -E treat warnings as errors\n");
|
||||
pc_printf(" -X<num> abstract machine size limit in bytes\n");
|
||||
pc_printf(" -XD<num> abstract machine data/stack size limit in bytes\n");
|
||||
pc_printf(" -\\ use '\\' for escape characters\n");
|
||||
@@ -1506,6 +1511,9 @@ static void parse(void)
|
||||
case tTYPEDEF:
|
||||
dotypedef();
|
||||
break;
|
||||
case tUNION:
|
||||
dounion();
|
||||
break;
|
||||
case tSTRUCT:
|
||||
declstruct();
|
||||
break;
|
||||
@@ -2689,8 +2697,11 @@ static cell initvector(int ident,int tag,cell size,int fillzero,
|
||||
} while (matchtoken(',')); /* do */
|
||||
needtoken('}');
|
||||
} else {
|
||||
init(ident,&ctag,errorfound);
|
||||
matchtag(tag,ctag,TRUE);
|
||||
if (!lexpeek('}'))
|
||||
{
|
||||
init(ident,&ctag,errorfound);
|
||||
matchtag(tag,ctag,TRUE);
|
||||
}
|
||||
} /* if */
|
||||
/* fill up the literal queue with a series */
|
||||
if (ellips) {
|
||||
@@ -3192,6 +3203,8 @@ static int parse_old_decl(declinfo_t *decl, int flags)
|
||||
}
|
||||
needtoken(':');
|
||||
}
|
||||
if (type->numtags > 1)
|
||||
error(158);
|
||||
}
|
||||
|
||||
if (type->numtags == 0) {
|
||||
@@ -4214,6 +4227,27 @@ static void dotypedef()
|
||||
functags_add(def, &type);
|
||||
}
|
||||
|
||||
// Unsafe union - only supports function types. This is a transition hack for SP2.
|
||||
static void dounion()
|
||||
{
|
||||
token_ident_t ident;
|
||||
if (!needsymbol(&ident))
|
||||
return;
|
||||
|
||||
int prev_tag = pc_findtag(ident.name);
|
||||
if (prev_tag != -1 && !(prev_tag & FUNCTAG))
|
||||
error(94);
|
||||
|
||||
funcenum_t *def = funcenums_add(ident.name);
|
||||
needtoken('{');
|
||||
while (!matchtoken('}')) {
|
||||
functag_t type;
|
||||
parse_function_type(&type);
|
||||
functags_add(def, &type);
|
||||
}
|
||||
|
||||
require_newline(TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* dofuncenum - declare function enumerations
|
||||
|
||||
@@ -1963,6 +1963,7 @@ const char *sc_tokens[] = {
|
||||
"return",
|
||||
"sizeof", "sleep", "static", "stock", "struct", "switch",
|
||||
"tagof", "*then", "typedef",
|
||||
"union",
|
||||
"void",
|
||||
"while",
|
||||
"#assert", "#define", "#else", "#elseif", "#emit", "#endif", "#endinput",
|
||||
|
||||
@@ -201,6 +201,7 @@ static const char *errmsg[] = {
|
||||
/*155*/ "expected newline, but found '%s'\n",
|
||||
/*156*/ "the 'any' type is not allowed in new-style natives\n",
|
||||
/*157*/ "'%s' is a reserved keyword\n",
|
||||
/*158*/ "multi-tags are no longer supported\n",
|
||||
#else
|
||||
"\315e\306\227\266k\217:\235\277bu\201fo\220\204\223\012",
|
||||
"\202l\224\250s\205g\346\356e\233\201(\243\315\214\267\202) \253 f\255low ea\305 \042c\353e\042\012",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// 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'.
|
||||
*
|
||||
@@ -81,6 +82,8 @@ static short lastfile;
|
||||
int errline = sErrLine;
|
||||
sErrLine = -1;
|
||||
|
||||
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
|
||||
@@ -113,8 +116,13 @@ static short lastfile;
|
||||
errnum++; /* a fatal error also counts as an error */
|
||||
} else {
|
||||
msg=warnmsg[number-200];
|
||||
pre=prefix[2];
|
||||
warnnum++;
|
||||
if (sc_warnings_are_errors) {
|
||||
pre=prefix[0];
|
||||
errnum++;
|
||||
} else {
|
||||
pre=prefix[2];
|
||||
warnnum++;
|
||||
}
|
||||
} /* if */
|
||||
|
||||
assert(errstart<=fline);
|
||||
@@ -164,7 +172,7 @@ static short lastfile;
|
||||
errorcount=0;
|
||||
lastline=fline;
|
||||
lastfile=fcurrent;
|
||||
if (number<200)
|
||||
if (!is_warning)
|
||||
errorcount++;
|
||||
if (errorcount>=3)
|
||||
error(167); /* too many error/warning messages on one line */
|
||||
|
||||
@@ -94,6 +94,7 @@ int pc_optimize=sOPTIMIZE_NOMACRO; /* (peephole) optimization level */
|
||||
int pc_memflags=0; /* special flags for the stack/heap usage */
|
||||
int sc_showincludes=0; /* show include files */
|
||||
int sc_require_newdecls=0; /* Require new-style declarations */
|
||||
bool sc_warnings_are_errors=false;
|
||||
|
||||
constvalue sc_automaton_tab = { NULL, "", 0, 0}; /* automaton table */
|
||||
constvalue sc_state_tab = { NULL, "", 0, 0}; /* state table */
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
new String:oldArray[][] =
|
||||
{
|
||||
"string",
|
||||
"string2",
|
||||
};
|
||||
|
||||
char newArray[][] =
|
||||
{
|
||||
"another string",
|
||||
"more strings",
|
||||
};
|
||||
|
||||
native Print( const String:string[] );
|
||||
|
||||
public OnPluginStart()
|
||||
{
|
||||
Print( oldArray[ 0 ] );
|
||||
Print( newArray[ 0 ] );
|
||||
}
|
||||
Reference in New Issue
Block a user