diff mbox series

[v2,07/17] ansification: remove _PTR

Message ID 20171207181909.1112-8-yselkowi@redhat.com
State New
Headers show
Series Newlib ANSI-fication | expand

Commit Message

Yaakov Selkowitz Dec. 7, 2017, 6:18 p.m. UTC
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>

---
 newlib/libc/include/_ansi.h                  |  2 -
 newlib/libc/include/malloc.h                 | 34 ++++++++---------
 newlib/libc/include/stdio.h                  | 56 ++++++++++++++--------------
 newlib/libc/include/stdlib.h                 | 38 +++++++++----------
 newlib/libc/include/string.h                 | 20 +++++-----
 newlib/libc/include/sys/reent.h              | 22 +++++------
 newlib/libc/machine/powerpc/machine/malloc.h | 12 +++---
 newlib/libc/machine/powerpc/machine/stdlib.h | 12 +++---
 newlib/libc/machine/powerpc/vec_calloc.c     |  2 +-
 newlib/libc/machine/powerpc/vec_free.c       |  2 +-
 newlib/libc/machine/powerpc/vec_malloc.c     |  2 +-
 newlib/libc/machine/powerpc/vec_realloc.c    |  4 +-
 newlib/libc/machine/powerpc/vfscanf.c        |  2 +-
 newlib/libc/machine/spu/fread.c              |  2 +-
 newlib/libc/machine/spu/fwrite.c             |  2 +-
 newlib/libc/machine/xstormy16/mallocr.c      | 10 ++---
 newlib/libc/reent/readr.c                    |  2 +-
 newlib/libc/reent/writer.c                   |  2 +-
 newlib/libc/search/bsearch.c                 | 12 +++---
 newlib/libc/stdio/fdopen.c                   |  2 +-
 newlib/libc/stdio/fgets.c                    |  6 +--
 newlib/libc/stdio/fopen.c                    |  2 +-
 newlib/libc/stdio/fread.c                    | 10 ++---
 newlib/libc/stdio/freopen.c                  |  2 +-
 newlib/libc/stdio/fseeko.c                   |  2 +-
 newlib/libc/stdio/fvwrite.c                  |  4 +-
 newlib/libc/stdio/fvwrite.h                  |  2 +-
 newlib/libc/stdio/fwrite.c                   |  4 +-
 newlib/libc/stdio/makebuf.c                  |  2 +-
 newlib/libc/stdio/nano-vfprintf.c            |  4 +-
 newlib/libc/stdio/nano-vfprintf_local.h      |  2 +-
 newlib/libc/stdio/nano-vfscanf.c             |  2 +-
 newlib/libc/stdio/setvbuf.c                  |  2 +-
 newlib/libc/stdio/stdio.c                    |  2 +-
 newlib/libc/stdio/ungetc.c                   |  4 +-
 newlib/libc/stdio/vfprintf.c                 | 12 +++---
 newlib/libc/stdio/vfscanf.c                  |  8 ++--
 newlib/libc/stdio/vfwprintf.c                |  6 +--
 newlib/libc/stdio/vfwscanf.c                 |  6 +--
 newlib/libc/stdio64/fdopen64.c               |  2 +-
 newlib/libc/stdio64/fopen64.c                |  2 +-
 newlib/libc/stdio64/freopen64.c              |  2 +-
 newlib/libc/stdlib/__call_atexit.c           |  6 +--
 newlib/libc/stdlib/atexit.h                  |  4 +-
 newlib/libc/stdlib/calloc.c                  |  2 +-
 newlib/libc/stdlib/cxa_atexit.c              |  2 +-
 newlib/libc/stdlib/exit.c                    |  2 +-
 newlib/libc/stdlib/malign.c                  |  2 +-
 newlib/libc/stdlib/malloc.c                  |  4 +-
 newlib/libc/stdlib/msize.c                   |  2 +-
 newlib/libc/stdlib/on_exit.c                 |  4 +-
 newlib/libc/stdlib/realloc.c                 |  4 +-
 newlib/libc/stdlib/reallocf.c                |  8 ++--
 newlib/libc/stdlib/valloc.c                  |  4 +-
 newlib/libc/string/memccpy.c                 | 10 ++---
 newlib/libc/string/memchr.c                  |  4 +-
 newlib/libc/string/memcmp.c                  |  4 +-
 newlib/libc/string/memcpy.c                  |  8 ++--
 newlib/libc/string/memmove.c                 |  6 +--
 newlib/libc/string/mempcpy.c                 |  6 +--
 newlib/libc/string/memrchr.c                 |  4 +-
 newlib/libc/string/memset.c                  |  4 +-
 newlib/libc/string/rawmemchr.c               |  4 +-
 newlib/libc/sys/linux/pread.c                |  4 +-
 newlib/libc/sys/linux/pread64.c              |  2 +-
 newlib/libc/sys/linux/pwrite.c               |  4 +-
 newlib/libc/sys/linux/pwrite64.c             |  2 +-
 newlib/libc/sys/rtems/crt0.c                 | 10 ++---
 newlib/libc/unix/pread.c                     |  4 +-
 newlib/libc/unix/pwrite.c                    |  4 +-
 newlib/libc/xdr/xdr_sizeof.c                 |  2 +-
 winsup/cygwin/include/cygwin/stdlib.h        |  4 +-
 72 files changed, 228 insertions(+), 230 deletions(-)

-- 
2.15.1
diff mbox series

Patch

diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h
index 5e2eac93a..e955138fe 100644
--- a/newlib/libc/include/_ansi.h
+++ b/newlib/libc/include/_ansi.h
@@ -47,7 +47,6 @@ 
 #endif
 
 #ifdef _HAVE_STDC
-#define	_PTR		void *
 #define	_VOLATILE	volatile
 #define	_SIGNED		signed
 #define _VOID void
@@ -69,7 +68,6 @@ 
 #define _LONG_DOUBLE long double
 #endif
 #else	
-#define	_PTR		char *
 #define	_VOLATILE
 #define	_SIGNED
 #define _VOID void
