Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/osrm-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,13 @@ jobs:
CXXCOMPILER: g++-13
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'

- name: gcc-12-release
- name: gcc-15-release
continue-on-error: false
node: 22
runs-on: ubuntu-22.04
runs-on: ubuntu-25.04
BUILD_TYPE: Release
CCOMPILER: gcc-12
CXXCOMPILER: g++-12
CCOMPILER: gcc-15
CXXCOMPILER: g++-15
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'

- name: conan-linux-release-node
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased
- Changes from 6.0.0
- Misc:
- CHANGED: Remove libfmt from third_party and replace with std::format [#7238](https://github.com/Project-OSRM/osrm-backend/issues/7238)
- ADDED: Add husky pre-commit hook for compiling and linting staged JS files [#7228](https://github.com/Project-OSRM/osrm-backend/issues/7228)
- CHANGED: Standardize linting configuration with ESM-specific rules [#7229](https://github.com/Project-OSRM/osrm-backend/issues/7229)
- CHANGED: Convert scripts from CommonJS to modern ESM format [#7230](https://github.com/Project-OSRM/osrm-backend/pull/7230)
Expand Down
16 changes: 9 additions & 7 deletions include/util/json_renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#include <boost/assert.hpp>

#include <fmt/compile.h>

namespace osrm::util::json
{

Expand Down Expand Up @@ -50,12 +48,16 @@ template <typename Out> struct Renderer
{
// we don't want to print NaN or Infinity
BOOST_ASSERT(std::isfinite(number.value));
// `fmt::memory_buffer` stores first 500 bytes in the object itself(i.e. on stack in this
// case) and then grows using heap if needed
fmt::memory_buffer buffer;
fmt::format_to(std::back_inserter(buffer), FMT_COMPILE("{:.10g}"), number.value);
// 64 bytes is plenty for "{:.10g}" formatted doubles
std::array<char, 64> buffer{};

// format into the buffer
auto it = std::format_to(buffer.begin(), "{:.10g}", number.value);

// compute number of characters to write
const size_t size = static_cast<size_t>(std::distance(buffer.begin(), it));

write(buffer.data(), buffer.size());
write(buffer.data(), size);
}

void operator()(const Object &object)
Expand Down
5 changes: 1 addition & 4 deletions scripts/update_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ PROTOZERO_TAG=v1.7.1
VTZERO_PATH="mapbox/vtzero"
VTZERO_TAG=v1.1.0

FMT_PATH="fmtlib/fmt"
FMT_TAG=v10.2.1

FLATBUFFERS_PATH="google/flatbuffers"
FLATBUFFERS_TAG=v24.3.25

Expand All @@ -56,6 +53,6 @@ function update_subtree () {
}

## Update dependencies
for dep in osmium sol rapidjson microtar protozero vtzero fmt flatbuffers; do
for dep in osmium sol rapidjson microtar protozero vtzero flatbuffers; do
update_subtree $dep
done
8 changes: 4 additions & 4 deletions src/server/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_stream.hpp>

#include <fmt/format.h>
#include <format>
#include <vector>

namespace osrm::server
Expand Down Expand Up @@ -91,9 +91,9 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t
{
keep_alive = true;
current_reply.headers.emplace_back("Connection", "keep-alive");
current_reply.headers.emplace_back("Keep-Alive",
"timeout=" + fmt::to_string(keepalive_timeout) +
", max=" + fmt::to_string(processed_requests));
current_reply.headers.emplace_back(
"Keep-Alive",
std::format("timeout={}, max={}", keepalive_timeout, processed_requests));
}

// compress the result w/ gzip/deflate if requested
Expand Down
16 changes: 9 additions & 7 deletions src/util/log.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "util/log.hpp"
#include "util/isatty.hpp"
#include <boost/algorithm/string/predicate.hpp>
#include <chrono>
#include <cstdio>
#include <fmt/chrono.h>
#include <format>
#include <iostream>
#include <mutex>
#include <string>
Expand Down Expand Up @@ -75,12 +76,13 @@ void Log::Init()

auto format = [is_terminal](const char *level, const char *color)
{
const auto timestamp = std::chrono::system_clock::now();
return fmt::format("{}[{:%FT%H:%M:}{:%S}] [{}] ",
is_terminal ? color : "",
timestamp,
timestamp.time_since_epoch(),
level);
const auto now = std::chrono::system_clock::now();

// Format full timestamp with seconds precision
// ISO-8601 style: 2025-09-13T15:42:07
const auto timestamp = std::format("{:%FT%T}", floor<std::chrono::seconds>(now));

return std::format("{}[{}] [{}] ", is_terminal ? color : "", timestamp, level);
};

switch (level)
Expand Down
8 changes: 0 additions & 8 deletions third_party/fmt/.clang-format

This file was deleted.

8 changes: 0 additions & 8 deletions third_party/fmt/.github/dependabot.yml

This file was deleted.

6 changes: 0 additions & 6 deletions third_party/fmt/.github/issue_template.md

This file was deleted.

7 changes: 0 additions & 7 deletions third_party/fmt/.github/pull_request_template.md

This file was deleted.

30 changes: 0 additions & 30 deletions third_party/fmt/.github/workflows/cifuzz.yml

This file was deleted.

35 changes: 0 additions & 35 deletions third_party/fmt/.github/workflows/doc.yml

This file was deleted.

26 changes: 0 additions & 26 deletions third_party/fmt/.github/workflows/lint.yml

This file was deleted.

111 changes: 0 additions & 111 deletions third_party/fmt/.github/workflows/linux.yml

This file was deleted.

Loading
Loading