[libcxx-commits] [PATCH] D128600: [libc++][mingw] Remove setlocale from snprintf_l

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 26 13:45:35 PDT 2022


mstorsjo added a comment.

In D128600#3610680 <https://reviews.llvm.org/D128600#3610680>, @alvinhochun wrote:

> `long double` is an issue though...

Yup, `long double` on x86 is a tricky thing. In the CI configuration, we build with `-DLIBCXX_EXTRA_SITE_DEFINES="__USE_MINGW_ANSI_STDIO=1"`, which makes sure that both the library is built with this define, and the define is set whenever any user of the library includes libc++ headers (I think libstdc++ does the same, where including libstdc++ also enables the same for your code).

(This isn't the configuration I built it for llvm-mingw releases though, but maybe I should.)

So for this case, one (messy) possible way forward could be to use the modern locale APIs if `__USE_MINGW_ANSI_STDIO` isn't set (or is 0) which would help for the actual llvm-mingw releases for now, while using the slow approach when x86 `long double`s are needed. (That codepath wouldn't be covered by CI unfortunately then, though.)

I guess the more complete/proper way forward would make a mingw-w64 specific implementation of these (or some similar) functions too, if `__USE_MINGW_ANSI_STDIO` is set to 1. (No idea offhand how hard that would be though...)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128600



More information about the libcxx-commits mailing list