2002-06-27 Benjamin Kosnik <bkoz@redhat.com>

* libc/include/stdio.h: Untangle, add _BEGIN_STD_C and _END_STD_C.
        * libc/include/time.h: Same.
        * libc/include/string.h: Same.
        * libc/include/stdlib.h: Same.
        * libc/include/signal.h: Same.
        * libc/include/setjmp.h: Same.
        * libc/include/math.h: Same.
        * libc/include/locale.h: Same.
        * libc/include/ctype.h: Same.
        * libc/include/machine/setjmp.h: Same.
        * libc/include/_ansi.h (_BEGIN_STD_C): Add.
        (_END_STD_C): Add.
This commit is contained in:
Jeff Johnston 2002-06-27 23:58:38 +00:00
parent 533b4e6644
commit c1a3171f2d
12 changed files with 100 additions and 53 deletions

View File

@ -1,3 +1,18 @@
2002-06-27 Benjamin Kosnik <bkoz@redhat.com>
* libc/include/stdio.h: Untangle, add _BEGIN_STD_C and _END_STD_C.
* libc/include/time.h: Same.
* libc/include/string.h: Same.
* libc/include/stdlib.h: Same.
* libc/include/signal.h: Same.
* libc/include/setjmp.h: Same.
* libc/include/math.h: Same.
* libc/include/locale.h: Same.
* libc/include/ctype.h: Same.
* libc/include/machine/setjmp.h: Same.
* libc/include/_ansi.h (_BEGIN_STD_C): Add.
(_END_STD_C): Add.
2002-06-27 Jeff Johnston <jjohnstn@redhat.com> 2002-06-27 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/_types.h: Define _ssize_t as int if int is * libc/include/sys/_types.h: Define _ssize_t as int if int is

View File

@ -74,4 +74,21 @@
#define _ATTRIBUTE(attrs) #define _ATTRIBUTE(attrs)
#endif #endif
/* ISO C++. */
#ifdef __cplusplus
#if !(defined(_BEGIN_STD_C) && defined(_END_STD_C))
#ifdef _HAVE_STD_CXX
#define _BEGIN_STD_C namespace std { extern "C" {
#define _END_STD_C } }
#else
#define _BEGIN_STD_C extern "C" {
#define _END_STD_C }
#endif
#endif
#else
#define _BEGIN_STD_C
#define _END_STD_C
#endif
#endif /* _ANSIDECL_H_ */ #endif /* _ANSIDECL_H_ */

View File

@ -1,11 +1,10 @@
#ifndef _CTYPE_H_ #ifndef _CTYPE_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _CTYPE_H_ #define _CTYPE_H_
#include "_ansi.h" #include "_ansi.h"
_BEGIN_STD_C
int _EXFUN(isalnum, (int __c)); int _EXFUN(isalnum, (int __c));
int _EXFUN(isalpha, (int __c)); int _EXFUN(isalpha, (int __c));
int _EXFUN(iscntrl, (int __c)); int _EXFUN(iscntrl, (int __c));
@ -66,7 +65,6 @@ extern __IMPORT _CONST char _ctype_[];
#define toascii(c) ((c)&0177) #define toascii(c) ((c)&0177)
#endif #endif
#ifdef __cplusplus _END_STD_C
}
#endif
#endif /* _CTYPE_H_ */ #endif /* _CTYPE_H_ */

View File

