diff --git a/engine/qclib/qcc.h b/engine/qclib/qcc.h index ef2a3b6eb..80bfcdab5 100644 --- a/engine/qclib/qcc.h +++ b/engine/qclib/qcc.h @@ -757,6 +757,7 @@ enum { WARN_PRECOMPILERMESSAGE, WARN_TOOMANYPARAMETERSFORFUNC, WARN_TOOMANYPARAMETERSVARARGS, + WARN_NESTEDCOMMENT, WARN_STRINGTOOLONG, WARN_BADTARGET, WARN_BADPRAGMA, diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index 814bb84a4..5565989fc 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -2417,6 +2417,8 @@ void QCC_PR_LexWhitespace (pbool inhibitpreprocessor) pr_file_p++; 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] != '/'); pr_file_p+=2; continue; @@ -4148,6 +4150,8 @@ pbool QCC_PR_CheckTokenComment(const char *string, char **comment) QCC_PR_ParseError(0, "EOF inside comment\n"); 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] != '/'); 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); } - 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 if (QCC_PR_CheckKeyword (keyword_class, "accessor")) diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index b608f37fe..612a9e6c1 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -218,6 +218,7 @@ struct { {" F322", WARN_IFSTRING_USED}, {" F323", WARN_UNREACHABLECODE}, {" F324", WARN_FORMATSTRING}, + {" F325", WARN_NESTEDCOMMENT}, {" F207", WARN_NOTREFERENCEDFIELD}, {" F208", WARN_NOTREFERENCEDCONST}, @@ -4157,7 +4158,7 @@ void QCC_PR_CommandLinePrecompilerOptions (void) keyword_state = true; else if (!strcmp(myargv[i]+5, "fteqcc")) ; //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; @@ -4170,6 +4171,21 @@ void QCC_PR_CommandLinePrecompilerOptions (void) keyword_thinktime = keyword_until = keyword_loop = 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")) { flag_ifvector = flag_vectorlogic = true;