summary refs log tree commit diff stats
path: root/compiler/pragmas.nim
diff options
context:
space:
mode:
authorAudun Wilhelmsen <skyfex@gmail.com>2014-03-18 21:11:57 +0100
committerAudun Wilhelmsen <skyfex@gmail.com>2014-03-18 21:11:57 +0100
commit1e45bb79ab4beb7a027b403bd78e879975b09963 (patch)
tree909f3eec08e3ffc255d2cbaf067df38e5d6fec17 /compiler/pragmas.nim
parent261a6ca0179c98559d62d2f56be15cedaffeda0a (diff)
downloadNim-1e45bb79ab4beb7a027b403bd78e879975b09963.tar.gz
Added support for {.packed.} pragma on objects
Added tests for packed and union pragmas
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r--compiler/pragmas.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index fba4e7657..efd06eef4 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -52,7 +52,7 @@ const
   typePragmas* = {wImportc, wExportc, wDeprecated, wMagic, wAcyclic, wNodecl, 
     wPure, wHeader, wCompilerproc, wFinal, wSize, wExtern, wShallow,
     wImportCpp, wImportObjC, wError, wIncompleteStruct, wByCopy, wByRef,
-    wInheritable, wGensym, wInject, wRequiresInit, wUnchecked, wUnion}
+    wInheritable, wGensym, wInject, wRequiresInit, wUnchecked, wUnion, wPacked}
   fieldPragmas* = {wImportc, wExportc, wDeprecated, wExtern, 
     wImportCpp, wImportObjC, wError}
   varPragmas* = {wImportc, wExportc, wVolatile, wRegister, wThreadVar, wNodecl, 
@@ -655,6 +655,10 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
           incl(sym.flags, sfThread)
           incl(sym.flags, sfProcvar)
           if sym.typ != nil: incl(sym.typ.flags, tfThread)
+        of wPacked:
+          noVal(it)
+          if sym.typ == nil: invalidPragma(it)
+          else: incl(sym.typ.flags, tfPacked)
         of wHint: message(it.info, hintUser, expectStrLit(c, it))
         of wWarning: message(it.info, warnUser, expectStrLit(c, it))
         of wError: