jankratochvil marked an inline comment as done.
jankratochvil added inline comments.
================
Comment at: lldb/tools/driver/Driver.cpp:871
int main(int argc, char const *argv[]) {
+ ::setlocale(LC_ALL, "");
+ ::setlocale(LC_CTYPE, "");
----------------
teemperor wrote:
> Can you make this `std::setlocale`?
OK, I see <clocale> is for `std::setlocale`.
================
Comment at: lldb/tools/driver/Driver.cpp:872
+ ::setlocale(LC_ALL, "");
+ ::setlocale(LC_CTYPE, "");
+
----------------
teemperor wrote:
> I don't think we need this if we set `LC_ALL`?
Originally I have just copy-pasted it. But when testing it more now I think it
makes some sense:
```
#include <locale.h>
#include <stdio.h>
#include <wctype.h>
int main(void) {
printf("setlocale(LC_ALL )=%s\n",setlocale(LC_ALL ,""));
printf("iswprint(0x17e)=%d\n",iswprint(0x17e));
printf("setlocale(LC_CTYPE):%s\n",setlocale(LC_CTYPE,""));
printf("iswprint(0x17e)=%d\n",iswprint(0x17e));
return 0;
}
$ LANG=C LC_NAME=foobar LC_CTYPE=en_US.UTF-8 ./setlocale
setlocale(LC_ALL )=(null)
iswprint(0x17e)=0
setlocale(LC_CTYPE):en_US.UTF-8
iswprint(0x17e)=1
```
Because: [[
https://pubs.opengroup.org/onlinepubs/009695399/functions/setlocale.html |
Setting all of the categories of the locale of the process is similar to
successively setting each individual category of the locale of the process,
except that all error checking is done before any actions are performed. ]]
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105779/new/
https://reviews.llvm.org/D105779
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits