Skip to content

Conversation

@mszabo-wikia
Copy link
Contributor

The formatter function should be const as per docs.

Avoid the following:

In file included from /hhvm/hphp/runtime/ext/facts/facts-store.cpp:26:
In file included from /hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/Synchronized.h:32:
In file included from /hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/Function.h:215:
In file included from /hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/lang/Exception.h:27:
In file included from /hhvm/_build/third-party/fmt/bundled_fmt-prefix/include/fmt/format.h:41:
/hhvm/_build/third-party/fmt/bundled_fmt-prefix/include/fmt/base.h:2240:23: error: no matching member function for call to 'format'
 2240 |     ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));
      |                    ~~~^~~~~~
/hhvm/_build/third-party/fmt/bundled_fmt-prefix/include/fmt/base.h:2220:21: note: in instantiation of function template specialization 'fmt::detail::value<fmt::context>::format_custom<HPHP::Facts::Clock, fmt::formatter<HPHP::Facts::Clock>>' requested here
 2220 |     custom.format = format_custom<value_type, formatter<value_type, char_type>>;
      |                     ^
/hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/logging/LogStreamProcessor.h:255:13: note: in instantiation of function template specialization 'folly::LogStreamProcessor::formatLogString<HPHP::Facts::Clock, HPHP::Facts::Clock, unsigned long, unsigned long>' requested here
  255 |             formatLogString(fmt, std::forward<Args>(args)...)) {}
      |             ^
/hhvm/hphp/runtime/ext/facts/facts-store.cpp:1176:5: note: in instantiation of function template specialization 'folly::LogStreamProcessor::LogStreamProcessor<HPHP::Facts::Clock &, HPHP::Facts::Clock &, unsigned long, unsigned long>' requested here
 1176 |     XLOGF(
      |     ^
/hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/logging/xlog.h:108:3: note: expanded from macro 'XLOGF'
  108 |   XLOG_IMPL(                               \
      |   ^
/hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/logging/xlog.h:481:3: note: expanded from macro 'XLOG_IMPL'
  481 |   XLOG_ACTUAL_IMPL(                 \
      |   ^
/hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/logging/xlog.h:534:11: note: expanded from macro 'XLOG_ACTUAL_IMPL'
  534 |           ::folly::LogStreamProcessor(                                      \
      |           ^
/hhvm/hphp/runtime/ext/facts/file-facts.h:155:8: note: candidate function template not viable: 'this' argument has type 'const fmt::formatter<HPHP::Facts::Clock>', but method is not marked const
  155 |   auto format(const HPHP::Facts::Clock& c, FormatContext& ctx)
      |        ^
18 warnings and 1 error generated.

Avoid the following:

```
In file included from /hhvm/hphp/runtime/ext/facts/facts-store.cpp:26:
In file included from /hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/Synchronized.h:32:
In file included from /hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/Function.h:215:
In file included from /hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/lang/Exception.h:27:
In file included from /hhvm/_build/third-party/fmt/bundled_fmt-prefix/include/fmt/format.h:41:
/hhvm/_build/third-party/fmt/bundled_fmt-prefix/include/fmt/base.h:2240:23: error: no matching member function for call to 'format'
 2240 |     ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));
      |                    ~~~^~~~~~
/hhvm/_build/third-party/fmt/bundled_fmt-prefix/include/fmt/base.h:2220:21: note: in instantiation of function template specialization 'fmt::detail::value<fmt::context>::format_custom<HPHP::Facts::Clock, fmt::formatter<HPHP::Facts::Clock>>' requested here
 2220 |     custom.format = format_custom<value_type, formatter<value_type, char_type>>;
      |                     ^
/hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/logging/LogStreamProcessor.h:255:13: note: in instantiation of function template specialization 'folly::LogStreamProcessor::formatLogString<HPHP::Facts::Clock, HPHP::Facts::Clock, unsigned long, unsigned long>' requested here
  255 |             formatLogString(fmt, std::forward<Args>(args)...)) {}
      |             ^
/hhvm/hphp/runtime/ext/facts/facts-store.cpp:1176:5: note: in instantiation of function template specialization 'folly::LogStreamProcessor::LogStreamProcessor<HPHP::Facts::Clock &, HPHP::Facts::Clock &, unsigned long, unsigned long>' requested here
 1176 |     XLOGF(
      |     ^
/hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/logging/xlog.h:108:3: note: expanded from macro 'XLOGF'
  108 |   XLOG_IMPL(                               \
      |   ^
/hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/logging/xlog.h:481:3: note: expanded from macro 'XLOG_IMPL'
  481 |   XLOG_ACTUAL_IMPL(                 \
      |   ^
/hhvm/_build/third-party/folly/bundled_folly-prefix/include/folly/logging/xlog.h:534:11: note: expanded from macro 'XLOG_ACTUAL_IMPL'
  534 |           ::folly::LogStreamProcessor(                                      \
      |           ^
/hhvm/hphp/runtime/ext/facts/file-facts.h:155:8: note: candidate function template not viable: 'this' argument has type 'const fmt::formatter<HPHP::Facts::Clock>', but method is not marked const
  155 |   auto format(const HPHP::Facts::Clock& c, FormatContext& ctx)
      |        ^
18 warnings and 1 error generated.
```
@facebook-github-bot
Copy link
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. (Because this pull request was imported automatically, there will not be any future comments.)

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 2f1cd08.

@mszabo-wikia mszabo-wikia deleted the fix-clock-formatter branch October 6, 2025 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants