summaryrefslogtreecommitdiff
path: root/contrib/libstdc++/include/c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libstdc++/include/c')
-rw-r--r--contrib/libstdc++/include/c/std_cerrno.h14
-rw-r--r--contrib/libstdc++/include/c/std_cmath.h83
-rw-r--r--contrib/libstdc++/include/c/std_csetjmp.h8
-rw-r--r--contrib/libstdc++/include/c/std_cstdarg.h1
-rw-r--r--contrib/libstdc++/include/c/std_cstddef.h4
-rw-r--r--contrib/libstdc++/include/c/std_cstdio.h43
-rw-r--r--contrib/libstdc++/include/c/std_cwchar.h21
-rw-r--r--contrib/libstdc++/include/c/std_cwctype.h4
8 files changed, 178 insertions, 0 deletions
diff --git a/contrib/libstdc++/include/c/std_cerrno.h b/contrib/libstdc++/include/c/std_cerrno.h
index 93ba868438998..646d609657409 100644
--- a/contrib/libstdc++/include/c/std_cerrno.h
+++ b/contrib/libstdc++/include/c/std_cerrno.h
@@ -31,6 +31,15 @@
// ISO C++ 14882: 19.3 Error numbers
//
+/** @file cerrno
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c errno.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std.
+ */
+
#ifndef _CPP_CERRNO
#define _CPP_CERRNO 1
@@ -38,4 +47,9 @@
#include_next <errno.h>
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef errno
+#define errno errno
+#endif
+
#endif
diff --git a/contrib/libstdc++/include/c/std_cmath.h b/contrib/libstdc++/include/c/std_cmath.h
index 33ac50b9f9ad3..beb7141625cee 100644
--- a/contrib/libstdc++/include/c/std_cmath.h
+++ b/contrib/libstdc++/include/c/std_cmath.h
@@ -36,6 +36,89 @@
#pragma GCC system_header
+#include <bits/c++config.h>
+
#include_next <math.h>
+// Get rid of those macros defined in <math.h> in lieu of real functions.
+#undef abs
+#undef div
+#undef acos
+#undef asin
+#undef atan
+#undef atan2
+#undef ceil
+#undef cos
+#undef cosh
+#undef exp
+#undef fabs
+#undef floor
+#undef fmod
+#undef frexp
+#undef ldexp
+#undef log
+#undef log10
+#undef modf
+#undef pow
+#undef sin
+#undef sinh
+#undef sqrt
+#undef tan
+#undef tanh
+
+#undef fpclassify
+#undef isfinite
+#undef isinf
+#undef isnan
+#undef isnormal
+#undef signbit
+#undef isgreater
+#undef isgreaterequal
+#undef isless
+#undef islessequal
+#undef islessgreater
+#undef isunordered
+
+namespace std
+{
+ inline double
+ abs(double __x)
+ { return __builtin_fabs(__x); }
+
+ inline float
+ abs(float __x)
+ { return __builtin_fabsf(__x); }
+
+ inline long double
+ abs(long double __x)
+ { return __builtin_fabsl(__x); }
+
+#if _GLIBCPP_HAVE_MODFF
+ inline float
+ modf(float __x, float* __iptr) { return modff(__x, __iptr); }
+#else
+ inline float
+ modf(float __x, float* __iptr)
+ {
+ double __tmp;
+ double __res = modf(static_cast<double>(__x), &__tmp);
+ *__iptr = static_cast<float>(__tmp);
+ return __res;
+ }
+#endif
+
+#if _GLIBCPP_HAVE_MODFL
+ inline long double
+ modf(long double __x, long double* __iptr) { return modfl(__x, __iptr); }
+#else
+ inline long double
+ modf(long double __x, long double* __iptr)
+ {
+ double __tmp;
+ double __res = modf(static_cast<double>(__x), &__tmp);
+ * __iptr = static_cast<long double>(__tmp);
+ return __res;
+ }
+#endif
+}
#endif
diff --git a/contrib/libstdc++/include/c/std_csetjmp.h b/contrib/libstdc++/include/c/std_csetjmp.h
index 011907bbaa14a..fe3f9c70bcdda 100644
--- a/contrib/libstdc++/include/c/std_csetjmp.h
+++ b/contrib/libstdc++/include/c/std_csetjmp.h
@@ -38,4 +38,12 @@
#include_next <setjmp.h>
+// Get rid of those macros defined in <setjmp.h> in lieu of real functions.
+#undef longjmp
+
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef setjmp
+#define setjmp(env) std::setjmp (env)
+#endif
+
#endif
diff --git a/contrib/libstdc++/include/c/std_cstdarg.h b/contrib/libstdc++/include/c/std_cstdarg.h
index d2cb544157973..39d019bc1c28d 100644
--- a/contrib/libstdc++/include/c/std_cstdarg.h
+++ b/contrib/libstdc++/include/c/std_cstdarg.h
@@ -36,6 +36,7 @@
#pragma GCC system_header
+#undef __need___va_list
#include_next <stdarg.h>
#endif
diff --git a/contrib/libstdc++/include/c/std_cstddef.h b/contrib/libstdc++/include/c/std_cstddef.h
index da41736ef9ed1..82561cdac7bc3 100644
--- a/contrib/libstdc++/include/c/std_cstddef.h
+++ b/contrib/libstdc++/include/c/std_cstddef.h
@@ -36,6 +36,10 @@
#pragma GCC system_header
+#define __need_size_t
+#define __need_ptrdiff_t
+#define __need_NULL
+#define __need_offsetof
#include_next <stddef.h>
#endif
diff --git a/contrib/libstdc++/include/c/std_cstdio.h b/contrib/libstdc++/include/c/std_cstdio.h
index 542b92414ca23..3d6272aa62e33 100644
--- a/contrib/libstdc++/include/c/std_cstdio.h
+++ b/contrib/libstdc++/include/c/std_cstdio.h
@@ -38,4 +38,47 @@
#include_next <stdio.h>
+// Get rid of those macros defined in <stdio.h> in lieu of real functions.
+#undef clearerr
+#undef fclose
+#undef feof
+#undef ferror
+#undef fflush
+#undef fgetc
+#undef fgetpos
+#undef fgets
+#undef fopen
+#undef fprintf
+#undef fputc
+#undef fputs
+#undef fread
+#undef freopen
+#undef fscanf
+#undef fseek
+#undef fsetpos
+#undef ftell
+#undef fwrite
+#undef getc
+#undef getchar
+#undef gets
+#undef perror
+#undef printf
+#undef putc
+#undef putchar
+#undef puts
+#undef remove
+#undef rename
+#undef rewind
+#undef scanf
+#undef setbuf
+#undef setvbuf
+#undef sprintf
+#undef sscanf
+#undef tmpfile
+#undef tmpnam
+#undef ungetc
+#undef vfprintf
+#undef vprintf
+#undef vsprintf
+
#endif
diff --git a/contrib/libstdc++/include/c/std_cwchar.h b/contrib/libstdc++/include/c/std_cwchar.h
index f9dfbadb9bad6..d06f5e4efcd7d 100644
--- a/contrib/libstdc++/include/c/std_cwchar.h
+++ b/contrib/libstdc++/include/c/std_cwchar.h
@@ -36,6 +36,27 @@
#pragma GCC system_header
+#include <bits/c++config.h>
+#include <cstddef>
+#include <ctime>
+
+#if _GLIBCPP_HAVE_WCHAR_H
#include_next <wchar.h>
+#endif
+
+// Need to do a bit of trickery here with mbstate_t as char_traits
+// assumes it is in wchar.h, regardless of wchar_t specializations.
+#ifndef _GLIBCPP_HAVE_MBSTATE_T
+namespace std
+{
+ extern "C"
+ {
+ typedef struct
+ {
+ int __fill[6];
+ } mbstate_t;
+ }
+}
+#endif
#endif
diff --git a/contrib/libstdc++/include/c/std_cwctype.h b/contrib/libstdc++/include/c/std_cwctype.h
index ef6b44bd97a39..d51569843a670 100644
--- a/contrib/libstdc++/include/c/std_cwctype.h
+++ b/contrib/libstdc++/include/c/std_cwctype.h
@@ -36,6 +36,10 @@
#pragma GCC system_header
+#include <bits/c++config.h>
+
+#if _GLIBCPP_HAVE_WCTYPE_H
#include_next <wctype.h>
+#endif
#endif