mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 07:32:02 +00:00
[qfcc] Add pragma to control optimization
And force a couple of tests to be built with optimization. I'll probably add it to most, if not all, but for now I'm clearing up tests as I go.
This commit is contained in:
parent
f714b6fbea
commit
64c8c02eac
3 changed files with 22 additions and 0 deletions
|
@ -125,6 +125,24 @@ set_warn (pragma_arg_t *args)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_optimize (pragma_arg_t *args)
|
||||
{
|
||||
if (!args) {
|
||||
warning (0, "missing warn flag");
|
||||
return;
|
||||
}
|
||||
const char *flag = args->arg;
|
||||
if (!strcmp (flag, "on") || !strcmp (flag, "!off")) {
|
||||
options.code.optimize = true;
|
||||
} else if (!strcmp (flag, "!on") || !strcmp (flag, "off")) {
|
||||
options.code.optimize = false;
|
||||
}
|
||||
if (args->next) {
|
||||
warning (0, "pragma optimize: ignoring extra arguments");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pragma_process ()
|
||||
{
|
||||
|
@ -143,6 +161,8 @@ pragma_process ()
|
|||
set_bug (pragma_args->next);
|
||||
} else if (!strcmp (id, "warn")) {
|
||||
set_warn (pragma_args->next);
|
||||
} else if (!strcmp (id, "optimize")) {
|
||||
set_optimize (pragma_args->next);
|
||||
} else {
|
||||
warning (0, "unknown pragma: '%s'", id);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#pragma warn error
|
||||
#pragma optimize on
|
||||
|
||||
@interface Object
|
||||
{
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#pragma optimize on
|
||||
#include "test-harness.h"
|
||||
|
||||
int counter;
|
||||
|
|
Loading…
Reference in a new issue