Merge pull request #9269 from ethereum/commandline-clearer-error-for-options-disallowed-in-asm-mode

Only actually specified options in command-line error in assembly mode
This commit is contained in:
chriseth 2020-06-29 16:53:46 +02:00 committed by GitHub
commit 0ffe0f7c25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 3 deletions

View File

@ -59,6 +59,7 @@
#include <boost/filesystem.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <boost/range/adaptor/filtered.hpp>
#include <boost/algorithm/string.hpp>
#ifdef _WIN32 // windows
@ -1200,9 +1201,14 @@ bool CommandLineInterface::processInput()
};
if (countEnabledOptions(nonAssemblyModeOptions) >= 1)
{
auto optionEnabled = [&](string const& name){ return m_args.count(name) > 0; };
auto enabledOptions = boost::copy_range<vector<string>>(nonAssemblyModeOptions | boost::adaptors::filtered(optionEnabled));
serr() << "The following options are invalid in assembly mode: ";
serr() << joinOptionNames(nonAssemblyModeOptions) << ". ";
serr() << "Optimization is disabled by default and can be enabled with --" << g_argOptimize << "." << endl;
serr() << joinOptionNames(enabledOptions) << ".";
if (m_args.count(g_strOptimizeYul) || m_args.count(g_strNoOptimizeYul))
serr() << " Optimization is disabled by default and can be enabled with --" << g_argOptimize << "." << endl;
serr() << endl;
return false;
}

View File

@ -0,0 +1 @@
--strict-assembly --optimize-yul

View File

@ -0,0 +1 @@
The following options are invalid in assembly mode: --optimize-yul. Optimization is disabled by default and can be enabled with --optimize.

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,3 @@
{
sstore(0, 1)
}

View File

@ -1 +1 @@
The following options are invalid in assembly mode: --output-dir, --gas, --combined-json, --optimize-yul, --no-optimize-yul. Optimization is disabled by default and can be enabled with --optimize.
The following options are invalid in assembly mode: --output-dir.