[cfe-commits] [patch] Don't mark libc++ functions as always_inline in debug mode.

Howard Hinnant hhinnant at apple.com
Mon Feb 20 06:58:06 PST 2012


This is more than just an optimization issue.  Experience with libstdc++ has shown a persistent ABI stability problem over the years with functions getting silently uninlined in one release of libstdc++.dylib and inlined in the next.  The best way to hold the ABI stable is to put inlining under my control, not the compielr's.

For those clients wishing to change these settings, <__config> was designed to defer to the client's wishes from the command line:

-D_LIBCPP_INLINE_VISIBILITY

will be used in preference to whatever <__config> says (or if it doesn't, that's the bug to fix).

Howard

On Feb 20, 2012, at 7:58 AM, Chris Lattner wrote:

> Why are these functions marked always-inline in the first place?
> 
> -Chris
> 
> On Feb 19, 2012, at 7:24 PM, Jeffrey Yasskin <jyasskin at gmail.com> wrote:
> 
>> Really, even if libc++ is bug-free, it'll confuse users if debugging
>> it in -O0 mode produces strange line jumps.
>> 
>> If NDEBUG is the wrong macro, would it make sense to provide a
>> LIBCXX_DEBUG flag to move the inlining decisions to clang?
>> 
>> On Sun, Feb 19, 2012 at 6:57 PM, Howard Hinnant <hhinnant at apple.com> wrote:
>>> On Feb 19, 2012, at 9:30 PM, Jeffrey Yasskin wrote:
>>> 
>>>> This patch may not be quite right, since the always_inline macros seem
>>>> to also have visibility effects, which this patch would block. I also
>>>> had to build with an explicit -UNDEBUG since cmake appears to add
>>>> -DNDEBUG regardless of whether the build mode requests it.
>>>> 
>>>> Jeffrey
>>>> <no_inline_debug.patch>
>>> 
>>> I can't commit this one.  The presumption is that NDEBUG is up to the client to turn on and off for his own purposes, and that libc++ does not need to be debugged by him.  I realize that libc++ has bugs.  But the goal is for it to not have bugs, and when it does need to be debugged, a libc++ developer such as myself will do it.
>>> 
>>> Howard
>>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list