[cfe-commits] [libcxx] r104982 - /libcxx/trunk/include/cstddef

Eli Friedman eli.friedman at gmail.com
Fri May 28 13:34:38 PDT 2010


On Fri, May 28, 2010 at 1:12 PM, Howard Hinnant <hhinnant at apple.com> wrote:
> On May 28, 2010, at 4:10 PM, Eli Friedman wrote:
>
>> On Fri, May 28, 2010 at 11:04 AM, Howard Hinnant <hhinnant at apple.com> wrote:
>>> Author: hhinnant
>>> Date: Fri May 28 13:04:31 2010
>>> New Revision: 104982
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=104982&view=rev
>>> Log:
>>> Fixed [support.types].  <cstddef> wasn't definining NULL or offsetof.
>>>
>>> Modified:
>>>    libcxx/trunk/include/cstddef
>>>
>>> Modified: libcxx/trunk/include/cstddef
>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstddef?rev=104982&r1=104981&r2=104982&view=diff
>>> ==============================================================================
>>> --- libcxx/trunk/include/cstddef (original)
>>> +++ libcxx/trunk/include/cstddef Fri May 28 13:04:31 2010
>>> @@ -34,9 +34,11 @@
>>>  */
>>>
>>>  #include <__config>
>>> +#define __need_NULL
>>>  #define __need_ptrdiff_t
>>>  #define __need_size_t
>>>  #include <stddef.h>
>>> +#include <stddef.h>
>>
>> Umm, what?
>
> <chuckle> I know, I know.  On Mac OS the first trip through <stddef.h> doesn't define offsetof.  Or said differently, offsetof doesn't get defined if any of __need_* are defined.  The first trip creates the desired macros and #undefines the request.  The second trip creates offsetof. <shrug>

Why not get rid of the __need_ defines and just include stddef.h once?

-Eli




More information about the cfe-commits mailing list