diff options
author | chriseth <chris@ethereum.org> | 2018-10-09 04:31:08 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-10-12 21:15:02 +0800 |
commit | 95d3e7feb39e896bf499e816a8cf037b7fdff62d (patch) | |
tree | e7682a08e32c300e5cc49af5dc8482037411d7a2 /solc | |
parent | 26c693aa920ec1ea41ef7994a3dc8bb45b78f866 (diff) | |
download | dexon-solidity-95d3e7feb39e896bf499e816a8cf037b7fdff62d.tar.gz dexon-solidity-95d3e7feb39e896bf499e816a8cf037b7fdff62d.tar.zst dexon-solidity-95d3e7feb39e896bf499e816a8cf037b7fdff62d.zip |
More helpful error messages for linker.
Diffstat (limited to 'solc')
-rw-r--r-- | solc/CommandLineInterface.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 7ab76c12..4052ed13 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -482,9 +482,23 @@ bool CommandLineInterface::parseLibraryOption(string const& _input) string addrString(lib.begin() + colon + 1, lib.end()); boost::trim(libName); boost::trim(addrString); + if (addrString.substr(0, 2) == "0x") + addrString = addrString.substr(2); + if (addrString.empty()) + { + cerr << "Empty address provided for library \"" << libName << "\": " << endl; + cerr << "Note that there should not be any whitespace after the colon." << endl; + return false; + } + else if (addrString.length() != 40) + { + cerr << "Invalid length for address for library \"" << libName << "\": " << addrString.length() << " instead of 40 characters." << endl; + return false; + } if (!passesAddressChecksum(addrString, false)) { - cerr << "Invalid checksum on library address \"" << libName << "\": " << addrString << endl; + cerr << "Invalid checksum on address for library \"" << libName << "\": " << addrString << endl; + cerr << "The correct checksum is " << dev::getChecksummedAddress(addrString) << endl; return false; } bytes binAddr = fromHex(addrString); @@ -569,7 +583,7 @@ Allowed options)", g_argLibraries.c_str(), po::value<vector<string>>()->value_name("libs"), "Direct string or file containing library addresses. Syntax: " - "<libraryName>: <address> [, or whitespace] ...\n" + "<libraryName>:<address> [, or whitespace] ...\n" "Address is interpreted as a hex string optionally prefixed by 0x." ) ( |