diff options
author | Ayke van Laethem <[email protected]> | 2023-05-13 13:26:34 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2023-05-17 11:21:15 +0200 |
commit | 4c682680ca00523fb5ffac722bc3f19296e3e60f (patch) | |
tree | ccf25fb26ffb9e6c0198bdd411535893f6da1ec5 /compileopts/config.go | |
parent | af76c807e27fa2d964b3b10cb2a07677554c9f3f (diff) | |
download | tinygo-4c682680ca00523fb5ffac722bc3f19296e3e60f.tar.gz tinygo-4c682680ca00523fb5ffac722bc3f19296e3e60f.zip |
compileopts: don't filter build tags, use specific build tags instead
This basically reverts https://github.com/tinygo-org/tinygo/pull/3357
and replaces it with a different mechanism to get to the same goal.
I do not think filtering tags like this is a good idea: it's the wrong
part of the compiler to be concerned with such tags (that part sets
tags, but doesn't modify existing tags). Instead, I've written the
//go:build lines in such a way that it has the same effect: WASI
defaults to leveldb, everything else defaults to fnv, and it's possible
to override the default using build tags.
Diffstat (limited to 'compileopts/config.go')
-rw-r--r-- | compileopts/config.go | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/compileopts/config.go b/compileopts/config.go index 402f0a9e0..9a4bc3106 100644 --- a/compileopts/config.go +++ b/compileopts/config.go @@ -75,8 +75,7 @@ func (c *Config) GOARM() string { // BuildTags returns the complete list of build tags used during this build. func (c *Config) BuildTags() []string { - targetTags := filterTags(c.Target.BuildTags, c.Options.Tags) - tags := append(targetTags, []string{"tinygo", "math_big_pure_go", "gc." + c.GC(), "scheduler." + c.Scheduler(), "serial." + c.Serial()}...) + tags := append(c.Target.BuildTags, []string{"tinygo", "math_big_pure_go", "gc." + c.GC(), "scheduler." + c.Scheduler(), "serial." + c.Serial()}...) for i := 1; i <= c.GoMinorVersion; i++ { tags = append(tags, fmt.Sprintf("go1.%d", i)) } @@ -552,27 +551,3 @@ type TestConfig struct { BenchMem bool Shuffle string } - -// filterTags removes predefined build tags for a target if a conflicting option -// is provided by the user. -func filterTags(targetTags []string, userTags []string) []string { - var filtered []string - for _, t := range targetTags { - switch { - case strings.HasPrefix(t, "runtime_memhash_"): - overridden := false - for _, ut := range userTags { - if strings.HasPrefix(ut, "runtime_memhash_") { - overridden = true - break - } - } - if !overridden { - filtered = append(filtered, t) - } - default: - filtered = append(filtered, t) - } - } - return filtered -} |