<div dir="ltr">Is GNUC_PREREQ defined if  you first<div><br></div><div>#include <features></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 25, 2014 at 9:58 AM, Mojca Miklavec <span dir="ltr"><<a href="mailto:mojca.miklavec.lists@gmail.com" target="_blank">mojca.miklavec.lists@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">> Does gcc under Solaris not define __GNUC_PREREQ? In any case, I'll change<br>
> this so that if GNUC_PREREQ is not defined unordered_map will be used by<br>
> default.<br>
<br>
</div>These are all the defines containing GNU that I see (when using gcc 4.8):<br>
<br>
#define __GNUC_PATCHLEVEL__ 2<br>
#define __GNUC__ 4<br>
#define __GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 +<br>
__GNUC_PATCHLEVEL__)<br>
#define __GNUC_VA_LIST<br>
#define __GNUC_MINOR__ 8<br>
#define __GNUC_GNU_INLINE__ 1<br>
<br>
I'm not sure how to test for sure that GNUC_PREREQ isn't defined.<br>
<br>
With clang on Mac OS X 10.7 I get:<br>
<br>
#define __GNUC_MINOR__ 2<br>
#define __GNUC_PATCHLEVEL__ 1<br>
#define __GNUC_STDC_INLINE__ 1<br>
#define __GNUC__ 4<br>
<br>
Even with clang 3.4.<br>
<br>
If I test the following on Mac (with clang):<br>
<br>
#if __GNUC_PREREQ(4,1)<br>
  printf("yes\n");<br>
#else<br>
  printf("no\n");<br>
#endif<br>
<br>
I get a compiler error:<br>
<br>
error: token is not a valid binary operator in a preprocessor subexpression<br>
#if __GNUC_PREREQ(4,1)<br>
<br>
I believe that a different test is needed, but I'm not sure which one.<br>
<br>
Blindly using "tr1" won't do any good either. Here's an example of the<br>
code that I recently had to patch to make the compilation succeed on<br>
multiple version of OS X (C++11 shouldn't use "tr1"):<br>
<br>
#include <ciso646><br>
<br>
#if __cplusplus >= 201103L || defined(_LIBCPP_VERSION)<br>
#include <memory><br>
#else<br>
#include <tr1/memory><br>
#endif<br>
<br>
#if __cplusplus >= 201103L || defined(_LIBCPP_VERSION)<br>
using std::shared_ptr;<br>
using std::static_pointer_cast;<br>
using std::weak_ptr;<br>
#else<br>
using std::tr1::shared_ptr;<br>
using std::tr1::static_pointer_cast;<br>
using std::tr1::weak_ptr;<br>
#endif<br>
<span class="HOEnZb"><font color="#888888"><br>
Mojca<br>
<br>
</font></span></blockquote></div><br></div>