[PATCH] D68472: [test] Depend on C.UTF-8 dependency for mri-utf8.test
    Hubert Tong via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Oct  4 15:28:04 PDT 2019
    
    
  
hubert.reinterpretcast added a comment.
In D68472#1695156 <https://reviews.llvm.org/D68472#1695156>, @thopre wrote:
> I believe that's because it is a builtin locale (much like the C locale). There wasn't one in /usr/share/locale on the Ubuntu docker image I've tested this but it did work while trying with en_US.UTF-8 did not.
I mean that using `"C.UTF-8"` with `setlocale` gets me a null pointer, and using `"en_US.UTF-8"` gets me a string with the following:
  #include <locale.h>
  extern int printf(const char *, ...);
  void trylocale(const char *locale) {
    const char *ret = setlocale(LC_ALL, locale);
    printf("setlocale(\"%s\") returned \"%s\".\n", locale, ret ? ret : "(null)");
  }
  int main(void) {
    trylocale("C.UTF-8");
    trylocale("en_US.UTF-8");
  }
On AIX:
  setlocale("C.UTF-8") returned "(null)".
  setlocale("en_US.UTF-8") returned "en_US.UTF-8 en_US.UTF-8 en_US.UTF-8 en_US.UTF-8 en_US.UTF-8 en_US.UTF-8".
On RHEL 7:
  setlocale("C.UTF-8") returned "(null)".
  setlocale("en_US.UTF-8") returned "en_US.UTF-8".
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68472/new/
https://reviews.llvm.org/D68472
    
    
More information about the llvm-commits
mailing list