Fix: ust-compiler: constructor/destructor build on g++ 4.8
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 9 Dec 2021 21:07:15 +0000 (16:07 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 9 Dec 2021 21:20:38 +0000 (16:20 -0500)
commit2ccdf268c1df8e595bfa891edb2d0e1b5cbd1bb6
tree31802c00d3ea630a0e631b5119de8e462f3d8ef0
parenta5868ac0bb84b61b50fb7bb18a224c99e7990a9b
Fix: ust-compiler: constructor/destructor build on g++ 4.8

g++ 4.8 build fails with:

15:16:07 ../../../../include/lttng/ust-compiler.h:104:31: error: can’t set ‘no_instrument_function’ attribute after definition
15:16:07   LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_constructor_destructor_,         \
15:16:07                                ^
15:16:07 ../../../../include/lttng/tracepoint.h:84:3: note: in definition of macro ‘LTTNG_UST___TP_COMBINE_TOKENS’
15:16:07    _tokena##_tokenb
15:16:07    ^
15:16:07 ../../../../include/lttng/ust-compiler.h:104:2: note: in expansion of macro ‘LTTNG_UST__TP_COMBINE_TOKENS’
15:16:07   LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_constructor_destructor_,         \
15:16:07   ^
15:16:07 ../../../../include/lttng/ust-tracepoint-event.h:1230:1: note: in expansion of macro ‘LTTNG_UST_DECLARE_CONSTRUCTOR_DESTRUCTOR’
15:16:07  LTTNG_UST_DECLARE_CONSTRUCTOR_DESTRUCTOR(
15:16:07  ^
15:16:07 In file included from ../../../../include/lttng/tracepoint.h:25:0,
15:16:07                  from ust_tests_hello.h:13,
15:16:07                  from tp-cpp.cpp:8:
15:16:07 ../../../../include/lttng/ust-compiler.h:109:2: error: can’t set ‘no_instrument_function’ attribute after definition
15:16:07   ~LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_constructor_destructor_,        \
15:16:07   ^
15:16:07 ../../../../include/lttng/ust-tracepoint-event.h:1230:1: note: in expansion of macro ‘LTTNG_UST_DECLARE_CONSTRUCTOR_DESTRUCTOR’
15:16:07  LTTNG_UST_DECLARE_CONSTRUCTOR_DESTRUCTOR(
15:16:07  ^

Fix this by moving the implementation of the constructor and destructor
outside of the class, thus applying the attribute to a forward
declaration.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9e097d50dff7a8f9bef07b04ddad38bd6877f892
include/lttng/ust-compiler.h
This page took 0.024757 seconds and 4 git commands to generate.