mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use "C" instead user environment locale in solc
This commit is contained in:
parent
26963775fe
commit
9dc26af829
@ -11,7 +11,7 @@ Compiler Features:
|
|||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Yul IR Code Generation: Optimize embedded creation code with correct settings. This fixes potential mismatches between the constructor code of a contract compiled in isolation and the bytecode in ``type(C).creationCode``, resp. the bytecode used for ``new C(...)``.
|
* Yul IR Code Generation: Optimize embedded creation code with correct settings. This fixes potential mismatches between the constructor code of a contract compiled in isolation and the bytecode in ``type(C).creationCode``, resp. the bytecode used for ``new C(...)``.
|
||||||
|
* Fix internal error for locales with unusual capitalization rules. Locale set in the environment is now completely ignored.
|
||||||
|
|
||||||
### 0.8.12 (2022-02-16)
|
### 0.8.12 (2022-02-16)
|
||||||
|
|
||||||
|
@ -27,40 +27,16 @@
|
|||||||
|
|
||||||
#include <boost/exception/all.hpp>
|
#include <boost/exception/all.hpp>
|
||||||
|
|
||||||
#include <clocale>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace solidity;
|
using namespace solidity;
|
||||||
|
|
||||||
/*
|
|
||||||
The equivalent of setlocale(LC_ALL, "C") is called before any user code is run.
|
|
||||||
If the user has an invalid environment setting then it is possible for the call
|
|
||||||
to set locale to fail, so there are only two possible actions, the first is to
|
|
||||||
throw a runtime exception and cause the program to quit (default behaviour),
|
|
||||||
or the second is to modify the environment to something sensible (least
|
|
||||||
surprising behaviour).
|
|
||||||
|
|
||||||
The follow code produces the least surprising behaviour. It will use the user
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
static void setDefaultOrCLocale()
|
|
||||||
{
|
|
||||||
#if __unix__
|
|
||||||
if (!std::setlocale(LC_ALL, ""))
|
|
||||||
{
|
|
||||||
setenv("LC_ALL", "C", 1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
setDefaultOrCLocale();
|
|
||||||
solidity::frontend::CommandLineInterface cli(cin, cout, cerr);
|
solidity::frontend::CommandLineInterface cli(cin, cout, cerr);
|
||||||
return cli.run(argc, argv) ? 0 : 1;
|
return cli.run(argc, argv) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user