Skip to content

Commit

Permalink
future: do not use "cold" attribute for lambda
Browse files Browse the repository at this point in the history
to workaround GCC-9 bug:

../../include/seastar/core/future.hh: In member function ‘void
seastar::promise<T>::abandoned()’:
../../include/seastar/core/future.hh:1350:38: error: expected identifier
before ‘{’ token
 1350 |         [&] () __attribute__((cold)) {
      |                                      ^
../../include/seastar/core/future.hh:1350:38: error: type-specifier
invalid in lambda

see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89640

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Mar 21, 2019
1 parent 767aeab commit f9e43c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/seastar/core/future.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ void promise<T...>::abandoned() noexcept {
assert(_state && !_state->available());
// Encourage the compiler to move this away from the hot paths. __builtin_expect is not enough
// to do that. Cold lambdas work (at least for GCC8+).
[&] () __attribute__((cold)) {
[&] () {
try {
// Constructing broken_promise may throw (std::logic_error ctor is not noexcept).
set_exception(broken_promise{});
Expand Down

0 comments on commit f9e43c3

Please sign in to comment.