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

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 13:31:59 PDT 2015


On Thu, Oct 8, 2015 at 7:23 AM, Marshall Clow <mclow.lists at gmail.com> wrote:

> On Tue, Oct 6, 2015 at 3:36 PM, Richard Smith <richard at metafoo.co.uk>
> wrote:
>
>> Split <math.h> out of <cmath>. This is a big change, but the same pattern
>> as the prior ones.
>>
>> In this patch, you replicate the #ifdef XXX, __libcpp_XXX, #undef XXX
> dance for all the isXXX functions. Is that because they're not required to
> be actual functions in a C library?
>

Yes. Per C11 7.12.3, the following are defined as type-generic macros that
take any real floating-point type:

  fpclassify, isfinite, isinf, isnan, isnormal, signbit

Per C11 7.12.14, the following are defined as type-generic macros that take
any pair of real floating-point types:

  isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered

Per [c.math]p10, we are required to remove those macros and replace them
with a set of overloaded functions. For those cases (and *only* those
cases), we define a function template to capture the contents of the macro,
then undefine the macro.

Note that libc++'s behavior here is non-conforming (both before and after
this change) because it's required to provide a specific set of overloads,
but instead only provides a template. This patch series neither improves
nor regresses libc++'s conformance in that area.


> Other than that Q, LGTM. Like the extended tests.
>
> -- Marshall
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151008/1dc9ccbe/attachment.html>


More information about the cfe-commits mailing list