Skip to content

Conversation

@No0ne558
Copy link
Contributor

@No0ne558 No0ne558 commented Jan 2, 2026

This PR completes the C++23 modernization of ViewTouch and fixes a critical page inheritance bug introduced during refactoring.

Summary

  • Complete C++23 Modernization: Converted all ~450+ snprintf/sprintf calls to std::format
  • 🐛 Page Inheritance Fix: Restored parent page zone inheritance functionality
  • 🔧 CI Updates: Updated CI workflow to use C++23 with GCC 14+
  • 🛡️ Compiler Compatibility: Added feature detection for C++20/C++23 stdlib features

Changes

1. Complete C++23 Modernization (commit 9bc5f9c)

  • Converted ~450+ snprintf/sprintf calls to C++23 std::format using format_to_buffer()
  • Added cpp23_utils.hh library with format_to_buffer, to_underlying, Result<T>
  • Modernized 60+ files across main, zone, src, term, loader, cdu
  • Benefits: type safety, memory safety, readability, maintainability, zero runtime overhead
  • All builds passing with 0 errors

2. Page Inheritance Fix (commit a1de375)

  • Removed erroneous default: case in Page::Init() switch statement that forced parent_id = 0 for unhandled page types
  • Restores inheritance for PAGE_SYSTEM, PAGE_TEMPLATE, PAGE_CHECKS, PAGE_KITCHEN_VID, PAGE_KITCHEN_VID2, PAGE_BAR1, PAGE_BAR2
  • Matches master branch behavior where unhandled types retain initialized parent_id
  • Fixes: Pages not showing inherited zones from parent pages

3. Compiler Compatibility (commit e425f05)

  • Add __has_include detection for <format> and <expected> headers
  • Provide fallback for std::to_underlying() using static_cast
  • Conditionally compile std::expected types when available
  • Add compile-time warning if std::format unavailable

4. CI Workflow Updates (commits 4df8de1, 50986cb, da44a86)

  • Changed CI from C++20 to C++23 standard
  • Restricted CI testing to GCC 14+ (only compiler with full C++23 stdlib support)
  • Older compilers (GCC 12-13, Clang 16-18) lack std::format in libstdc++ even with -std=c++23
  • Documents minimum compiler requirements in workflow

Testing

  • ✅ Local builds passing (GCC 14.2.0, C++23)
  • ✅ CI builds configured for GCC 14+ with C++23
  • ✅ Page inheritance verified working correctly
  • ✅ All 60+ modernized files compile successfully

Requirements

  • C++23 compiler and standard library with std::format support
  • GCC 14+ or equivalent (GCC 13 and Clang 18 lack complete C++23 stdlib)

Files Modified

  • Core: cpp23_utils.hh (new), zone.cc
  • Main: 31+ files in business/, data/, hardware/, ui/
  • Zone: 18 zone implementation files
  • CI: linux-simple-builds.yml
  • Docs: changelog.md

…std::format

- Converted ~450+ snprintf/sprintf calls to C++23 std::format using format_to_buffer()
- Added src/utils/cpp23_utils.hh library with format_to_buffer, to_underlying, Result<T>
- Modernized 60+ files across main/, zone/, src/, term/, loader/, cdu/
- Benefits: type safety, memory safety, readability, maintainability, zero overhead
- All builds passing with 0 errors

Known Issues:
- Some child pages not inheriting parent page buttons correctly
- Requires further investigation in page hierarchy handling
- Removed erroneous default case that forced parent_id = 0 for unhandled page types
- Restores inheritance for PAGE_SYSTEM, PAGE_TEMPLATE, PAGE_CHECKS, PAGE_KITCHEN_VID, PAGE_KITCHEN_VID2, PAGE_BAR1, PAGE_BAR2
- Matches master branch behavior where unhandled types retain initialized parent_id
- Fixes pages not showing inherited zones from parent pages
- Add __has_include detection for <format> and <expected> headers
- Provide fallback for std::to_underlying() using static_cast
- Conditionally compile std::expected types when available
- Add compile-time error if std::format unavailable
- Fixes Clang 18 build failures in CI (requires C++20+ stdlib with std::format)
- Change std: [20] to std: [23] in linux-simple-builds.yml
- Required due to C++23 modernization using std::format extensively
- Matches CMakeLists.txt default standard and local development
- Only test with g++-14 which has full C++23 stdlib (std::format, etc.)
- Older compilers lack std::format even with -std=c++23 flag
- Change #error to #warning for better diagnostics when std::format missing
- Documents minimum compiler requirements in workflow comments
- Keep only g++-14 in the include section
- Previous commit only removed from matrix but include re-added them
- Now truly restricts CI to GCC 14+ only
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