CommandLineInterface: In error message about options disallowed in assembly mode only include the names of actually used options

This commit is contained in:
Kamil Śliwak 2020-06-29 15:11:33 +02:00
parent 8fde9fd1c3
commit 3f3f8adcb8
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.