Skip to content

Add a way to optionally suppress usage of std::source_location#295

Merged
ToruNiina merged 1 commit into
ToruNiina:mainfrom
franzpoeschel:undef-source-location
Dec 3, 2025
Merged

Add a way to optionally suppress usage of std::source_location#295
ToruNiina merged 1 commit into
ToruNiina:mainfrom
franzpoeschel:undef-source-location

Conversation

@franzpoeschel

Copy link
Copy Markdown
Contributor

The integrated checks for availability of std::source_location seem to not work correctly for Clang++ 11-13, compare this output from our failing CI:

[ 42%] Building CXX object CMakeFiles/picongpu-hostonly.dir/plugins/openPMD/toml.cpp.o
In file included from /builds/hzdr/crp/picongpu/include/picongpu/plugins/openPMD/toml.cpp:38:
In file included from /builds/hzdr/crp/picongpu/thirdParty/toml11/include/toml.hpp:29:
/builds/hzdr/crp/picongpu/thirdParty/toml11/include/toml11/compat.hpp:494:30: error: no type named 'source_location' in namespace 'std'
using source_location = std::source_location;

This PR adds a way to suppress usage of std::source_location:

#define TOML11_DISABLE_SOURCE_LOCATION
#include <toml.hpp>

@franzpoeschel franzpoeschel changed the title Add a define to optionally suppress usage of std::source_location Add a way to optionally suppress usage of std::source_location Jun 17, 2025
@franzpoeschel

Copy link
Copy Markdown
Contributor Author

@ToruNiina Could you have a look at this PR, please? This is currently blocking us from upgrading to the recent version of toml11.
I think that the failing CI run is unrelated to this, as the PR only adds an additional macro check.

@ax3l

ax3l commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

Hi @ToruNiina, if you have a chance, could we please merge this to ensure one turn off the std::source_location usage?

In some C++20 compilers, this feature is still flaky and we would like to turn it off selectively when needed 🙏

@ToruNiina ToruNiina merged commit b96acf9 into ToruNiina:main Dec 3, 2025
266 of 278 checks passed
github-actions Bot pushed a commit that referenced this pull request Dec 3, 2025
Add a way to optionally suppress usage of std::source_location b96acf9
@ToruNiina

Copy link
Copy Markdown
Owner

Yesterday I triggered CI for the branch that applied these changes to the latest main branch(https://github.com/ToruNiina/toml11/tree/rerun-295). And it passed. The changes itself also looks good to me, so I'll merge it. Sorry for the delay!

@ax3l

ax3l commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Thank you @ToruNiina!

We are trying to transition a few more projects to C++20 and this patch would help to deal with older clang compilers (like v13.0).

Do you think you could include this in a 4.5.0 release of toml11? 🙏

@ax3l ax3l mentioned this pull request Feb 24, 2026
3 tasks
@ax3l

ax3l commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Hi @ToruNiina,

Can you potentially draft a new release for TOML11 with fixes like those? 🙏

ax3l added a commit to BLAST-WarpX/warpx that referenced this pull request Apr 24, 2026
Switch to C++20. AMReX is making the switch soon
(AMReX-Codes/amrex#4840) and is preparing CI
in AMReX-Codes/amrex#4976 so we can also
generally pull up the requirements.

- [x] wait for 26.03 release
- [x] patch [toml11](ToruNiina/toml11#295) / use
clang 14+ (for CI, we can do
openPMD/openPMD-api#1874 )
- [x] merge for the 26.05 release cycle

---------

Co-authored-by: Weiqun Zhang <weiqunzhang@lbl.gov>
Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
Co-authored-by: Luca Fedeli <luca.fedeli@cea.fr>
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.

3 participants