<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Actually, I just found precedent in limit.h and other headers: <a href="https://github.com/llvm-mirror/clang/blob/master/lib/Headers/limits.h#L92" class="">https://github.com/llvm-mirror/clang/blob/master/lib/Headers/limits.h#L92</a>.<div class=""><br class=""></div><div class="">I think that answers my question. I'll submit a Phab review and we'll see then :-)</div><div class=""><br class=""></div><div class="">Louis<br class=""><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 12, 2019, at 16:37, Louis Dionne via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">In C++11 and above, C99/C11 features should be available even when using C++. For example, FLT_HAS_SUBNORM should be provided by <float.h>:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class="">    $ cat <<EOF | clang++ -xc++ -std=c++11 -</font></div><div class=""><font face="Monaco" class="">    #include <float.h></font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class="">    #ifndef FLT_HAS_SUBNORM</font></div><div class=""><font face="Monaco" class="">    #   error "FLT_HAS_SUBNORM is missing"</font></div><div class=""><font face="Monaco" class="">    #endif</font></div><div class=""><font face="Monaco" class="">    EOF</font></div><div class=""><br class=""></div><div class="">This should also work when including `<cfloat>`. However, this currently:</div><div class="">- fails in -std=c++11 or above</div><div class="">- succeeds in -std=gnu++11 or above</div><div class="">- succeeds in -std=c11 or above</div><div class="">- succeeds in -std=gnu11 or above</div><div class=""><br class=""></div><div class="">If I understand correctly, the problem is that we currently have the following in clang/lib/Headers/float.h:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class="">    #include_next <float.h> // pick up whatever the system provides</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class="">    ...</font></div><div class=""><font face="Monaco" class="">    #undef FLT_HAS_SUBNORM // undefine what the system provides</font></div><div class=""><font face="Monaco" class="">    ...</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class="">    // redefine our own version of the macro</font></div><div class=""><font face="Monaco" class="">    #if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)</font></div><div class=""><font face="Monaco" class="">        ...</font></div><div class=""><font face="Monaco" class="">    #  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__</font></div><div class=""><font face="Monaco" class="">        ...</font></div><div class=""><font face="Monaco" class="">    #endif</font></div><div class=""><br class=""></div><div class="">The #if block checks whether we're compiling in C11 or above, or whether we're compiling in a non-strict dialect (basically some any gnuXXX dialect). However, it doesn't check for strictly conforming C++, and as a result we don't get the definitions. I'd like to know what's the right strategy for providing these definitions in C++, and whether there's an established way of doing this already. Naively, changing the #if to</div><div class=""><br class=""></div><div class=""><font face="Monaco" class="">    #if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || (defined(__cplusplus) && __cplusplus >= 201103L)</font></div><div class=""><font face="Monaco" class="">        ...</font></div><div class=""><font face="Monaco" class="">    #  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__</font></div><div class=""><font face="Monaco" class="">        ...</font></div><div class=""><font face="Monaco" class="">    #endif</font></div><div class=""><br class=""></div><div class="">seems to do the job. But I'm not very familiar with how Clang's headers are imbricked into libc++ and how they interact with per-platform headers, so I'm asking here.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Louis</div><div class=""><br class=""></div></div>_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""></div></blockquote></div><br class=""></div></div></body></html>