Boost logo

Boost :

Subject: Re: [boost] Stacktrace library starts review today 14th Dec
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2016-12-18 08:56:01


On 17 Dec 2016 at 21:43, Antony Polukhin wrote:

> >> > Also, I get why there's the stack-trace function at the top of the
> >> > stacktrace, and it would be the wrong approach to remove it manually. I
> >> > would however like a workaround, so that the stacktrace doesn't include
> >> > those calls.
> >>
> >> That top level frame may dissappear/reapper depending on the compiler
> >> version and even compiler flags. I was experimenting with skipping the
> >> first frame or forcing inlinement. I've found no good way to resolve
> >> that issue.
> >
> > As I mentioned in a previous post, you want to use noinline to force
> > a guaranteed first entry to strip. As it's a header only library,
> > you'll get this perversity:
> >
> > __declspec(noinline) inline void make_backtrace(...)
> >
> > ... which is completely legal because you want inline linkage
> > semantics, but to never inline the function.
>
> Oh, now I've got that. I've been confused by the `__declspec(noinline)
> inline`. Thanks again!
> Does the `BOOST_NOINLINE inline` solution work well on GCC, CLANG and
> other compilers?

For the major compilers targeting their native ecosystem I've found
they work as expected. Though the markup is perverse, and you might
want to add an explanatory comment :).

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ 
http://ie.linkedin.com/in/nialldouglas/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk