Skip to content

Make nolocale-test actually disable locale - #4939

Merged
vitaut merged 1 commit into
fmtlib:mainfrom
tiagomacarios:fix-nolocale-test
Sep 11, 2026
Merged

vitaut merged 1 commit into
fmtlib:mainfrom
tiagomacarios:fix-nolocale-test

Conversation

@tiagomacarios

Copy link
Copy Markdown
Contributor

nolocale-test defines FMT_STATIC_THOUSANDS_SEPARATOR, which stopped doing anything in b90b4bc ("Remove FMT_STATIC_THOUSANDS_SEPARATOR in favor of FMT_USE_LOCALE"). That macro no longer appears anywhere under include/, so since then the target has compiled src/format.cc with locale support enabled.

It is not a dead target: the pedantic CI jobs build it (linux.yml and macos.yml both pass -DFMT_PEDANTIC=ON), and it passes. So the configuration looks covered while nothing actually tests it. #4627, a locale-off build break, landed during that window.

This defines FMT_USE_LOCALE=0 instead. Verified the target still builds clean in that configuration (MSVC 19.51, Ninja, -DFMT_PEDANTIC=ON).

Two things this deliberately does not do, happy to follow up on either:

  • It does not add chrono.h/xchar.h to the target. chrono.h includes <locale> unconditionally, and this target looks like it exists for platforms that have no <locale> at all. Instantiating the formatters in that configuration - which is what would actually have caught fix: error: invalid 'static_cast' from type 'fmt::v12::locale_ref' to type 'bool' #4627 - probably wants a separate target.
  • FMT_PEDANTIC is off in the Windows workflow, so this configuration still never builds on MSVC.

nolocale-test defines FMT_STATIC_THOUSANDS_SEPARATOR, which stopped doing
anything in b90b4bc ("Remove FMT_STATIC_THOUSANDS_SEPARATOR in favor of
FMT_USE_LOCALE"). That macro no longer appears anywhere under include/, so
since then the target has compiled src/format.cc with locale support enabled.

It is not a dead target: the pedantic CI jobs build it (linux.yml, macos.yml
both pass -DFMT_PEDANTIC=ON), and it passes. So the configuration looks
covered while nothing actually tests it. fmtlib#4627 - a locale-off build break -
landed during that window.

Define FMT_USE_LOCALE=0 instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vitaut
vitaut merged commit e5d13d8 into fmtlib:main Sep 11, 2026
47 checks passed
@vitaut

vitaut commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Nice catch, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants