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 /src | |
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 'src')
-rw-r--r-- | src/runtime/memhash_fnv.go | 5 | ||||
-rw-r--r-- | src/runtime/memhash_leveldb.go | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/runtime/memhash_fnv.go b/src/runtime/memhash_fnv.go index 09ef7e86f..4d82971d0 100644 --- a/src/runtime/memhash_fnv.go +++ b/src/runtime/memhash_fnv.go @@ -1,4 +1,7 @@ -//go:build !runtime_memhash_tsip && !runtime_memhash_leveldb +//go:build (!wasi && !runtime_memhash_tsip && !runtime_memhash_leveldb) || (wasi && runtime_memhash_fnv) + +// This is the default for all targets except WASI, unless a more specific build +// tag is set. package runtime diff --git a/src/runtime/memhash_leveldb.go b/src/runtime/memhash_leveldb.go index 34a598e43..22ff829e4 100644 --- a/src/runtime/memhash_leveldb.go +++ b/src/runtime/memhash_leveldb.go @@ -1,4 +1,7 @@ -//go:build runtime_memhash_leveldb +//go:build runtime_memhash_leveldb || (wasi && !runtime_memhash_fnv && !runtime_memhash_tsip) + +// This is the default for WASI, but can also be used on other targets with the +// right build tag. // This is the hash function from Google's leveldb key-value storage system. It // processes 4 bytes at a time making it faster than the FNV hash for buffer |