diff options
author | Christopher Gilbert <christopher.john.gilbert@gmail.com> | 2016-08-30 19:29:37 +0800 |
---|---|---|
committer | Christopher Gilbert <christopher.john.gilbert@gmail.com> | 2016-08-30 19:29:37 +0800 |
commit | 1b9147d7db08a94dd00532bc611ac322c8ed3e57 (patch) | |
tree | 80b4c89b5c0b7aed52e994d43d6d471ed926fa72 /lllc | |
parent | 29b8965b9541e75905bb688954649ee7b0b0fefc (diff) | |
download | dexon-solidity-1b9147d7db08a94dd00532bc611ac322c8ed3e57.tar.gz dexon-solidity-1b9147d7db08a94dd00532bc611ac322c8ed3e57.tar.zst dexon-solidity-1b9147d7db08a94dd00532bc611ac322c8ed3e57.zip |
Fixed a bug causing solc to crash on startup due to invalid environment settings for locale
Diffstat (limited to 'lllc')
-rw-r--r-- | lllc/main.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lllc/main.cpp b/lllc/main.cpp index a4c92d67..46416365 100644 --- a/lllc/main.cpp +++ b/lllc/main.cpp @@ -22,6 +22,7 @@ #include <fstream> #include <iostream> +#include <clocale> #include <liblll/Compiler.h> #include <libdevcore/CommonIO.h> #include <libdevcore/CommonData.h> @@ -52,10 +53,20 @@ void version() exit(0); } +void setEnv() { + std::setlocale(LC_ALL, "C"); +#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) + if (!std::setlocale(LC_ALL, "")) { + setenv("LC_ALL", "C", 1); + } +#endif +} + enum Mode { Binary, Hex, Assembly, ParseTree, Disassemble }; int main(int argc, char** argv) { + setEnv(); unsigned optimise = 1; string infile; Mode mode = Hex; |