Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Trim <functional>, <sstream>, and unused <map> from thin wrapper and validator headers - #135

Open
clockblocker wants to merge 1 commit into
mainfrom
trim-thin-header-includes
Open

clockblocker wants to merge 1 commit into
mainfrom
trim-thin-header-includes

Conversation

@clockblocker

@clockblocker clockblocker commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Removes unnecessary <functional>, <sstream>, and <map> includes from the thin wrapper and validator headers. Zero public API changes; validation error messages remain identical.

Key details

  • Drop <functional> from internal/cpp20/Result.hpp, Validator.hpp, and Literal.hpp (avoids pulling <unordered_map> on libstdc++). Result::transform_error calls f directly instead of via std::invoke (matching its existing static_assert), and std::hash specializations rely on the declarations already provided by <string>/<memory>/<variant>/<vector> (matching Ref.hpp/Box.hpp).
  • Drop <sstream> from comparisons.hpp, AnyOf.hpp, OneOf.hpp, and PatternValidator.hpp in favor of std::string/std::to_string, using std::snprintf("%g" / "%Lg") for floats in comparisons.hpp so floating-point formatting matches std::stringstream.
  • Drop unused <map> from Size.hpp.

Compile-time impact (-fsyntax-only, C++20)

Header g++-16 (libstdc++) AppleClang 17 (libc++)
rfl/Result.hpp 314 → 288 ms (-7.9k lines) 360 → 336 ms (-6.2k lines)
rfl/Validator.hpp + rfl/comparisons.hpp 342 → 301 ms (-11.2k lines) 426 → 358 ms (-15.3k lines)
rfl/Size.hpp 339 → 299 ms (-12.6k lines) 374 → 344 ms (-9.8k lines)

AI auhtored

clockblocker added a commit that referenced this pull request Nov 28, 2026
…#120)

