diff options
author | def <dennis@felsin9.de> | 2015-05-07 22:31:45 +0200 |
---|---|---|
committer | def <dennis@felsin9.de> | 2015-05-07 22:31:45 +0200 |
commit | 4a2a0894aee91fac027f9d0cce401bf5c9dc353b (patch) | |
tree | 557c17d1689a2373887c62187b802f5262a860a0 /compiler | |
parent | 78c26cbf18cf1c39964ce32a4991ea4f997a980e (diff) | |
download | Nim-4a2a0894aee91fac027f9d0cce401bf5c9dc353b.tar.gz |
Implicitly assume compilers to know naked and noreturn attributes
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/cgen.nim | 8 | ||||
-rw-r--r-- | compiler/extccomp.nim | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 8e532739b..4b0bac28a 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -677,10 +677,10 @@ proc genProcAux(m: BModule, prc: PSym) = genStmts(p, prc.getBody) # modifies p.locals, p.init, etc. var generatedProc: Rope if sfNoReturn in prc.flags: - if {hasNoreturn, hasDeclspec} <= extccomp.CC[extccomp.cCompiler].props: + if hasDeclspec in extccomp.CC[extccomp.cCompiler].props: header = "__declspec(noreturn) " & header if sfPure in prc.flags: - if {hasNaked, hasDeclspec} <= extccomp.CC[extccomp.cCompiler].props: + if hasDeclspec in extccomp.CC[extccomp.cCompiler].props: header = "__declspec(naked) " & header generatedProc = rfmt(nil, "$N$1 {$n$2$3$4}$N$N", header, p.s(cpsLocals), p.s(cpsInit), p.s(cpsStmts)) @@ -723,9 +723,9 @@ proc genProcPrototype(m: BModule, sym: PSym) = var header = genProcHeader(m, sym) if sym.typ.callConv != ccInline and crossesCppBoundary(m, sym): header = "extern \"C\" " & header - if sfPure in sym.flags and {hasNaked, hasAttribute} <= CC[cCompiler].props: + if sfPure in sym.flags and hasAttribute in CC[cCompiler].props: header.add(" __attribute__((naked))") - if sfNoReturn in sym.flags and {hasNoreturn, hasAttribute} <= CC[cCompiler].props: + if sfNoReturn in sym.flags and hasAttribute in CC[cCompiler].props: header.add(" __attribute__((noreturn))") add(m.s[cfsProcHeaders], rfmt(nil, "$1;$n", header)) diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 3d4d1a3a5..31b03f418 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -28,8 +28,6 @@ type hasGnuAsm, # CC's asm uses the absurd GNU assembler syntax hasDeclspec, # CC has __declspec(X) hasAttribute, # CC has __attribute__((X)) - hasNaked, # CC has naked declspec/attribute - hasNoreturn # CC has noreturn declspec/attribute TInfoCCProps* = set[TInfoCCProp] TInfoCC* = tuple[ name: string, # the short name of the compiler @@ -87,7 +85,7 @@ compiler gcc: structStmtFmt: "$1 $3 $2 ", # struct|union [packed] $name packedPragma: "__attribute__((__packed__))", props: {hasSwitchRange, hasComputedGoto, hasCpp, hasGcGuard, hasGnuAsm, - hasAttribute, hasNaked, hasNoreturn}) + hasAttribute}) # LLVM Frontend for GCC/G++ compiler llvmGcc: @@ -129,7 +127,7 @@ compiler vcc: asmStmtFrmt: "__asm{$n$1$n}$n", structStmtFmt: "$3$n$1 $2", packedPragma: "#pragma pack(1)", - props: {hasCpp, hasAssume, hasDeclspec, hasNaked, hasNoreturn}) + props: {hasCpp, hasAssume, hasDeclspec}) # Intel C/C++ Compiler compiler icl: |