diff --git a/newlib/libc/include/malloc.h b/newlib/libc/include/malloc.h
index b1e0a0946..f9144cdca 100644
--- a/newlib/libc/include/malloc.h
+++ b/newlib/libc/include/malloc.h
@@ -34,44 +34,44 @@  struct mallinfo {
 
 /* The routines.  */
 
-extern _PTR malloc (size_t);
+extern void *malloc (size_t);
 #ifdef __CYGWIN__
 #undef _malloc_r
 #define _malloc_r(r, s) malloc (s)
 #else
-extern _PTR _malloc_r (struct _reent *, size_t);
+extern void *_malloc_r (struct _reent *, size_t);
 #endif
 
-extern _VOID free (_PTR);
+extern _VOID free (void *);
 #ifdef __CYGWIN__
 #undef _free_r
 #define _free_r(r, p) free (p)
 #else
-extern _VOID _free_r (struct _reent *, _PTR);
+extern _VOID _free_r (struct _reent *, void *);
 #endif
 
-extern _PTR realloc (_PTR, size_t);
+extern void *realloc (void *, size_t);
 #ifdef __CYGWIN__
 #undef _realloc_r
 #define _realloc_r(r, p, s) realloc (p, s)
 #else
-extern _PTR _realloc_r (struct _reent *, _PTR, size_t);
+extern void *_realloc_r (struct _reent *, void *, size_t);
 #endif
 
-extern _PTR calloc (size_t, size_t);
+extern void *calloc (size_t, size_t);
 #ifdef __CYGWIN__
 #undef _calloc_r
 #define _calloc_r(r, s1, s2) calloc (s1, s2);
 #else
-extern _PTR _calloc_r (struct _reent *, size_t, size_t);
+extern void *_calloc_r (struct _reent *, size_t, size_t);
 #endif
 
-extern _PTR memalign (size_t, size_t);
+extern void *memalign (size_t, size_t);
 #ifdef __CYGWIN__
 #undef _memalign_r
 #define _memalign_r(r, s1, s2) memalign (s1, s2);
 #else
-extern _PTR _memalign_r (struct _reent *, size_t, size_t);
+extern void *_memalign_r (struct _reent *, size_t, size_t);
 #endif
 
 extern struct mallinfo mallinfo (void);
@@ -98,31 +98,31 @@  extern int mallopt (int, int);
 extern int _mallopt_r (struct _reent *, int, int);
 #endif
 
-extern size_t malloc_usable_size (_PTR);
+extern size_t malloc_usable_size (void *);
 #ifdef __CYGWIN__
 #undef _malloc_usable_size_r
 #define _malloc_usable_size_r(r, p) malloc_usable_size (p)
 #else
-extern size_t _malloc_usable_size_r (struct _reent *, _PTR);
+extern size_t _malloc_usable_size_r (struct _reent *, void *);
 #endif
 
 /* These aren't too useful on an embedded system, but we define them
    anyhow.  */
 
-extern _PTR valloc (size_t);
+extern void *valloc (size_t);
 #ifdef __CYGWIN__
 #undef _valloc_r
 #define _valloc_r(r, s) valloc (s)
 #else
-extern _PTR _valloc_r (struct _reent *, size_t);
+extern void *_valloc_r (struct _reent *, size_t);
 #endif
 
-extern _PTR pvalloc (size_t);
+extern void *pvalloc (size_t);
 #ifdef __CYGWIN__
 #undef _pvalloc_r
 #define _pvalloc_r(r, s) pvalloc (s)
 #else
-extern _PTR _pvalloc_r (struct _reent *, size_t);
+extern void *_pvalloc_r (struct _reent *, size_t);
 #endif
 
 extern int malloc_trim (size_t);
@@ -159,7 +159,7 @@  extern _VOID _mstats_r (struct _reent *, char *);
 
 #ifndef __CYGWIN__
 /* Some systems provide this, so do too for compatibility.  */
-extern void cfree (_PTR);
+extern void cfree (void *);
 #endif /* __CYGWIN__ */
 
 #ifdef __cplusplus
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index 9152bf096..fe0a31827 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -220,8 +220,8 @@  int	_EXFUN(putc, (int, FILE *));
 int	_EXFUN(putchar, (int));
 int	_EXFUN(puts, (const char *));
 int	_EXFUN(ungetc, (int, FILE *));
-size_t	_EXFUN(fread, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
-size_t	_EXFUN(fwrite, (const _PTR __restrict , size_t _size, size_t _n, FILE *));
+size_t	_EXFUN(fread, (void *__restrict, size_t _size, size_t _n, FILE *__restrict));
+size_t	_EXFUN(fwrite, (const void *__restrict , size_t _size, size_t _n, FILE *));
 #ifdef _COMPILING_NEWLIB
 int	_EXFUN(fgetpos, (FILE *, _fpos_t *));
 #else
@@ -434,8 +434,8 @@  int	_EXFUN(_fputc_r, (struct _reent *, int, FILE *));
 int	_EXFUN(_fputc_unlocked_r, (struct _reent *, int, FILE *));
 int	_EXFUN(_fputs_r, (struct _reent *, const char *__restrict, FILE *__restrict));
 int	_EXFUN(_fputs_unlocked_r, (struct _reent *, const char *__restrict, FILE *__restrict));
-size_t	_EXFUN(_fread_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
-size_t	_EXFUN(_fread_unlocked_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
+size_t	_EXFUN(_fread_r, (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict));
+size_t	_EXFUN(_fread_unlocked_r, (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict));
 int	_EXFUN(_fscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
 int	_EXFUN(_fseek_r, (struct _reent *, FILE *, long, int));
@@ -443,8 +443,8 @@  int	_EXFUN(_fseeko_r,(struct _reent *, FILE *, _off_t, int));
 long	_EXFUN(_ftell_r, (struct _reent *, FILE *));
 _off_t	_EXFUN(_ftello_r,(struct _reent *, FILE *));
 void	_EXFUN(_rewind_r, (struct _reent *, FILE *));
-size_t	_EXFUN(_fwrite_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
-size_t	_EXFUN(_fwrite_unlocked_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
+size_t	_EXFUN(_fwrite_r, (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict));
+size_t	_EXFUN(_fwrite_unlocked_r, (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict));
 int	_EXFUN(_getc_r, (struct _reent *, FILE *));
 int	_EXFUN(_getc_unlocked_r, (struct _reent *, FILE *));
 int	_EXFUN(_getchar_r, (struct _reent *));
@@ -539,8 +539,8 @@  int	_EXFUN(fileno_unlocked, (FILE *));
 int	_EXFUN(fflush_unlocked, (FILE *));
 int	_EXFUN(fgetc_unlocked, (FILE *));
 int	_EXFUN(fputc_unlocked, (int, FILE *));
-size_t	_EXFUN(fread_unlocked, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
-size_t	_EXFUN(fwrite_unlocked, (const _PTR __restrict , size_t _size, size_t _n, FILE *));
+size_t	_EXFUN(fread_unlocked, (void *__restrict, size_t _size, size_t _n, FILE *__restrict));
+size_t	_EXFUN(fwrite_unlocked, (const void *__restrict , size_t _size, size_t _n, FILE *));
 #endif
 
 #if __GNU_VISIBLE
@@ -583,35 +583,35 @@  int	_EXFUN(__swbuf_r, (struct _reent *, int, FILE *));
 
 #if __BSD_VISIBLE
 # ifdef __LARGE64_FILES
-FILE	*_EXFUN(funopen,(const _PTR __cookie,
-		int (*__readfn)(_PTR __c, char *__buf,
+FILE	*_EXFUN(funopen,(const void *__cookie,
+		int (*__readfn)(void *__c, char *__buf,
 				_READ_WRITE_BUFSIZE_TYPE __n),
-		int (*__writefn)(_PTR __c, const char *__buf,
+		int (*__writefn)(void *__c, const char *__buf,
 				 _READ_WRITE_BUFSIZE_TYPE __n),
-		_fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence),
-		int (*__closefn)(_PTR __c)));
-FILE	*_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie,
-		int (*__readfn)(_PTR __c, char *__buf,
+		_fpos64_t (*__seekfn)(void *__c, _fpos64_t __off, int __whence),
+		int (*__closefn)(void *__c)));
+FILE	*_EXFUN(_funopen_r,(struct _reent *, const void *__cookie,
+		int (*__readfn)(void *__c, char *__buf,
 				_READ_WRITE_BUFSIZE_TYPE __n),
-		int (*__writefn)(_PTR __c, const char *__buf,
+		int (*__writefn)(void *__c, const char *__buf,
 				 _READ_WRITE_BUFSIZE_TYPE __n),
-		_fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence),
-		int (*__closefn)(_PTR __c)));
+		_fpos64_t (*__seekfn)(void *__c, _fpos64_t __off, int __whence),
+		int (*__closefn)(void *__c)));
 # else
-FILE	*_EXFUN(funopen,(const _PTR __cookie,
-		int (*__readfn)(_PTR __cookie, char *__buf,
+FILE	*_EXFUN(funopen,(const void *__cookie,
+		int (*__readfn)(void *__cookie, char *__buf,
 				_READ_WRITE_BUFSIZE_TYPE __n),
-		int (*__writefn)(_PTR __cookie, const char *__buf,
+		int (*__writefn)(void *__cookie, const char *__buf,
 				 _READ_WRITE_BUFSIZE_TYPE __n),
-		fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence),
-		int (*__closefn)(_PTR __cookie)));
-FILE	*_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie,
-		int (*__readfn)(_PTR __cookie, char *__buf,
+		fpos_t (*__seekfn)(void *__cookie, fpos_t __off, int __whence),
+		int (*__closefn)(void *__cookie)));
+FILE	*_EXFUN(_funopen_r,(struct _reent *, const void *__cookie,
+		int (*__readfn)(void *__cookie, char *__buf,
 				_READ_WRITE_BUFSIZE_TYPE __n),
-		int (*__writefn)(_PTR __cookie, const char *__buf,
+		int (*__writefn)(void *__cookie, const char *__buf,
 				 _READ_WRITE_BUFSIZE_TYPE __n),
-		fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence),
-		int (*__closefn)(_PTR __cookie)));
+		fpos_t (*__seekfn)(void *__cookie, fpos_t __off, int __whence),
+		int (*__closefn)(void *__cookie)));
 # endif /* !__LARGE64_FILES */
 
 # define	fropen(__cookie, __fn) funopen(__cookie, __fn, (int (*)())0, \
diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
index ac433db21..7213a3c16 100644
--- a/newlib/libc/include/stdlib.h
+++ b/newlib/libc/include/stdlib.h
@@ -54,7 +54,7 @@  typedef struct
 
 #ifndef __compar_fn_t_defined
 #define __compar_fn_t_defined
-typedef int (*__compar_fn_t) (const _PTR, const _PTR);
+typedef int (*__compar_fn_t) (const void *, const void *);
 #endif
 
 #define EXIT_FAILURE 1
@@ -82,15 +82,15 @@  int	_EXFUN(atoi,(const char *__nptr));
 int	_EXFUN(_atoi_r,(struct _reent *, const char *__nptr));
 long	_EXFUN(atol,(const char *__nptr));
 long	_EXFUN(_atol_r,(struct _reent *, const char *__nptr));
-_PTR	_EXFUN(bsearch,(const _PTR __key,
-		       const _PTR __base,
+void *	_EXFUN(bsearch,(const void *__key,
+		       const void *__base,
 		       size_t __nmemb,
 		       size_t __size,
 		       __compar_fn_t _compar));
-_PTR	_EXFUN_NOTHROW(calloc,(size_t __nmemb, size_t __size));
+void *	_EXFUN_NOTHROW(calloc,(size_t __nmemb, size_t __size));
 div_t	_EXFUN(div,(int __numer, int __denom));
 _VOID	_EXFUN(exit,(int __status) _ATTRIBUTE ((__noreturn__)));
-_VOID	_EXFUN_NOTHROW(free,(_PTR));
+_VOID	_EXFUN_NOTHROW(free,(void *));
 char *  _EXFUN(getenv,(const char *__string));
 char *	_EXFUN(_getenv_r,(struct _reent *, const char *__string));
 char *	_EXFUN(_findenv,(const char *, int *));
@@ -101,7 +101,7 @@  int	_EXFUN(getsubopt,(char **, char * const *, char **));
 #endif
 long	_EXFUN(labs,(long));
 ldiv_t	_EXFUN(ldiv,(long __numer, long __denom));
-_PTR	_EXFUN_NOTHROW(malloc,(size_t __size));
+void *	_EXFUN_NOTHROW(malloc,(size_t __size));
 int	_EXFUN(mblen,(const char *, size_t));
 int	_EXFUN(_mblen_r,(struct _reent *, const char *, size_t, _mbstate_t *));
 int	_EXFUN(mbtowc,(wchar_t *__restrict, const char *__restrict, size_t));
@@ -136,13 +136,13 @@  int	_EXFUN(_mkostemps_r, (struct _reent *, char *, int, int));
 int	_EXFUN(_mkstemp_r, (struct _reent *, char *));
 int	_EXFUN(_mkstemps_r, (struct _reent *, char *, int));
 char *	_EXFUN(_mktemp_r, (struct _reent *, char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead"))));
-_VOID	_EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, __compar_fn_t _compar));
+_VOID	_EXFUN(qsort,(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar));
 int	_EXFUN(rand,(_VOID));
-_PTR	_EXFUN_NOTHROW(realloc,(_PTR __r, size_t __size));
+void *	_EXFUN_NOTHROW(realloc,(void *__r, size_t __size));
 #if __BSD_VISIBLE
 void	*reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2)
 	    __alloc_size(3);
-_PTR	_EXFUN(reallocf,(_PTR __r, size_t __size));
+void *	_EXFUN(reallocf,(void *__r, size_t __size));
 #endif
 #if __BSD_VISIBLE || __XSI_VISIBLE >= 4
 char *	_EXFUN(realpath, (const char *__restrict path, char *__restrict resolved_path));
@@ -193,7 +193,7 @@  char *  _EXFUN(l64a,(long __input));
 char *  _EXFUN(_l64a_r,(struct _reent *,long __input));
 #endif
 #if __MISC_VISIBLE
-int	_EXFUN(on_exit,(_VOID (*__func)(int, _PTR),_PTR __arg));
+int	_EXFUN(on_exit,(_VOID (*__func)(int, void *),void *__arg));
 #endif
 #if __ISO_C_VISIBLE >= 1999
 _VOID	_EXFUN(_Exit,(int __status) _ATTRIBUTE ((__noreturn__)));
@@ -202,7 +202,7 @@  _VOID	_EXFUN(_Exit,(int __status) _ATTRIBUTE ((__noreturn__)));
 int	_EXFUN(putenv,(char *__string));
 #endif
 int	_EXFUN(_putenv_r,(struct _reent *, char *__string));
-_PTR	_EXFUN(_reallocf_r,(struct _reent *, _PTR, size_t));
+void *	_EXFUN(_reallocf_r,(struct _reent *, void *, size_t));
 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
 int	_EXFUN(setenv,(const char *__string, const char *__value, int __overwrite));
 #endif
@@ -273,7 +273,7 @@  unsigned long long _EXFUN(_strtoull_r,(struct _reent *, const char *__restrict _
 
 #ifndef __CYGWIN__
 #if __MISC_VISIBLE
-_VOID	_EXFUN(cfree,(_PTR));
+_VOID	_EXFUN(cfree,(void *));
 #endif
 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
 int	_EXFUN(unsetenv,(const char *__string));
@@ -287,10 +287,10 @@  int _EXFUN(__nonnull ((1)) posix_memalign,(void **, size_t, size_t));
 
 char *	_EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**));
 #ifndef __CYGWIN__
-_PTR	_EXFUN_NOTHROW(_malloc_r,(struct _reent *, size_t));
-_PTR	_EXFUN_NOTHROW(_calloc_r,(struct _reent *, size_t, size_t));
-_VOID	_EXFUN_NOTHROW(_free_r,(struct _reent *, _PTR));
-_PTR	_EXFUN_NOTHROW(_realloc_r,(struct _reent *, _PTR, size_t));
+void *	_EXFUN_NOTHROW(_malloc_r,(struct _reent *, size_t));
+void *	_EXFUN_NOTHROW(_calloc_r,(struct _reent *, size_t, size_t));
+_VOID	_EXFUN_NOTHROW(_free_r,(struct _reent *, void *));
+void *	_EXFUN_NOTHROW(_realloc_r,(struct _reent *, void *, size_t));
 _VOID	_EXFUN(_mstats_r,(struct _reent *, char *));
 #endif
 int	_EXFUN(_system_r,(struct _reent *, const char *));
@@ -302,13 +302,13 @@  _VOID	_EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *))
    version.  We want that #undef qsort_r will still let you
    invoke the underlying function, but that requires gcc support. */
 #if __GNU_VISIBLE
-_VOID	_EXFUN(qsort_r,(_PTR __base, size_t __nmemb, size_t __size, int (*_compar)(const _PTR, const _PTR, _PTR), _PTR __thunk));
+_VOID	_EXFUN(qsort_r,(void *__base, size_t __nmemb, size_t __size, int (*_compar)(const void *, const void *, void *), void *__thunk));
 #elif __BSD_VISIBLE
 # ifdef __GNUC__
-_VOID	_EXFUN(qsort_r,(_PTR __base, size_t __nmemb, size_t __size, _PTR __thunk, int (*_compar)(_PTR, const _PTR, const _PTR)))
+_VOID	_EXFUN(qsort_r,(void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *)))
              __asm__ (__ASMNAME ("__bsd_qsort_r"));
 # else
-_VOID	_EXFUN(__bsd_qsort_r,(_PTR __base, size_t __nmemb, size_t __size, _PTR __thunk, int (*_compar)(_PTR, const _PTR, const _PTR)));
+_VOID	_EXFUN(__bsd_qsort_r,(void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *)));
 #  define qsort_r __bsd_qsort_r
 # endif
 #endif
diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index b54b83335..e44ac3079 100644
--- a/newlib/libc/include/string.h
+++ b/newlib/libc/include/string.h
@@ -26,11 +26,11 @@ 
 
 _BEGIN_STD_C
 
-_PTR 	 _EXFUN(memchr,(const _PTR, int, size_t));
-int 	 _EXFUN(memcmp,(const _PTR, const _PTR, size_t));
-_PTR 	 _EXFUN(memcpy,(_PTR __restrict, const _PTR __restrict, size_t));
-_PTR	 _EXFUN(memmove,(_PTR, const _PTR, size_t));
-_PTR	 _EXFUN(memset,(_PTR, int, size_t));
+void *	 _EXFUN(memchr,(const void *, int, size_t));
+int 	 _EXFUN(memcmp,(const void *, const void *, size_t));
+void *	 _EXFUN(memcpy,(void *__restrict, const void *__restrict, size_t));
+void *	 _EXFUN(memmove,(void *, const void *, size_t));
+void *	 _EXFUN(memset,(void *, int, size_t));
 char 	*_EXFUN(strcat,(char *__restrict, const char *__restrict));
 char 	*_EXFUN(strchr,(const char *, int));
 int	 _EXFUN(strcmp,(const char *, const char *));
@@ -64,13 +64,13 @@  int	 _EXFUN(timingsafe_bcmp,(const void *, const void *, size_t));
 int	 _EXFUN(timingsafe_memcmp,(const void *, const void *, size_t));
 #endif
 #if __MISC_VISIBLE || __POSIX_VISIBLE
-_PTR	 _EXFUN(memccpy,(_PTR __restrict, const _PTR __restrict, int, size_t));
+void *	 _EXFUN(memccpy,(void *__restrict, const void *__restrict, int, size_t));
 #endif
 #if __GNU_VISIBLE
-_PTR	 _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
-_PTR	 _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
-_PTR 	 _EXFUN(memrchr,(const _PTR, int, size_t));
-_PTR 	 _EXFUN(rawmemchr,(const _PTR, int));
+void *	 _EXFUN(mempcpy,(void *, const void *, size_t));
+void *	 _EXFUN(memmem, (const void *, size_t, const void *, size_t));
+void *	 _EXFUN(memrchr,(const void *, int, size_t));
+void *	 _EXFUN(rawmemchr,(const void *, int));
 #endif
 #if __POSIX_VISIBLE >= 200809
 char 	*_EXFUN(stpcpy,(char *__restrict, const char *__restrict));
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index aa352dc08..1381db67b 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -192,15 +192,15 @@  struct __sFILE {
 #endif
 
   /* operations */
-  _PTR	_cookie;	/* cookie passed to io functions */
+  void *	_cookie;	/* cookie passed to io functions */
 
-  _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR,
+  _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, void *,
 					   char *, _READ_WRITE_BUFSIZE_TYPE));
-  _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR,
+  _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, void *,
 					    const char *,
 					    _READ_WRITE_BUFSIZE_TYPE));
-  _fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int));
-  int _EXFNPTR(_close, (struct _reent *, _PTR));
+  _fpos_t _EXFNPTR(_seek, (struct _reent *, void *, _fpos_t, int));
+  int _EXFNPTR(_close, (struct _reent *, void *));
 
   /* separate buffer for long sequences of ungetc() */
   struct __sbuf _ub;	/* ungetc buffer */
