Skip to content

Commit

Permalink
tracepoints: fix for compiling on gcc 9
Browse files Browse the repository at this point in the history
In gcc 9.1.1, strictly following the C++ standard, one is no longer
allowed to specify attributes, e.g., [[gnu::cold]], on function
definitions - only on function declaration. As an annoying side-effect,
we get warnings if we specify them on a lambda, which is both a declaration
and a definition.

The easiest workaround is to use the old-style __attribute__((cold))
instead of the more modern syntax [[gnu::cold]]. The old-style syntax
isn't bound by the C++ standard, and its behavior hasn't changed in
gcc 9.1.1.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20190519122628.6226-1-nyh@scylladb.com>
  • Loading branch information
nyh authored and Waldemar Kozaczuk committed May 19, 2019
1 parent 31926c3 commit cb96e93
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x64/arch-trace.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ slow_path:
auto pdata = &data;
// encapsulate the trace_slow_path() in a function callable from asm:
void (*do_slow_path)(tracepointv* tp, decltype(data)* d)
= [](tracepointv* tp, decltype(data)* d) [[gnu::cold]] {
= [](tracepointv* tp, decltype(data)* d) __attribute__((cold)) {
tp->trace_slow_path(*d);
};
tracepointv* tp = this;
Expand Down

0 comments on commit cb96e93

Please sign in to comment.