You are not logged in.

#1 2019-03-11 16:46:45

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 744

Emit code for all inline methods with g++

I'm trying to force g++ to emit the code for all the inline methods of my classes during the compilation of the unit tests. This is to obtain a sensible coverage report, since code for inline methods that are never used is not emitted and thus it does not appear in the coverage report. This can be done on a per-method basis by adding the attribute [[gnu::used]] to the function declaration, but this is annoying (must be added to every method), error prone (one could forget to add it to a newly added method) and it clutters the code. Is there a g++ flag to automatically set this attribute for all methods/functions? Thanks.

Offline

Board footer

Powered by FluxBB