aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rw-r--r--Changelog.md2
-rw-r--r--docs/conf.py10
-rw-r--r--docs/installing-solidity.rst6
-rw-r--r--docs/miscellaneous.rst25
-rw-r--r--libevmasm/EVMSchedule.h2
-rw-r--r--libevmasm/GasMeter.h2
-rw-r--r--libevmasm/Instruction.cpp6
-rw-r--r--libevmasm/Instruction.h2
-rw-r--r--libevmasm/PeepholeOptimiser.cpp2
-rw-r--r--libevmasm/SemanticInformation.cpp2
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp2
-rw-r--r--libsolidity/inlineasm/AsmParser.cpp4
-rwxr-xr-xscripts/tests.sh2
-rw-r--r--solc/CommandLineInterface.cpp18
15 files changed, 40 insertions, 49 deletions
diff --git a/.travis.yml b/.travis.yml
index d4b37f20..c31d9b2b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,7 +21,7 @@
# You should have received a copy of the GNU General Public License
# along with solidity. If not, see <http://www.gnu.org/licenses/>
#
-# (c) 2016 solidity contributors.
+# (c) 2016-2017 solidity contributors.
#------------------------------------------------------------------------------
language: cpp
@@ -73,7 +73,7 @@ matrix:
dist: trusty
sudo: required
compiler: gcc
- node_js: stable
+ node_js: "5"
services:
- docker
before_install:
diff --git a/Changelog.md b/Changelog.md
index 79d2fe44..0c4e8329 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -4,6 +4,8 @@ Features:
* Type system: Support explicit conversion of external function to address.
Bugfixes:
+ * Commandline interface: Always escape filenames (replace ``/``, ``:`` and ``.`` with ``_``).
+ * Commandline interface: Do not try creating paths ``.`` and ``..``.
* Type system: Disallow arrays with negative length.
### 0.4.9 (2017-01-31)
diff --git a/docs/conf.py b/docs/conf.py
index 159cd3ea..ca8c0fec 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -15,6 +15,7 @@
import sys
import os
+import re
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -56,9 +57,14 @@ copyright = '2016-2017, Ethereum'
# built documents.
#
# The short X.Y version.
-version = '0.4.10'
+with open('../CMakeLists.txt', 'r') as f:
+ version = re.search('PROJECT_VERSION "([^"]+)"', f.read()).group(1)
# The full version, including alpha/beta/rc tags.
-release = '0.4.10-develop'
+if os.path.isfile('../prerelease.txt') != True or os.path.getsize('../prerelease.txt') == 0:
+ release = version
+else:
+ # This is a prerelease version
+ release = version + '-develop'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst
index 44a2d45f..42905ede 100644
--- a/docs/installing-solidity.rst
+++ b/docs/installing-solidity.rst
@@ -83,6 +83,12 @@ If you want to use the cutting edge developer version:
sudo apt-get update
sudo apt-get install solc
+Arch Linux also has packages, albeit limited to the latest development version:
+
+.. code:: bash
+
+ pacman -S solidity-git
+
Homebrew is missing pre-built bottles at the time of writing,
following a Jenkins to TravisCI migration, but Homebrew
should still work just fine as a means to build-from-source.
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index c5a0262f..cc40d6a7 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -137,31 +137,6 @@ Different types have different rules for cleaning up invalid values:
| | |will be thrown |
+---------------+---------------+-------------------+
-
-*****************
-Esoteric Features
-*****************
-
-There are some types in Solidity's type system that have no counterpart in the syntax. One of these types are the types of functions. But still, using ``var`` it is possible to have local variables of these types::
-
- contract FunctionSelector {
- function select(bool useB, uint x) returns (uint z) {
- var f = a;
- if (useB) f = b;
- return f(x);
- }
-
- function a(uint x) returns (uint z) {
- return x * x;
- }
-
- function b(uint x) returns (uint z) {
- return 2 * x;
- }
- }
-
-Calling ``select(false, x)`` will compute ``x * x`` and ``select(true, x)`` will compute ``2 * x``.
-
.. index:: optimizer, common subexpression elimination, constant propagation
*************************
diff --git a/libevmasm/EVMSchedule.h b/libevmasm/EVMSchedule.h
index f882f006..ce9003bd 100644
--- a/libevmasm/EVMSchedule.h
+++ b/libevmasm/EVMSchedule.h
@@ -47,7 +47,7 @@ struct EVMSchedule
unsigned callStipend = 2300;
unsigned callValueTransferGas = 9000;
unsigned callNewAccountGas = 25000;
- unsigned suicideRefundGas = 24000;
+ unsigned selfdestructRefundGas = 24000;
unsigned memoryGas = 3;
unsigned quadCoeffDiv = 512;
unsigned createDataGas = 200;
diff --git a/libevmasm/GasMeter.h b/libevmasm/GasMeter.h
index 0bc10f1f..8ade838a 100644
--- a/libevmasm/GasMeter.h
+++ b/libevmasm/GasMeter.h
@@ -61,7 +61,7 @@ namespace GasCosts
static unsigned const callStipend = 2300;
static unsigned const callValueTransferGas = 9000;
static unsigned const callNewAccountGas = 25000;
- static unsigned const suicideRefundGas = 24000;
+ static unsigned const selfdestructRefundGas = 24000;
static unsigned const memoryGas = 3;
static unsigned const quadCoeffDiv = 512;
static unsigned const createDataGas = 200;
diff --git a/libevmasm/Instruction.cpp b/libevmasm/Instruction.cpp
index b0f063da..f9ee9be1 100644
--- a/libevmasm/Instruction.cpp
+++ b/libevmasm/Instruction.cpp
@@ -160,7 +160,7 @@ const std::map<std::string, Instruction> dev::solidity::c_instructions =
{ "RETURN", Instruction::RETURN },
{ "DELEGATECALL", Instruction::DELEGATECALL },
{ "INVALID", Instruction::INVALID },
- { "SUICIDE", Instruction::SUICIDE }
+ { "SELFDESTRUCT", Instruction::SELFDESTRUCT }
};
static const std::map<Instruction, InstructionInfo> c_instructionInfo =
@@ -293,9 +293,9 @@ static const std::map<Instruction, InstructionInfo> c_instructionInfo =
{ Instruction::CALL, { "CALL", 0, 7, 1, true, Tier::Special } },
{ Instruction::CALLCODE, { "CALLCODE", 0, 7, 1, true, Tier::Special } },
{ Instruction::RETURN, { "RETURN", 0, 2, 0, true, Tier::Zero } },
- { Instruction::DELEGATECALL,{ "DELEGATECALL", 0, 6, 1, true, Tier::Special } },
+ { Instruction::DELEGATECALL, { "DELEGATECALL", 0, 6, 1, true, Tier::Special } },
{ Instruction::INVALID, { "INVALID", 0, 0, 0, true, Tier::Zero } },
- { Instruction::SUICIDE, { "SUICIDE", 0, 1, 0, true, Tier::Zero } }
+ { Instruction::SELFDESTRUCT, { "SELFDESTRUCT", 0, 1, 0, true, Tier::Zero } }
};
void dev::solidity::eachInstruction(
diff --git a/libevmasm/Instruction.h b/libevmasm/Instruction.h
index be71a499..7f56ad3a 100644
--- a/libevmasm/Instruction.h
+++ b/libevmasm/Instruction.h
@@ -178,7 +178,7 @@ enum class Instruction: uint8_t
DELEGATECALL, ///< like CALLCODE but keeps caller's value and sender
INVALID = 0xfe, ///< invalid instruction for expressing runtime errors (e.g., division-by-zero)
- SUICIDE = 0xff ///< halt execution and register account for later deletion
+ SELFDESTRUCT = 0xff ///< halt execution and register account for later deletion
};
/// @returns the number of PUSH Instruction _inst
diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp
index 528ce1c4..9a8341ab 100644
--- a/libevmasm/PeepholeOptimiser.cpp
+++ b/libevmasm/PeepholeOptimiser.cpp
@@ -200,7 +200,7 @@ struct UnreachableCode
it[0] != Instruction::RETURN &&
it[0] != Instruction::STOP &&
it[0] != Instruction::INVALID &&
- it[0] != Instruction::SUICIDE
+ it[0] != Instruction::SELFDESTRUCT
)
return false;
diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp
index d3ce4735..3a0843b8 100644
--- a/libevmasm/SemanticInformation.cpp
+++ b/libevmasm/SemanticInformation.cpp
@@ -116,7 +116,7 @@ bool SemanticInformation::altersControlFlow(AssemblyItem const& _item)
case Instruction::JUMP:
case Instruction::JUMPI:
case Instruction::RETURN:
- case Instruction::SUICIDE:
+ case Instruction::SELFDESTRUCT:
case Instruction::STOP:
case Instruction::INVALID:
return true;
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index b66a3e12..d74d9dd3 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -648,7 +648,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
case Location::Selfdestruct:
arguments.front()->accept(*this);
utils().convertType(*arguments.front()->annotation().type, *function.parameterTypes().front(), true);
- m_context << Instruction::SUICIDE;
+ m_context << Instruction::SELFDESTRUCT;
break;
case Location::SHA3:
{
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp
index fcc92dbb..46a2730d 100644
--- a/libsolidity/inlineasm/AsmParser.cpp
+++ b/libsolidity/inlineasm/AsmParser.cpp
@@ -152,8 +152,8 @@ std::map<string, dev::solidity::Instruction> const& Parser::instructions()
s_instructions[name] = instruction.second;
}
- // add alias for selfdestruct
- s_instructions["selfdestruct"] = solidity::Instruction::SUICIDE;
+ // add alias for suicide
+ s_instructions["suicide"] = solidity::Instruction::SELFDESTRUCT;
}
return s_instructions;
}
diff --git a/scripts/tests.sh b/scripts/tests.sh
index f2142946..ba932da5 100755
--- a/scripts/tests.sh
+++ b/scripts/tests.sh
@@ -35,7 +35,7 @@ echo "Running commandline tests..."
echo "Checking that StandardToken.sol, owned.sol and mortal.sol produce bytecode..."
output=$("$REPO_ROOT"/build/solc/solc --bin "$REPO_ROOT"/std/*.sol 2>/dev/null | grep "ffff" | wc -l)
-test "$output" = "3"
+test "${output//[[:blank:]]/}" = "3"
# This conditional is only needed because we don't have a working Homebrew
# install for `eth` at the time of writing, so we unzip the ZIP file locally
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index dd80e189..6759727f 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -200,7 +200,7 @@ void CommandLineInterface::handleBinary(string const& _contract)
if (m_args.count(g_argCloneBinary))
{
if (m_args.count(g_argOutputDir))
- createFile(_contract + ".clone_bin", m_compiler->cloneObject(_contract).toHex());
+ createFile(m_compiler->filesystemFriendlyName(_contract) + ".clone_bin", m_compiler->cloneObject(_contract).toHex());
else
{
cout << "Clone Binary: " << endl;
@@ -210,7 +210,7 @@ void CommandLineInterface::handleBinary(string const& _contract)
if (m_args.count(g_argBinaryRuntime))
{
if (m_args.count(g_argOutputDir))
- createFile(_contract + ".bin-runtime", m_compiler->runtimeObject(_contract).toHex());
+ createFile(m_compiler->filesystemFriendlyName(_contract) + ".bin-runtime", m_compiler->runtimeObject(_contract).toHex());
else
{
cout << "Binary of the runtime part: " << endl;
@@ -222,7 +222,7 @@ void CommandLineInterface::handleBinary(string const& _contract)
void CommandLineInterface::handleOpcode(string const& _contract)
{
if (m_args.count(g_argOutputDir))
- createFile(_contract + ".opcode", solidity::disassemble(m_compiler->object(_contract).bytecode));
+ createFile(m_compiler->filesystemFriendlyName(_contract) + ".opcode", solidity::disassemble(m_compiler->object(_contract).bytecode));
else
{
cout << "Opcodes: " << endl;
@@ -249,7 +249,7 @@ void CommandLineInterface::handleSignatureHashes(string const& _contract)
out += toHex(it.first.ref()) + ": " + it.second->externalSignature() + "\n";
if (m_args.count(g_argOutputDir))
- createFile(_contract + ".signatures", out);
+ createFile(m_compiler->filesystemFriendlyName(_contract) + ".signatures", out);
else
cout << "Function signatures: " << endl << out;
}
@@ -261,7 +261,7 @@ void CommandLineInterface::handleOnChainMetadata(string const& _contract)
string data = m_compiler->onChainMetadata(_contract);
if (m_args.count("output-dir"))
- createFile(_contract + "_meta.json", data);
+ createFile(m_compiler->filesystemFriendlyName(_contract) + "_meta.json", data);
else
cout << "Metadata: " << endl << data << endl;
}
@@ -302,7 +302,7 @@ void CommandLineInterface::handleMeta(DocumentationType _type, string const& _co
output = dev::jsonPrettyPrint(m_compiler->metadata(_contract, _type));
if (m_args.count(g_argOutputDir))
- createFile(_contract + suffix, output);
+ createFile(m_compiler->filesystemFriendlyName(_contract) + suffix, output);
else
{
cout << title << endl;
@@ -461,7 +461,9 @@ void CommandLineInterface::createFile(string const& _fileName, string const& _da
namespace fs = boost::filesystem;
// create directory if not existent
fs::path p(m_args.at(g_argOutputDir).as<string>());
- fs::create_directories(p);
+ // Do not try creating the directory if the first item is . or ..
+ if (p.filename() != "." && p.filename() != "..")
+ fs::create_directories(p);
string pathName = (p / _fileName).string();
ofstream outFile(pathName);
outFile << _data;
@@ -981,7 +983,7 @@ void CommandLineInterface::outputCompilationResults()
{
stringstream data;
m_compiler->streamAssembly(data, contract, m_sourceCodes, m_args.count(g_argAsmJson));
- createFile(contract + (m_args.count(g_argAsmJson) ? "_evm.json" : ".evm"), data.str());
+ createFile(m_compiler->filesystemFriendlyName(contract) + (m_args.count(g_argAsmJson) ? "_evm.json" : ".evm"), data.str());
}
else
{