Stacked cleanly on wave4/error-kind (4A) and Wave 1A (#135).

Polish from audit #16:
- Preserve Wave 1A <sstream> elimination across PatternValidator.hpp,
  comparisons.hpp, AnyOf.hpp, OneOf.hpp, and internal/cpp20/Result.hpp.
- Move builtin_error_code_str, parse_builtin_error_code, compose_size_code,
  and compose_code_points_code out-of-line into src/rfl/internal/Error.cpp
  (wired into src/reflectcpp.cpp with RFL_API declarations in Error.hpp) to
  trim Error.hpp compile-time weight.
- Fix P0 missing catch (...) in MapReader.hpp (both validator and non-validator
  key paths) and harden Validator.hpp and AllOf.hpp noexcept boundaries with
  const std::exception& and catch (...).
- Guard constant nullptr V::code in validator_code.hpp with if constexpr to
  avoid GCC 13 -Werror=nonnull.
- Add ASan+UBSan unit test coverage for non-std::exception throws in
  Validator, AllOf, and MapReader.
clockblocker added a commit that referenced this pull request Nov 29, 2026
…#120)

Stacked cleanly on wave4/error-kind (4A) and Wave 1A (#135).

Polish from audit #16:
- Preserve Wave 1A <sstream> elimination across PatternValidator.hpp,
  comparisons.hpp, AnyOf.hpp, OneOf.hpp, and internal/cpp20/Result.hpp.
- Move builtin_error_code_str, parse_builtin_error_code, compose_size_code,
  and compose_code_points_code out-of-line into src/rfl/internal/Error.cpp
  (wired into src/reflectcpp.cpp with RFL_API declarations in Error.hpp) to
  trim Error.hpp compile-time weight.
- Fix P0 missing catch (...) in MapReader.hpp (both validator and non-validator
  key paths) and harden Validator.hpp and AllOf.hpp noexcept boundaries with
  const std::exception& and catch (...).
- Guard constant nullptr V::code in validator_code.hpp with if constexpr to
  avoid GCC 13 -Werror=nonnull.
- Add ASan+UBSan unit test coverage for non-std::exception throws in
  Validator, AllOf, and MapReader.
clockblocker added a commit that referenced this pull request Nov 29, 2026
…#120)

Stacked cleanly on wave4/error-kind (4A) and Wave 1A (#135).

Polish from audit #16:
- Preserve Wave 1A <sstream> elimination across PatternValidator.hpp,
  comparisons.hpp, AnyOf.hpp, OneOf.hpp, and internal/cpp20/Result.hpp.
- Move builtin_error_code_str, parse_builtin_error_code, compose_size_code,
  and compose_code_points_code out-of-line into src/rfl/internal/Error.cpp
  (wired into src/reflectcpp.cpp with RFL_API declarations in Error.hpp) to
  trim Error.hpp compile-time weight.
- Fix P0 missing catch (...) in MapReader.hpp (both validator and non-validator
  key paths) and harden Validator.hpp and AllOf.hpp noexcept boundaries with
  const std::exception& and catch (...).
- Guard constant nullptr V::code in validator_code.hpp with if constexpr to
  avoid GCC 13 -Werror=nonnull.
- Add ASan+UBSan unit test coverage for non-std::exception throws in
  Validator, AllOf, and MapReader.
clockblocker added a commit that referenced this pull request Nov 29, 2026
…#120)

Stacked cleanly on wave4/error-kind (4A) and Wave 1A (#135).

Polish from audit #16:
- Preserve Wave 1A <sstream> elimination across PatternValidator.hpp,
  comparisons.hpp, AnyOf.hpp, OneOf.hpp, and internal/cpp20/Result.hpp.
- Move builtin_error_code_str, parse_builtin_error_code, compose_size_code,
  and compose_code_points_code out-of-line into src/rfl/internal/Error.cpp
  (wired into src/reflectcpp.cpp with RFL_API declarations in Error.hpp) to
  trim Error.hpp compile-time weight.
- Fix P0 missing catch (...) in MapReader.hpp (both validator and non-validator
  key paths) and harden Validator.hpp and AllOf.hpp noexcept boundaries with
  const std::exception& and catch (...).
- Guard constant nullptr V::code in validator_code.hpp with if constexpr to
  avoid GCC 13 -Werror=nonnull.
- Add ASan+UBSan unit test coverage for non-std::exception throws in
  Validator, AllOf, and MapReader.
clockblocker added a commit that referenced this pull request Nov 29, 2026
…#120)

Stacked cleanly on wave4/error-kind (4A) and Wave 1A (#135).

Polish from audit #16:
- Preserve Wave 1A <sstream> elimination across PatternValidator.hpp,
  comparisons.hpp, AnyOf.hpp, OneOf.hpp, and internal/cpp20/Result.hpp.
- Move builtin_error_code_str, parse_builtin_error_code, compose_size_code,
  and compose_code_points_code out-of-line into src/rfl/internal/Error.cpp
  (wired into src/reflectcpp.cpp with RFL_API declarations in Error.hpp) to
  trim Error.hpp compile-time weight.
- Fix P0 missing catch (...) in MapReader.hpp (both validator and non-validator
  key paths) and harden Validator.hpp and AllOf.hpp noexcept boundaries with
  const std::exception& and catch (...).
- Guard constant nullptr V::code in validator_code.hpp with if constexpr to
  avoid GCC 13 -Werror=nonnull.
- Add ASan+UBSan unit test coverage for non-std::exception throws in
  Validator, AllOf, and MapReader.
clockblocker added a commit that referenced this pull request Nov 29, 2026
…#120)

Stacked cleanly on wave4/error-kind (4A) and Wave 1A (#135).

Polish from audit #16:
- Preserve Wave 1A <sstream> elimination across PatternValidator.hpp,
  comparisons.hpp, AnyOf.hpp, OneOf.hpp, and internal/cpp20/Result.hpp.
- Move builtin_error_code_str, parse_builtin_error_code, compose_size_code,
  and compose_code_points_code out-of-line into src/rfl/internal/Error.cpp
  (wired into src/reflectcpp.cpp with RFL_API declarations in Error.hpp) to
  trim Error.hpp compile-time weight.
- Fix P0 missing catch (...) in MapReader.hpp (both validator and non-validator
  key paths) and harden Validator.hpp and AllOf.hpp noexcept boundaries with
  const std::exception& and catch (...).
- Guard constant nullptr V::code in validator_code.hpp with if constexpr to
  avoid GCC 13 -Werror=nonnull.
- Add ASan+UBSan unit test coverage for non-std::exception throws in
  Validator, AllOf, and MapReader.
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.

1 participant