[PATCH] D12747: Implement [depr.c.headers]

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 18:25:45 PDT 2015


Patch #12 needs revision. A bunch of function definitions were moved
out of the std namespace and into the global.
That change is incorrect.



On Thu, Oct 8, 2015 at 7:09 PM, Eric Fiselier <eric at efcs.ca> wrote:
> Patch #11 LGTM. Any reason you removed the "#pragma diagnostic ignored
> "-Wnonnull"" in test/std/depr/depr.c.headers/stdlib_h.pass.cpp?
> I would like to leave it in so this test doesn't fail with older clang
> versions.
>
> /Eric
>
> On Thu, Oct 8, 2015 at 6:47 PM, Eric Fiselier <eric at efcs.ca> wrote:
>> Patch #10 LGTM.
>>
>> On Thu, Oct 8, 2015 at 4:28 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>>> On Thu, Oct 8, 2015 at 11:50 AM, Marshall Clow <mclow.lists at gmail.com>
>>> wrote:
>>>>
>>>> On Tue, Oct 6, 2015 at 3:57 PM, Richard Smith <richard at metafoo.co.uk>
>>>> wrote:
>>>>>
>>>>> <stddef.h>. This one is tricky:
>>>>>
>>>>> 1) There's an (undocumented) interface between the C standard library and
>>>>> this header, where the macros __need_ptrdiff_t, __need_size_t,
>>>>> __need_wchar_t, __need_NULL, __need_wint_t request just a piece of this
>>>>> header rather than the whole thing. If we see any of those, just go straight
>>>>> to the underlying header.
>>>>
>>>>
>>>> Ok, but in that case we don't get nullptr.  I suspect that's OK.
>>>>
>>>>>
>>>>> 2) We probably don't want <stddef.h> to include <cstddef> (for
>>>>> consistency with other headers)
>>>>
>>>>
>>>> No, we do not! :-)
>>>>
>>>>>
>>>>> , but <stddef.h> must provide a ::nullptr_t (which we don't want
>>>>> <cstddef> to provide). So neither header includes the other. Instead, both
>>>>> include <__nullptr> for std::nullptr_t, and we duplicate the definition of
>>>>> max_align_t between them, in the case where the compiler's <stddef.h>
>>>>> doesn't provide it.
>>>>>
>>>>> If you prefer, I could make <stddef.h> include <cstddef> to avoid the
>>>>> duplication of the max_align_t logic.
>>>>
>>>>
>>>> No; this is a minor annoyance, and layer jumping (<stdXXX.h> including
>>>> <cstdXXX>) is a major annoyance - and I'm pretty sure that that would come
>>>> back to bite us in the future.
>>>>
>>>> Looks ok to me.
>>>
>>>
>>> Thanks, everything up to and including patch 09 is now committed.


More information about the cfe-commits mailing list