[qfcc] Add pragma to control warning promotion

This allows me to disable -Werror in the Makefile but still have the
build tests work properly and not fail when they shouldn't.
This commit is contained in:
Bill Currie 2022-01-25 22:14:12 +09:00
parent 40f5b8a482
commit e4bb5c8048
15 changed files with 48 additions and 0 deletions

View file

@ -107,6 +107,24 @@ set_bug (pragma_arg_t *args)
}
}
static void
set_warn (pragma_arg_t *args)
{
if (!args) {
warning (0, "missing warn flag");
return;
}
const char *flag = args->arg;
if (!strcmp (flag, "error")) {
options.warnings.promote = true;
} else if (!strcmp (flag, "!error")) {
options.warnings.promote = false;
}
if (args->next) {
warning (0, "pragma warn: ignoring extra arguments");
}
}
void
pragma_process ()
{
@ -123,6 +141,8 @@ pragma_process ()
set_traditional (0);
} else if (!strcmp (id, "bug")) {
set_bug (pragma_args->next);
} else if (!strcmp (id, "warn")) {
set_warn (pragma_args->next);
} else {
warning (0, "unknown pragma: '%s'", id);
}

View file

@ -1,3 +1,5 @@
#pragma warn error
@interface foo
{
id isa;

View file

@ -1,3 +1,5 @@
#pragma warn error
@interface Object
{
Class isa;

View file

@ -1,3 +1,5 @@
#pragma warn error
@interface Object
{
Class isa;

View file

@ -1,3 +1,5 @@
#pragma warn error
@interface Object
{
Class isa;

View file

@ -1,3 +1,5 @@
#pragma warn error
double a;
int b[] = {1.0d};
int main ()

View file

@ -1,3 +1,5 @@
#pragma warn error
double a;
float b = 1.0d;
int main ()

View file

@ -1,3 +1,5 @@
#pragma warn error
double a;
int main ()
{

View file

@ -1,3 +1,5 @@
#pragma warn error
double a;
float b;
int main ()

View file

@ -1,3 +1,5 @@
#pragma warn error
double a;
int b[] = {1.0d};
int main ()

View file

@ -1,3 +1,5 @@
#pragma warn error
double a;
int b = 1.0d;
int main ()

View file

@ -1,3 +1,5 @@
#pragma warn error
double a;
int main ()
{

View file

@ -1,3 +1,5 @@
#pragma warn error
double a;
int b;
int main ()

View file

@ -1,3 +1,5 @@
#pragma warn error
double a;
float b;
int main ()

View file

@ -1,3 +1,5 @@
#pragma warn error
double a;
int b;
int main ()