r289018 - [Headers] Enable #include_next<float.h> on Darwin

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 25 06:29:01 PDT 2017


On Wed, Dec 7, 2016 at 9:13 PM, Bruno Cardoso Lopes via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> Author: bruno
> Date: Wed Dec  7 20:13:56 2016
> New Revision: 289018
>
> URL: http://llvm.org/viewvc/llvm-project?rev=289018&view=rev
> Log:
> [Headers] Enable #include_next<float.h> on Darwin
>
> Allows darwin targets to provide additional definitions and
> implementation specifc values for float.h
>
> rdar://problem/21961491
>
> Added:
>     cfe/trunk/test/Headers/Inputs/usr/
>     cfe/trunk/test/Headers/Inputs/usr/include/
>     cfe/trunk/test/Headers/Inputs/usr/include/float.h
>     cfe/trunk/test/Headers/float-darwin.c
> Modified:
>     cfe/trunk/lib/Headers/float.h

This commit appears to have caused a regression:
https://bugs.llvm.org//show_bug.cgi?id=31504

I am running into this on a Snow Leopard system as well, where the
Integration tests are now failing because float.h cannot be found by
the system #include_next. I was thinking of modifying
lib/Headers/float.h to use the SDK version as mentioned in the bug
report, but I share the reporter's question: why was this change
needed in the first place? I couldn't find a review for the commit,
and don't have access to the rdar link.

Thanks!

~Aaron

>
> Modified: cfe/trunk/lib/Headers/float.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/float.h?rev=289018&r1=289017&r2=289018&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Headers/float.h (original)
> +++ cfe/trunk/lib/Headers/float.h Wed Dec  7 20:13:56 2016
> @@ -27,9 +27,12 @@
>  /* If we're on MinGW, fall back to the system's float.h, which might have
>   * additional definitions provided for Windows.
>   * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
> + *
> + * Also fall back on Darwin to allow additional definitions and
> + * implementation-defined values.
>   */
> -#if (defined(__MINGW32__) || defined(_MSC_VER)) && __STDC_HOSTED__ && \
> -    __has_include_next(<float.h>)
> +#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
> +    __STDC_HOSTED__ && __has_include_next(<float.h>)
>  #  include_next <float.h>
>
>  /* Undefine anything that we'll be redefining below. */
>
> Added: cfe/trunk/test/Headers/Inputs/usr/include/float.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/Inputs/usr/include/float.h?rev=289018&view=auto
> ==============================================================================
> --- cfe/trunk/test/Headers/Inputs/usr/include/float.h (added)
> +++ cfe/trunk/test/Headers/Inputs/usr/include/float.h Wed Dec  7 20:13:56 2016
> @@ -0,0 +1,6 @@
> +#ifndef SYSFLOAT_H
> +#define SYSFLOAT_H
> +
> +#define FLT_HAS_SUBNORM 1
> +
> +#endif /* SYSFLOAT_H */
>
> Added: cfe/trunk/test/Headers/float-darwin.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/float-darwin.c?rev=289018&view=auto
> ==============================================================================
> --- cfe/trunk/test/Headers/float-darwin.c (added)
> +++ cfe/trunk/test/Headers/float-darwin.c Wed Dec  7 20:13:56 2016
> @@ -0,0 +1,13 @@
> +// REQUIRES: system-darwin
> +// RUN: %clang -target x86_64-apple-darwin10 -fsyntax-only -std=c11 -isysroot %S/Inputs %s
> +#include <float.h>
> +
> +// Test the #include_next on float.h works on Darwin.
> +#ifndef FLT_HAS_SUBNORM
> +  #error "FLT_HAS_SUBNORM not defined"
> +#endif
> +
> +// Test that definition from builtin are also present.
> +#ifndef FLT_MAX
> +  #error "FLT_MAX not defined"
> +#endif
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list