[PATCH] D58149: [clang] Make sure C99/C11 features in <float.h> are provided in C++11

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 13 21:11:07 PST 2019


jfb added a comment.

In D58149#1397532 <https://reviews.llvm.org/D58149#1397532>, @rsmith wrote:

> In D58149#1397499 <https://reviews.llvm.org/D58149#1397499>, @ldionne wrote:
>
> > In D58149#1397390 <https://reviews.llvm.org/D58149#1397390>, @jfb wrote:
> >
> > > In D58149#1397382 <https://reviews.llvm.org/D58149#1397382>, @efriedma wrote:
> > >
> > > > Formally, I don't think C11 is a normative reference for C++11 or C++14, only C++17 (see [intro.refs] in the standard).
> > >
> >
> >
> > You're right. I don't mind submitting a patch that enables it for C++17 and above only if that's what you want, however...
> >
> > > Right, this was changed in wg21.link/p0063r3
> > >  That being said, we *can* offer these C11 features as extensions IIUC.
> >
> > ... I think it's also fine to have it in C++11.
>
>
> In C++11, this is technically valid:
>
>   #define FLT_TRUE_MIN 1
>   #include <cfloat>
>   #if FLT_TRUE_MIN != 1
>   #error float.h redefined my macro
>   #endif
>
>
> and likewise
>
>   #include <cfloat>
>   constexpr float FLT_TRUE_MIN = 0.0001f;
>
>
> ... but both will fail with this patch, so providing these macros is technically non-conforming. I don't know to what extent we should care about such uses, though. We generally leak additional non-conforming names from the system `<*.h>` headers into the user's namespace if the libc headers put them there. This would, however, probably be the first time that we put them there ourselves.


🎻 ← tiny unicode violin for anyone this would break ☺️


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58149/new/

https://reviews.llvm.org/D58149





More information about the cfe-commits mailing list