diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2019-05-17 12:56:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-17 12:56:53 -0700 |
commit | 9c637288cf3b1c7505fa7d8edc1536b6e64d5967 (patch) | |
tree | fc7b0e579f3f9de41fca28c65551fb3359c8f40b /test/example/c-api-kitchen-sink.c | |
parent | 1184678086b284944bb119a97ca048b64d4078b6 (diff) | |
download | binaryen-9c637288cf3b1c7505fa7d8edc1536b6e64d5967.tar.gz binaryen-9c637288cf3b1c7505fa7d8edc1536b6e64d5967.tar.bz2 binaryen-9c637288cf3b1c7505fa7d8edc1536b6e64d5967.zip |
Features C/JS API (#2049)
Add feature handling to the C/JS APIs. No features are enabled by
default, so all used features will have to be explicitly enabled in
order for modules to validate.
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 1761ab0bb..1359385eb 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -160,6 +160,16 @@ void test_types() { printf("BinaryenTypeAuto: %d\n", BinaryenTypeAuto()); } +void test_features() { + printf("BinaryenFeatureAtomics: %d\n", BinaryenFeatureAtomics()); + printf("BinaryenFeatureBulkMemory: %d\n", BinaryenFeatureBulkMemory()); + printf("BinaryenFeatureMutableGlobals: %d\n", BinaryenFeatureMutableGlobals()); + printf("BinaryenFeatureNontrappingFPToInt: %d\n", BinaryenFeatureNontrappingFPToInt()); + printf("BinaryenFeatureSignExt: %d\n", BinaryenFeatureSignExt()); + printf("BinaryenFeatureSIMD128: %d\n", BinaryenFeatureSIMD128()); + printf("BinaryenFeatureExceptionHandling: %d\n", BinaryenFeatureExceptionHandling()); +} + void test_core() { // Module creation @@ -511,6 +521,16 @@ void test_core() { // A bunch of our code needs drop(), auto-add it BinaryenModuleAutoDrop(module); + BinaryenFeatures features = + BinaryenFeatureAtomics() | + BinaryenFeatureBulkMemory() | + BinaryenFeatureNontrappingFPToInt() | + BinaryenFeatureSignExt() | + BinaryenFeatureSIMD128(); + + BinaryenSetFeatures(module, features); + assert(BinaryenGetFeatures(module) == features); + // Verify it validates assert(BinaryenModuleValidate(module)); @@ -830,6 +850,7 @@ void test_color_status() { int main() { test_types(); + test_features(); test_core(); test_unreachable(); test_relooper(); |