@@ -248,15 +248,15 @@  struct __sFILE64 {
   struct _reent *_data;
 
   /* operations */
-  _PTR	_cookie;	/* cookie passed to io functions */
+  void *	_cookie;	/* cookie passed to io functions */
 
-  _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR,
+  _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, void *,
 					   char *, _READ_WRITE_BUFSIZE_TYPE));
-  _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR,
+  _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, void *,
 					    const char *,
 					    _READ_WRITE_BUFSIZE_TYPE));
-  _fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int));
-  int _EXFNPTR(_close, (struct _reent *, _PTR));
+  _fpos_t _EXFNPTR(_seek, (struct _reent *, void *, _fpos_t, int));
+  int _EXFNPTR(_close, (struct _reent *, void *));
 
   /* separate buffer for long sequences of ungetc() */
   struct __sbuf _ub;	/* ungetc buffer */
@@ -275,7 +275,7 @@  struct __sFILE64 {
   int   _flags2;        /* for future use */
 
   _off64_t _offset;     /* current lseek offset */
-  _fpos64_t _EXFNPTR(_seek64, (struct _reent *, _PTR, _fpos64_t, int));
+  _fpos64_t _EXFNPTR(_seek64, (struct _reent *, void *, _fpos64_t, int));
 
 #ifndef __SINGLE_THREAD__
   _flock_t _lock;	/* for thread-safety locking */
diff --git a/newlib/libc/machine/powerpc/machine/malloc.h b/newlib/libc/machine/powerpc/machine/malloc.h
index 945a9651a..6be7eac80 100644
--- a/newlib/libc/machine/powerpc/machine/malloc.h
+++ b/newlib/libc/machine/powerpc/machine/malloc.h
@@ -3,14 +3,14 @@ 
 
 # if defined(__ALTIVEC__)
 
-_PTR    _EXFUN(vec_calloc,(size_t __nmemb, size_t __size));
-_PTR    _EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size));
-_VOID   _EXFUN(vec_free,(_PTR));
+void *_EXFUN(vec_calloc,(size_t __nmemb, size_t __size));
+void *_EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size));
+_VOID   _EXFUN(vec_free,(void *));
 #define _vec_freer _freer
-_PTR    _EXFUN(vec_malloc,(size_t __size));
+void *_EXFUN(vec_malloc,(size_t __size));
 #define _vec_mallocr _memalign_r
-_PTR    _EXFUN(vec_realloc,(_PTR __r, size_t __size));
-_PTR    _EXFUN(_vec_realloc_r,(struct _reent *, _PTR __r, size_t __size));
+void *_EXFUN(vec_realloc,(void *__r, size_t __size));
+void *_EXFUN(_vec_realloc_r,(struct _reent *, void *__r, size_t __size));
 
 # endif /* __ALTIVEC__ */
 
diff --git a/newlib/libc/machine/powerpc/machine/stdlib.h b/newlib/libc/machine/powerpc/machine/stdlib.h
index 1cf18371a..bc9b9cfe9 100644
--- a/newlib/libc/machine/powerpc/machine/stdlib.h
+++ b/newlib/libc/machine/powerpc/machine/stdlib.h
@@ -5,14 +5,14 @@ 
 
 # if defined(__ALTIVEC__)
 
-_PTR    _EXFUN(vec_calloc,(size_t __nmemb, size_t __size));
-_PTR    _EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size));
-_VOID   _EXFUN(vec_free,(_PTR));
+void *_EXFUN(vec_calloc,(size_t __nmemb, size_t __size));
+void *_EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size));
+_VOID   _EXFUN(vec_free,(void *));
 #define _vec_freer _freer
-_PTR    _EXFUN(vec_malloc,(size_t __size));
+void *_EXFUN(vec_malloc,(size_t __size));
 #define _vec_mallocr _memalign_r
-_PTR    _EXFUN(vec_realloc,(_PTR __r, size_t __size));
-_PTR    _EXFUN(_vec_realloc_r,(struct _reent *, _PTR __r, size_t __size));
+void *_EXFUN(vec_realloc,(void *__r, size_t __size));
+void *_EXFUN(_vec_realloc_r,(struct _reent *, void *__r, size_t __size));
 
 # endif /* __ALTIVEC__ */
 
