-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
test: perf: alternator: mark format string as constexpr
#18685
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before this change, we use `update_item_suffix` as a format string fed to `format(...)`, which is resolved to `seastar::format()`. but with a patch which migrates the `seastar::format()` to the backend with compile-time format check, the caller sites using `format()` would fail to build, because `update_item_suffix` is not a `constexpr`: ``` /home/kefu/.local/bin/clang++ -DFMT_SHARED -DSCYLLA_BUILD_MODE=release -DSEASTAR_API_LEVEL=7 -DSEASTAR_LOGGER_COMPILE_TIME_FMT -DSEASTAR_LOGGER_TYPE_STDOUT -DSEASTAR_SCHEDULING_GROUPS_COUNT=16 -DSEASTAR_SSTRING -DXXH_PRIVATE_API -DCMAKE_INTDIR=\"RelWithDebInfo\" -I/home/kefu/dev/scylladb -I/home/kefu/dev/scylladb/build/gen -I/home/kefu/dev/scylladb/seastar/include -I/home/kefu/dev/scylladb/build/seastar/gen/include -I/home/kefu/dev/scylladb/build/seastar/gen/src -isystem /home/kefu/dev/scylladb/abseil -isystem /home/kefu/dev/scylladb/build/rust -ffunction-sections -fdata-sections -O3 -g -gz -std=gnu++20 -fvisibility=hidden -Wall -Werror -Wextra -Wno-error=deprecated-declarations -Wimplicit-fallthrough -Wno-c++11-narrowing -Wno-deprecated-copy -Wno-mismatched-tags -Wno-missing-field-initializers -Wno-overloaded-virtual -Wno-unsupported-friend -Wno-enum-constexpr-conversion -Wno-unused-parameter -ffile-prefix-map=/home/kefu/dev/scylladb=. -march=westmere -mllvm -inline-threshold=2500 -fno-slp-vectorize -U_FORTIFY_SOURCE -Werror=unused-result -MD -MT test/perf/CMakeFiles/test-perf.dir/RelWithDebInfo/perf_alternator.cc.o -MF test/perf/CMakeFiles/test-perf.dir/RelWithDebInfo/perf_alternator.cc.o.d -o test/perf/CMakeFiles/test-perf.dir/RelWithDebInfo/perf_alternator.cc.o -c /home/kefu/dev/scylladb/test/perf/perf_alternator.cc /home/kefu/dev/scylladb/test/perf/perf_alternator.cc:249:69: error: call to consteval function 'fmt::basic_format_string<char, const char (&)[1]>::basic_format_string<const char *, 0>' is not a constant expression 249 | return make_request(cli, "UpdateItem", prefix + seastar::format(update_item_suffix, "")); | ^ /usr/include/fmt/core.h:2776:67: note: read of non-constexpr variable 'update_item_suffix' is not allowed in a constant expression 2776 | FMT_CONSTEVAL FMT_INLINE basic_format_string(const S& s) : str_(s) { | ^ /home/kefu/dev/scylladb/test/perf/perf_alternator.cc:249:69: note: in call to 'basic_format_string<const char *, 0>(update_item_suffix)' 249 | return make_request(cli, "UpdateItem", prefix + seastar::format(update_item_suffix, "")); | ^~~~~~~~~~~~~~~~~~ /home/kefu/dev/scylladb/test/perf/perf_alternator.cc:198:6: note: declared here 198 | auto update_item_suffix = R"( | ^ ``` so, to prepare the change switching to compile-time format checking, let's mark this variable `static constexpr`. this is also more correct, as this variable is * a compile time constant, and * is not shared across different compilation units. Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
tchaikov
added
area/test
Issues related to the testing system code and environment
type/code cleanup
backport/none
Backport is not required
labels
May 15, 2024
@nuivall hi Marcin, could you help review this change? |
avikivity
approved these changes
May 15, 2024
nuivall
approved these changes
May 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
🟢 CI State: SUCCESS✅ - Build Build Details:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/test
Issues related to the testing system code and environment
backport/none
Backport is not required
promoted-to-master
type/code cleanup
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
before this change, we use
update_item_suffix
as a format string fed toformat(...)
, which is resolved toseastar::format()
. but with a patch which migrates theseastar::format()
to the backend with compile-time format check, the caller sites usingformat()
would fail to build, becauseupdate_item_suffix
is not aconstexpr
:so, to prepare the change switching to compile-time format checking, let's mark this variable
static constexpr
. this is also more correct, as this variable is