Skip to content

Move #ifdef OSRM_HAS_STD_FORMAT from call sites into format.hpp#7371

Merged
DennisOSRM merged 2 commits intocopilot/replace-boost-format-with-libfmtfrom
copilot/move-ifdef-to-format-header
Feb 19, 2026
Merged

Move #ifdef OSRM_HAS_STD_FORMAT from call sites into format.hpp#7371
DennisOSRM merged 2 commits intocopilot/replace-boost-format-with-libfmtfrom
copilot/move-ifdef-to-format-header

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 19, 2026

Call sites in utils.hpp and table_service.cpp had duplicated #ifdef OSRM_HAS_STD_FORMAT guards to select between runtime_format (std) and runtime (fmt). The compatibility abstraction should live entirely in format.hpp.

Changes

  • include/util/format.hpp — Add runtime_format to the fmt fallback branch, wrapping fmt::runtime, so both branches expose a uniform runtime_format interface:

    // Before: only in OSRM_HAS_STD_FORMAT branch
    // After: also in fmt fallback branch
    inline auto runtime_format(std::string_view s) { return fmt::runtime(s); }
  • include/server/service/utils.hpp / src/server/service/table_service.cpp — Remove #ifdef OSRM_HAS_STD_FORMAT guards at call sites; both now unconditionally call osrm::util::compat::runtime_format(msg_template).

Original prompt

Pull Request: https://github.com/Project-OSRM/osrm-backend/pull/7363/files

Move the ifdef into format.hpp. Don't do this check at the call site.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>
Copilot AI changed the title [WIP] Move ifdef into format.hpp for better organization Move #ifdef OSRM_HAS_STD_FORMAT from call sites into format.hpp Feb 19, 2026
Copilot AI requested a review from DennisOSRM February 19, 2026 22:35
@DennisOSRM
Copy link
Copy Markdown
Collaborator

@copilot make sure the change is formatted as needed.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 19, 2026

@copilot make sure the change is formatted as needed.

Confirmed — ran ./scripts/format.sh and all three changed files (include/util/format.hpp, include/server/service/utils.hpp, src/server/service/table_service.cpp) pass clang-format-18 with no modifications needed.

@DennisOSRM DennisOSRM marked this pull request as ready for review February 19, 2026 23:43
@DennisOSRM DennisOSRM merged commit a255dc0 into copilot/replace-boost-format-with-libfmt Feb 19, 2026
1 check passed
@DennisOSRM DennisOSRM deleted the copilot/move-ifdef-to-format-header branch February 19, 2026 23:43
DennisOSRM added a commit that referenced this pull request Feb 21, 2026
* Initial plan

* Replace boost::format with libfmt across the codebase

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Remove unnecessary util/log.hpp include from shared_monitor.hpp

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Fix code formatting as reported by CI

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Fix npm audit security vulnerability in tar package

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Add missing <memory> include to multi_level_partition.hpp

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Add missing <memory> include to compressed_edge_container.hpp

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Add missing <vector> include to io_config.hpp

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Add missing <string> and <cstring> includes to storage headers

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Add missing includes: util/format.hpp and <vector>

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Fix runtime format string handling for C++20 std::format compatibility

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* [WIP] Fix build errors in project (#7367)

* Fix clang-format-18 formatting in include/util/format.hpp (#7368)

* Fix std::make_format_args rvalue binding error with GCC 13 (#7369)

* Fix missing `<unistd.h>` include for macOS in io-benchmark (#7370)

* Move `#ifdef OSRM_HAS_STD_FORMAT` from call sites into `format.hpp` (#7371)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>
Co-authored-by: Dennis Luxen <info@project-osrm.org>
MarcelloPerathoner pushed a commit to MarcelloPerathoner/osrm-backend that referenced this pull request Feb 24, 2026
* Initial plan

* Replace boost::format with libfmt across the codebase

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Remove unnecessary util/log.hpp include from shared_monitor.hpp

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Fix code formatting as reported by CI

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Fix npm audit security vulnerability in tar package

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Add missing <memory> include to multi_level_partition.hpp

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Add missing <memory> include to compressed_edge_container.hpp

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Add missing <vector> include to io_config.hpp

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Add missing <string> and <cstring> includes to storage headers

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Add missing includes: util/format.hpp and <vector>

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* Fix runtime format string handling for C++20 std::format compatibility

Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>

* [WIP] Fix build errors in project (Project-OSRM#7367)

* Fix clang-format-18 formatting in include/util/format.hpp (Project-OSRM#7368)

* Fix std::make_format_args rvalue binding error with GCC 13 (Project-OSRM#7369)

* Fix missing `<unistd.h>` include for macOS in io-benchmark (Project-OSRM#7370)

* Move `#ifdef OSRM_HAS_STD_FORMAT` from call sites into `format.hpp` (Project-OSRM#7371)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: DennisOSRM <1067895+DennisOSRM@users.noreply.github.com>
Co-authored-by: Dennis Luxen <info@project-osrm.org>
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