teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!



================
Comment at: lldb/tools/driver/Driver.cpp:872
+  ::setlocale(LC_ALL, "");
+  ::setlocale(LC_CTYPE, "");
+
----------------
jankratochvil wrote:
> 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. ]]
Good point, didn't think of that case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105779/new/

https://reviews.llvm.org/D105779

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to