diff --git a/newlib/libc/machine/powerpc/vec_calloc.c b/newlib/libc/machine/powerpc/vec_calloc.c
index 8a10507d3..cc156bc76 100644
--- a/newlib/libc/machine/powerpc/vec_calloc.c
+++ b/newlib/libc/machine/powerpc/vec_calloc.c
@@ -43,7 +43,7 @@  Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 
 #ifndef _REENT_ONLY
 
-_PTR
+void *
 _DEFUN (vec_calloc, (n, size),
 	size_t n,
 	size_t size)
diff --git a/newlib/libc/machine/powerpc/vec_free.c b/newlib/libc/machine/powerpc/vec_free.c
index b55c52dde..fa2ea9686 100644
--- a/newlib/libc/machine/powerpc/vec_free.c
+++ b/newlib/libc/machine/powerpc/vec_free.c
@@ -7,7 +7,7 @@ 
 
 void
 _DEFUN (vec_free, (aptr),
-        _PTR aptr)
+        void *aptr)
 {
   _free_r (_REENT, aptr);
 }
diff --git a/newlib/libc/machine/powerpc/vec_malloc.c b/newlib/libc/machine/powerpc/vec_malloc.c
index 181f360f0..ad62b119f 100644
--- a/newlib/libc/machine/powerpc/vec_malloc.c
+++ b/newlib/libc/machine/powerpc/vec_malloc.c
@@ -95,7 +95,7 @@  Supporting OS subroutines required: <<sbrk>>.  */
 
 #ifndef _REENT_ONLY
 
