From 1ca2ee5d66d5baafe946d2a607799b24fdb6c75e Mon Sep 17 00:00:00 2001 From: Frits van Bommel Date: Sun, 17 May 2009 23:33:35 +0200 Subject: [PATCH] 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. --- dmd/attrib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dmd/attrib.c b/dmd/attrib.c index 4d36f72a..31dfc7a7 100644 --- a/dmd/attrib.c +++ b/dmd/attrib.c @@ -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());