aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/alloca.h3
-rw-r--r--include/assert.h4
-rw-r--r--include/bits/types.h2
-rw-r--r--include/ctype.h4
-rw-r--r--include/err.h4
-rw-r--r--include/errno.h4
-rw-r--r--include/error.h4
-rw-r--r--include/iso646.h1
-rw-r--r--include/malloc.h10
-rw-r--r--include/obstack.h4
-rw-r--r--include/slibc-alloc.h3
-rw-r--r--include/slibc-error.h4
-rw-r--r--include/slibc/features.h8
-rw-r--r--include/stdalign.h2
-rw-r--r--include/stdarg.h1
-rw-r--r--include/stdbool.h1
-rw-r--r--include/stddef.h1
-rw-r--r--include/stdint.h3
-rw-r--r--include/stdlib.h2
-rw-r--r--include/stdnoreturn.h2
-rw-r--r--include/string.h18
-rw-r--r--include/strings.h4
-rw-r--r--include/unistd.h2
-rw-r--r--include/wchar.h20
24 files changed, 53 insertions, 58 deletions
diff --git a/include/alloca.h b/include/alloca.h
index 3ef962b..68e50bf 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -17,8 +17,9 @@
*/
#ifndef _ALLOCA_H
#define _ALLOCA_H
-#ifndef _PORTABLE_SOURCE
#include <slibc/version.h>
+#include <slibc/features.h>
+#ifndef __PORTABLE
diff --git a/include/assert.h b/include/assert.h
index 1e351bd..6315ae1 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -18,8 +18,6 @@
#ifndef _ASSERT_H
#define _ASSERT_H
#include <slibc/version.h>
-
-
#include <slibc/features.h>
@@ -58,7 +56,7 @@
#define static_assert _Static_assert
-#ifndef _PORTABLE_SOURCE
+#ifndef __PORTABLE
/**
* Unless `NDEBUG` is defined, print an error message
* and abort the process, if `errnum` is non-zero.
diff --git a/include/bits/types.h b/include/bits/types.h
index 58c6064..e594e44 100644
--- a/include/bits/types.h
+++ b/include/bits/types.h
@@ -54,7 +54,7 @@ typedef unsigned long int uptrdiff_t;
#endif
-#ifndef _PORTABLE_SOURCE
+#ifndef __PORTABLE
/**
* Integer type which can represent any character.
* May not be greater than the with of type long.
diff --git a/include/ctype.h b/include/ctype.h
index 9d4addc..f01ad57 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -18,6 +18,7 @@
#ifndef _CTYPE_H
#define _CTYPE_H
#include <slibc/version.h>
+#include <slibc/features.h>
#ifndef _SLIBC_SUPPRESS_WARNINGS
# warning "Functions in <ctype.h>, 'isascii' and 'toascii', only support ASCII."
@@ -25,9 +26,6 @@
#endif
-#include <slibc/features.h>
-
-
/**
* Check whether a character is an alphabetical
diff --git a/include/err.h b/include/err.h
index 9c28533..6e9b828 100644
--- a/include/err.h
+++ b/include/err.h
@@ -17,15 +17,15 @@
*/
#ifndef _ERR_H
#define _ERR_H
-#ifndef _PORTABLE_SOURCE
#include <slibc/version.h>
+#include <slibc/features.h>
+#ifndef __PORTABLE
#ifndef _SLIBC_SUPPRESS_WARNINGS
# warning "Please consider not using <err.h>."
#endif
-#include <slibc/features.h>
#include <stdarg.h>
diff --git a/include/errno.h b/include/errno.h
index a1cc191..9344a8a 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -18,9 +18,9 @@
#ifndef _ERRNO_H
#define _ERRNO_H
#include <slibc/version.h>
+#include <slibc/features.h>
-#include <slibc/features.h>
/* TODO include error definitions */
@@ -41,7 +41,7 @@
volatile int* __errno(void) __GCC_ONLY(__attribute__((const))); /* TODO not implemented */
-#ifndef _PORTABLE_SOURCE
+#ifndef __PORTABLE
/**
* This is the name that was used to invoke the program
* running in the current process. This is the value
diff --git a/include/error.h b/include/error.h
index 36cdacc..f38ee44 100644
--- a/include/error.h
+++ b/include/error.h
@@ -17,8 +17,9 @@
*/
#ifndef _ERROR_H
#define _ERROR_H
-#ifndef _PORTABLE_SOURCE
#include <slibc/version.h>
+#include <slibc/features.h>
+#ifndef __PORTABLE
#ifndef _SLIBC_SUPPRESS_WARNINGS
# warning "Please consider not using <error.h>."
@@ -26,7 +27,6 @@
#include <slibc/features.h>
-#include <stdarg.h>
diff --git a/include/iso646.h b/include/iso646.h
index 557b0a8..c0c7a51 100644
--- a/include/iso646.h
+++ b/include/iso646.h
@@ -18,6 +18,7 @@
#ifndef _ISO646_H
#define _ISO646_H
#include <slibc/version.h>
+#include <slibc/features.h>
#ifndef _SLIBC_SUPPRESS_WARNINGS
# warning "Please consider not using <iso646.h>, is really not good for readability."
diff --git a/include/malloc.h b/include/malloc.h
index ab8e0a9..56a6174 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -18,8 +18,6 @@
#ifndef _MALLOC_H
#define _MALLOC_H
#include <slibc/version.h>
-
-
#include <slibc/features.h>
@@ -112,13 +110,13 @@ void free(void*)
* beginning of a memory allocation on the heap.
* However, if it is `NULL`, nothing will happen.
*/
-#ifndef _PORTABLE_SOURCE
+#ifndef __PORTABLE
void cfree(void*, ...)
__deprecated("'cfree' is deprecated and not portable, use 'free' instead.");
#endif
-#ifndef _PORTABLE_SOURCE
+#ifndef __PORTABLE
/**
* Variant of `malloc` that returns an address with a
* specified alignment.
@@ -169,7 +167,7 @@ void* memalign(size_t, size_t)
int posix_memalign(void**, size_t, size_t)
__GCC_ONLY(__attribute__((nonnull)));
-#ifndef _PORTABLE_SOURCE
+#ifndef __PORTABLE
/**
* `valloc(n)` is equivalent to `memalign(sysconf(_SC_PAGESIZE), n)`.
*
@@ -241,7 +239,7 @@ void* aligned_alloc(size_t, size_t)
#endif
-#if defined(_GNU_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_GNU_SOURCE) && !defined(__PORTABLE)
/**
* This function returns the allocation size of
* a memory segment.
diff --git a/include/obstack.h b/include/obstack.h
index 947e991..da1acc3 100644
--- a/include/obstack.h
+++ b/include/obstack.h
@@ -17,11 +17,9 @@
*/
#ifndef _OBSTACK_H
#define _OBSTACK_H
-#ifndef _PORTABLE_SOURCE
#include <slibc/version.h>
-
-
#include <slibc/features.h>
+#ifndef __PORTABLE
diff --git a/include/slibc-alloc.h b/include/slibc-alloc.h
index b230f16..d792ebc 100644
--- a/include/slibc-alloc.h
+++ b/include/slibc-alloc.h
@@ -17,8 +17,9 @@
*/
#ifndef _SLIBC_ALLOC_H
#define _SLIBC_ALLOC_H
-#ifndef _PORTABLE_SOURCE
#include <slibc/version.h>
+#include <slibc/features.h>
+#ifndef __PORTABLE
diff --git a/include/slibc-error.h b/include/slibc-error.h
index 6232aab..086ad31 100644
--- a/include/slibc-error.h
+++ b/include/slibc-error.h
@@ -17,11 +17,11 @@
*/
#ifndef _SLIBC_ERROR_H
#define _SLIBC_ERROR_H
-#ifndef _PORTABLE_SOURCE
#include <slibc/version.h>
+#include <slibc/features.h>
+#ifndef __PORTABLE
-#include <slibc/features.h>
#include <stdarg.h>
#include <errno.h>
diff --git a/include/slibc/features.h b/include/slibc/features.h
index ba91975..7363215 100644
--- a/include/slibc/features.h
+++ b/include/slibc/features.h
@@ -23,6 +23,14 @@
/**
+ * Macro that is defined if portability shall be ensured.
+ */
+#if defined(_PORTABLE_SOURCE) || defined(_LIBRARY_HEADER)
+# define __PORTABLE
+#endif
+
+
+/**
* Is C11, or newer, used?
*/
#if __STDC_VERSION__ >= 201112L || defined(_ISOC11_SOURCE)
diff --git a/include/stdalign.h b/include/stdalign.h
index b247b2c..905b963 100644
--- a/include/stdalign.h
+++ b/include/stdalign.h
@@ -18,8 +18,6 @@
#ifndef _STDALIGN_H
#define _STDALIGN_H
#include <slibc/version.h>
-
-
#include <slibc/features.h>
diff --git a/include/stdarg.h b/include/stdarg.h
index 577f26a..84bc840 100644
--- a/include/stdarg.h
+++ b/include/stdarg.h
@@ -18,6 +18,7 @@
#ifndef _STDARG_H
#define _STDARG_H
#include <slibc/version.h>
+#include <slibc/features.h>
#include <bits/stdarg.h>
diff --git a/include/stdbool.h b/include/stdbool.h
index 3025899..794be99 100644
--- a/include/stdbool.h
+++ b/include/stdbool.h
@@ -18,6 +18,7 @@
#ifndef _STDBOOL_H
#define _STDBOOL_H
#include <slibc/version.h>
+#include <slibc/features.h>
diff --git a/include/stddef.h b/include/stddef.h
index 0e10989..26286f5 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -18,6 +18,7 @@
#ifndef _STDDEF_H
#define _STDDEF_H
#include <slibc/version.h>
+#include <slibc/features.h>
diff --git a/include/stdint.h b/include/stdint.h
index a8cb426..d9e0dcd 100644
--- a/include/stdint.h
+++ b/include/stdint.h
@@ -18,6 +18,7 @@
#ifndef _STDINT_H
#define _STDINT_H
#include <slibc/version.h>
+#include <slibc/features.h>
@@ -376,7 +377,7 @@
#define SSIZE_MIN INTPTR_MIN
-#ifndef _PORTABLE_SOURCE
+#ifndef __PORTABLE
/**
* Maximum value of `wchar_t`.
*/
diff --git a/include/stdlib.h b/include/stdlib.h
index 5ac4e7c..3151947 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -18,9 +18,9 @@
#ifndef _STDLIB_H
#define _STDLIB_H
#include <slibc/version.h>
+#include <slibc/features.h>
-#include <slibc/features.h>
#include <malloc.h>
diff --git a/include/stdnoreturn.h b/include/stdnoreturn.h
index 19c6016..3260cf2 100644
--- a/include/stdnoreturn.h
+++ b/include/stdnoreturn.h
@@ -18,8 +18,6 @@
#ifndef _STDNORETURN_H
#define _STDNORETURN_H
#include <slibc/version.h>
-
-
#include <slibc/features.h>
diff --git a/include/string.h b/include/string.h
index 09bdc5e..5891dbb 100644
--- a/include/string.h
+++ b/include/string.h
@@ -18,8 +18,6 @@
#ifndef _STRING_H
#define _STRING_H
#include <slibc/version.h>
-
-
#include <slibc/features.h>
@@ -73,7 +71,7 @@ char* strerror_l(int, locale_t)
__GCC_ONLY(__attribute__((warn_unused_result)));
-#if !defined(_PORTABLE_SOURCE) && !defined(_SLIBC_SOURCE)
+#if !defined(__PORTABLE) && !defined(_SLIBC_SOURCE)
/**
* Reenterant variant of `strerror`.
*
@@ -131,7 +129,7 @@ size_t strlen(const char*)
#if (defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || \
defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || \
- defined(_BSD_SOURCE)) && !defined(_PORTABLE_SOURCE)
+ defined(_BSD_SOURCE)) && !defined(__PORTABLE)
/**
* Variant of `strlen` that only inspects the
* beginning of s string.
@@ -167,7 +165,7 @@ void* memset(void*, int, size_t);
*/
void* memcpy(void* restrict, const void* restrict, size_t);
-#if defined(_GNU_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_GNU_SOURCE) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, non-overlapping, segment.
*
@@ -222,7 +220,7 @@ void* mempmove(void*, const void*, size_t);
*/
void* memccpy(void* restrict, const void* restrict, int, size_t);
-#if defined(_SLIBC_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_SLIBC_SOURCE) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, possibly overlapping, segment,
* but stop if a specific byte is encountered.
@@ -264,7 +262,7 @@ char* strcpy(char* restrict, const char* restrict)
char* stpcpy(char* restrict, const char* restrict)
__GCC_ONLY(__attribute__((returns_nonnull, nonnull)));
-#if defined(_SLIBC_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_SLIBC_SOURCE) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, non-overlapping, segment,
* stop when a NUL byte or a specified byte is encountered.
@@ -321,7 +319,7 @@ char* strstrcpy(char* restrict, const char* restrict, const char* restrict)
char* strncpy(char* restrict, const char* restrict, size_t)
__GCC_ONLY(__attribute__((returns_nonnull, nonnull)));
-#if defined(_GNU_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_GNU_SOURCE) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, non-overlapping, segment,
* stop when a NUL byte is encountered.
@@ -397,7 +395,7 @@ char* strstrncpy(char* restrict, const char* restrict, const char* restrict, siz
# endif
#endif
-#if defined(_SLIBC_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_SLIBC_SOURCE) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, possibly overlapping, segment,
* stop when a NUL byte is encountered.
@@ -604,7 +602,7 @@ char* strncat(char* restrict, const char* restrict, size_t)
char* strdup(const char*)
__GCC_ONLY(__attribute__((malloc, nonnull, warn_unused_result)));
-#if !defined(_PORTABLE_SOURCE)
+#if !defined(__PORTABLE)
# if defined(_GNU_SOURCE)
/**
* Duplicate a string.
diff --git a/include/strings.h b/include/strings.h
index 505e8ec..0a4bc5e 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -18,8 +18,6 @@
#ifndef _STRINGS_H
#define _STRINGS_H
#include <slibc/version.h>
-
-
#include <slibc/features.h>
@@ -39,7 +37,7 @@
void bzero(void*, size_t)
__deprecated("Use 'memset', 'explicit_bzero' or 'secure_free' instead.");
-#if !defined(_PORTABLE_SOURCE) && (defined(_SLIBC_SOURCE) || defined(_BSD_SOURCE))
+#if !defined(__PORTABLE) && (defined(_SLIBC_SOURCE) || defined(_BSD_SOURCE))
/**
* Override a memory segment with zeroes.
*
diff --git a/include/unistd.h b/include/unistd.h
index cbc6b2d..b2831f5 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -18,8 +18,6 @@
#ifndef _UNISTD_H
#define _UNISTD_H
#include <slibc/version.h>
-
-
#include <slibc/features.h>
diff --git a/include/wchar.h b/include/wchar.h
index d00056e..34c066e 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -17,11 +17,9 @@
*/
#ifndef _WCHAR_H
#define _WCHAR_H
-#ifndef _PORTABLE_SOURCE /* `wchar_t` is not portable. */
#include <slibc/version.h>
-
-
#include <slibc/features.h>
+#ifndef __PORTABLE /* `wchar_t` is not portable. */
@@ -43,7 +41,7 @@ size_t wcslen(const wchar_t*)
#if (defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || \
defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || \
- defined(_BSD_SOURCE)) && !defined(_PORTABLE_SOURCE)
+ defined(_BSD_SOURCE)) && !defined(__PORTABLE)
/**
* `wchar_t` version of `strnlen`.
*
@@ -79,7 +77,7 @@ wchar_t* wmemset(wchar_t*, wchar_t, size_t);
*/
wchar_t* wmemcpy(wchar_t* restrict, const wchar_t* restrict, size_t);
-#if defined(_GNU_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_GNU_SOURCE) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, non-overlapping, segment.
*
@@ -120,7 +118,7 @@ wchar_t* wmempmove(wchar_t*, const wchar_t*, size_t);
# endif
#endif
-#if defined(_SLIBC_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_SLIBC_SOURCE) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, non-overlapping, segment,
* but stop if a specific character is encountered.
@@ -169,7 +167,7 @@ wchar_t* wmemcmove(wchar_t*, const wchar_t*, wchar_t, size_t);
wchar_t* wcscpy(wchar_t* restrict, const wchar_t* restrict)
__GCC_ONLY(__attribute__((returns_nonnull, nonnull)));
-#if (defined(_SLIBC_SOURCE) || defined(_GNU_SOURCE)) && !defined(_PORTABLE_SOURCE)
+#if (defined(_SLIBC_SOURCE) || defined(_GNU_SOURCE)) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, non-overlapping, segment,
* stop when a NUL wide character is encountered.
@@ -184,7 +182,7 @@ wchar_t* wcpcpy(wchar_t* restrict, const wchar_t* restrict)
__GCC_ONLY(__attribute__((returns_nonnull, nonnull)));
#endif
-#if defined(_SLIBC_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_SLIBC_SOURCE) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, non-overlapping, segment,
* stop when a NUL wide character or a specified wide character
@@ -242,7 +240,7 @@ wchar_t* wcswcscpy(wchar_t* restrict, const wchar_t* restrict, const wchar_t* re
wchar_t* wcsncpy(wchar_t* restrict, const wchar_t* restrict, size_t)
__GCC_ONLY(__attribute__((returns_nonnull, nonnull)));
-#if defined(_GNU_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_GNU_SOURCE) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, non-overlapping, segment,
* stop when a NUL wide character is encountered.
@@ -319,7 +317,7 @@ wchar_t* wcswcsncpy(wchar_t* restrict, const wchar_t* restrict, const wchar_t* r
# endif
#endif
-#if defined(_SLIBC_SOURCE) && !defined(_PORTABLE_SOURCE)
+#if defined(_SLIBC_SOURCE) && !defined(__PORTABLE)
/**
* Copy a memory segment to another, possibly overlapping, segment,
* stop when a NUL wide character is encountered.
@@ -516,7 +514,7 @@ wchar_t* wcsncat(wchar_t* restrict whither, const wchar_t* restrict whence, size
/* wcpncat does not exsits because use of it would be very inefficient. */
-#if !defined(_PORTABLE_SOURCE)
+#if !defined(__PORTABLE)
/**
* Duplicate a string.
*