Mercurial > projects > ldc
comparison dmd/attrib.c @ 1392:336faed34424
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.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sun, 17 May 2009 23:33:35 +0200 |
parents | 229e02867307 |
children | def7a1d494fd |
comparison
equal
deleted
inserted
replaced
1391:3af4ad55a004 | 1392:336faed34424 |
---|---|
1010 printf("pragma %s", ident->toChars()); | 1010 printf("pragma %s", ident->toChars()); |
1011 if (args) | 1011 if (args) |
1012 { | 1012 { |
1013 for (size_t i = 0; i < args->dim; i++) | 1013 for (size_t i = 0; i < args->dim; i++) |
1014 { | 1014 { |
1015 // ignore errors in ignored pragmas. | |
1016 global.gag++; | |
1017 unsigned errors_save = global.errors; | |
1018 | |
1015 Expression *e = (Expression *)args->data[i]; | 1019 Expression *e = (Expression *)args->data[i]; |
1016 e = e->semantic(sc); | 1020 e = e->semantic(sc); |
1017 e = e->optimize(WANTvalue | WANTinterpret); | 1021 e = e->optimize(WANTvalue | WANTinterpret); |
1018 if (i == 0) | 1022 if (i == 0) |
1019 printf(" ("); | 1023 printf(" ("); |
1020 else | 1024 else |
1021 printf(","); | 1025 printf(","); |
1022 printf("%s", e->toChars()); | 1026 printf("%s", e->toChars()); |
1027 | |
1028 // restore error state. | |
1029 global.gag--; | |
1030 global.errors = errors_save; | |
1023 } | 1031 } |
1024 if (args->dim) | 1032 if (args->dim) |
1025 printf(")"); | 1033 printf(")"); |
1026 } | 1034 } |
1027 printf("\n"); | 1035 printf("\n"); |
1028 } | 1036 } |
1029 goto Lnodecl; | |
1030 } | 1037 } |
1031 else | 1038 else |
1032 error("unrecognized pragma(%s)", ident->toChars()); | 1039 error("unrecognized pragma(%s)", ident->toChars()); |
1033 | 1040 |
1034 if (decl) | 1041 if (decl) |