From dd351db799d79e34cbedce9e41efedc7de18e7e6 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Thu, 8 Dec 2016 23:21:39 -0500 Subject: [PATCH] conversion-gen: add --skip-unsafe flag We should expose the SkipUnsafe option, for legacy compatability, so that conversion-go can be used in other projects, and for platforms where unsafe is not available. Make unsafe code generation the default though, and have the help text hint that the resulting code is sub-optimal. --- cmd/libs/go2idl/conversion-gen/main.go | 2 ++ hack/verify-flags/known-flags.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/cmd/libs/go2idl/conversion-gen/main.go b/cmd/libs/go2idl/conversion-gen/main.go index 80cca4030e4..fe5b86e5c77 100644 --- a/cmd/libs/go2idl/conversion-gen/main.go +++ b/cmd/libs/go2idl/conversion-gen/main.go @@ -64,6 +64,8 @@ func main() { } pflag.CommandLine.StringSliceVar(&customArgs.ExtraPeerDirs, "extra-peer-dirs", customArgs.ExtraPeerDirs, "Comma-separated list of import paths which are considered, after tag-specified peers, for conversions.") + pflag.CommandLine.BoolVar(&customArgs.SkipUnsafe, "skip-unsafe", customArgs.SkipUnsafe, + "If true, will not generate code using unsafe pointer conversions; resulting code may be slower.") arguments.CustomArgs = customArgs // Run it. diff --git a/hack/verify-flags/known-flags.txt b/hack/verify-flags/known-flags.txt index 506ee90d60d..65eacba81ed 100644 --- a/hack/verify-flags/known-flags.txt +++ b/hack/verify-flags/known-flags.txt @@ -561,6 +561,7 @@ since-time skip-generated-rewrite skip-munges skip-preflight-checks +skip-unsafe sort-by source-file ssh-env