diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 50b8c338fb1ee..8fbdd3579f380 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -22,7 +22,7 @@ const const declPragmas = {wImportc, wImportObjC, wImportCpp, wImportJs, wExportc, wExportCpp, - wExportNims, wExtern, wDeprecated, wNodecl, wError, wUsed, wAlign} + wExportNims, wExtern, wDeprecated, wNodecl, wError, wUsed} ## common pragmas for declarations, to a good approximation procPragmas* = declPragmas + {FirstCallConv..LastCallConv, wMagic, wNoSideEffect, wSideEffect, wNoreturn, wNosinks, wDynlib, wHeader, @@ -56,22 +56,23 @@ const wFloatChecks, wInfChecks, wNanChecks, wPragma, wEmit, wUnroll, wLinearScanEnd, wPatterns, wTrMacros, wEffects, wNoForward, wReorder, wComputedGoto, wInjectStmt, wExperimental, wThis, wUsed, wInvariant, wAssume, wAssert} - lambdaPragmas* = declPragmas + {FirstCallConv..LastCallConv, + lambdaPragmas* = {FirstCallConv..LastCallConv, wNoSideEffect, wSideEffect, wNoreturn, wNosinks, wDynlib, wHeader, wThread, wAsmNoStackFrame, wRaises, wLocks, wTags, wRequires, wEnsures, - wGcSafe, wCodegenDecl} - {wExportNims, wError, wUsed} # why exclude these? + wGcSafe, wCodegenDecl, wNoInit} typePragmas* = declPragmas + {wMagic, wAcyclic, wPure, wHeader, wCompilerProc, wCore, wFinal, wSize, wShallow, wIncompleteStruct, wCompleteStruct, wByCopy, wByRef, wInheritable, wGensym, wInject, wRequiresInit, wUnchecked, wUnion, wPacked, wCppNonPod, wBorrow, wGcSafe, wPartial, wExplain, wPackage} - fieldPragmas* = declPragmas + { - wGuard, wBitsize, wCursor, wRequiresInit, wNoalias} - {wExportNims, wNodecl} # why exclude these? + fieldPragmas* = declPragmas + {wGuard, wBitsize, wCursor, + wRequiresInit, wNoalias, wAlign} - {wExportNims, wNodecl} # why exclude these? varPragmas* = declPragmas + {wVolatile, wRegister, wThreadVar, wMagic, wHeader, wCompilerProc, wCore, wDynlib, wNoInit, wCompileTime, wGlobal, - wGensym, wInject, wCodegenDecl, wGuard, wGoto, wCursor, wNoalias} + wGensym, wInject, wCodegenDecl, + wGuard, wGoto, wCursor, wNoalias, wAlign} constPragmas* = declPragmas + {wHeader, wMagic, wGensym, wInject, wIntDefine, wStrDefine, wBoolDefine, wCompilerProc, wCore} diff --git a/tests/proc/tlambdapragma.nim b/tests/proc/tlambdapragma.nim new file mode 100644 index 0000000000000..daa952b1efa86 --- /dev/null +++ b/tests/proc/tlambdapragma.nim @@ -0,0 +1,7 @@ +discard """ + errormsg: "invalid pragma: exportc" +""" + +let _ = proc () {.exportc.} = + # this would previously cause a codegen error + discard