@ -5,9 +5,6 @@
*/ */
#ifndef _LOCALE_H_ #ifndef _LOCALE_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _LOCALE_H_ #define _LOCALE_H_
#include "_ansi.h" #include "_ansi.h"
@ -24,6 +21,8 @@ extern "C" {
#define LC_TIME 5 #define LC_TIME 5
#define LC_MESSAGES 6 #define LC_MESSAGES 6
_BEGIN_STD_C
struct lconv struct lconv
{ {
char *decimal_point; char *decimal_point;
@ -55,7 +54,6 @@ struct _reent;
char *_EXFUN(_setlocale_r,(struct _reent *, int category, const char *locale)); char *_EXFUN(_setlocale_r,(struct _reent *, int category, const char *locale));
struct lconv *_EXFUN(_localeconv_r,(struct _reent *)); struct lconv *_EXFUN(_localeconv_r,(struct _reent *));
#ifdef __cplusplus _END_STD_C
}
#endif
#endif /* _LOCALE_H_ */ #endif /* _LOCALE_H_ */

View File

@ -1,3 +1,6 @@
_BEGIN_STD_C
#if defined(__arm__) || defined(__thumb__) #if defined(__arm__) || defined(__thumb__)
/* /*
* All callee preserved registers: * All callee preserved registers:
@ -176,9 +179,15 @@ typedef _JBTYPE jmp_buf[_JBLEN];
typedef int jmp_buf[_JBLEN]; typedef int jmp_buf[_JBLEN];
#endif #endif
_END_STD_C
#if defined(__CYGWIN__) || defined(__rtems__) #if defined(__CYGWIN__) || defined(__rtems__)
#include <signal.h> #include <signal.h>
#ifdef __cplusplus
extern "C" {
#endif
/* POSIX sigsetjmp/siglongjmp macros */ /* POSIX sigsetjmp/siglongjmp macros */
typedef int sigjmp_buf[_JBLEN+2]; typedef int sigjmp_buf[_JBLEN+2];
@ -197,5 +206,8 @@ typedef int sigjmp_buf[_JBLEN+2];
sigprocmask (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\ sigprocmask (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
longjmp (env, val)) longjmp (env, val))
#ifdef __cplusplus
}
#endif
#endif /* __CYGWIN__ or __rtems__ */ #endif /* __CYGWIN__ or __rtems__ */
#endif #endif

View File

@ -1,15 +1,14 @@
/* math.h -- Definitions for the math floating point package. */ /* math.h -- Definitions for the math floating point package. */
#ifndef _MATH_H_ #ifndef _MATH_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _MATH_H_ #define _MATH_H_
#include <sys/reent.h> #include <sys/reent.h>
#include <machine/ieeefp.h> #include <machine/ieeefp.h>
#include "_ansi.h" #include "_ansi.h"
_BEGIN_STD_C
#ifndef HUGE_VAL #ifndef HUGE_VAL
/* Define HUGE_VAL as infinity, unless HUGE_VAL is already defined /* Define HUGE_VAL as infinity, unless HUGE_VAL is already defined
@ -359,11 +358,10 @@ extern __IMPORT _CONST _LIB_VERSION_TYPE _LIB_VERSION;
#endif /* ! defined (__STRICT_ANSI__) */ #endif /* ! defined (__STRICT_ANSI__) */
_END_STD_C
#ifdef __FAST_MATH__ #ifdef __FAST_MATH__
#include <machine/fastmath.h> #include <machine/fastmath.h>
#endif #endif
#ifdef __cplusplus
}
#endif
#endif /* _MATH_H_ */ #endif /* _MATH_H_ */

View File

@ -4,19 +4,17 @@
*/ */
#ifndef _SETJMP_H_ #ifndef _SETJMP_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _SETJMP_H_ #define _SETJMP_H_
#include "_ansi.h" #include "_ansi.h"
#include <machine/setjmp.h> #include <machine/setjmp.h>
_BEGIN_STD_C
void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval)); void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval));
int _EXFUN(setjmp,(jmp_buf __jmpb)); int _EXFUN(setjmp,(jmp_buf __jmpb));
#ifdef __cplusplus _END_STD_C
}
#endif
#endif /* _SETJMP_H_ */ #endif /* _SETJMP_H_ */

View File

@ -1,12 +1,11 @@
#ifndef _SIGNAL_H_ #ifndef _SIGNAL_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _SIGNAL_H_ #define _SIGNAL_H_
#include "_ansi.h" #include "_ansi.h"
#include <sys/signal.h> #include <sys/signal.h>
_BEGIN_STD_C
typedef int sig_atomic_t; /* Atomic entity type (ANSI) */ typedef int sig_atomic_t; /* Atomic entity type (ANSI) */
#if defined(__STDC__) || defined(__cplusplus) #if defined(__STDC__) || defined(__cplusplus)
@ -31,7 +30,6 @@ _sig_func_ptr _EXFUN(signal, (int, _sig_func_ptr));
int _EXFUN(raise, (int)); int _EXFUN(raise, (int));
#endif #endif
#ifdef __cplusplus _END_STD_C
}
#endif
#endif /* _SIGNAL_H_ */ #endif /* _SIGNAL_H_ */

View File

