[tlbuild] interact.cc and getline insanity

John Bowman bowman at ualberta.ca
Fri Apr 25 18:13:34 CEST 2014


Is GNUC_PREREQ defined if  you first

#include <features>



On Fri, Apr 25, 2014 at 9:58 AM, Mojca Miklavec <
mojca.miklavec.lists at gmail.com> wrote:

> > Does gcc under Solaris not define __GNUC_PREREQ? In any case, I'll change
> > this so that if GNUC_PREREQ is not defined unordered_map will be used by
> > default.
>
> These are all the defines containing GNU that I see (when using gcc 4.8):
>
> #define __GNUC_PATCHLEVEL__ 2
> #define __GNUC__ 4
> #define __GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 +
> __GNUC_PATCHLEVEL__)
> #define __GNUC_VA_LIST
> #define __GNUC_MINOR__ 8
> #define __GNUC_GNU_INLINE__ 1
>
> I'm not sure how to test for sure that GNUC_PREREQ isn't defined.
>
> With clang on Mac OS X 10.7 I get:
>
> #define __GNUC_MINOR__ 2
> #define __GNUC_PATCHLEVEL__ 1
> #define __GNUC_STDC_INLINE__ 1
> #define __GNUC__ 4
>
> Even with clang 3.4.
>
> If I test the following on Mac (with clang):
>
> #if __GNUC_PREREQ(4,1)
>   printf("yes\n");
> #else
>   printf("no\n");
> #endif
>
> I get a compiler error:
>
> error: token is not a valid binary operator in a preprocessor subexpression
> #if __GNUC_PREREQ(4,1)
>
> I believe that a different test is needed, but I'm not sure which one.
>
> Blindly using "tr1" won't do any good either. Here's an example of the
> code that I recently had to patch to make the compilation succeed on
> multiple version of OS X (C++11 shouldn't use "tr1"):
>
> #include <ciso646>
>
> #if __cplusplus >= 201103L || defined(_LIBCPP_VERSION)
> #include <memory>
> #else
> #include <tr1/memory>
> #endif
>
> #if __cplusplus >= 201103L || defined(_LIBCPP_VERSION)
> using std::shared_ptr;
> using std::static_pointer_cast;
> using std::weak_ptr;
> #else
> using std::tr1::shared_ptr;
> using std::tr1::static_pointer_cast;
> using std::tr1::weak_ptr;
> #endif
>
> Mojca
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/tlbuild/attachments/20140425/1c1f5e57/attachment.html>


More information about the tlbuild mailing list