aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-29 08:01:47 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-29 18:09:18 +0800
commit7fb4a64136af18f2b61aef71ecc33ccbbc790ec6 (patch)
treec44271af2ca3c9a4461a297ba608f1a75910f09b
parentb364bd048ffaf233782a23dabd13622431a75aa3 (diff)
downloaddexon-solidity-7fb4a64136af18f2b61aef71ecc33ccbbc790ec6.tar
dexon-solidity-7fb4a64136af18f2b61aef71ecc33ccbbc790ec6.tar.gz
dexon-solidity-7fb4a64136af18f2b61aef71ecc33ccbbc790ec6.tar.bz2
dexon-solidity-7fb4a64136af18f2b61aef71ecc33ccbbc790ec6.tar.lz
dexon-solidity-7fb4a64136af18f2b61aef71ecc33ccbbc790ec6.tar.xz
dexon-solidity-7fb4a64136af18f2b61aef71ecc33ccbbc790ec6.tar.zst
dexon-solidity-7fb4a64136af18f2b61aef71ecc33ccbbc790ec6.zip
Move all file specific globals to anonymous namespace
-rw-r--r--libdevcore/CommonIO.cpp5
-rw-r--r--libdevcore/SwarmHash.cpp4
-rw-r--r--libevmasm/PeepholeOptimiser.cpp5
-rw-r--r--libsolidity/ast/Types.cpp5
-rw-r--r--libsolidity/codegen/ContractCompiler.cpp5
-rw-r--r--lllc/main.cpp6
-rw-r--r--test/ExecutionFramework.cpp6
-rw-r--r--test/fuzzer.cpp5
8 files changed, 36 insertions, 5 deletions
diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp
index 52829455..5d47937b 100644
--- a/libdevcore/CommonIO.cpp
+++ b/libdevcore/CommonIO.cpp
@@ -35,6 +35,9 @@
using namespace std;
using namespace dev;
+namespace
+{
+
template <typename _T>
inline _T contentsGeneric(std::string const& _file)
{
@@ -56,6 +59,8 @@ inline _T contentsGeneric(std::string const& _file)
return ret;
}
+}
+
string dev::contentsString(string const& _file)
{
return contentsGeneric<string>(_file);
diff --git a/libdevcore/SwarmHash.cpp b/libdevcore/SwarmHash.cpp
index 78188668..1c718200 100644
--- a/libdevcore/SwarmHash.cpp
+++ b/libdevcore/SwarmHash.cpp
@@ -24,6 +24,8 @@
using namespace std;
using namespace dev;
+namespace
+{
bytes toLittleEndian(size_t _size)
{
@@ -59,6 +61,8 @@ h256 swarmHashIntermediate(string const& _input, size_t _offset, size_t _length)
return swarmHashSimple(ref, _length);
}
+}
+
h256 dev::swarmHash(string const& _input)
{
return swarmHashIntermediate(_input, 0, _input.size());
diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp
index e94a8ba4..31fdd317 100644
--- a/libevmasm/PeepholeOptimiser.cpp
+++ b/libevmasm/PeepholeOptimiser.cpp
@@ -30,6 +30,9 @@ using namespace dev;
// TODO: Extend this to use the tools from ExpressionClasses.cpp
+namespace
+{
+
struct OptimiserState
{
AssemblyItems const& items;
@@ -246,6 +249,8 @@ void applyMethods(OptimiserState& _state, Method, OtherMethods... _other)
applyMethods(_state, _other...);
}
+}
+
bool PeepholeOptimiser::optimise()
{
OptimiserState state {m_items, 0, std::back_inserter(m_optimisedItems)};
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index 65b09840..15475034 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -304,6 +304,9 @@ MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition
return members;
}
+namespace
+{
+
bool isValidShiftAndAmountType(Token::Value _operator, Type const& _shiftAmountType)
{
// Disable >>> here.
@@ -317,6 +320,8 @@ bool isValidShiftAndAmountType(Token::Value _operator, Type const& _shiftAmountT
return false;
}
+}
+
IntegerType::IntegerType(int _bits, IntegerType::Modifier _modifier):
m_bits(_bits), m_modifier(_modifier)
{
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp
index e53f1b94..24d3d959 100644
--- a/libsolidity/codegen/ContractCompiler.cpp
+++ b/libsolidity/codegen/ContractCompiler.cpp
@@ -39,6 +39,9 @@ using namespace std;
using namespace dev;
using namespace dev::solidity;
+namespace
+{
+
/**
* Simple helper class to ensure that the stack height is the same at certain places in the code.
*/
@@ -53,6 +56,8 @@ private:
unsigned stackHeight;
};
+}
+
void ContractCompiler::compileContract(
ContractDefinition const& _contract,
std::map<const ContractDefinition*, eth::Assembly const*> const& _contracts
diff --git a/lllc/main.cpp b/lllc/main.cpp
index adf181c7..06a0fc81 100644
--- a/lllc/main.cpp
+++ b/lllc/main.cpp
@@ -39,7 +39,7 @@ static string const VersionString =
(string(SOL_VERSION_PRERELEASE).empty() ? "" : "-" + string(SOL_VERSION_PRERELEASE)) +
(string(SOL_VERSION_BUILDINFO).empty() ? "" : "+" + string(SOL_VERSION_BUILDINFO));
-void help()
+static void help()
{
cout
<< "Usage lllc [OPTIONS] <file>" << endl
@@ -54,7 +54,7 @@ void help()
exit(0);
}
-void version()
+static void version()
{
cout << "LLLC, the Lovely Little Language Compiler " << endl;
cout << "Version: " << VersionString << endl;
@@ -74,7 +74,7 @@ specified default locale if it is valid, and if not then it will modify the
environment the process is running in to use a sensible default. This also means
that users do not need to install language packs for their OS.
*/
-void setDefaultOrCLocale()
+static void setDefaultOrCLocale()
{
#if __unix__
if (!std::setlocale(LC_ALL, ""))
diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp
index f4e5fcef..b2de814a 100644
--- a/test/ExecutionFramework.cpp
+++ b/test/ExecutionFramework.cpp
@@ -31,8 +31,8 @@ using namespace dev::test;
namespace // anonymous
{
- h256 const EmptyTrie("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421");
-}
+
+h256 const EmptyTrie("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421");
string getIPCSocketPath()
{
@@ -43,6 +43,8 @@ string getIPCSocketPath()
return ipcPath;
}
+}
+
ExecutionFramework::ExecutionFramework() :
m_rpc(RPCSession::instance(getIPCSocketPath())),
m_optimize(dev::test::Options::get().optimize),
diff --git a/test/fuzzer.cpp b/test/fuzzer.cpp
index cf99755f..c3a321f7 100644
--- a/test/fuzzer.cpp
+++ b/test/fuzzer.cpp
@@ -40,6 +40,9 @@ typedef void (*CStyleReadFileCallback)(char const* _path, char** o_contents, cha
extern char const* compileStandard(char const* _input, CStyleReadFileCallback _readCallback);
}
+namespace
+{
+
bool quiet = false;
string contains(string const& _haystack, vector<string> const& _needles)
@@ -169,6 +172,8 @@ void testCompiler()
}
}
+}
+
int main(int argc, char** argv)
{
po::options_description options(