2012-09-28 18:36:46 -04:00
|
|
|
/*******************************************************************************
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-03-22 13:47:38 -04:00
|
|
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
This file is part of the Sortix C Library.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
option) any later version.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
features.h
|
|
|
|
Various things for various systems, programs, compabillity, and whatnot.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2012-09-28 18:36:46 -04:00
|
|
|
*******************************************************************************/
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-04-21 16:46:44 -04:00
|
|
|
#ifndef _FEATURES_H
|
|
|
|
#define _FEATURES_H 1
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-03-22 13:47:38 -04:00
|
|
|
/* Support macro to ease testing the compiler version. */
|
|
|
|
#define __GCC_PREREQ(gcc_major, gcc_minor) \
|
|
|
|
(((gcc_major) == __GNUC__ && (gcc_minor) >= __GNUC_MINOR__) || \
|
|
|
|
((gcc_major) < __GNUC__))
|
|
|
|
|
|
|
|
/* Preprocessor trick to turn anything into a string. */
|
|
|
|
#define __STRINGIFY(x) #x
|
|
|
|
|
|
|
|
/* Issue warning when this is used, except in defines, where the warning is
|
|
|
|
inserted whenever the macro is expanded. This can be used to deprecated
|
|
|
|
macros - and it happens on preprocessor level - so it shouldn't change any
|
|
|
|
semantics of any code that uses such a macro. The argument msg should be a
|
|
|
|
string that contains the warning. */
|
|
|
|
#define __PRAGMA_WARNING(msg) _Pragma(__STRINGIFY(GCC warning msg))
|
|
|
|
|
2011-08-05 08:25:00 -04:00
|
|
|
/* C++ needs to know that types and declarations are C, not C++. */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define __BEGIN_DECLS extern "C" {
|
|
|
|
#define __END_DECLS }
|
|
|
|
#else
|
|
|
|
#define __BEGIN_DECLS
|
|
|
|
#define __END_DECLS
|
|
|
|
#endif
|
|
|
|
|
2013-03-19 18:28:32 -04:00
|
|
|
/* Sortix system components implicitly use the native API. */
|
|
|
|
#if defined(LIBC_LIBRARY) || defined(SORTIX_KERNEL)
|
|
|
|
#define _SORTIX_SOURCE 1
|
|
|
|
#endif
|
|
|
|
|
2012-02-11 12:50:12 -05:00
|
|
|
/* By default, assume the source is compiled using the native API. */
|
|
|
|
#if !defined(_SORTIX_SOURCE) && \
|
|
|
|
!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
|
|
|
|
!defined(_BSD_SOURCE) && \
|
|
|
|
!defined(_SVID_SOURCE) && \
|
|
|
|
!defined(_XOPEN_SOURCE) && !defined(_XOPEN_SOURCE_EXTENDED) && \
|
|
|
|
!defined(_GNU_SOURCE) && \
|
2012-02-11 20:03:34 -05:00
|
|
|
1
|
2012-02-11 12:50:12 -05:00
|
|
|
#define _SORTIX_SOURCE 1
|
|
|
|
#endif
|
|
|
|
|
2012-02-12 19:07:02 -05:00
|
|
|
/* Whether to override some "standard" functions with Sortix alternatives. */
|
|
|
|
#if !defined(__SORTIX_STDLIB_REDIRECTS)
|
|
|
|
#if defined(_SORTIX_SOURCE)
|
|
|
|
#define __SORTIX_STDLIB_REDIRECTS 1
|
|
|
|
#else
|
|
|
|
#define __SORTIX_STDLIB_REDIRECTS 0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2013-02-21 06:00:57 -05:00
|
|
|
#ifndef restrict
|
2012-01-07 19:59:22 -05:00
|
|
|
#define restrict
|
2013-02-21 06:00:57 -05:00
|
|
|
#endif
|
2012-01-07 19:59:22 -05:00
|
|
|
|
2012-02-11 12:50:12 -05:00
|
|
|
/* TODO: Improve these declarations, perhaps like they are in glibc. */
|
2011-08-05 08:25:00 -04:00
|
|
|
#define __POSIX_NO_OBSOLETE
|
|
|
|
|
|
|
|
#ifdef __POSIX_NO_OBSOLETE
|
|
|
|
#define __POSIX_OBSOLETE 999999L
|
|
|
|
#else
|
|
|
|
#define __POSIX_OBSOLETE 200112L
|
|
|
|
#endif
|
|
|
|
|
2013-03-08 12:16:36 -05:00
|
|
|
#define __pure2 __attribute__((__const__))
|
|
|
|
|
2011-11-24 04:26:36 -05:00
|
|
|
/* Don't provide things from standard headers that is not implemented. */
|
2012-02-11 12:50:12 -05:00
|
|
|
/*#define __SORTIX_SHOW_UNIMPLEMENTED*/
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-01-15 19:45:51 -05:00
|
|
|
#if !defined(_LIBC_HACK_FEATURE_NO_DECLARATIONS)
|
|
|
|
|
2011-11-24 04:26:36 -05:00
|
|
|
#include <sortix/bits.h>
|
2013-01-15 19:45:51 -05:00
|
|
|
#include <sys/__/types.h>
|
|
|
|
|
|
|
|
#endif
|
2011-11-24 04:26:36 -05:00
|
|
|
|
2013-01-15 19:45:51 -05:00
|
|
|
#undef _LIBC_HACK_FEATURE_NO_DECLARATIONS
|
2011-11-24 04:26:36 -05:00
|
|
|
|
2011-08-05 08:25:00 -04:00
|
|
|
#endif
|