This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52032] Function and class attributes should optionally take a bool parameter enabling them


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52032

--- Comment #4 from Joseph Garvin <joseph.h.garvin at gmail dot com> 2012-01-30 21:13:37 UTC ---
That's why I put the severity as enhancement :)

I thought of a better example.

template<bool force_inline>
void __attribute__((always_inline(force_inline))) foo()
{
    // ...
}

Now you can choose whether to force inlining of foo on a per call site basis,
which AFAICT there is no way to do in GCC currently. I don't think template
specialization can accomplish the same -- the best you could do would be
defining a function with a copy pasta of the same code but a different name.
You couldn't have both versions call a common function because the force_inline
parameter would need to apply to it as well.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]