mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[qfcc] Add --ruamoko command line option and pragma
The command line option works the same way as --advanced/traditional/extended, as does the pragma. As well, raumoko (alternative spelling) can be used because both are legitimate and some people may prefer one spelling over the other. As always, use of the pragma is at one's own risk: its intended use is forcing the target in the unit tests.
This commit is contained in:
parent
52a399daeb
commit
f3770cc647
3 changed files with 39 additions and 15 deletions
|
@ -109,7 +109,7 @@ typedef struct {
|
||||||
qboolean progdefs_h; // generate progdefs.h
|
qboolean progdefs_h; // generate progdefs.h
|
||||||
qboolean qccx_escapes; // use qccx escapes instead of standard C
|
qboolean qccx_escapes; // use qccx escapes instead of standard C
|
||||||
int traditional; // behave more like qcc
|
int traditional; // behave more like qcc
|
||||||
qboolean advanced; // behold the power of Ruamoko
|
int advanced; // behold the power of Ruamoko
|
||||||
qboolean compile; // serparate compilation mode
|
qboolean compile; // serparate compilation mode
|
||||||
qboolean partial_link; // partial linking
|
qboolean partial_link; // partial linking
|
||||||
qboolean preprocess_only;// run only cpp, don't compile
|
qboolean preprocess_only;// run only cpp, don't compile
|
||||||
|
|
|
@ -69,6 +69,7 @@ enum {
|
||||||
OPT_NO_DEFAULT_PATHS,
|
OPT_NO_DEFAULT_PATHS,
|
||||||
OPT_PROGDEFS,
|
OPT_PROGDEFS,
|
||||||
OPT_QCCX_ESCAPES,
|
OPT_QCCX_ESCAPES,
|
||||||
|
OPT_RUAMOKO,
|
||||||
OPT_TRADITIONAL,
|
OPT_TRADITIONAL,
|
||||||
OPT_BUG,
|
OPT_BUG,
|
||||||
};
|
};
|
||||||
|
@ -92,7 +93,9 @@ static struct option const long_options[] = {
|
||||||
{"progs-src", required_argument, 0, 'P'},
|
{"progs-src", required_argument, 0, 'P'},
|
||||||
{"qccx-escapes", no_argument, 0, OPT_QCCX_ESCAPES},
|
{"qccx-escapes", no_argument, 0, OPT_QCCX_ESCAPES},
|
||||||
{"quiet", no_argument, 0, 'q'},
|
{"quiet", no_argument, 0, 'q'},
|
||||||
|
{"raumoko", no_argument, 0, OPT_RUAMOKO},
|
||||||
{"relocatable", no_argument, 0, 'r'},
|
{"relocatable", no_argument, 0, 'r'},
|
||||||
|
{"ruamoko", no_argument, 0, OPT_RUAMOKO},
|
||||||
{"save-temps", no_argument, 0, 'S'},
|
{"save-temps", no_argument, 0, 'S'},
|
||||||
{"source", required_argument, 0, 's'},
|
{"source", required_argument, 0, 's'},
|
||||||
{"traditional", no_argument, 0, OPT_TRADITIONAL},
|
{"traditional", no_argument, 0, OPT_TRADITIONAL},
|
||||||
|
@ -394,16 +397,22 @@ DecodeArgs (int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case OPT_TRADITIONAL:
|
case OPT_TRADITIONAL:
|
||||||
options.traditional = 2;
|
options.traditional = 2;
|
||||||
options.advanced = false;
|
options.advanced = 0;
|
||||||
options.code.progsversion = PROG_ID_VERSION;
|
options.code.progsversion = PROG_ID_VERSION;
|
||||||
options.code.const_initializers = true;
|
options.code.const_initializers = true;
|
||||||
break;
|
break;
|
||||||
case OPT_ADVANCED:
|
case OPT_ADVANCED:
|
||||||
options.traditional = 0;
|
options.traditional = 0;
|
||||||
options.advanced = true;
|
options.advanced = 1;
|
||||||
options.code.progsversion = PROG_V6P_VERSION;
|
options.code.progsversion = PROG_V6P_VERSION;
|
||||||
options.code.const_initializers = false;
|
options.code.const_initializers = false;
|
||||||
break;
|
break;
|
||||||
|
case OPT_RUAMOKO:
|
||||||
|
options.traditional = 0;
|
||||||
|
options.advanced = 2;
|
||||||
|
options.code.progsversion = PROG_VERSION;
|
||||||
|
options.code.const_initializers = false;
|
||||||
|
break;
|
||||||
case OPT_BLOCK_DOT:
|
case OPT_BLOCK_DOT:
|
||||||
if (optarg) {
|
if (optarg) {
|
||||||
char *opts = strdup (optarg);
|
char *opts = strdup (optarg);
|
||||||
|
@ -693,7 +702,7 @@ DecodeArgs (int argc, char **argv)
|
||||||
if (saw_MD)
|
if (saw_MD)
|
||||||
options.preprocess_only = 0;
|
options.preprocess_only = 0;
|
||||||
if (!source_files && !options.advanced) {
|
if (!source_files && !options.advanced) {
|
||||||
// progs.src mode without --advanced implies --traditional
|
// progs.src mode without --advanced or --ruamoko implies --traditional
|
||||||
// but --extended overrides
|
// but --extended overrides
|
||||||
if (!options.traditional)
|
if (!options.traditional)
|
||||||
options.traditional = 2;
|
options.traditional = 2;
|
||||||
|
@ -712,14 +721,10 @@ DecodeArgs (int argc, char **argv)
|
||||||
if (!options.code.progsversion)
|
if (!options.code.progsversion)
|
||||||
options.code.progsversion = PROG_V6P_VERSION;
|
options.code.progsversion = PROG_V6P_VERSION;
|
||||||
if (!options.traditional) {
|
if (!options.traditional) {
|
||||||
options.advanced = true;
|
// avanced=2 requires the Ruamoko ISA
|
||||||
if (options.code.progsversion < PROG_VERSION) {
|
options.advanced = 2 - (options.code.progsversion < PROG_VERSION);
|
||||||
add_cpp_def ("-D__RUAMOKO__=1");
|
const char *ruamoko = va (0, "-D__RUAMOKO__=%d", options.advanced);
|
||||||
add_cpp_def ("-D__RAUMOKO__=1");
|
add_cpp_def (save_string (ruamoko));
|
||||||
} else {
|
|
||||||
add_cpp_def ("-D__RUAMOKO__=2");
|
|
||||||
add_cpp_def ("-D__RAUMOKO__=2");
|
|
||||||
}
|
|
||||||
if (options.code.ifstring == (qboolean) -1)
|
if (options.code.ifstring == (qboolean) -1)
|
||||||
options.code.ifstring = false;
|
options.code.ifstring = false;
|
||||||
if (options.code.short_circuit == (qboolean) -1)
|
if (options.code.short_circuit == (qboolean) -1)
|
||||||
|
@ -741,6 +746,13 @@ DecodeArgs (int argc, char **argv)
|
||||||
options.code.crc = false;
|
options.code.crc = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.traditional && options.advanced) {
|
||||||
|
fprintf (stderr,
|
||||||
|
"%s: internal error: traditional and advanced twisted\n",
|
||||||
|
this_program);
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
// add the default paths
|
// add the default paths
|
||||||
if (!options.no_default_paths) {
|
if (!options.no_default_paths) {
|
||||||
add_cpp_sysinc ("-isystem");
|
add_cpp_sysinc ("-isystem");
|
||||||
|
|
|
@ -63,21 +63,31 @@ static void
|
||||||
set_traditional (int traditional)
|
set_traditional (int traditional)
|
||||||
{
|
{
|
||||||
switch (traditional) {
|
switch (traditional) {
|
||||||
|
case -1:
|
||||||
|
options.traditional = 0;
|
||||||
|
options.advanced = 2;
|
||||||
|
options.code.progsversion = PROG_VERSION;
|
||||||
|
type_default = &type_int;
|
||||||
|
type_long_int = &type_long;
|
||||||
|
type_ulong_uint = &type_ulong;
|
||||||
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
options.traditional = 0;
|
options.traditional = 0;
|
||||||
options.advanced = true;
|
options.advanced = 1;
|
||||||
options.code.progsversion = PROG_V6P_VERSION;
|
options.code.progsversion = PROG_V6P_VERSION;
|
||||||
type_default = &type_int;
|
type_default = &type_int;
|
||||||
|
type_long_int = &type_int;
|
||||||
|
type_ulong_uint = &type_uint;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
options.traditional = 1;
|
options.traditional = 1;
|
||||||
options.advanced = false;
|
options.advanced = 0;
|
||||||
options.code.progsversion = PROG_ID_VERSION;
|
options.code.progsversion = PROG_ID_VERSION;
|
||||||
type_default = &type_float;
|
type_default = &type_float;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
options.traditional = 2;
|
options.traditional = 2;
|
||||||
options.advanced = false;
|
options.advanced = 0;
|
||||||
options.code.progsversion = PROG_ID_VERSION;
|
options.code.progsversion = PROG_ID_VERSION;
|
||||||
type_default = &type_float;
|
type_default = &type_float;
|
||||||
break;
|
break;
|
||||||
|
@ -157,6 +167,8 @@ pragma_process ()
|
||||||
set_traditional (1);
|
set_traditional (1);
|
||||||
} else if (!strcmp (id, "advanced")) {
|
} else if (!strcmp (id, "advanced")) {
|
||||||
set_traditional (0);
|
set_traditional (0);
|
||||||
|
} else if (!strcmp (id, "ruamoko") || !strcmp (id, "raumoko")) {
|
||||||
|
set_traditional (-1);
|
||||||
} else if (!strcmp (id, "bug")) {
|
} else if (!strcmp (id, "bug")) {
|
||||||
set_bug (pragma_args->next);
|
set_bug (pragma_args->next);
|
||||||
} else if (!strcmp (id, "warn")) {
|
} else if (!strcmp (id, "warn")) {
|
||||||
|
|
Loading…
Reference in a new issue