-_PTR
+void *
 _DEFUN (vec_malloc, (nbytes),
 	size_t nbytes)		/* get a block */
 {
diff --git a/newlib/libc/machine/powerpc/vec_realloc.c b/newlib/libc/machine/powerpc/vec_realloc.c
index 7e857b55a..05ee82be1 100644
--- a/newlib/libc/machine/powerpc/vec_realloc.c
+++ b/newlib/libc/machine/powerpc/vec_realloc.c
@@ -6,9 +6,9 @@ 
 
 #ifndef _REENT_ONLY
 
-_PTR
+void *
 _DEFUN (vec_realloc, (ap, nbytes),
-	_PTR ap,
+	void *ap,
 	size_t nbytes)
 {
   return _vec_realloc_r (_REENT, ap, nbytes);
diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c
index df5344e20..b27a0b81c 100644
--- a/newlib/libc/machine/powerpc/vfscanf.c
+++ b/newlib/libc/machine/powerpc/vfscanf.c
@@ -928,7 +928,7 @@  __svfscanf_r (rptr, fp, fmt0, ap)
 	      *p = 0;
 	      res = (*ccfn) (rptr, buf, (char **) NULL, base);
 	      if ((flags & POINTER) && !(flags & VECTOR))
-		*(va_arg (ap, _PTR *)) = (_PTR) (unsigned _POINTER_INT) res;
+		*(va_arg (ap, void **)) = (void *) (unsigned _POINTER_INT) res;
 	      else if (flags & SHORT)
 		{
 		  if (!(flags & VECTOR))
diff --git a/newlib/libc/machine/spu/fread.c b/newlib/libc/machine/spu/fread.c
index 3ea24cc4a..8a6e9c417 100644
--- a/newlib/libc/machine/spu/fread.c
+++ b/newlib/libc/machine/spu/fread.c
@@ -50,7 +50,7 @@  typedef struct
 
 size_t
 _DEFUN (fread, (buf, size, count, fp),
-	_PTR __restrict  buf,
+	void *__restrict  buf,
 	size_t size,
 	size_t count,
 	FILE *__restrict fp)
diff --git a/newlib/libc/machine/spu/fwrite.c b/newlib/libc/machine/spu/fwrite.c
index 149eb1345..0db2f549b 100644
--- a/newlib/libc/machine/spu/fwrite.c
+++ b/newlib/libc/machine/spu/fwrite.c
@@ -50,7 +50,7 @@  typedef struct
 
 size_t
 _DEFUN (fwrite, (buf, size, count, fp),
-	const _PTR __restrict buf,
+	const void *__restrict buf,
 	size_t size,
 	size_t count,
 	FILE * fp)
diff --git a/newlib/libc/machine/xstormy16/mallocr.c b/newlib/libc/machine/xstormy16/mallocr.c
index 23e02f74c..07be53039 100644
--- a/newlib/libc/machine/xstormy16/mallocr.c
+++ b/newlib/libc/machine/xstormy16/mallocr.c
@@ -1,7 +1,7 @@ 
 #include <malloc.h>
 
 #ifdef DEFINE_MALLOC
-_PTR 
+void *
 _malloc_r (struct _reent *r, size_t sz)
 {
   return malloc (sz);
@@ -9,7 +9,7 @@  _malloc_r (struct _reent *r, size_t sz)
 #endif
 
 #ifdef DEFINE_CALLOC
-_PTR 
+void *
 _calloc_r (struct _reent *r, size_t a, size_t b)
 {
   return calloc (a, b);
@@ -18,15 +18,15 @@  _calloc_r (struct _reent *r, size_t a, size_t b)
 
 #ifdef DEFINE_FREE
 void
-_free_r (struct _reent *r, _PTR x)
+_free_r (struct _reent *r, void *x)
 {
   free (x);
 }
 #endif
 
 #ifdef DEFINE_REALLOC
-_PTR 
-_realloc_r (struct _reent *r, _PTR x, size_t sz)
+void *
+_realloc_r (struct _reent *r, void *x, size_t sz)
 {
   return realloc (x, sz);
 }
diff --git a/newlib/libc/reent/readr.c b/newlib/libc/reent/readr.c
index edc6fd08b..9a3a694cc 100644
--- a/newlib/libc/reent/readr.c
+++ b/newlib/libc/reent/readr.c
@@ -41,7 +41,7 @@  _ssize_t
 _DEFUN (_read_r, (ptr, fd, buf, cnt),
      struct _reent *ptr,
      int fd,
-     _PTR buf,
+     void *buf,
      size_t cnt)
 {
   _ssize_t ret;
diff --git a/newlib/libc/reent/writer.c b/newlib/libc/reent/writer.c
index 4c4f95f77..8d4b37530 100644
--- a/newlib/libc/reent/writer.c
+++ b/newlib/libc/reent/writer.c
@@ -41,7 +41,7 @@  _ssize_t
 _DEFUN (_write_r, (ptr, fd, buf, cnt),
      struct _reent *ptr,
      int fd,
-     const _PTR buf,
+     const void *buf,
      size_t cnt)
 {
   _ssize_t ret;
diff --git a/newlib/libc/search/bsearch.c b/newlib/libc/search/bsearch.c
index 86380a816..79a489680 100644
--- a/newlib/libc/search/bsearch.c
+++ b/newlib/libc/search/bsearch.c
@@ -55,15 +55,15 @@  No supporting OS subroutines are required.
 
 #include <stdlib.h>
 
-_PTR
+void *
 _DEFUN (bsearch, (key, base, nmemb, size, compar),
-	const _PTR key,
-	const _PTR base,
+	const void *key,
+	const void *base,
 	size_t nmemb,
 	size_t size,
-	int _EXFNPTR(compar, (const _PTR, const _PTR)))
+	int _EXFNPTR(compar, (const void *, const void *)))
 {
-  _PTR current;
+  void *current;
   size_t lower = 0;
   size_t upper = nmemb;
   size_t index;
@@ -75,7 +75,7 @@  _DEFUN (bsearch, (key, base, nmemb, size, compar),
   while (lower < upper)
     {
       index = (lower + upper) / 2;
-      current = (_PTR) (((char *) base) + (index * size));
+      current = (void *) (((char *) base) + (index * size));
 
       result = compar (key, current);
 
diff --git a/newlib/libc/stdio/fdopen.c b/newlib/libc/stdio/fdopen.c
index 82b7a9bc2..876a94117 100644
--- a/newlib/libc/stdio/fdopen.c
+++ b/newlib/libc/stdio/fdopen.c
@@ -94,7 +94,7 @@  _DEFUN(_fdopen_r, (ptr, fd, mode),
     _fcntl_r (ptr, fd, F_SETFL, fdflags | O_APPEND);
 #endif
   fp->_file = fd;
-  fp->_cookie = (_PTR) fp;
+  fp->_cookie = (void *) fp;
 
 #undef _read
 #undef _write
diff --git a/newlib/libc/stdio/fgets.c b/newlib/libc/stdio/fgets.c
index 5edeef957..d4e0af35c 100644
--- a/newlib/libc/stdio/fgets.c
+++ b/newlib/libc/stdio/fgets.c
@@ -164,20 +164,20 @@  _DEFUN(_fgets_r, (ptr, buf, n, fp),
        */
       if (len > n)
 	len = n;
-      t = (unsigned char *) memchr ((_PTR) p, '\n', len);
+      t = (unsigned char *) memchr ((void *) p, '\n', len);
       if (t != 0)
 	{
 	  len = ++t - p;
 	  fp->_r -= len;
 	  fp->_p = t;
-	  _CAST_VOID memcpy ((_PTR) s, (_PTR) p, len);
+	  _CAST_VOID memcpy ((void *) s, (void *) p, len);
 	  s[len] = 0;
           _newlib_flockfile_exit (fp);
 	  return (buf);
 	}
       fp->_r -= len;
       fp->_p += len;
-      _CAST_VOID memcpy ((_PTR) s, (_PTR) p, len);
+      _CAST_VOID memcpy ((void *) s, (void *) p, len);
       s += len;
     }
   while ((n -= len) != 0);
diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c
index e6b044557..57268945f 100644
--- a/newlib/libc/stdio/fopen.c
+++ b/newlib/libc/stdio/fopen.c
@@ -142,7 +142,7 @@  _DEFUN(_fopen_r, (ptr, file, mode),
 
   fp->_file = f;
   fp->_flags = flags;
-  fp->_cookie = (_PTR) fp;
+  fp->_cookie = (void *) fp;
   fp->_read = __sread;
   fp->_write = __swrite;
   fp->_seek = __sseek;
diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c
index cff60efe1..58aa2c68d 100644
--- a/newlib/libc/stdio/fread.c
+++ b/newlib/libc/stdio/fread.c
@@ -144,7 +144,7 @@  _DEFUN(crlf_r, (ptr, fp, buf, count, eof),
 size_t
 _DEFUN(_fread_r, (ptr, buf, size, count, fp),
        struct _reent * ptr,
-       _PTR __restrict buf,
+       void *__restrict buf,
        size_t size,
        size_t count,
        FILE * __restrict fp)
@@ -173,7 +173,7 @@  _DEFUN(_fread_r, (ptr, buf, size, count, fp),
     {
       /* First copy any available characters from ungetc buffer.  */
       int copy_size = resid > fp->_r ? fp->_r : resid;
-      _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, (size_t) copy_size);
+      _CAST_VOID memcpy ((void *) p, (void *) fp->_p, (size_t) copy_size);
       fp->_p += copy_size;
       fp->_r -= copy_size;
       p += copy_size;
@@ -222,7 +222,7 @@  _DEFUN(_fread_r, (ptr, buf, size, count, fp),
     {
       while (resid > (r = fp->_r))
 	{
-	  _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, (size_t) r);
+	  _CAST_VOID memcpy ((void *) p, (void *) fp->_p, (size_t) r);
 	  fp->_p += r;
 	  /* fp->_r = 0 ... done in __srefill */
 	  p += r;
@@ -241,7 +241,7 @@  _DEFUN(_fread_r, (ptr, buf, size, count, fp),
 	      return (total - resid) / size;
 	    }
 	}
-      _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, resid);
+      _CAST_VOID memcpy ((void *) p, (void *) fp->_p, resid);
       fp->_r -= resid;
       fp->_p += resid;
     }
@@ -261,7 +261,7 @@  _DEFUN(_fread_r, (ptr, buf, size, count, fp),
 #ifndef _REENT_ONLY
 size_t
 _DEFUN(fread, (buf, size, count, fp),
-       _PTR __restrict  buf,
+       void *__restrict  buf,
        size_t size,
        size_t count,
        FILE *__restrict fp)
diff --git a/newlib/libc/stdio/freopen.c b/newlib/libc/stdio/freopen.c
index 7e70b9a98..46cbd81ce 100644
--- a/newlib/libc/stdio/freopen.c
+++ b/newlib/libc/stdio/freopen.c
@@ -221,7 +221,7 @@  _DEFUN(_freopen_r, (ptr, file, mode, fp),
 
   fp->_flags = flags;
   fp->_file = f;
-  fp->_cookie = (_PTR) fp;
+  fp->_cookie = (void *) fp;
   fp->_read = __sread;
   fp->_write = __swrite;
   fp->_seek = __sseek;
diff --git a/newlib/libc/stdio/fseeko.c b/newlib/libc/stdio/fseeko.c
index 58bb9511b..a2ed1b5b5 100644
--- a/newlib/libc/stdio/fseeko.c
+++ b/newlib/libc/stdio/fseeko.c
@@ -99,7 +99,7 @@  _DEFUN(_fseeko_r, (ptr, fp, offset, whence),
        _off_t offset,
        int whence)
 {
-  _fpos_t _EXFNPTR(seekfn, (struct _reent *, _PTR, _fpos_t, int));
+  _fpos_t _EXFNPTR(seekfn, (struct _reent *, void *, _fpos_t, int));
   _fpos_t target;
   _fpos_t curoff = 0;
   size_t n;
diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c
index c93888dc4..95bd34c6d 100644
--- a/newlib/libc/stdio/fvwrite.c
+++ b/newlib/libc/stdio/fvwrite.c
@@ -26,7 +26,7 @@ 
 #include "fvwrite.h"
 
 #define	MIN(a, b) ((a) < (b) ? (a) : (b))
-#define	COPY(n)	  _CAST_VOID memmove ((_PTR) fp->_p, (_PTR) p, (size_t) (n))
+#define	COPY(n)	  _CAST_VOID memmove ((void *) fp->_p, (void *) p, (size_t) (n))
 
 #define GETIOV(extra_work) \
   while (len == 0) \
@@ -219,7 +219,7 @@  _DEFUN(__sfvwrite_r, (ptr, fp, uio),
 	  GETIOV (nlknown = 0);
 	  if (!nlknown)
 	    {
-	      nl = memchr ((_PTR) p, '\n', len);
+	      nl = memchr ((void *) p, '\n', len);
 	      nldist = nl ? nl + 1 - p : len + 1;
 	      nlknown = 1;
 	    }
diff --git a/newlib/libc/stdio/fvwrite.h b/newlib/libc/stdio/fvwrite.h
index 8b01a2a9d..91cabc890 100644
--- a/newlib/libc/stdio/fvwrite.h
+++ b/newlib/libc/stdio/fvwrite.h
@@ -22,7 +22,7 @@ 
  * I/O descriptors for __sfvwrite_r().
  */
 struct __siov {
-	const _PTR     iov_base;
+	const void *iov_base;
 	size_t	iov_len;
 };
 struct __suio {
diff --git a/newlib/libc/stdio/fwrite.c b/newlib/libc/stdio/fwrite.c
index cfaa2499a..7dec80c1a 100644
--- a/newlib/libc/stdio/fwrite.c
+++ b/newlib/libc/stdio/fwrite.c
@@ -110,7 +110,7 @@  static char sccsid[] = "%W% (Berkeley) %G%";
 size_t
 _DEFUN(_fwrite_r, (ptr, buf, size, count, fp),
        struct _reent * ptr,
-       const _PTR __restrict buf,
+       const void *__restrict buf,
        size_t size,
        size_t count,
        FILE * __restrict fp)
@@ -171,7 +171,7 @@  ret:
 #ifndef _REENT_ONLY
 size_t
 _DEFUN(fwrite, (buf, size, count, fp),
-       const _PTR __restrict buf,
+       const void *__restrict buf,
        size_t size,
        size_t count,
        FILE * fp)
diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c
index ac1276b48..c76527da6 100644
--- a/newlib/libc/stdio/makebuf.c
+++ b/newlib/libc/stdio/makebuf.c
@@ -39,7 +39,7 @@  _DEFUN(__smakebuf_r, (ptr, fp),
        struct _reent *ptr,
        register FILE *fp)
 {
-  register _PTR p;
+  register void *p;
   int flags;
   size_t size;
   int couldbetty;
diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c
index ad75b195c..58359dd4a 100644
--- a/newlib/libc/stdio/nano-vfprintf.c
+++ b/newlib/libc/stdio/nano-vfprintf.c
@@ -229,7 +229,7 @@  _DEFUN(__ssputs_r, (ptr, fp, buf, len),
   if (len < w)
     w = len;
 
-  (void)memmove ((_PTR) fp->_p, (_PTR) buf, (size_t) (w));
+  (void)memmove ((void *) fp->_p, (void *) buf, (size_t) (w));
   fp->_w -= w;
   fp->_p += w;
   return 0;
@@ -321,7 +321,7 @@  _DEFUN(__ssprint_r, (ptr, fp, uio),
       if (len < w)
 	w = len;
 
-      (void)memmove ((_PTR) fp->_p, (_PTR) p, (size_t) (w));
+      (void)memmove ((void *) fp->_p, (void *) p, (size_t) (w));
       fp->_w -= w;
       fp->_p += w;
       /* Pretend we copied all.  */
diff --git a/newlib/libc/stdio/nano-vfprintf_local.h b/newlib/libc/stdio/nano-vfprintf_local.h
index f883741d2..15ddce08e 100644
--- a/newlib/libc/stdio/nano-vfprintf_local.h
+++ b/newlib/libc/stdio/nano-vfprintf_local.h
@@ -114,7 +114,7 @@  extern char *_dtoa_r (struct _reent *, double, int,
 #define u_quad_t unsigned long
 
 typedef quad_t * quad_ptr_t;
-typedef _PTR     void_ptr_t;
+typedef void *void_ptr_t;
 typedef char *   char_ptr_t;
 typedef long *   long_ptr_t;
 typedef int  *   int_ptr_t;
diff --git a/newlib/libc/stdio/nano-vfscanf.c b/newlib/libc/stdio/nano-vfscanf.c
index 0196b285a..553fc22cb 100644
--- a/newlib/libc/stdio/nano-vfscanf.c
+++ b/newlib/libc/stdio/nano-vfscanf.c
@@ -255,7 +255,7 @@  _DEFUN(__ssrefill_r, (ptr, fp),
 #else
 int _EXFUN (_sungetc_r, (struct _reent *, int, register FILE *));
 int _EXFUN (__ssrefill_r, (struct _reent *, register FILE *));
-size_t _EXFUN (_sfread_r, (struct _reent *, _PTR buf, size_t, size_t, FILE *));
+size_t _EXFUN (_sfread_r, (struct _reent *, void *buf, size_t, size_t, FILE *));
 #endif /* !STRING_ONLY.  */
 
 int
diff --git a/newlib/libc/stdio/setvbuf.c b/newlib/libc/stdio/setvbuf.c
index 684a8b582..6ce0ee1fe 100644
--- a/newlib/libc/stdio/setvbuf.c
+++ b/newlib/libc/stdio/setvbuf.c
@@ -123,7 +123,7 @@  _DEFUN(setvbuf, (fp, buf, mode, size),
     FREEUB(reent, fp);
   fp->_r = fp->_lbfsize = 0;
   if (fp->_flags & __SMBF)
-    _free_r (reent, (_PTR) fp->_bf._base);
+    _free_r (reent, (void *) fp->_bf._base);
   fp->_flags &= ~(__SLBF | __SNBF | __SMBF | __SOPT | __SNPT | __SEOF);
 
   if (mode == _IONBF)
diff --git a/newlib/libc/stdio/stdio.c b/newlib/libc/stdio/stdio.c
index e64c061dd..0e8016b12 100644
--- a/newlib/libc/stdio/stdio.c
+++ b/newlib/libc/stdio/stdio.c
@@ -65,7 +65,7 @@  _DEFUN(__sread, (ptr, cookie, buf, n),
 _READ_WRITE_RETURN_TYPE
 _DEFUN(__seofread, (ptr, cookie, buf, len),
        struct _reent *_ptr,
-       _PTR cookie,
+       void *cookie,
        char *buf,
        _READ_WRITE_BUFSIZE_TYPE len)
 {
diff --git a/newlib/libc/stdio/ungetc.c b/newlib/libc/stdio/ungetc.c
index 98590478b..f7e12880e 100644
--- a/newlib/libc/stdio/ungetc.c
+++ b/newlib/libc/stdio/ungetc.c
@@ -100,10 +100,10 @@  _DEFUN(__submore, (rptr, fp),
       return 0;
     }
   i = fp->_ub._size;
-  p = (unsigned char *) _realloc_r (rptr, (_PTR) (fp->_ub._base), i << 1);
+  p = (unsigned char *) _realloc_r (rptr, (void *) (fp->_ub._base), i << 1);
   if (p == NULL)
     return EOF;
-  _CAST_VOID memcpy ((_PTR) (p + i), (_PTR) p, (size_t) i);
+  _CAST_VOID memcpy ((void *) (p + i), (void *) p, (size_t) i);
   fp->_p = p + i;
   fp->_ub._base = p;
   fp->_ub._size = i << 1;
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index b9b17fe58..f2d052b13 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -254,7 +254,7 @@  _DEFUN(__ssputs_r, (ptr, fp, buf, len),
 	}
 	if (len < w)
 		w = len;
-	(void)memmove ((_PTR) fp->_p, (_PTR) buf, (size_t) (w));
+	(void)memmove ((void *) fp->_p, (void *) buf, (size_t) (w));
 	fp->_w -= w;
 	fp->_p += w;
 
@@ -339,7 +339,7 @@  _DEFUN(__ssprint_r, (ptr, fp, uio),
 		}
 		if (len < w)
 			w = len;
-		(void)memmove ((_PTR) fp->_p, (_PTR) p, (size_t) (w));
+		(void)memmove ((void *) fp->_p, (void *) p, (size_t) (w));
 		fp->_w -= w;
 		fp->_p += w;
 		w = len;          /* pretend we copied all */
@@ -571,7 +571,7 @@  static int exponent(char *, int, int);
 #endif
 
 typedef quad_t * quad_ptr_t;
-typedef _PTR     void_ptr_t;
+typedef void *void_ptr_t;
 typedef char *   char_ptr_t;
 typedef long *   long_ptr_t;
 typedef int  *   int_ptr_t;
@@ -1175,7 +1175,7 @@  reswitch:	switch (ch) {
 			if (ch == 'C' || (flags & LONGINT)) {
 				mbstate_t ps;
 
-				memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
+				memset ((void *)&ps, '\0', sizeof (mbstate_t));
 				if ((size = (int)_wcrtomb_r (data, cp,
 					       (wchar_t)GET_ARG (N, ap, wint_t),
 						&ps)) == -1) {
@@ -1463,7 +1463,7 @@  string:
 
 				wcp = (const wchar_t *)cp;
 				size = m = 0;
-				memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
+				memset ((void *)&ps, '\0', sizeof (mbstate_t));
 
 				/* Count number of bytes needed for multibyte
 				   string that will be produced from widechar
@@ -1509,7 +1509,7 @@  string:
 					cp = buf;
 
 				/* Convert widechar string to multibyte string. */
-				memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
+				memset ((void *)&ps, '\0', sizeof (mbstate_t));
 				if (_wcsrtombs_r (data, cp, &wcp, size, &ps)
 				    != size) {
 					fp->_flags |= __SERR;
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index 38ef36ea5..8009699e4 100644
--- a/newlib/libc/stdio/vfscanf.c
+++ b/newlib/libc/stdio/vfscanf.c
@@ -349,7 +349,7 @@  _DEFUN(__ssrefill_r, (ptr, fp),
 size_t
 _DEFUN(_sfread_r, (ptr, buf, size, count, fp),
        struct _reent * ptr,
-       _PTR buf,
+       void *buf,
        size_t size,
        size_t count,
        FILE * fp)
@@ -367,7 +367,7 @@  _DEFUN(_sfread_r, (ptr, buf, size, count, fp),
 
   while (resid > (r = fp->_r))
     {
-      _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, (size_t) r);
+      _CAST_VOID memcpy ((void *) p, (void *) fp->_p, (size_t) r);
       fp->_p += r;
       fp->_r = 0;
       p += r;
@@ -378,7 +378,7 @@  _DEFUN(_sfread_r, (ptr, buf, size, count, fp),
           return (total - resid) / size;
         }
     }
-  _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, resid);
+  _CAST_VOID memcpy ((void *) p, (void *) fp->_p, resid);
   fp->_r -= resid;
   fp->_p += resid;
   return count;
@@ -386,7 +386,7 @@  _DEFUN(_sfread_r, (ptr, buf, size, count, fp),
 #else /* !STRING_ONLY || !INTEGER_ONLY */
 int _EXFUN (_sungetc_r, (struct _reent *, int, register FILE *));
 int _EXFUN (__ssrefill_r, (struct _reent *, register FILE *));
-size_t _EXFUN (_sfread_r, (struct _reent *, _PTR buf, size_t, size_t, FILE *));
+size_t _EXFUN (_sfread_r, (struct _reent *, void *buf, size_t, size_t, FILE *));
 #endif /* !STRING_ONLY || !INTEGER_ONLY */
 
 static inline int
diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c
index 1054eb942..449b628db 100644
--- a/newlib/libc/stdio/vfwprintf.c
+++ b/newlib/libc/stdio/vfwprintf.c
@@ -289,7 +289,7 @@  static int wexponent(wchar_t *, int, int);
 #endif
 
 typedef quad_t * quad_ptr_t;
-typedef _PTR     void_ptr_t;
+typedef void *void_ptr_t;
 typedef char *   char_ptr_t;
 typedef wchar_t* wchar_ptr_t;
 typedef long *   long_ptr_t;
@@ -1199,7 +1199,7 @@  string:
 
 				if (prec >= 0) {
 					char *p = arg;
-					memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
+					memset ((void *)&ps, '\0', sizeof (mbstate_t));
 					while (nchars < (size_t)prec) {
 						nconv = mbrlen (p, MB_CUR_MAX, &ps);
 						if (nconv == 0 || nconv == (size_t)-1 ||
@@ -1224,7 +1224,7 @@  string:
 					cp = malloc_buf;
 				} else
 					cp = buf;
-				memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
+				memset ((void *)&ps, '\0', sizeof (mbstate_t));
 				p = cp;
 				while (insize != 0) {
 					nconv = _mbrtowc_r (data, p, arg, insize, &ps);
diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c
index 73d8f3209..3ac6ecc07 100644
--- a/newlib/libc/stdio/vfwscanf.c
+++ b/newlib/libc/stdio/vfwscanf.c
@@ -936,7 +936,7 @@  _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
 	      else
 		mbp = GET_ARG(N, ap, char *);
 	      n = 0;
-	      memset ((_PTR)&mbs, '\0', sizeof (mbstate_t));
+	      memset ((void *)&mbs, '\0', sizeof (mbstate_t));
 	      while (width != 0 && (wi = _fgetwc_r (rptr, fp)) != WEOF)
 		{
 		  nconv = _wcrtomb_r (rptr, mbp, wi, &mbs);
@@ -1028,7 +1028,7 @@  _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
 	      else
 		mbp = GET_ARG(N, ap, char *);
 	      n = 0;
-	      memset ((_PTR) &mbs, '\0', sizeof (mbstate_t));
+	      memset ((void *) &mbs, '\0', sizeof (mbstate_t));
 	      while ((wi = _fgetwc_r (rptr, fp)) != WEOF
 		     && width != 0 && INCCL (wi))
 		{
@@ -1117,7 +1117,7 @@  _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
 #endif
 	      else
 		mbp = GET_ARG(N, ap, char *);
-	      memset ((_PTR) &mbs, '\0', sizeof (mbstate_t));
+	      memset ((void *) &mbs, '\0', sizeof (mbstate_t));
 	      while ((wi = _fgetwc_r (rptr, fp)) != WEOF
 		     && width != 0 && !iswspace (wi))
 		{
diff --git a/newlib/libc/stdio64/fdopen64.c b/newlib/libc/stdio64/fdopen64.c
index f0c3c0784..3c8d4fa05 100644
--- a/newlib/libc/stdio64/fdopen64.c
+++ b/newlib/libc/stdio64/fdopen64.c
@@ -76,7 +76,7 @@  _DEFUN (_fdopen64_r, (ptr, fd, mode),
     _fcntl_r (ptr, fd, F_SETFL, fdflags | O_APPEND);
 #endif
   fp->_file = fd;
-  fp->_cookie = (_PTR) fp;
+  fp->_cookie = (void *) fp;
 
 #undef _read
 #undef _write
diff --git a/newlib/libc/stdio64/fopen64.c b/newlib/libc/stdio64/fopen64.c
index 6bdf61973..406afa190 100644
--- a/newlib/libc/stdio64/fopen64.c
+++ b/newlib/libc/stdio64/fopen64.c
@@ -93,7 +93,7 @@  _DEFUN (_fopen64_r, (ptr, file, mode),
 
   fp->_file = f;
   fp->_flags = flags;
-  fp->_cookie = (_PTR) fp;
+  fp->_cookie = (void *) fp;
   fp->_read = __sread;
   fp->_write = __swrite64;
   fp->_seek = __sseek;
diff --git a/newlib/libc/stdio64/freopen64.c b/newlib/libc/stdio64/freopen64.c
index 02995b98a..d267899c6 100644
--- a/newlib/libc/stdio64/freopen64.c
+++ b/newlib/libc/stdio64/freopen64.c
@@ -222,7 +222,7 @@  _DEFUN (_freopen64_r, (ptr, file, mode, fp),
 
   fp->_flags = flags;
   fp->_file = f;
-  fp->_cookie = (_PTR) fp;
+  fp->_cookie = (void *) fp;
   fp->_read = __sread;
   fp->_write = __swrite64;
   fp->_seek = __sseek;
diff --git a/newlib/libc/stdlib/__call_atexit.c b/newlib/libc/stdlib/__call_atexit.c
index e6c1ee643..ad70fcd33 100644
--- a/newlib/libc/stdlib/__call_atexit.c
+++ b/newlib/libc/stdlib/__call_atexit.c
@@ -66,7 +66,7 @@  register_fini(void)
 
 void 
 _DEFUN (__call_exitprocs, (code, d),
-	int code, _PTR d)
+	int code, void *d)
 {
   register struct _atexit *p;
   struct _atexit **lastp;
@@ -119,9 +119,9 @@  _DEFUN (__call_exitprocs, (code, d),
 	  if (!args || (args->_fntypes & i) == 0)
 	    fn ();
 	  else if ((args->_is_cxa & i) == 0)
-	    (*((void (*)(int, _PTR)) fn))(code, args->_fnargs[n]);
+	    (*((void (*)(int, void *)) fn))(code, args->_fnargs[n]);
 	  else
-	    (*((void (*)(_PTR)) fn))(args->_fnargs[n]);
+	    (*((void (*)(void *)) fn))(args->_fnargs[n]);
 
 	  /* The function we called call atexit and registered another
 	     function (or functions).  Call these new functions before
diff --git a/newlib/libc/stdlib/atexit.h b/newlib/libc/stdlib/atexit.h
index eadc7d13d..df99963d5 100644
--- a/newlib/libc/stdlib/atexit.h
+++ b/newlib/libc/stdlib/atexit.h
@@ -9,6 +9,6 @@  enum __atexit_types
   __et_cxa
 };
 
-void __call_exitprocs (int, _PTR);
-int __register_exitproc (int, void (*fn) (void), _PTR, _PTR);
+void __call_exitprocs (int, void *);
+int __register_exitproc (int, void (*fn) (void), void *, void *);
 
diff --git a/newlib/libc/stdlib/calloc.c b/newlib/libc/stdlib/calloc.c
index dfdb7f5dc..f853f4f3c 100644
--- a/newlib/libc/stdlib/calloc.c
+++ b/newlib/libc/stdlib/calloc.c
@@ -45,7 +45,7 @@  Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 
 #ifndef _REENT_ONLY
 
-_PTR
+void *
 _DEFUN (calloc, (n, size),
 	size_t n,
 	size_t size)
diff --git a/newlib/libc/stdlib/cxa_atexit.c b/newlib/libc/stdlib/cxa_atexit.c
index c03894c4a..096add4fa 100644
--- a/newlib/libc/stdlib/cxa_atexit.c
+++ b/newlib/libc/stdlib/cxa_atexit.c
@@ -30,7 +30,7 @@  _DEFUN (__cxa_atexit,
 {
 #ifdef _LITE_EXIT
   /* Refer to comments in __atexit.c for more details of lite exit.  */
-  int __register_exitproc (int, void (*fn) (void), _PTR, _PTR)
+  int __register_exitproc (int, void (*fn) (void), void *, void *)
     __attribute__ ((weak));
 
   if (!__register_exitproc)
diff --git a/newlib/libc/stdlib/exit.c b/newlib/libc/stdlib/exit.c
index 481985cd1..8fa949081 100644
--- a/newlib/libc/stdlib/exit.c
+++ b/newlib/libc/stdlib/exit.c
@@ -55,7 +55,7 @@  _DEFUN (exit, (code),
 {
 #ifdef _LITE_EXIT
   /* Refer to comments in __atexit.c for more details of lite exit.  */
-  void __call_exitprocs (int, _PTR)) __attribute__((weak);
+  void __call_exitprocs (int, void *)) __attribute__((weak);
   if (__call_exitprocs)
 #endif
     __call_exitprocs (code, NULL);
diff --git a/newlib/libc/stdlib/malign.c b/newlib/libc/stdlib/malign.c
index d36846f98..e7d56bb51 100644
--- a/newlib/libc/stdlib/malign.c
+++ b/newlib/libc/stdlib/malign.c
@@ -8,7 +8,7 @@ 
 
 #ifndef _REENT_ONLY
 
-_PTR
+void *
 _DEFUN (memalign, (align, nbytes),
 	size_t align,
 	size_t nbytes)
diff --git a/newlib/libc/stdlib/malloc.c b/newlib/libc/stdlib/malloc.c
index 9cf897852..5acaa85d3 100644
--- a/newlib/libc/stdlib/malloc.c
+++ b/newlib/libc/stdlib/malloc.c
@@ -158,7 +158,7 @@  Supporting OS subroutines required: <<sbrk>>.  */
 
 #ifndef _REENT_ONLY
 
-_PTR
+void *
 _DEFUN (malloc, (nbytes),
 	size_t nbytes)		/* get a block */
 {
@@ -167,7 +167,7 @@  _DEFUN (malloc, (nbytes),
 
 void
 _DEFUN (free, (aptr),
-	_PTR aptr)
+	void *aptr)
 {
   _free_r (_REENT, aptr);
 }
diff --git a/newlib/libc/stdlib/msize.c b/newlib/libc/stdlib/msize.c
index e33e4aa37..8c2b221e4 100644
--- a/newlib/libc/stdlib/msize.c
+++ b/newlib/libc/stdlib/msize.c
@@ -10,7 +10,7 @@ 
 
 size_t
 _DEFUN (malloc_usable_size, (ptr),
-	_PTR ptr)
+	void *ptr)
 {
   return _malloc_usable_size_r (_REENT, ptr);
 }
diff --git a/newlib/libc/stdlib/on_exit.c b/newlib/libc/stdlib/on_exit.c
index b21cf0cb2..329b25425 100644
--- a/newlib/libc/stdlib/on_exit.c
+++ b/newlib/libc/stdlib/on_exit.c
@@ -68,8 +68,8 @@  const void * const __on_exit_dummy = &__on_exit_args;
 int
 _DEFUN (on_exit,
 	(fn, arg),
-	_VOID _EXFNPTR(fn, (int, _PTR)),
-        _PTR arg)
+	_VOID _EXFNPTR(fn, (int, void *)),
+        void *arg)
 {
   return __register_exitproc (__et_onexit, (void (*)(void)) fn, arg, NULL);
 }
diff --git a/newlib/libc/stdlib/realloc.c b/newlib/libc/stdlib/realloc.c
index 8258e211e..00a88a5a2 100644
--- a/newlib/libc/stdlib/realloc.c
+++ b/newlib/libc/stdlib/realloc.c
@@ -10,9 +10,9 @@  int _dummy_realloc = 1;
 
 #ifndef _REENT_ONLY
 
-_PTR
+void *
 _DEFUN (realloc, (ap, nbytes),
-	_PTR ap,
+	void *ap,
 	size_t nbytes)
 {
   return _realloc_r (_REENT, ap, nbytes);
diff --git a/newlib/libc/stdlib/reallocf.c b/newlib/libc/stdlib/reallocf.c
index b3f1b2aab..c4aaeaeaa 100644
--- a/newlib/libc/stdlib/reallocf.c
+++ b/newlib/libc/stdlib/reallocf.c
@@ -30,10 +30,10 @@ 
 
 #include <stdlib.h>
 
-_PTR
+void *
 _DEFUN (_reallocf_r, (reentptr, ptr, size),
 	struct _reent *reentptr,
-	_PTR ptr,
+	void *ptr,
 	size_t size)
 {
 	void *nptr;
@@ -45,9 +45,9 @@  _DEFUN (_reallocf_r, (reentptr, ptr, size),
 }
 
 #ifndef _REENT_ONLY
-_PTR
+void *
 _DEFUN (reallocf, (ptr, size),
-	_PTR ptr,
+	void *ptr,
 	size_t size)
 {
   return _reallocf_r(_REENT, ptr, size);
diff --git a/newlib/libc/stdlib/valloc.c b/newlib/libc/stdlib/valloc.c
index 26a44df44..83a839e31 100644
--- a/newlib/libc/stdlib/valloc.c
+++ b/newlib/libc/stdlib/valloc.c
@@ -8,14 +8,14 @@ 
 
 #ifndef _REENT_ONLY
 
-_PTR
+void *
 _DEFUN (valloc, (nbytes),
 	size_t nbytes)
 {
   return _valloc_r (_REENT, nbytes);
 }
 
-_PTR
+void *
 _DEFUN (pvalloc, (nbytes),
 	size_t nbytes)
 {
diff --git a/newlib/libc/string/memccpy.c b/newlib/libc/string/memccpy.c
index b03b504c1..9b94061cb 100644
--- a/newlib/libc/string/memccpy.c
+++ b/newlib/libc/string/memccpy.c
@@ -55,16 +55,16 @@  PORTABILITY
 #endif
 
 
-_PTR
+void *
 _DEFUN (memccpy, (dst0, src0, endchar, len0),
-	_PTR __restrict dst0,
-	const _PTR __restrict src0,
+	void *__restrict dst0,
+	const void *__restrict src0,
 	int endchar0,
 	size_t len0)
 {
 
 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
-  _PTR ptr = NULL;
+  void *ptr = NULL;
   char *dst = (char *) dst0;
   char *src = (char *) src0;
   char endchar = endchar0 & 0xff;
@@ -80,7 +80,7 @@  _DEFUN (memccpy, (dst0, src0, endchar, len0),
 
   return ptr;
 #else
-  _PTR ptr = NULL;
+  void *ptr = NULL;
   char *dst = dst0;
   const char *src = src0;
   long *aligned_dst;
diff --git a/newlib/libc/string/memchr.c b/newlib/libc/string/memchr.c
index 9660ed383..91f0b3788 100644
--- a/newlib/libc/string/memchr.c
+++ b/newlib/libc/string/memchr.c
@@ -61,9 +61,9 @@  QUICKREF
    to fill (long)MASK. */
 #define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK))
 
-_PTR
+void *
 _DEFUN (memchr, (src_void, c, length),
-	const _PTR src_void,
+	const void *src_void,
 	int c,
 	size_t length)
 {
diff --git a/newlib/libc/string/memcmp.c b/newlib/libc/string/memcmp.c
index 37d653a26..c05cf5745 100644
--- a/newlib/libc/string/memcmp.c
+++ b/newlib/libc/string/memcmp.c
@@ -44,8 +44,8 @@  QUICKREF
 
 int
 _DEFUN (memcmp, (m1, m2, n),
-	const _PTR m1,
-	const _PTR m2,
+	const void *m1,
+	const void *m2,
 	size_t n)
 {
 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
diff --git a/newlib/libc/string/memcpy.c b/newlib/libc/string/memcpy.c
index 919379053..e1ae0ffe9 100644
--- a/newlib/libc/string/memcpy.c
+++ b/newlib/libc/string/memcpy.c
@@ -43,17 +43,17 @@  QUICKREF
 /* Threshhold for punting to the byte copier.  */
 #define TOO_SMALL(LEN)  ((LEN) < BIGBLOCKSIZE)
 
-_PTR
+void *
 _DEFUN (memcpy, (dst0, src0, len0),
-	_PTR __restrict dst0,
-	const _PTR __restrict src0,
+	void *__restrict dst0,
+	const void *__restrict src0,
 	size_t len0)
 {
 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
   char *dst = (char *) dst0;
   char *src = (char *) src0;
 
-  _PTR save = dst0;
+  void *save = dst0;
 
   while (len0--)
     {
diff --git a/newlib/libc/string/memmove.c b/newlib/libc/string/memmove.c
index e50ab587a..70adb836c 100644
--- a/newlib/libc/string/memmove.c
+++ b/newlib/libc/string/memmove.c
@@ -48,11 +48,11 @@  QUICKREF
 #define TOO_SMALL(LEN)  ((LEN) < BIGBLOCKSIZE)
 
 /*SUPPRESS 20*/
-_PTR
+void *
 __inhibit_loop_to_libcall
 _DEFUN (memmove, (dst_void, src_void, length),
-	_PTR dst_void,
-	const _PTR src_void,
+	void *dst_void,
+	const void *src_void,
 	size_t length)
 {
 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
diff --git a/newlib/libc/string/mempcpy.c b/newlib/libc/string/mempcpy.c
index 79cbf2350..babaea006 100644
--- a/newlib/libc/string/mempcpy.c
+++ b/newlib/libc/string/mempcpy.c
@@ -42,10 +42,10 @@  PORTABILITY
 /* Threshhold for punting to the byte copier.  */
 #define TOO_SMALL(LEN)  ((LEN) < BIGBLOCKSIZE)
 
-_PTR
+void *
 _DEFUN (mempcpy, (dst0, src0, len0),
-	_PTR dst0,
-	const _PTR src0,
+	void *dst0,
+	const void *src0,
 	size_t len0)
 {
 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
diff --git a/newlib/libc/string/memrchr.c b/newlib/libc/string/memrchr.c
index 7a28e2733..432f46212 100644
--- a/newlib/libc/string/memrchr.c
+++ b/newlib/libc/string/memrchr.c
@@ -61,9 +61,9 @@  QUICKREF
    to fill (long)MASK. */
 #define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK))
 
-_PTR
+void *
 _DEFUN (memrchr, (src_void, c, length),
-	const _PTR src_void,
+	const void *src_void,
 	int c,
 	size_t length)
 {
diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c
index 284c36e2c..5ce15c5aa 100644
--- a/newlib/libc/string/memset.c
+++ b/newlib/libc/string/memset.c
@@ -33,10 +33,10 @@  QUICKREF
 #define UNALIGNED(X)   ((long)X & (LBLOCKSIZE - 1))
 #define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE)
 
-_PTR
+void *
 __inhibit_loop_to_libcall
 _DEFUN (memset, (m, c, n),
-	_PTR m,
+	void *m,
 	int c,
 	size_t n)
 {
diff --git a/newlib/libc/string/rawmemchr.c b/newlib/libc/string/rawmemchr.c
index b2078dc27..881bd231a 100644
--- a/newlib/libc/string/rawmemchr.c
+++ b/newlib/libc/string/rawmemchr.c
@@ -60,9 +60,9 @@  QUICKREF
    to fill (long)MASK. */
 #define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK))
 
-_PTR
+void *
 _DEFUN (rawmemchr, (src_void, c),
-	const _PTR src_void,
+	const void *src_void,
 	int c)
 {
   const unsigned char *src = (const unsigned char *) src_void;
diff --git a/newlib/libc/sys/linux/pread.c b/newlib/libc/sys/linux/pread.c
index 8a016e08a..8d905598f 100644
--- a/newlib/libc/sys/linux/pread.c
+++ b/newlib/libc/sys/linux/pread.c
@@ -9,7 +9,7 @@  ssize_t
 _DEFUN (_pread_r, (rptr, fd, buf, n, off),
      struct _reent *rptr,
      int fd,
-     _PTR buf,
+     void *buf,
      size_t n,
      off_t off)
 {
@@ -35,7 +35,7 @@  _DEFUN (_pread_r, (rptr, fd, buf, n, off),
 ssize_t
 _DEFUN (__libc_pread, (fd, buf, n, off),
      int fd,
-     _PTR buf,
+     void *buf,
      size_t n,
      off_t off)
 {
diff --git a/newlib/libc/sys/linux/pread64.c b/newlib/libc/sys/linux/pread64.c
index f95989b45..20d1f9c35 100644
--- a/newlib/libc/sys/linux/pread64.c
+++ b/newlib/libc/sys/linux/pread64.c
@@ -32,7 +32,7 @@  Supporting OS subroutine required: <<read>>, <<lseek64>>.
 ssize_t
 _DEFUN (__libc_pread64, (fd, buf, n, off),
      int fd,
-     _PTR buf,
+     void *buf,
      size_t n,
      loff_t off)
 {
diff --git a/newlib/libc/sys/linux/pwrite.c b/newlib/libc/sys/linux/pwrite.c
index 2db2935ed..b0ec9c233 100644
--- a/newlib/libc/sys/linux/pwrite.c
+++ b/newlib/libc/sys/linux/pwrite.c
@@ -9,7 +9,7 @@  ssize_t
 _DEFUN (_pwrite_r, (rptr, fd, buf, n, off),
      struct _reent *rptr,
      int fd,
-     const _PTR buf,
+     const void *buf,
      size_t n,
      off_t off)
 {
@@ -35,7 +35,7 @@  _DEFUN (_pwrite_r, (rptr, fd, buf, n, off),
 ssize_t
 _DEFUN (__libc_pwrite, (fd, buf, n, off),
      int fd,
-     const _PTR buf,
+     const void *buf,
      size_t n,
      off_t off)
 {
diff --git a/newlib/libc/sys/linux/pwrite64.c b/newlib/libc/sys/linux/pwrite64.c
index d486988dd..c80a3a2d3 100644
--- a/newlib/libc/sys/linux/pwrite64.c
+++ b/newlib/libc/sys/linux/pwrite64.c
@@ -32,7 +32,7 @@  Supporting OS subroutine required: <<write>>, <<lseek64>>.
 ssize_t
 _DEFUN (__libc_pwrite64, (fd, buf, n, off),
      int fd,
-     _PTR buf,
+     void *buf,
      size_t n,
      loff_t off)
 {
diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c
index 9778b985a..dca5fc8bc 100644
--- a/newlib/libc/sys/rtems/crt0.c
+++ b/newlib/libc/sys/rtems/crt0.c
@@ -30,7 +30,7 @@  ret func body
 RTEMS_STUB(void *,malloc(size_t s), { return 0; })
 RTEMS_STUB(void *,realloc(void* p, size_t s), { return 0; })
 RTEMS_STUB(void, free(void* ptr), { })
-RTEMS_STUB(_PTR, calloc(size_t s1, size_t s2), { return 0; })
+RTEMS_STUB(void *, calloc(size_t s1, size_t s2), { return 0; })
 RTEMS_STUB(int, posix_memalign(void **p, size_t si, size_t s2), { return -1; })
 
 /* Stubs for routines from RTEMS <sys/lock.h> */
@@ -186,10 +186,10 @@  RTEMS_STUB(int, issetugid (void), { return 0; })
 #endif
 
 /* stdlib.h */
-RTEMS_STUB(_PTR, _realloc_r(struct _reent *r, _PTR p, size_t s), { return 0; })
-RTEMS_STUB(_PTR, _calloc_r(struct _reent *r, size_t s1, size_t s2), { return 0; })
-RTEMS_STUB(_PTR, _malloc_r(struct _reent * r, size_t s), { return 0; })
-RTEMS_STUB(_VOID, _free_r(struct _reent *r, _PTR *p), { })
+RTEMS_STUB(void *, _realloc_r(struct _reent *r, void *p, size_t s), { return 0; })
+RTEMS_STUB(void *, _calloc_r(struct _reent *r, size_t s1, size_t s2), { return 0; })
+RTEMS_STUB(void *, _malloc_r(struct _reent * r, size_t s), { return 0; })
+RTEMS_STUB(_VOID, _free_r(struct _reent *r, void **p), { })
 
 /* stubs for functions required by libc/stdlib */
 RTEMS_STUB(void, __assert_func(const char *file, int line, const char *failedexpr), { })
diff --git a/newlib/libc/unix/pread.c b/newlib/libc/unix/pread.c
index 236044465..54efe29fe 100644
--- a/newlib/libc/unix/pread.c
+++ b/newlib/libc/unix/pread.c
@@ -41,7 +41,7 @@  ssize_t
 _DEFUN (_pread_r, (rptr, fd, buf, n, off),
      struct _reent *rptr,
      int fd,
-     _PTR buf,
+     void *buf,
      size_t n,
      off_t off)
 {
@@ -67,7 +67,7 @@  _DEFUN (_pread_r, (rptr, fd, buf, n, off),
 ssize_t
 _DEFUN (pread, (fd, buf, n, off),
      int fd,
-     _PTR buf,
+     void *buf,
      size_t n,
      off_t off)
 {
diff --git a/newlib/libc/unix/pwrite.c b/newlib/libc/unix/pwrite.c
index 3bf759bd0..939d186d4 100644
--- a/newlib/libc/unix/pwrite.c
+++ b/newlib/libc/unix/pwrite.c
@@ -42,7 +42,7 @@  ssize_t
 _DEFUN (_pwrite_r, (rptr, fd, buf, n, off),
      struct _reent *rptr,
      int fd,
-     const _PTR buf,
+     const void *buf,
      size_t n,
      off_t off)
 {
@@ -68,7 +68,7 @@  _DEFUN (_pwrite_r, (rptr, fd, buf, n, off),
 ssize_t
 _DEFUN (pwrite, (fd, buf, n, off),
      int fd,
-     const _PTR buf,
+     const void *buf,
      size_t n,
      off_t off)
 {
diff --git a/newlib/libc/xdr/xdr_sizeof.c b/newlib/libc/xdr/xdr_sizeof.c
index fe7aaa723..b7dc6d098 100644
--- a/newlib/libc/xdr/xdr_sizeof.c
+++ b/newlib/libc/xdr/xdr_sizeof.c
@@ -144,7 +144,7 @@  _DEFUN (x_putint32, (xdrs, int32p),
 unsigned long
 _DEFUN (xdr_sizeof, (func, data),
         xdrproc_t func,
-	_PTR data)
+	void *data)
 {
   XDR x;
   struct xdr_ops ops;
diff --git a/winsup/cygwin/include/cygwin/stdlib.h b/winsup/cygwin/include/cygwin/stdlib.h
index fc8bc8486..845d2d81b 100644
--- a/winsup/cygwin/include/cygwin/stdlib.h
+++ b/winsup/cygwin/include/cygwin/stdlib.h
@@ -45,9 +45,9 @@  int posix_openpt (int);
 #define _unsetenv_r UNUSED__unsetenv_r
 #endif
 
-extern _PTR memalign (size_t, size_t);
+extern void *memalign (size_t, size_t);
 #if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112)
-extern _PTR valloc (size_t);
+extern void *valloc (size_t);
 #endif
 
 #undef _malloc_r