Skip to content

fix(pj_base): portable float parsing for libc++ (no std::from_chars)#99

Open
facontidavide wants to merge 3 commits into
mainfrom
fix/settings-from-chars-float
Open

fix(pj_base): portable float parsing for libc++ (no std::from_chars)#99
facontidavide wants to merge 3 commits into
mainfrom
fix/settings-from-chars-float

Conversation

@facontidavide
Copy link
Copy Markdown
Contributor

@facontidavide facontidavide commented May 27, 2026

Summary

SettingsValue::toDouble() instantiated std::from_chars<double> — a deleted overload in Apple Clang's libc++ — which broke the macOS build of plotjuggler_core 0.4.1 (pj_base/sdk/plugin_data_api.hpp, call to deleted function 'from_chars'). This surfaced downstream when pj-official-plugins PR #90 bumped to core 0.4.1 and macOS CI went red; core's own CI never caught it because there was no macOS workflow.

Per maintainer feedback on this PR, CLA automation/docs added earlier in the branch were also removed from this PR.

Changes

  • pj_base/number_parse.hpp (new) — reusable PJ::parseNumber<T>(std::string_view) -> std::optional<T>. Parses the entire string (nullopt on empty / trailing garbage / overflow). Integral T uses std::from_chars; floating-point T routes through std::strto* (the libc++-portable path). Placed in namespace PJ and auto-installed via the existing install(DIRECTORY include/), so plugins and PJ4 can reuse the same parse.
  • SettingsValue::toInt/toDouble now call parseNumber; the private parse<T> is removed.
  • .github/workflows/macos-ci.yml (new)macos-15-intel, conan + ninja, builds with with_tests=True and runs ctest. Closes the macOS coverage gap.
  • .github/workflows/pre-commit.yml (new) — runs the existing .pre-commit-config.yaml (clang-format, etc.) on PRs.
  • Removed CLA artifacts from this PR — deleted .github/workflows/cla.yml and CLA.md so CLA is not part of this change set.

Testing

  • Linux GCC 15.2, -Werror: builds clean (0 errors), plugin_data_api_test + settings_store_host_test pass.
  • pre-commit run passes on all changed files.
  • The macOS/libc++ path is validated by the new macos-ci.yml on this PR.

Follow-up

A patch release (e.g. 0.4.2) carrying this fix is needed before pj-official-plugins #90 can go green on macOS.

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

Thank you for your contribution. Before we can merge it, please sign the Contributor License Agreement by posting a comment on this pull request with exactly the text below:


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@facontidavide facontidavide force-pushed the fix/settings-from-chars-float branch from 0891eb1 to 8801a36 Compare May 27, 2026 17:59
SettingsValue::toDouble instantiated std::from_chars<double>, a deleted
overload in Apple Clang's libc++, which broke the macOS build of 0.4.1.

Extract a reusable PJ::parseNumber<T> helper (pj_base/number_parse.hpp)
that routes floating-point through std::strto* while keeping integers on
std::from_chars, and have SettingsValue use it so plugins and PJ4 can
reuse the same portable parse.

Also add macOS and pre-commit CI workflows: core had Linux and Windows
coverage but no macOS, which is why the libc++ break shipped unnoticed.
@facontidavide
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@facontidavide facontidavide force-pushed the fix/settings-from-chars-float branch from 8801a36 to 5b29467 Compare May 27, 2026 18:08
@facontidavide
Copy link
Copy Markdown
Contributor Author

@copilot remove the CLA COMPLETELY from workflow and project in general, in this PR

Copy link
Copy Markdown

Copilot AI commented May 27, 2026

@copilot remove the CLA COMPLETELY from workflow and project in general, in this PR

Done in commit 6ba75af: removed .github/workflows/cla.yml and CLA.md, so CLA has been removed from this PR.

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