From 01a1316b36c90ef7358767423e9500df8cfffb9d Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 29 Jul 2021 21:48:42 +0200 Subject: [PATCH] Only set "runs" if used. --- solc/CommandLineParser.cpp | 6 ++++-- test/solc/CommandLineParser.cpp | 3 --- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/solc/CommandLineParser.cpp b/solc/CommandLineParser.cpp index 59972fb3b..a01aa59f5 100644 --- a/solc/CommandLineParser.cpp +++ b/solc/CommandLineParser.cpp @@ -967,7 +967,8 @@ General Information)").c_str(), m_options.optimizer.enabled = (m_args.count(g_strOptimize) > 0); m_options.optimizer.noOptimizeYul = (m_args.count(g_strNoOptimizeYul) > 0); - m_options.optimizer.expectedExecutionsPerDeployment = m_args.at(g_strOptimizeRuns).as(); + if (!m_args[g_strOptimizeRuns].defaulted()) + m_options.optimizer.expectedExecutionsPerDeployment = m_args.at(g_strOptimizeRuns).as(); if (m_args.count(g_strYulOptimizations)) { @@ -1132,7 +1133,8 @@ General Information)").c_str(), m_args.count(g_strModelCheckerTargets) || m_args.count(g_strModelCheckerTimeout); m_options.output.experimentalViaIR = (m_args.count(g_strExperimentalViaIR) > 0); - m_options.optimizer.expectedExecutionsPerDeployment = m_args[g_strOptimizeRuns].as(); + if (!m_args[g_strOptimizeRuns].defaulted()) + m_options.optimizer.expectedExecutionsPerDeployment = m_args.at(g_strOptimizeRuns).as(); m_options.optimizer.enabled = (m_args.count(g_strOptimize) > 0); m_options.optimizer.noOptimizeYul = (m_args.count(g_strNoOptimizeYul) > 0); diff --git a/test/solc/CommandLineParser.cpp b/test/solc/CommandLineParser.cpp index 8d24f97aa..02444ce5d 100644 --- a/test/solc/CommandLineParser.cpp +++ b/test/solc/CommandLineParser.cpp @@ -78,7 +78,6 @@ BOOST_AUTO_TEST_CASE(no_options) CommandLineOptions expectedOptions; expectedOptions.input.paths = {"contract.sol"}; - expectedOptions.optimizer.expectedExecutionsPerDeployment = 200; expectedOptions.modelChecker.initialize = true; expectedOptions.modelChecker.settings = { ModelCheckerContracts::Default(), @@ -334,8 +333,6 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options) expectedOptions.optimizer.yulSteps = "agf"; expectedOptions.optimizer.expectedExecutionsPerDeployment = 1000; } - else - expectedOptions.optimizer.expectedExecutionsPerDeployment = OptimiserSettings{}.expectedExecutionsPerDeployment; stringstream sout, serr; optional parsedOptions = parseCommandLine(commandLine, sout, serr);