diff options
Diffstat (limited to 'src/cmd/compile/internal/gc/lex.go')
-rw-r--r-- | src/cmd/compile/internal/gc/lex.go | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/cmd/compile/internal/gc/lex.go b/src/cmd/compile/internal/gc/lex.go index 5ff55d7c83..c0039fd880 100644 --- a/src/cmd/compile/internal/gc/lex.go +++ b/src/cmd/compile/internal/gc/lex.go @@ -40,17 +40,15 @@ func plan9quote(s string) string { return s } -type Pragma syntax.Pragma - const ( // Func pragmas. - Nointerface Pragma = 1 << iota - Noescape // func parameters don't escape - Norace // func must not have race detector annotations - Nosplit // func should not execute on separate stack - Noinline // func should not be inlined - CgoUnsafeArgs // treat a pointer to one arg as a pointer to them all - UintptrEscapes // pointers converted to uintptr escape + Nointerface syntax.Pragma = 1 << iota + Noescape // func parameters don't escape + Norace // func must not have race detector annotations + Nosplit // func should not execute on separate stack + Noinline // func should not be inlined + CgoUnsafeArgs // treat a pointer to one arg as a pointer to them all + UintptrEscapes // pointers converted to uintptr escape // Runtime-only func pragmas. // See ../../../../runtime/README.md for detailed descriptions. @@ -63,7 +61,7 @@ const ( NotInHeap // values of this type must not be heap allocated ) -func pragmaValue(verb string) Pragma { +func pragmaValue(verb string) syntax.Pragma { switch verb { case "go:nointerface": if obj.Fieldtrack_enabled != 0 { @@ -78,24 +76,12 @@ func pragmaValue(verb string) Pragma { case "go:noinline": return Noinline case "go:systemstack": - if !compiling_runtime { - yyerror("//go:systemstack only allowed in runtime") - } return Systemstack case "go:nowritebarrier": - if !compiling_runtime { - yyerror("//go:nowritebarrier only allowed in runtime") - } return Nowritebarrier case "go:nowritebarrierrec": - if !compiling_runtime { - yyerror("//go:nowritebarrierrec only allowed in runtime") - } return Nowritebarrierrec | Nowritebarrier // implies Nowritebarrier case "go:yeswritebarrierrec": - if !compiling_runtime { - yyerror("//go:yeswritebarrierrec only allowed in runtime") - } return Yeswritebarrierrec case "go:cgo_unsafe_args": return CgoUnsafeArgs |