Allow ignored pragmas to have a body; don't ignore the body.

Also, ignore errors while trying to make sense of parameters to ignored pragmas
for -v.
This commit is contained in:
Frits van Bommel
2009-05-17 23:33:35 +02:00
parent be25445461
commit 1ca2ee5d66

View File

@@ -1012,6 +1012,10 @@ void PragmaDeclaration::semantic(Scope *sc)
{
for (size_t i = 0; i < args->dim; i++)
{
// ignore errors in ignored pragmas.
global.gag++;
unsigned errors_save = global.errors;
Expression *e = (Expression *)args->data[i];
e = e->semantic(sc);
e = e->optimize(WANTvalue | WANTinterpret);
@@ -1020,13 +1024,16 @@ void PragmaDeclaration::semantic(Scope *sc)
else
printf(",");
printf("%s", e->toChars());
// restore error state.
global.gag--;
global.errors = errors_save;
}
if (args->dim)
printf(")");
}
printf("\n");
}
goto Lnodecl;
}
else
error("unrecognized pragma(%s)", ident->toChars());