mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
CommandLineInterface: Report an error if library appears multiple times in the --libraries option
This commit is contained in:
parent
c3b862c073
commit
1a4d38c0ac
@ -19,6 +19,7 @@ Compiler Features:
|
|||||||
|
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
* Command Line Interface: Reject duplicate libraries in ``--libraries`` option instead of arbitrarily choosing one.
|
||||||
* SMTChecker: Fix lack of reporting potential violations when using only the CHC engine.
|
* SMTChecker: Fix lack of reporting potential violations when using only the CHC engine.
|
||||||
* SMTChecker: Fix internal error on conversion from string literal to byte.
|
* SMTChecker: Fix internal error on conversion from string literal to byte.
|
||||||
* SMTChecker: Fix internal error when using tuples of rational literals inside the conditional operator.
|
* SMTChecker: Fix internal error when using tuples of rational literals inside the conditional operator.
|
||||||
|
@ -664,9 +664,16 @@ bool CommandLineInterface::parseLibraryOption(string const& _input)
|
|||||||
serr() << "Colon separator missing in library address specifier \"" << lib << "\"" << endl;
|
serr() << "Colon separator missing in library address specifier \"" << lib << "\"" << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
string libName(lib.begin(), lib.begin() + static_cast<ptrdiff_t>(colon));
|
string libName(lib.begin(), lib.begin() + static_cast<ptrdiff_t>(colon));
|
||||||
string addrString(lib.begin() + static_cast<ptrdiff_t>(colon) + 1, lib.end());
|
|
||||||
boost::trim(libName);
|
boost::trim(libName);
|
||||||
|
if (m_libraries.count(libName))
|
||||||
|
{
|
||||||
|
serr() << "Address specified more than once for library \"" << libName << "\"." << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string addrString(lib.begin() + static_cast<ptrdiff_t>(colon) + 1, lib.end());
|
||||||
boost::trim(addrString);
|
boost::trim(addrString);
|
||||||
if (addrString.substr(0, 2) == "0x")
|
if (addrString.substr(0, 2) == "0x")
|
||||||
addrString = addrString.substr(2);
|
addrString = addrString.substr(2);
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
--strict-assembly --libraries library.sol:L:0x1234567890123456789012345678901234567890,library.sol:L:0x0987654321098765432109876543210987654321
|
@ -0,0 +1 @@
|
|||||||
|
Address specified more than once for library "library.sol:L".
|
@ -0,0 +1 @@
|
|||||||
|
1
|
@ -0,0 +1,5 @@
|
|||||||
|
object "a" {
|
||||||
|
code {
|
||||||
|
let addr := linkersymbol("library.sol:L")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
--strict-assembly --libraries library1.sol:L:0x1111111111111111111111111111111111111111,library2.sol:L:0x2222222222222222222222222222222222222222
|
@ -0,0 +1 @@
|
|||||||
|
Warning: Yul is still experimental. Please use the output with care.
|
@ -0,0 +1,6 @@
|
|||||||
|
object "a" {
|
||||||
|
code {
|
||||||
|
let addr1 := linkersymbol("library1.sol:L")
|
||||||
|
let addr2 := linkersymbol("library2.sol:L")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
======= linking_strict_assembly_same_library_name_different_files/input.yul (EVM) =======
|
||||||
|
|
||||||
|
Pretty printed source:
|
||||||
|
object "a" {
|
||||||
|
code {
|
||||||
|
let addr1 := linkersymbol("library1.sol:L")
|
||||||
|
let addr2 := linkersymbol("library2.sol:L")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Binary representation:
|
||||||
|
7311111111111111111111111111111111111111117322222222222222222222222222222222222222225050
|
||||||
|
|
||||||
|
Text representation:
|
||||||
|
linkerSymbol("f3ffc10c396a7cc41ae954b050792839d20947bf73497d30c49a9fda1ea477ec")
|
||||||
|
/* "linking_strict_assembly_same_library_name_different_files/input.yul":32:75 */
|
||||||
|
linkerSymbol("c3523432985587641d17c68161d2f700c57aaf4ed21cda4f25d76193c831f97f")
|
||||||
|
/* "linking_strict_assembly_same_library_name_different_files/input.yul":22:133 */
|
||||||
|
pop
|
||||||
|
pop
|
Loading…
Reference in New Issue
Block a user