@ -24,9 +24,6 @@
*/ */
#ifndef _STDIO_H_ #ifndef _STDIO_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _STDIO_H_ #define _STDIO_H_
#include "_ansi.h" #include "_ansi.h"
@ -48,6 +45,8 @@ extern "C" {
#include <sys/reent.h> #include <sys/reent.h>
#include <sys/types.h> #include <sys/types.h>
_BEGIN_STD_C
typedef _fpos_t fpos_t; typedef _fpos_t fpos_t;
typedef struct __sFILE FILE; typedef struct __sFILE FILE;
@ -385,7 +384,6 @@ static __inline int __sputc(int _c, FILE *_p) {
#endif #endif
#endif #endif
#ifdef __cplusplus _END_STD_C
}
#endif
#endif /* _STDIO_H_ */ #endif /* _STDIO_H_ */

View File

@ -5,9 +5,6 @@
*/ */
#ifndef _STDLIB_H_ #ifndef _STDLIB_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _STDLIB_H_ #define _STDLIB_H_
#include "_ansi.h" #include "_ansi.h"
@ -22,6 +19,8 @@ extern "C" {
#include <alloca.h> #include <alloca.h>
#endif #endif
_BEGIN_STD_C
typedef struct typedef struct
{ {
int quot; /* quotient */ int quot; /* quotient */
@ -176,7 +175,6 @@ int _EXFUN(_system_r,(struct _reent *, const char *));
_VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)); _VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *));
#ifdef __cplusplus _END_STD_C
}
#endif
#endif /* _STDLIB_H_ */ #endif /* _STDLIB_H_ */

View File

@ -7,10 +7,6 @@
#ifndef _STRING_H_ #ifndef _STRING_H_
#define _STRING_H_ #define _STRING_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "_ansi.h" #include "_ansi.h"
#include <sys/reent.h> #include <sys/reent.h>
@ -21,6 +17,8 @@ extern "C" {
#define NULL 0 #define NULL 0
#endif #endif
_BEGIN_STD_C
_PTR _EXFUN(memchr,(const _PTR, int, size_t)); _PTR _EXFUN(memchr,(const _PTR, int, size_t));
int _EXFUN(memcmp,(const _PTR, const _PTR, size_t)); int _EXFUN(memcmp,(const _PTR, const _PTR, size_t));
_PTR _EXFUN(memcpy,(_PTR, const _PTR, size_t)); _PTR _EXFUN(memcpy,(_PTR, const _PTR, size_t));
@ -94,7 +92,6 @@ char *_EXFUN(strsignal, (int __signo));
#endif /* ! __STRICT_ANSI__ */ #endif /* ! __STRICT_ANSI__ */
#ifdef __cplusplus _END_STD_C
}
#endif
#endif /* _STRING_H_ */ #endif /* _STRING_H_ */

View File

@ -10,10 +10,6 @@
#include "_ansi.h" #include "_ansi.h"
#include <sys/reent.h> #include <sys/reent.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef NULL #ifndef NULL
#define NULL 0 #define NULL 0
#endif #endif
@ -32,6 +28,8 @@ extern "C" {
#include <sys/types.h> #include <sys/types.h>
_BEGIN_STD_C
struct tm struct tm
{ {
int tm_sec; int tm_sec;
@ -62,6 +60,12 @@ char *_EXFUN(ctime_r, (const time_t *, char *));
struct tm *_EXFUN(gmtime_r, (const time_t *, struct tm *)); struct tm *_EXFUN(gmtime_r, (const time_t *, struct tm *));
struct tm *_EXFUN(localtime_r, (const time_t *, struct tm *)); struct tm *_EXFUN(localtime_r, (const time_t *, struct tm *));
_END_STD_C
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __STRICT_ANSI__ #ifndef __STRICT_ANSI__
char *_EXFUN(strptime, (const char *, const char *, struct tm *)); char *_EXFUN(strptime, (const char *, const char *, struct tm *));
_VOID _EXFUN(tzset, (_VOID)); _VOID _EXFUN(tzset, (_VOID));
@ -115,12 +119,20 @@ char *_EXFUN(timezone, (void));
#endif /* __CYGWIN__ */ #endif /* __CYGWIN__ */
#endif /* !__STRICT_ANSI__ */ #endif /* !__STRICT_ANSI__ */
#ifdef __cplusplus
}
#endif
#include <sys/features.h> #include <sys/features.h>
#if defined(_POSIX_TIMERS) #if defined(_POSIX_TIMERS)
#include <signal.h> #include <signal.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Clocks, P1003.1b-1993, p. 263 */ /* Clocks, P1003.1b-1993, p. 263 */
int _EXFUN(clock_settime, (clockid_t clock_id, const struct timespec *tp)); int _EXFUN(clock_settime, (clockid_t clock_id, const struct timespec *tp));
@ -148,8 +160,15 @@ int _EXFUN(timer_getoverrun, (timer_t timerid));
int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp)); int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp));
#ifdef __cplusplus
}
#endif
#endif /* _POSIX_TIMERS */ #endif /* _POSIX_TIMERS */
#ifdef __cplusplus
extern "C" {
#endif
/* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */ /* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */
/* values for the clock enable attribute */ /* values for the clock enable attribute */
@ -217,5 +236,6 @@ int _EXFUN(clock_getenable_attr, (clockid_t clock_id, int *attr));
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* _TIME_H_ */ #endif /* _TIME_H_ */