From e9226225d7675e5d5cd03759a813ef79e3d3c590 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 18 Jul 2017 14:31:12 +0100 Subject: Properly export the license() method in Emscripten --- Changelog.md | 1 + solc/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index e64a8fea..f43897a2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ ### 0.4.14 (unreleased) Features: + * C API (``jsonCompiler``): Export the ``license`` method. * Inline Assembly: Show useful error message if trying to access calldata variables. * Inline Assembly: Support variable declaration without initial value (defaults to 0). * Type Checker: Disallow value transfers to contracts without a payable fallback function. diff --git a/solc/CMakeLists.txt b/solc/CMakeLists.txt index a5515d81..18e83e75 100644 --- a/solc/CMakeLists.txt +++ b/solc/CMakeLists.txt @@ -18,7 +18,7 @@ else() endif() if (EMSCRIPTEN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EXPORTED_FUNCTIONS='[\"_compileJSON\",\"_version\",\"_compileJSONMulti\",\"_compileJSONCallback\",\"_compileStandard\"]' -s RESERVED_FUNCTION_POINTERS=20") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EXPORTED_FUNCTIONS='[\"_compileJSON\",\"_license\",\"_version\",\"_compileJSONMulti\",\"_compileJSONCallback\",\"_compileStandard\"]' -s RESERVED_FUNCTION_POINTERS=20") add_executable(soljson jsonCompiler.cpp ${HEADERS}) eth_use(soljson REQUIRED Solidity::solidity) else() -- cgit From 6e4150a5cf919f6e1cbdc8167baaba48915954ae Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 18 Jul 2017 14:40:24 +0100 Subject: Test for version/license in jsonCompiler --- test/libsolidity/JSONCompiler.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/libsolidity/JSONCompiler.cpp b/test/libsolidity/JSONCompiler.cpp index aa690f0b..a6a7bc5b 100644 --- a/test/libsolidity/JSONCompiler.cpp +++ b/test/libsolidity/JSONCompiler.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "../Metadata.h" #include "../TestHelper.h" @@ -32,6 +33,8 @@ using namespace std; extern "C" { +extern char const* version(); +extern char const* license(); extern char const* compileJSONMulti(char const* _input, bool _optimize); } @@ -57,6 +60,18 @@ Json::Value compile(string const& _input) BOOST_AUTO_TEST_SUITE(JSONCompiler) +BOOST_AUTO_TEST_CASE(read_version) +{ + string output(version()); + BOOST_CHECK(output.find(VersionString) == 0); +} + +BOOST_AUTO_TEST_CASE(read_license) +{ + string output(license()); + BOOST_CHECK(output.find("GNU GENERAL PUBLIC LICENSE") != string::npos); +} + BOOST_AUTO_TEST_CASE(basic_compilation) { char const* input = R"( -- cgit