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 <n...@scylladb.com>
---
 arch/x64/arch-trace.hh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x64/arch-trace.hh b/arch/x64/arch-trace.hh
index 55ddf822..908ee9ac 100644
--- a/arch/x64/arch-trace.hh
+++ b/arch/x64/arch-trace.hh
@@ -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;
-- 
2.21.0

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20190519122628.6226-1-nyh%40scylladb.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to