From 4d81752204fede13d6513def4195aabe66c5586f Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Tue, 16 Apr 2019 16:47:50 -0700 Subject: Change default feature set to MVP (#1993) In the absence of the target features section or command line flags. When there are command line flags, it is an error if they do not exactly match the target features section, except if --detect-features has been provided. Also adds a --print-features pass to print the command line flags for all enabled options and uses it to make the feature tests more rigorous. --- src/passes/PrintFeatures.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/passes/PrintFeatures.cpp (limited to 'src/passes/PrintFeatures.cpp') diff --git a/src/passes/PrintFeatures.cpp b/src/passes/PrintFeatures.cpp new file mode 100644 index 000000000..9c7172eee --- /dev/null +++ b/src/passes/PrintFeatures.cpp @@ -0,0 +1,39 @@ +/* + * Copyright 2019 WebAssembly Community Group participants + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// +// Print out the feature options corresponding to enabled features +// + +#include "wasm.h" +#include "wasm-features.h" +#include "pass.h" + +namespace wasm { + +struct PrintFeatures : public Pass { + void run(PassRunner* runner, Module* module) override { + module->features.iterFeatures([](FeatureSet::Feature f) { + std::cout << "--enable-" << FeatureSet::toString(f) << std::endl; + }); + } +}; + +Pass* createPrintFeaturesPass() { + return new PrintFeatures(); +} + +} // namespace wasm -- cgit v1.2.3