summary refs log tree commit diff stats
path: root/nim/pragmas.pas
diff options
context:
space:
mode:
Diffstat (limited to 'nim/pragmas.pas')
-rw-r--r--nim/pragmas.pas20
1 files changed, 17 insertions, 3 deletions
diff --git a/nim/pragmas.pas b/nim/pragmas.pas
index 68bc366f1..636a1198a 100644
--- a/nim/pragmas.pas
+++ b/nim/pragmas.pas
@@ -135,8 +135,8 @@ var
   v: string;
   m: TMagic;
 begin
-  if not (sfSystemModule in c.module.flags) then
-    liMessage(n.info, errMagicOnlyInSystem);
+  //if not (sfSystemModule in c.module.flags) then
+  //  liMessage(n.info, errMagicOnlyInSystem);
   if n.kind <> nkExprColonExpr then
     liMessage(n.info, errStringLiteralExpected);
   if n.sons[1].kind = nkIdent then v := n.sons[1].ident.s
@@ -172,6 +172,19 @@ begin
     liMessage(n.info, errOnOrOffExpected)
 end;
 
+procedure pragmaDeadCodeElim(c: PContext; n: PNode); 
+begin
+  if (n.kind = nkExprColonExpr) and (n.sons[1].kind = nkIdent) then begin
+    case whichKeyword(n.sons[1].ident) of
+      wOn:  include(c.module.flags, sfDeadCodeElim);
+      wOff: exclude(c.module.flags, sfDeadCodeElim);
+      else  liMessage(n.info, errOnOrOffExpected)
+    end
+  end
+  else
+    liMessage(n.info, errOnOrOffExpected)
+end;
+
 procedure processCallConv(c: PContext; n: PNode);
 var
   sw: TSpecialWord;
@@ -466,6 +479,7 @@ begin
           wVolatile: begin noVal(it); Include(sym.flags, sfVolatile); end;
           wRegister: begin noVal(it); include(sym.flags, sfRegister); end;
           wThreadVar: begin noVal(it); include(sym.flags, sfThreadVar); end;
+          wDeadCodeElim: pragmaDeadCodeElim(c, it);
           wMagic: processMagic(c, it, sym);
           wCompileTime: begin
             noVal(it);
@@ -612,7 +626,7 @@ begin
       wHint, wWarning, wError, wFatal, wDefine, wUndef,
       wCompile, wLink, wLinkSys, wPure,
       wPush, wPop, wFixupSystem, wBreakpoint, wCheckpoint,
-      wPassL, wPassC]);
+      wPassL, wPassC, wDeadCodeElim]);
 end;
 
 procedure pragmaLambda(c: PContext; s: PSym; n: PNode);