diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 52c9a00fe..c5b258364 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,18 @@ +2009-12-17 Jerker Back + + * libc/include/_ansi.h: Add new _EXFNPTR macro for using with + function pointer arguments. + * libc/iconv/lib/conv.h: Use _EXFNPTR rather than _EXPARM macro. + * libc/iconv/lib/ucsconv.h: Ditto. + * libc/include/stdlib.h: Use new _EXFNPTR macro for function pointers. + * libc/include/sys/reent.h: Ditto. + * libc/include/sys/unistd.h: Ditto. + * libc/search/bsearch.c: Ditto. + * libc/stdio/fseek.c: Ditto. + * libc/stdio64/fseeko64.c: Ditto. + * libc/stdlib/atexit.c: Ditto. + * libc/stdlib/on_exit.c: Ditto. + 2009-12-17 Ralf Corsépius * libc/include/machine/ieeefp.h: Rework __IEEE_*_ENDIAN handling. diff --git a/newlib/libc/iconv/lib/conv.h b/newlib/libc/iconv/lib/conv.h index 03c7c119d..550f44949 100644 --- a/newlib/libc/iconv/lib/conv.h +++ b/newlib/libc/iconv/lib/conv.h @@ -63,7 +63,7 @@ typedef struct * Pointer to conversion-specific data if success. In case of error * returns NULL and sets current thread's/process's errno. */ - _VOID_PTR _EXPARM(open, (struct _reent *rptr, + _VOID_PTR _EXFNPTR(open, (struct _reent *rptr, _CONST char *to, _CONST char *from)); @@ -81,7 +81,7 @@ typedef struct * When successful, returns (size_t)0. In case of error, sets current * thread's/process's errno and returns (size_t)-1 (same as iconv_open()). */ - size_t _EXPARM(close, (struct _reent *rptr, + size_t _EXFNPTR(close, (struct _reent *rptr, _VOID_PTR data)); /* convert - perform encoding conversion. @@ -114,7 +114,7 @@ typedef struct * Reversible conversions are not counted. In case of error, sets current * thread's/process's errno and returns (size_t)-1 (same as iconv()). */ - size_t _EXPARM(convert, (struct _reent *rptr, + size_t _EXFNPTR(convert, (struct _reent *rptr, _VOID_PTR data, _CONST unsigned char **inbuf, size_t *inbytesleft, @@ -135,7 +135,7 @@ typedef struct * If 'direction' is 0, "from" encoding is tested, else * "to" encoding is tested. */ - _VOID _EXPARM(get_state, (_VOID_PTR data, + _VOID _EXFNPTR(get_state, (_VOID_PTR data, mbstate_t *state, int direction)); @@ -154,7 +154,7 @@ typedef struct * "to" encoding is set. * Returns 0 if '*state' object has right format, -1 else. */ - int _EXPARM(set_state, (_VOID_PTR data, + int _EXFNPTR(set_state, (_VOID_PTR data, mbstate_t *state, int direction)); @@ -170,7 +170,7 @@ typedef struct * If 'direction' is 0, "from" encoding is tested, else * "to" encoding is tested. */ - int _EXPARM(get_mb_cur_max, (_VOID_PTR data, + int _EXFNPTR(get_mb_cur_max, (_VOID_PTR data, int direction)); /* @@ -185,7 +185,7 @@ typedef struct * If 'direction' is 0, "from" encoding is tested, else * "to" encoding is tested. */ - int _EXPARM(is_stateful, (_VOID_PTR data, + int _EXFNPTR(is_stateful, (_VOID_PTR data, int direction)); } iconv_conversion_handlers_t; diff --git a/newlib/libc/iconv/lib/ucsconv.h b/newlib/libc/iconv/lib/ucsconv.h index 3c39f39d3..4bf7174bf 100644 --- a/newlib/libc/iconv/lib/ucsconv.h +++ b/newlib/libc/iconv/lib/ucsconv.h @@ -68,7 +68,7 @@ typedef struct * Returns CES-specific data pointer if success. In case of error returns * NULL and sets current thread's/process's errno. */ - _VOID_PTR _EXPARM(init, (struct _reent *rptr, + _VOID_PTR _EXFNPTR(init, (struct _reent *rptr, _CONST char *encoding)); /* @@ -84,7 +84,7 @@ typedef struct * Returns (size_t)0 if success. In case of error returns (size_t)-1 and * sets current thread's/process's errno. */ - size_t _EXPARM(close, (struct _reent *rptr, + size_t _EXFNPTR(close, (struct _reent *rptr, _VOID_PTR data)); /* @@ -96,7 +96,7 @@ typedef struct * DESCRIPTION: * Returns encoding's maximum character length. */ - int _EXPARM(get_mb_cur_max, (_VOID_PTR data)); + int _EXFNPTR(get_mb_cur_max, (_VOID_PTR data)); /* * get_state - get current shift state. @@ -108,7 +108,7 @@ typedef struct * DESCRIPTION: * Returns encoding's current shift sequence. */ - _VOID _EXPARM(get_state, (_VOID_PTR data, + _VOID _EXFNPTR(get_state, (_VOID_PTR data, mbstate_t *state)); /* @@ -123,7 +123,7 @@ typedef struct * object is zero-object - reset current shift state. * Returns 0 if '*state' object has right format, -1 else. */ - int _EXPARM(set_state, (_VOID_PTR data, + int _EXFNPTR(set_state, (_VOID_PTR data, mbstate_t *state)); /* @@ -135,7 +135,7 @@ typedef struct * DESCRIPTION: * Returns 0 if encoding is stateless, else returns 1. */ - int _EXPARM(is_stateful, (_VOID_PTR data)); + int _EXFNPTR(is_stateful, (_VOID_PTR data)); /* * convert_to_ucs - convert character to UCS. @@ -155,7 +155,7 @@ typedef struct * returns ICONV_CES_INVALID_CHARACTER. If invalid or incomplete bytes * sequence was met, returns ICONV_CES_BAD_SEQUENCE. */ - ucs4_t _EXPARM(convert_to_ucs, (_VOID_PTR data, + ucs4_t _EXFNPTR(convert_to_ucs, (_VOID_PTR data, _CONST unsigned char **inbuf, size_t *inbytesleft)); } iconv_to_ucs_ces_handlers_t; @@ -172,26 +172,26 @@ typedef struct typedef struct { /* Same as in iconv_to_ucs_ces_handlers_t */ - _VOID_PTR _EXPARM(init, (struct _reent *rptr, + _VOID_PTR _EXFNPTR(init, (struct _reent *rptr, _CONST char *encoding)); /* Same as in iconv_to_ucs_ces_handlers_t */ - size_t _EXPARM(close, (struct _reent *rptr, + size_t _EXFNPTR(close, (struct _reent *rptr, _VOID_PTR data)); /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXPARM(get_mb_cur_max, (_VOID_PTR data)); + int _EXFNPTR(get_mb_cur_max, (_VOID_PTR data)); /* Same as in iconv_to_ucs_ces_handlers_t */ - _VOID _EXPARM(get_state, (_VOID_PTR data, + _VOID _EXFNPTR(get_state, (_VOID_PTR data, mbstate_t *state)); /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXPARM(set_state, (_VOID_PTR data, + int _EXFNPTR(set_state, (_VOID_PTR data, mbstate_t *state)); /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXPARM(is_stateful, (_VOID_PTR data)); + int _EXFNPTR(is_stateful, (_VOID_PTR data)); /* * convert_from_ucs - convert UCS character to destination encoding. @@ -215,7 +215,7 @@ typedef struct * If there is no corresponding character in destination encoding, returns * ICONV_CES_INVALID_CHARACTER. */ - size_t _EXPARM(convert_from_ucs, (_VOID_PTR data, + size_t _EXFNPTR(convert_from_ucs, (_VOID_PTR data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft)); diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index 5b2da4e4b..e584ec385 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -61,10 +61,12 @@ #define _EXFUN_NOTHROW(name, proto) __cdecl name proto _NOTHROW #define _EXFUN(name, proto) __cdecl name proto #define _EXPARM(name, proto) (* __cdecl name) proto +#define _EXFNPTR(name, proto) (__cdecl * name) proto #else #define _EXFUN_NOTHROW(name, proto) name proto _NOTHROW #define _EXFUN(name, proto) name proto #define _EXPARM(name, proto) (* name) proto +#define _EXFNPTR(name, proto) (* name) proto #endif #define _DEFUN(name, arglist, args) name(args) #define _DEFUN_VOID(name) name(_NOARGS) diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index ed39546ee..82a2207f5 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -74,7 +74,7 @@ _PTR _EXFUN(bsearch,(const _PTR __key, const _PTR __base, size_t __nmemb, size_t __size, - int _EXPARM(_compar,(const _PTR, const _PTR)))); + int _EXFNPTR(_compar,(const _PTR, const _PTR)))); _PTR _EXFUN_NOTHROW(calloc,(size_t __nmemb, size_t __size)); div_t _EXFUN(div,(int __numer, int __denom)); _VOID _EXFUN(exit,(int __status) _ATTRIBUTE ((noreturn))); diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index ed3d9aa01..12ac6b216 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -182,12 +182,12 @@ struct __sFILE { /* operations */ _PTR _cookie; /* cookie passed to io functions */ - _READ_WRITE_RETURN_TYPE _EXFUN((*_read),(struct _reent *, _PTR, + _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR, char *, int)); - _READ_WRITE_RETURN_TYPE _EXFUN((*_write),(struct _reent *, _PTR, + _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR, const char *, int)); - _fpos_t _EXFUN((*_seek),(struct _reent *, _PTR, _fpos_t, int)); - int _EXFUN((*_close),(struct _reent *, _PTR)); + _fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int)); + int _EXFNPTR(_close, (struct _reent *, _PTR)); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ @@ -237,12 +237,12 @@ struct __sFILE64 { /* operations */ _PTR _cookie; /* cookie passed to io functions */ - _READ_WRITE_RETURN_TYPE _EXFUN((*_read),(struct _reent *, _PTR, + _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR, char *, int)); - _READ_WRITE_RETURN_TYPE _EXFUN((*_write),(struct _reent *, _PTR, + _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR, const char *, int)); - _fpos_t _EXFUN((*_seek),(struct _reent *, _PTR, _fpos_t, int)); - int _EXFUN((*_close),(struct _reent *, _PTR)); + _fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int)); + int _EXFNPTR(_close, (struct _reent *, _PTR)); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ @@ -261,7 +261,7 @@ struct __sFILE64 { int _flags2; /* for future use */ _off64_t _offset; /* current lseek offset */ - _fpos64_t _EXFUN((*_seek64),(struct _reent *, _PTR, _fpos64_t, int)); + _fpos64_t _EXFNPTR(_seek64, (struct _reent *, _PTR, _fpos64_t, int)); #ifndef __SINGLE_THREAD__ _flock_t _lock; /* for thread-safety locking */ @@ -376,7 +376,7 @@ struct _reent struct _mprec *_mp; - void _EXFUN((*__cleanup),(struct _reent *)); + void _EXFNPTR(__cleanup, (struct _reent *)); int _gamma_signgam; @@ -593,7 +593,7 @@ struct _reent int __sdidinit; /* 1 means stdio has been init'd */ - void _EXFUN((*__cleanup),(struct _reent *)); + void _EXFNPTR(__cleanup, (struct _reent *)); /* used by mprec routines */ struct _Bigint *_result; diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 5abe5f709..80c35daf3 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -30,8 +30,8 @@ int _EXFUN(close, (int __fildes )); #if defined(__CYGWIN__) size_t _EXFUN(confstr, (int __name, char *__buf, size_t __len)); #endif -char _EXFUN(*ctermid, (char *__s )); -char _EXFUN(*cuserid, (char *__s )); +char * _EXFUN(ctermid, (char *__s )); +char * _EXFUN(cuserid, (char *__s )); #if defined(__CYGWIN__) int _EXFUN(daemon, (int nochdir, int noclose)); #endif @@ -67,7 +67,7 @@ pid_t _EXFUN(fork, (void )); long _EXFUN(fpathconf, (int __fd, int __name )); int _EXFUN(fsync, (int __fd)); int _EXFUN(fdatasync, (int __fd)); -char _EXFUN(*getcwd, (char *__buf, size_t __size )); +char * _EXFUN(getcwd, (char *__buf, size_t __size )); #if defined(__CYGWIN__) int _EXFUN(getdomainname ,(char *__name, size_t __len)); #endif @@ -80,11 +80,11 @@ int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] )); #if defined(__CYGWIN__) long _EXFUN(gethostid, (void)); #endif -char _EXFUN(*getlogin, (void )); +char * _EXFUN(getlogin, (void )); #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) int _EXFUN(getlogin_r, (char *name, size_t namesize) ); #endif -char _EXFUN(*getpass, (const char *__prompt)); +char * _EXFUN(getpass, (const char *__prompt)); int _EXFUN(getpagesize, (void)); #if defined(__CYGWIN__) int _EXFUN(getpeereid, (int, uid_t *, gid_t *)); @@ -101,7 +101,7 @@ uid_t _EXFUN(getuid, (void )); #endif #ifdef __CYGWIN__ char * _EXFUN(getusershell, (void)); -char _EXFUN(*getwd, (char *__buf )); +char * _EXFUN(getwd, (char *__buf )); int _EXFUN(iruserok, (unsigned long raddr, int superuser, const char *ruser, const char *luser)); #endif int _EXFUN(isatty, (int __fildes )); @@ -169,7 +169,7 @@ void _EXFUN(swab, (const void *, void *, ssize_t)); long _EXFUN(sysconf, (int __name )); pid_t _EXFUN(tcgetpgrp, (int __fildes )); int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id )); -char _EXFUN(*ttyname, (int __fildes )); +char * _EXFUN(ttyname, (int __fildes )); #if defined(__CYGWIN__) || defined(__rtems__) int _EXFUN(ttyname_r, (int, char *, size_t)); #endif diff --git a/newlib/libc/search/bsearch.c b/newlib/libc/search/bsearch.c index b9539aa3b..d874e79ae 100644 --- a/newlib/libc/search/bsearch.c +++ b/newlib/libc/search/bsearch.c @@ -69,7 +69,7 @@ _DEFUN (bsearch, (key, base, nmemb, size, compar), _CONST _PTR base _AND size_t nmemb _AND size_t size _AND - int _EXFUN ((*compar), (const _PTR, const _PTR))) + int _EXFNPTR(compar, (const _PTR, const _PTR))) { _PTR current; size_t lower = 0; diff --git a/newlib/libc/stdio/fseek.c b/newlib/libc/stdio/fseek.c index 526ae4ccb..0ba7b6ca3 100644 --- a/newlib/libc/stdio/fseek.c +++ b/newlib/libc/stdio/fseek.c @@ -123,7 +123,7 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence), long offset _AND int whence) { - _fpos_t _EXFUN((*seekfn), (struct _reent *, _PTR, _fpos_t, int)); + _fpos_t _EXFNPTR(seekfn, (struct _reent *, _PTR, _fpos_t, int)); _fpos_t target; _fpos_t curoff = 0; size_t n; diff --git a/newlib/libc/stdio64/fseeko64.c b/newlib/libc/stdio64/fseeko64.c index 6f5e9af1e..301d6f54f 100644 --- a/newlib/libc/stdio64/fseeko64.c +++ b/newlib/libc/stdio64/fseeko64.c @@ -104,7 +104,7 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, whence), _off64_t offset _AND int whence) { - _fpos64_t _EXFUN ((*seekfn), (struct _reent *, void *, _fpos64_t, int)); + _fpos64_t _EXFNPTR(seekfn, (struct _reent *, void *, _fpos64_t, int)); _fpos64_t target, curoff; size_t n; diff --git a/newlib/libc/stdlib/atexit.c b/newlib/libc/stdlib/atexit.c index 21ffd6e7b..fa91deb03 100644 --- a/newlib/libc/stdlib/atexit.c +++ b/newlib/libc/stdlib/atexit.c @@ -60,7 +60,7 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN (atexit, (fn), - _VOID _EXFUN ((*fn), (_VOID))) + _VOID _EXFNPTR(fn, (_VOID))) { return __register_exitproc (__et_atexit, fn, NULL, NULL); } diff --git a/newlib/libc/stdlib/on_exit.c b/newlib/libc/stdlib/on_exit.c index 3ac7f998b..b7fd130dc 100644 --- a/newlib/libc/stdlib/on_exit.c +++ b/newlib/libc/stdlib/on_exit.c @@ -65,7 +65,7 @@ Supporting OS subroutines required: None int _DEFUN (on_exit, (fn, arg), - _VOID _EXFUN ((*fn), (int, _PTR)) _AND + _VOID _EXFNPTR(fn, (int, _PTR)) _AND _PTR arg) { return __register_exitproc (__et_onexit, (void (*)(void)) fn, arg, NULL);