mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Reject optimizer options as invalid in linker and Standard JSON modes
This commit is contained in:
parent
b7c124911a
commit
7a36a1d1db
@ -12,11 +12,12 @@ Compiler Features:
|
||||
* SMTChecker: Support low level ``call`` as external calls to unknown code.
|
||||
* SMTChecker: Add constraints to better correlate ``address(this).balance`` and ``msg.value``.
|
||||
* SMTChecker: Support the ``value`` option for external function calls.
|
||||
* Commandline Interface: Disallowed the ``--experimental-via-ir`` option to be used with Standard Json, Assembler and Linker modes.
|
||||
|
||||
|
||||
Bugfixes:
|
||||
* Code Generator: Use stable source order for ABI functions.
|
||||
* Commandline Interface: Report optimizer options as invalid in Standard JSON and linker modes instead of ignoring them.
|
||||
* Commandline Interface: Disallow the ``--experimental-via-ir`` option in Standard JSON, Assembler and Linker modes.
|
||||
* Opcode Optimizer: Prevent the optimizer from running multiple times to avoid potential bytecode differences for referenced code.
|
||||
* Name Resolver: Fix that when importing an aliased symbol using ``import {AliasedName} from "a.sol"`` it would use the original name of the symbol and not the aliased one.
|
||||
* SMTChecker: Fix false negative caused by ``push`` on storage array references returned by internal functions.
|
||||
|
@ -940,6 +940,26 @@ General Information)").c_str(),
|
||||
if (!parseInputPathsAndRemappings())
|
||||
return false;
|
||||
|
||||
if (
|
||||
m_options.input.mode != InputMode::Compiler &&
|
||||
m_options.input.mode != InputMode::CompilerWithASTImport &&
|
||||
m_options.input.mode != InputMode::Assembler
|
||||
)
|
||||
{
|
||||
if (!m_args[g_strOptimizeRuns].defaulted())
|
||||
{
|
||||
serr() << "Option --" << g_strOptimizeRuns << " is only valid in compiler and assembler modes." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (string const& option: {g_strOptimize, g_strNoOptimizeYul, g_strOptimizeYul, g_strYulOptimizations})
|
||||
if (m_args.count(option) > 0)
|
||||
{
|
||||
serr() << "Option --" << option << " is only valid in compiler and assembler modes." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_options.input.mode == InputMode::StandardJson)
|
||||
return true;
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
--no-optimize-yul --link --libraries input.sol:L=0x1234567890123456789012345678901234567890
|
@ -0,0 +1 @@
|
||||
Option --no-optimize-yul is only valid in compiler and assembler modes.
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
--optimize --link --libraries input.sol:L=0x1234567890123456789012345678901234567890
|
@ -0,0 +1 @@
|
||||
Option --optimize is only valid in compiler and assembler modes.
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
--optimize-runs 1000 --link --libraries input.sol:L=0x1234567890123456789012345678901234567890
|
@ -0,0 +1 @@
|
||||
Option --optimize-runs is only valid in compiler and assembler modes.
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
--optimize-yul --link --libraries input.sol:L=0x1234567890123456789012345678901234567890
|
@ -0,0 +1 @@
|
||||
Option --optimize-yul is only valid in compiler and assembler modes.
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
--yul-optimizations a --link --libraries input.sol:L=0x1234567890123456789012345678901234567890
|
@ -0,0 +1 @@
|
||||
Option --yul-optimizations is only valid in compiler and assembler modes.
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
--no-optimize-yul
|
@ -0,0 +1 @@
|
||||
Option --no-optimize-yul is only valid in compiler and assembler modes.
|
@ -0,0 +1 @@
|
||||
1
|
1
test/cmdlineTests/standard_invalid_option_optimize/args
Normal file
1
test/cmdlineTests/standard_invalid_option_optimize/args
Normal file
@ -0,0 +1 @@
|
||||
--optimize
|
1
test/cmdlineTests/standard_invalid_option_optimize/err
Normal file
1
test/cmdlineTests/standard_invalid_option_optimize/err
Normal file
@ -0,0 +1 @@
|
||||
Option --optimize is only valid in compiler and assembler modes.
|
1
test/cmdlineTests/standard_invalid_option_optimize/exit
Normal file
1
test/cmdlineTests/standard_invalid_option_optimize/exit
Normal file
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
--optimize-runs 1000
|
@ -0,0 +1 @@
|
||||
Option --optimize-runs is only valid in compiler and assembler modes.
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
--optimize-yul
|
@ -0,0 +1 @@
|
||||
Option --optimize-yul is only valid in compiler and assembler modes.
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
--yul-optimizations a
|
@ -0,0 +1 @@
|
||||
Option --yul-optimizations is only valid in compiler and assembler modes.
|
@ -0,0 +1 @@
|
||||
1
|
@ -368,9 +368,6 @@ BOOST_AUTO_TEST_CASE(standard_json_mode_options)
|
||||
"--combined-json=abi,bin", // Accepted but has no effect in Standard JSON mode
|
||||
"--metadata-hash=swarm", // Ignored in Standard JSON mode
|
||||
"--metadata-literal", // Ignored in Standard JSON mode
|
||||
"--optimize", // Ignored in Standard JSON mode
|
||||
"--optimize-runs=1000", // Ignored in Standard JSON mode
|
||||
"--yul-optimizations=agf",
|
||||
"--model-checker-contracts=" // Ignored in Standard JSON mode
|
||||
"contract1.yul:A,"
|
||||
"contract2.yul:B",
|
||||
|
Loading…
Reference in New Issue
Block a user