diff options
author | Zhen Zhang <zhen@pineapple.exchange> | 2018-02-27 12:31:09 +0800 |
---|---|---|
committer | Zhen Zhang <zhen@pineapple.exchange> | 2018-02-28 09:31:24 +0800 |
commit | 5fd9ea4b2abf9d2498fa725cfdbdf152c3d3d15a (patch) | |
tree | 4f8247dd853e53d3372e7475b59f854cd2a6167e | |
parent | 1f5eb4ba59891387c2dfcc10103c2f187bf2b4ee (diff) | |
download | dexon-solidity-5fd9ea4b2abf9d2498fa725cfdbdf152c3d3d15a.tar.gz dexon-solidity-5fd9ea4b2abf9d2498fa725cfdbdf152c3d3d15a.tar.zst dexon-solidity-5fd9ea4b2abf9d2498fa725cfdbdf152c3d3d15a.zip |
Stop allow_guessing for command line option parser
-rw-r--r-- | Changelog.md | 1 | ||||
-rw-r--r-- | solc/CommandLineInterface.cpp | 1 | ||||
-rwxr-xr-x | test/cmdlineTests.sh | 15 |
3 files changed, 17 insertions, 0 deletions
diff --git a/Changelog.md b/Changelog.md index 3af3a99d..8aa7ba0c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,6 +14,7 @@ Bugfixes: * Standalone Assembly: Do not ignore input after closing brace of top level block. * Standard JSON: catch errors properly when invalid "sources" are passed * Type Checker: Properly warn when using ``_offset`` and ``_slot`` for constants in inline assembly. + * Commandline interface: throw error if option is unknown ### 0.4.20 (2018-02-14) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 8383afed..62b24975 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -627,6 +627,7 @@ Allowed options)", try { po::command_line_parser cmdLineParser(_argc, _argv); + cmdLineParser.style(po::command_line_style::default_style & (~po::command_line_style::allow_guessing)); cmdLineParser.options(allOptions).positional(filesPositions); po::store(cmdLineParser.run(), m_args); } diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index a249b601..f2c1f2c3 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -83,6 +83,21 @@ function compileWithoutWarning() test -z "$output" -a "$failed" -eq 0 } +printTask "Testing unknown options..." +( + set +e + output=$("$SOLC" --allow=test 2>&1) + failed=$? + set -e + + if [ "$output" == "unrecognised option '--allow=test'" ] && [ $failed -ne 0 ] ; then + echo "Passed" + else + printError "Incorrect response to unknown options: $STDERR" + exit 1 + fi +) + printTask "Compiling various other contracts and libraries..." ( cd "$REPO_ROOT"/test/compilationTests/ |