Move the Yul experimental warning from CommandLineParser to CommandLineInterface and remove stderr from the parser

This commit is contained in:
Kamil Śliwak 2021-10-11 14:20:56 +02:00
parent 3f5471165f
commit 16f62ed43e
4 changed files with 4 additions and 30 deletions

View File

@ -583,7 +583,7 @@ void CommandLineInterface::createJson(string const& _fileName, string const& _js
bool CommandLineInterface::parseArguments(int _argc, char const* const* _argv)
{
CommandLineParser parser(serr(/* _markAsUsed */ false));
CommandLineParser parser;
if (isatty(fileno(stdin)) && _argc == 1)
{
@ -604,7 +604,6 @@ bool CommandLineInterface::parseArguments(int _argc, char const* const* _argv)
return false;
}
m_hasOutput = m_hasOutput || parser.hasOutput();
m_options = parser.options();
return true;
@ -1003,6 +1002,8 @@ bool CommandLineInterface::assemble(yul::AssemblyStack::Language _language, yul:
{
solAssert(m_options.input.mode == InputMode::Assembler, "");
serr() << "Warning: Yul is still experimental. Please use the output with care." << endl;
bool successful = true;
map<string, yul::AssemblyStack> assemblyStacks;
for (auto const& src: m_fileReader.sourceCodes())

View File

@ -38,14 +38,6 @@ namespace po = boost::program_options;
namespace solidity::frontend
{
ostream& CommandLineParser::serr()
{
m_hasOutput = true;
return m_serr;
}
#define cerr
static string const g_strAllowPaths = "allow-paths";
static string const g_strBasePath = "base-path";
static string const g_strIncludePath = "include-path";
@ -278,8 +270,6 @@ OptimiserSettings CommandLineOptions::optimiserSettings() const
void CommandLineParser::parse(int _argc, char const* const* _argv)
{
m_hasOutput = false;
parseArgs(_argc, _argv);
processArgs();
}
@ -1167,8 +1157,6 @@ void CommandLineParser::processArgs()
"The selected input language is not directly supported when targeting the Ewasm machine "
"and automatic translation is not available."
);
serr() << "Warning: Yul is still experimental. Please use the output with care." << endl;
return;
}
else if (countEnabledOptions({g_strYulDialect, g_strMachine}) >= 1)

View File

@ -238,10 +238,6 @@ struct CommandLineOptions
class CommandLineParser
{
public:
explicit CommandLineParser(std::ostream& _serr):
m_serr(_serr)
{}
/// Parses the command-line arguments and fills out the internal CommandLineOptions structure.
/// @throws CommandLineValidationError if the arguments cannot be properly parsed or are invalid.
/// When an exception is thrown, the @p CommandLineOptions may be only partially filled out.
@ -249,9 +245,6 @@ public:
CommandLineOptions const& options() const { return m_options; }
/// Returns true if the parser has written anything to any of its output streams.
bool hasOutput() const { return m_hasOutput; }
static void printHelp(std::ostream& _out) { _out << optionsDescription(); }
private:
@ -292,13 +285,6 @@ private:
size_t countEnabledOptions(std::vector<std::string> const& _optionNames) const;
static std::string joinOptionNames(std::vector<std::string> const& _optionNames, std::string _separator = ", ");
/// Returns the stream that should receive error output. Sets m_hasOutput to true if the
/// stream has ever been used.
std::ostream& serr();
std::ostream& m_serr;
bool m_hasOutput = false;
CommandLineOptions m_options;
/// Map of command-line arguments produced by boost::program_options.

View File

@ -51,8 +51,7 @@ CommandLineOptions parseCommandLine(vector<string> const& _commandLine)
{
vector<char const*> argv = test::makeArgv(_commandLine);
stringstream serr;
CommandLineParser cliParser(serr);
CommandLineParser cliParser;
cliParser.parse(static_cast<int>(_commandLine.size()), argv.data());
return cliParser.options();
}