1
0
Fork 0
forked from fte/fteqw

Fix type parsing bug with eg: ("")

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5291 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-08-18 13:33:50 +00:00
parent a7b696ef8c
commit df8bd3ad8c
3 changed files with 30 additions and 2 deletions

View file

@ -757,6 +757,7 @@ enum {
WARN_PRECOMPILERMESSAGE, WARN_PRECOMPILERMESSAGE,
WARN_TOOMANYPARAMETERSFORFUNC, WARN_TOOMANYPARAMETERSFORFUNC,
WARN_TOOMANYPARAMETERSVARARGS, WARN_TOOMANYPARAMETERSVARARGS,
WARN_NESTEDCOMMENT,
WARN_STRINGTOOLONG, WARN_STRINGTOOLONG,
WARN_BADTARGET, WARN_BADTARGET,
WARN_BADPRAGMA, WARN_BADPRAGMA,

View file

@ -2417,6 +2417,8 @@ void QCC_PR_LexWhitespace (pbool inhibitpreprocessor)
pr_file_p++; pr_file_p++;
return; return;
} }
if (pr_file_p[0] == '/' && pr_file_p[1] == '*')
QCC_PR_ParseWarning(WARN_NESTEDCOMMENT, "\"/*\" inside comment");
} while (pr_file_p[0] != '*' || pr_file_p[1] != '/'); } while (pr_file_p[0] != '*' || pr_file_p[1] != '/');
pr_file_p+=2; pr_file_p+=2;
continue; continue;
@ -4148,6 +4150,8 @@ pbool QCC_PR_CheckTokenComment(const char *string, char **comment)
QCC_PR_ParseError(0, "EOF inside comment\n"); QCC_PR_ParseError(0, "EOF inside comment\n");
break; break;
} }
if (pr_file_p[0] == '/' && pr_file_p[1] == '*')
QCC_PR_ParseWarning(WARN_NESTEDCOMMENT, "\"/*\" inside comment");
} while (pr_file_p[0] != '*' || pr_file_p[1] != '/'); } while (pr_file_p[0] != '*' || pr_file_p[1] != '/');
if (pr_file_p[1] == 0) if (pr_file_p[1] == 0)
@ -5065,7 +5069,14 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
return QCC_PR_FindType (newt); return QCC_PR_FindType (newt);
} }
name = QCC_PR_CheckCompConstString(pr_token); name = pr_token;
if (pr_token_type != tt_name)
{
if (silentfail)
return NULL;
QCC_PR_ParseError (ERR_NOTATYPE, "\"%s\" is not a type", name);
}
// name = QCC_PR_CheckCompConstString(name);
//accessors //accessors
if (QCC_PR_CheckKeyword (keyword_class, "accessor")) if (QCC_PR_CheckKeyword (keyword_class, "accessor"))

View file

@ -218,6 +218,7 @@ struct {
{" F322", WARN_IFSTRING_USED}, {" F322", WARN_IFSTRING_USED},
{" F323", WARN_UNREACHABLECODE}, {" F323", WARN_UNREACHABLECODE},
{" F324", WARN_FORMATSTRING}, {" F324", WARN_FORMATSTRING},
{" F325", WARN_NESTEDCOMMENT},
{" F207", WARN_NOTREFERENCEDFIELD}, {" F207", WARN_NOTREFERENCEDFIELD},
{" F208", WARN_NOTREFERENCEDCONST}, {" F208", WARN_NOTREFERENCEDCONST},
@ -4157,7 +4158,7 @@ void QCC_PR_CommandLinePrecompilerOptions (void)
keyword_state = true; keyword_state = true;
else if (!strcmp(myargv[i]+5, "fteqcc")) else if (!strcmp(myargv[i]+5, "fteqcc"))
; //as above, its the default. ; //as above, its the default.
else if (!strcmp(myargv[i]+5, "id")) else if (!strcmp(myargv[i]+5, "qcc") || !strcmp(myargv[i]+5, "id"))
{ {
flag_ifvector = flag_vectorlogic = false; flag_ifvector = flag_vectorlogic = false;
@ -4170,6 +4171,21 @@ void QCC_PR_CommandLinePrecompilerOptions (void)
keyword_thinktime = keyword_until = keyword_loop = false; keyword_thinktime = keyword_until = keyword_loop = false;
keyword_wrap = keyword_weak = false; keyword_wrap = keyword_weak = false;
} }
else if (!strcmp(myargv[i]+5, "hcc") || !strcmp(myargv[i]+5, "hexenc"))
{
flag_ifvector = flag_vectorlogic = false;
keyword_asm = keyword_continue = keyword_for = keyword_goto = false;
keyword_const = keyword_var = keyword_inout = keyword_optional = keyword_state = keyword_inline = keyword_nosave = keyword_extern = keyword_shared = keyword_noref = keyword_unused = keyword_used = keyword_static = keyword_nonstatic = keyword_ignore = keyword_strip = false;
keyword_class = keyword_const = false;
keyword_vector = keyword_entity = keyword_float = keyword_string = false; //not to be confused with actual types, but rather the absence of the keyword local.
keyword_int = keyword_integer = keyword_typedef = keyword_struct = keyword_union = keyword_enum = keyword_enumflags = false;
keyword_wrap = keyword_weak = false;
keyword_thinktime = keyword_until = keyword_loop = true;
keyword_switch = keyword_case = keyword_default = keyword_break = true;
}
else if (!strcmp(myargv[i]+5, "gmqcc")) else if (!strcmp(myargv[i]+5, "gmqcc"))
{ {
flag_ifvector = flag_vectorlogic = true; flag_ifvector = flag_vectorlogic = true;