Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: fix compilation error caused by fmt::runtime() #2422

Merged

Conversation

pwrobelse
Copy link
Contributor

Depending on the 'SEASTAR_LOGGER_COMPILE_TIME_FMT' the declaration of 'logger::log()'
function may use either 'fmt::format_string' or 'const char*' format parameter.

In the case of the usage of 'const char*', there is a need to call 'fmt::runtime()' function to
obtain format_string.

When the project was built on Ubuntu 22.04 using the steps described in the tutorial,
there was a compilation error related to passing argument with type 'fmt::format_string<>'
to 'fmt::runtime()' that handles characters strings.

This change introduces contexpr if statement to remove the compilation error and use
'fmt::runtime()' only when the function takes 'const char*'.

Depending on the 'SEASTAR_LOGGER_COMPILE_TIME_FMT' the declaration
of 'logger::log()' function may use either 'fmt::format_string' or
'const char*' format parameter.

In the case of the usage of 'const char*', there is a need to call
'fmt::runtime()' function to obtain format_string.

When the project was built on Ubuntu 22.04 using the steps described
in the tutorial, there was a compilation error related to passing
argument with type 'fmt::format_string<>' to 'fmt::runtime()' that
handles characters strings.

This change introduces contexpr if statement to remove the compilation
error and use 'fmt::runtime()' only when the function takes 'const char*'.

Signed-off-by: Patryk Wrobel <patryk.wrobel@scylladb.com>
@pwrobelse
Copy link
Contributor Author

The error message that was seen on Ubuntu 22.04:

/home/ubuntu/repo/seastar/include/seastar/rpc/rpc.hh:221:60: error: no matching function for call to ‘runtime(fmt::v8::format_string<const seastar::socket_address&, long int&, std::basic_string_view<char, std::char_traits<char> >&>&)’
  221 |             fmt::format_to(fmt::appender(out), fmt::runtime(fmt), std::forward<Args>(args)...);

@pwrobelse pwrobelse marked this pull request as ready for review September 9, 2024 11:42
@pwrobelse
Copy link
Contributor Author

Perhaps, the problem started to be seen after merging: e3249a8

@avikivity avikivity merged commit 8c58a72 into scylladb:master Sep 9, 2024
14 checks passed
@tchaikov
Copy link
Contributor

tchaikov commented Sep 9, 2024

probably a better fix is to conditionalize this part with SEASTAR_LOGGER_COMPILE_TIME_FMT as well.

@tchaikov
Copy link
Contributor

probably a better fix is to conditionalize this part with SEASTAR_LOGGER_COMPILE_TIME_FMT as well.

created #2425

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.

3 participants