diff options
author | Colin Cross <ccross@android.com> | 2017-05-08 22:10:25 +0000 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-05-08 22:10:25 +0000 |
commit | 0fdee74f5b96599cc2278887d87311153bfac714 (patch) | |
tree | 930d281244a441230b1c78c8f92256e93ea6c7ed /androidmk | |
parent | a8688c465294dc0016c56855922238527d36cc1b (diff) | |
download | build_soong-0fdee74f5b96599cc2278887d87311153bfac714.tar.gz build_soong-0fdee74f5b96599cc2278887d87311153bfac714.tar.bz2 build_soong-0fdee74f5b96599cc2278887d87311153bfac714.zip |
Revert "androidmk: support cfi, diag, and misc_undefined properties"
This reverts commit a8688c465294dc0016c56855922238527d36cc1b.
Change-Id: Ida4050f3ddc8303d614f2bd2a01470ed5459fe2c
Diffstat (limited to 'androidmk')
-rw-r--r-- | androidmk/cmd/androidmk/android.go | 94 | ||||
-rw-r--r-- | androidmk/cmd/androidmk/androidmk_test.go | 14 |
2 files changed, 50 insertions, 58 deletions
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go index be75041e..3c3e2a1b 100644 --- a/androidmk/cmd/androidmk/android.go +++ b/androidmk/cmd/androidmk/android.go @@ -33,8 +33,7 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){ "LOCAL_MODULE_STEM": stem, "LOCAL_MODULE_HOST_OS": hostOs, "LOCAL_SRC_FILES": srcFiles, - "LOCAL_SANITIZE": sanitize(""), - "LOCAL_SANITIZE_DIAG": sanitize("diag."), + "LOCAL_SANITIZE": sanitize, // composite functions "LOCAL_MODULE_TAGS": includeVariableIf(bpVariable{"tags", bpparser.ListType}, not(valueDumpEquals("optional"))), @@ -414,63 +413,60 @@ func srcFiles(ctx variableAssignmentContext) error { return nil } -func sanitize(sub string) func(ctx variableAssignmentContext) error { - return func(ctx variableAssignmentContext) error { - val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType) - if err != nil { - return err - } +func sanitize(ctx variableAssignmentContext) error { + val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType) + if err != nil { + return err + } - lists, err := splitBpList(val, func(value bpparser.Expression) (string, bpparser.Expression, error) { - switch v := value.(type) { - case *bpparser.Variable: - return "vars", value, nil - case *bpparser.Operator: - ctx.file.errorf(ctx.mkvalue, "unknown sanitize expression") - return "unknown", value, nil - case *bpparser.String: - switch v.Value { - case "never", "address", "coverage", "integer", "thread", "undefined", "cfi": - bpTrue := &bpparser.Bool{ - Value: true, - } - return v.Value, bpTrue, nil - default: - return "misc_undefined", v, nil + lists, err := splitBpList(val, func(value bpparser.Expression) (string, bpparser.Expression, error) { + switch v := value.(type) { + case *bpparser.Variable: + return "vars", value, nil + case *bpparser.Operator: + ctx.file.errorf(ctx.mkvalue, "unknown sanitize expression") + return "unknown", value, nil + case *bpparser.String: + switch v.Value { + case "never", "address", "coverage", "integer", "thread", "undefined": + bpTrue := &bpparser.Bool{ + Value: true, } + return v.Value, bpTrue, nil default: - return "", nil, fmt.Errorf("sanitize expected a string, got %s", value.Type()) + ctx.file.errorf(ctx.mkvalue, "unknown sanitize argument: %s", v.Value) + return "unknown", value, nil } - }) - if err != nil { - return err + default: + return "", nil, fmt.Errorf("sanitize expected a string, got %s", value.Type()) } + }) + if err != nil { + return err + } - for k, v := range lists { - if emptyList(v) { - continue - } - - switch k { - case "never", "address", "coverage", "integer", "thread", "undefined", "cfi": - err = setVariable(ctx.file, false, ctx.prefix, "sanitize."+sub+k, lists[k].(*bpparser.List).Values[0], true) - case "misc_undefined": - err = setVariable(ctx.file, false, ctx.prefix, "sanitize."+sub+"misc_undefined", lists[k].(*bpparser.List), true) - case "unknown": - // Nothing, we already added the error above - case "vars": - fallthrough - default: - err = setVariable(ctx.file, true, ctx.prefix, "sanitize", v, true) - } + for k, v := range lists { + if emptyList(v) { + continue + } - if err != nil { - return err - } + switch k { + case "never", "address", "coverage", "integer", "thread", "undefined": + err = setVariable(ctx.file, false, ctx.prefix, "sanitize."+k, lists[k].(*bpparser.List).Values[0], true) + case "unknown": + // Nothing, we already added the error above + case "vars": + fallthrough + default: + err = setVariable(ctx.file, true, ctx.prefix, "sanitize", v, true) } - return err + if err != nil { + return err + } } + + return err } func prebuiltClass(ctx variableAssignmentContext) error { diff --git a/androidmk/cmd/androidmk/androidmk_test.go b/androidmk/cmd/androidmk/androidmk_test.go index 7ebc9472..0c44ea72 100644 --- a/androidmk/cmd/androidmk/androidmk_test.go +++ b/androidmk/cmd/androidmk/androidmk_test.go @@ -285,21 +285,17 @@ cc_library_shared { desc: "LOCAL_SANITIZE unknown parameter", in: ` include $(CLEAR_VARS) -LOCAL_SANITIZE := integer cfi asdf -LOCAL_SANITIZE_DIAG := cfi +LOCAL_SANITIZE := integer asdf LOCAL_SANITIZE_RECOVER := qwert include $(BUILD_SHARED_LIBRARY) `, expected: ` cc_library_shared { + // ANDROIDMK TRANSLATION ERROR: unknown sanitize argument: asdf + // integer asdf sanitize: { - integer: true, - cfi: true, - misc_undefined: ["asdf"], - diag: { - cfi: true, - }, - recover: ["qwert"], + integer: true, + recover: ["qwert"], }, } `, |