Skip to content

Commit 9dc26af

Browse files
wechmanwechman
authored andcommitted
Use "C" instead user environment locale in solc
1 parent 2696377 commit 9dc26af

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

Changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Compiler Features:
1111

1212
Bugfixes:
1313
* 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(...)``.
14-
14+
* Fix internal error for locales with unusual capitalization rules. Locale set in the environment is now completely ignored.
1515

1616
### 0.8.12 (2022-02-16)
1717

solc/main.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,40 +27,16 @@
2727

2828
#include <boost/exception/all.hpp>
2929

30-
#include <clocale>
3130
#include <iostream>
3231

3332
using namespace std;
3433
using namespace solidity;
3534

36-
/*
37-
The equivalent of setlocale(LC_ALL, "C") is called before any user code is run.
38-
If the user has an invalid environment setting then it is possible for the call
39-
to set locale to fail, so there are only two possible actions, the first is to
40-
throw a runtime exception and cause the program to quit (default behaviour),
41-
or the second is to modify the environment to something sensible (least
42-
surprising behaviour).
43-
44-
The follow code produces the least surprising behaviour. It will use the user
45-
specified default locale if it is valid, and if not then it will modify the
46-
environment the process is running in to use a sensible default. This also means
47-
that users do not need to install language packs for their OS.
48-
*/
49-
static void setDefaultOrCLocale()
50-
{
51-
#if __unix__
52-
if (!std::setlocale(LC_ALL, ""))
53-
{
54-
setenv("LC_ALL", "C", 1);
55-
}
56-
#endif
57-
}
5835

5936
int main(int argc, char** argv)
6037
{
6138
try
6239
{
63-
setDefaultOrCLocale();
6440
solidity::frontend::CommandLineInterface cli(cin, cout, cerr);
6541
return cli.run(argc, argv) ? 0 : 1;
6642
}

0 commit comments

Comments
 (0)