This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
_NEWLIB_VERSION exposure through sys/cdefs.h
- From: Jonathan Roelofs <jonathan at codesourcery dot com>
- To: <newlib at sourceware dot org>, Corinna Vinschen <vinschen at redhat dot com>
- Cc: Dan Albert <danalbert at google dot com>, JF Bastien <jfb at chromium dot org>
- Date: Wed, 17 Sep 2014 15:09:32 -0600
- Subject: _NEWLIB_VERSION exposure through sys/cdefs.h
- Authentication-results: sourceware.org; auth=none
Corinna,
In libc++, we'd like to be able to tell when the underlying libc is Newlib. At
the moment, that requires us to do things like this:
#if defined(__has_include) && __has_include(<newlib.h>)
#include <newlib.h>
#endif
#if defined(_NEWLIB_VERSION)
...
#endif
The problem with that strategy is that it does not work when using gcc, as it
doesn't have __has_include support yet. It came up in discussion that
sys/cdefs.h might be the right place for that, as that's where glibc puts __GLIBC__.
Would there be an objection to #include <newlib.h> from sys/cdefs.h? Is there a
better way to detect Newlib that I've overlooked?
Cheers,
Jon
--
Jon Roelofs
jonathan@codesourcery.com
CodeSourcery / Mentor Embedded