From f4ae7d680f72e788eab63d858c18f5bb966271b5 Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 22 Dec 2010 01:05:33 +0000 Subject: [PATCH] divVerent's patch to enable subscoped locals, not sure if subscoped_away is required, but committing that anyway. Its copied from pastebin, so sorry for conflicts. git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3706 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/qcc.h | 2 ++ engine/qclib/qccmain.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/engine/qclib/qcc.h b/engine/qclib/qcc.h index 204164c8e..6a5dbe7d5 100644 --- a/engine/qclib/qcc.h +++ b/engine/qclib/qcc.h @@ -342,6 +342,7 @@ typedef struct QCC_def_s pbool shared; pbool saved; pbool isstatic; + pbool subscoped_away; temp_t *temp; } QCC_def_t; @@ -468,6 +469,7 @@ extern pbool keyword_union; //you surly know what a union is! extern pbool keywords_coexist; extern pbool output_parms; extern pbool autoprototype; +extern pbool pr_subscopedlocals; extern pbool flag_ifstring; extern pbool flag_iffloat; extern pbool flag_acc; diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index aaba53dbe..9436a8e76 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -238,6 +238,7 @@ compiler_flag_t compiler_flag[] = { {&flag_filetimes, 0, "filetimes", "Check Filetimes", "Recompiles the progs only if the file times are modified."}, {&flag_fasttrackarrays, FLAG_MIDCOMPILE|FLAG_ASDEFAULT,"fastarrays","fast arrays where possible", "Generates extra instructions inside array handling functions to detect engine and use extension opcodes only in supporting engines.\nAdds a global which is set by the engine if the engine supports the extra opcodes. Note that this applies to all arrays or none."}, {&flag_assume_integer, FLAG_MIDCOMPILE,"assumeint", "Assume Integers", "Numerical constants are assumed to be integers, instead of floats."}, + {&pr_subscopedlocals, FLAG_MIDCOMPILE, "subscope", "Subscoped Locals", "Restrict the scope of locals to the block they are actually defined within, as in C."}, {NULL} }; @@ -2957,6 +2958,7 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string)); printf ("-Wall to give a stupid number of warnings\n"); printf ("-Ttarget to set a output format\n"); printf ("-Fautoproto to enable automatic prototyping\n"); + printf ("-Fsubscope to make locals specific to their subscope\n"); qcc_compileactive = false; return;