diff mbox series

[v2,08/17] ansification: remove _CAST_VOID

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

Commit Message

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

---
 newlib/libc/include/_ansi.h           |  2 --
 newlib/libc/include/sys/lock.h        | 20 ++++++++++----------
 newlib/libc/include/sys/stdio.h       |  4 ++--
 newlib/libc/machine/powerpc/vfscanf.c |  6 +++---
 newlib/libc/stdio/fgets.c             |  4 ++--
 newlib/libc/stdio/findfp.c            |  6 +++---
 newlib/libc/stdio/fread.c             |  6 +++---
 newlib/libc/stdio/fvwrite.c           |  2 +-
 newlib/libc/stdio/refill.c            |  2 +-
 newlib/libc/stdio/rewind.c            |  2 +-
 newlib/libc/stdio/setbuf.c            |  2 +-
 newlib/libc/stdio/setbuffer.c         |  2 +-
 newlib/libc/stdio/tmpfile.c           |  2 +-
 newlib/libc/stdio/ungetc.c            |  2 +-
 newlib/libc/stdio/vfscanf.c           |  4 ++--
 newlib/libc/stdio64/tmpfile64.c       |  2 +-
 newlib/libc/string/u_strerr.c         |  6 +++---
 17 files changed, 36 insertions(+), 38 deletions(-)

-- 
2.15.1
diff mbox series

Patch

diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h
index e955138fe..5e0cce4c8 100644
--- a/newlib/libc/include/_ansi.h
+++ b/newlib/libc/include/_ansi.h
@@ -63,7 +63,6 @@ 
 #endif
 #define	_DEFUN(name, arglist, args)	name(args)
 #define	_DEFUN_VOID(name)		name(void)
-#define _CAST_VOID (void)
 #ifndef _LONG_DOUBLE
 #define _LONG_DOUBLE long double
 #endif
@@ -75,7 +74,6 @@ 
 #define	_EXFUN_NOTHROW(name, proto)	name()
 #define	_DEFUN(name, arglist, args)	name arglist args;
 #define	_DEFUN_VOID(name)		name()
-#define _CAST_VOID
 #define _LONG_DOUBLE double
 #endif
 
diff --git a/newlib/libc/include/sys/lock.h b/newlib/libc/include/sys/lock.h
index 42f9c4cd9..528904957 100644
--- a/newlib/libc/include/sys/lock.h
+++ b/newlib/libc/include/sys/lock.h
@@ -13,16 +13,16 @@  typedef int _LOCK_RECURSIVE_T;
 
 #define __LOCK_INIT(class,lock) static int lock = 0;
 #define __LOCK_INIT_RECURSIVE(class,lock) static int lock = 0;
-#define __lock_init(lock) (_CAST_VOID 0)
-#define __lock_init_recursive(lock) (_CAST_VOID 0)
-#define __lock_close(lock) (_CAST_VOID 0)
-#define __lock_close_recursive(lock) (_CAST_VOID 0)
-#define __lock_acquire(lock) (_CAST_VOID 0)
-#define __lock_acquire_recursive(lock) (_CAST_VOID 0)
-#define __lock_try_acquire(lock) (_CAST_VOID 0)
-#define __lock_try_acquire_recursive(lock) (_CAST_VOID 0)
-#define __lock_release(lock) (_CAST_VOID 0)
-#define __lock_release_recursive(lock) (_CAST_VOID 0)
+#define __lock_init(lock) ((void) 0)
+#define __lock_init_recursive(lock) ((void) 0)
+#define __lock_close(lock) ((void) 0)
+#define __lock_close_recursive(lock) ((void) 0)
+#define __lock_acquire(lock) ((void) 0)
+#define __lock_acquire_recursive(lock) ((void) 0)
+#define __lock_try_acquire(lock) ((void) 0)
+#define __lock_try_acquire_recursive(lock) ((void) 0)
+#define __lock_release(lock) ((void) 0)
+#define __lock_release_recursive(lock) ((void) 0)
 
 #else
 
diff --git a/newlib/libc/include/sys/stdio.h b/newlib/libc/include/sys/stdio.h
index 0918fe157..91a274596 100644
--- a/newlib/libc/include/sys/stdio.h
+++ b/newlib/libc/include/sys/stdio.h
@@ -12,7 +12,7 @@ 
 #ifndef __SINGLE_THREAD__
 #  define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock))
 #else
-#  define _flockfile(fp)	(_CAST_VOID 0)
+#  define _flockfile(fp)	((void) 0)
 #endif
 #endif
 
@@ -20,7 +20,7 @@ 
 #ifndef __SINGLE_THREAD__
 #  define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock))
 #else
-#  define _funlockfile(fp)	(_CAST_VOID 0)
+#  define _funlockfile(fp)	((void) 0)
 #endif
 #endif
 
diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c
index b27a0b81c..4a3e48c22 100644
--- a/newlib/libc/machine/powerpc/vfscanf.c
+++ b/newlib/libc/machine/powerpc/vfscanf.c
@@ -912,7 +912,7 @@  __svfscanf_r (rptr, fp, fmt0, ap)
 	  if (flags & NDIGITS)
 	    {
 	      if (p > buf)
-		_CAST_VOID ungetc (*(u_char *)-- p, fp);
+		(void) ungetc (*(u_char *)-- p, fp);
 	      goto match_failure;
 	    }
 	  c = ((u_char *) p)[-1];
@@ -1112,11 +1112,11 @@  __svfscanf_r (rptr, fp, fmt0, ap)
               --nread;
 	      if (c != 'e' && c != 'E')
 		{
-		  _CAST_VOID ungetc (c, fp);	/* sign */
+		  (void) ungetc (c, fp);	/* sign */
 		  c = *(u_char *)-- p;
                   --nread;
 		}
-	      _CAST_VOID ungetc (c, fp);
+	      (void) ungetc (c, fp);
 	    }
 	  if ((flags & SUPPRESS) == 0)
 	    {
diff --git a/newlib/libc/stdio/fgets.c b/newlib/libc/stdio/fgets.c
index d4e0af35c..c6ef6d3d5 100644
--- a/newlib/libc/stdio/fgets.c
+++ b/newlib/libc/stdio/fgets.c
@@ -170,14 +170,14 @@  _DEFUN(_fgets_r, (ptr, buf, n, fp),
 	  len = ++t - p;
 	  fp->_r -= len;
 	  fp->_p = t;
-	  _CAST_VOID memcpy ((void *) s, (void *) p, len);
+	  (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 ((void *) s, (void *) p, len);
+      (void) memcpy ((void *) s, (void *) p, len);
       s += len;
     }
   while ((n -= len) != 0);
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index 3d928c15d..a7ea76bb5 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -230,7 +230,7 @@  _DEFUN(_cleanup_r, (ptr),
   if (ptr->_stderr != &__sf[2])
     (*cleanup_func) (ptr, ptr->_stderr);
 #endif
-  _CAST_VOID _fwalk_reent (ptr, cleanup_func);
+  (void) _fwalk_reent (ptr, cleanup_func);
 }
 
 #ifndef _REENT_ONLY
@@ -354,13 +354,13 @@  _DEFUN_VOID(__fp_lock_all)
 {
   __sfp_lock_acquire ();
 
-  _CAST_VOID _fwalk (_REENT, __fp_lock);
+  (void) _fwalk (_REENT, __fp_lock);
 }
 
 _VOID
 _DEFUN_VOID(__fp_unlock_all)
 {
-  _CAST_VOID _fwalk (_REENT, __fp_unlock);
+  (void) _fwalk (_REENT, __fp_unlock);
 
   __sfp_lock_release ();
 }
diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c
index 58aa2c68d..c9180b833 100644
--- a/newlib/libc/stdio/fread.c
+++ b/newlib/libc/stdio/fread.c
@@ -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 ((void *) p, (void *) fp->_p, (size_t) copy_size);
+      (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 ((void *) p, (void *) fp->_p, (size_t) r);
+	  (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 ((void *) p, (void *) fp->_p, resid);
+      (void) memcpy ((void *) p, (void *) fp->_p, resid);
       fp->_r -= resid;
       fp->_p += resid;
     }
diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c
index 95bd34c6d..d742784e5 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 ((void *) fp->_p, (void *) p, (size_t) (n))
+#define	COPY(n)	  (void) memmove ((void *) fp->_p, (void *) p, (size_t) (n))
 
 #define GETIOV(extra_work) \
   while (len == 0) \
diff --git a/newlib/libc/stdio/refill.c b/newlib/libc/stdio/refill.c
index fc738d455..6158f3ec0 100644
--- a/newlib/libc/stdio/refill.c
+++ b/newlib/libc/stdio/refill.c
@@ -107,7 +107,7 @@  _DEFUN(__srefill_r, (ptr, fp),
       /* Ignore this file in _fwalk to avoid potential deadlock. */
       short orig_flags = fp->_flags;
       fp->_flags = 1;
-      _CAST_VOID _fwalk (_GLOBAL_REENT, lflush);
+      (void) _fwalk (_GLOBAL_REENT, lflush);
       fp->_flags = orig_flags;
 
       /* Now flush this file without locking it. */
diff --git a/newlib/libc/stdio/rewind.c b/newlib/libc/stdio/rewind.c
index 873083b85..a09186bb0 100644
--- a/newlib/libc/stdio/rewind.c
+++ b/newlib/libc/stdio/rewind.c
@@ -56,7 +56,7 @@  _DEFUN(_rewind_r, (ptr, fp),
        struct _reent * ptr,
        register FILE * fp)
 {
-  _CAST_VOID _fseek_r (ptr, fp, 0L, SEEK_SET);
+  (void) _fseek_r (ptr, fp, 0L, SEEK_SET);
   clearerr (fp);
 }
 
diff --git a/newlib/libc/stdio/setbuf.c b/newlib/libc/stdio/setbuf.c
index a7df3a1f4..7308ab8c2 100644
--- a/newlib/libc/stdio/setbuf.c
+++ b/newlib/libc/stdio/setbuf.c
@@ -69,5 +69,5 @@  _DEFUN(setbuf, (fp, buf),
        FILE *__restrict fp,
        char *__restrict buf)
 {
-  _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
+  (void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
 }
diff --git a/newlib/libc/stdio/setbuffer.c b/newlib/libc/stdio/setbuffer.c
index cbcbde3db..6914ca7f2 100644
--- a/newlib/libc/stdio/setbuffer.c
+++ b/newlib/libc/stdio/setbuffer.c
@@ -70,5 +70,5 @@  _DEFUN(setbuffer, (fp, buf, size),
        char *buf,
        int size)
 {
-  _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size);
+  (void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size);
 }
diff --git a/newlib/libc/stdio/tmpfile.c b/newlib/libc/stdio/tmpfile.c
index 6145ad0bc..30e9040fd 100644
--- a/newlib/libc/stdio/tmpfile.c
+++ b/newlib/libc/stdio/tmpfile.c
@@ -73,7 +73,7 @@  _DEFUN(_tmpfile_r, (ptr),
   e = ptr->_errno;
   if (!fp)
     _close_r (ptr, fd);
-  _CAST_VOID _remove_r (ptr, f);
+  (void) _remove_r (ptr, f);
   ptr->_errno = e;
   return fp;
 }
diff --git a/newlib/libc/stdio/ungetc.c b/newlib/libc/stdio/ungetc.c
index f7e12880e..c673365b1 100644
--- a/newlib/libc/stdio/ungetc.c
+++ b/newlib/libc/stdio/ungetc.c
@@ -103,7 +103,7 @@  _DEFUN(__submore, (rptr, fp),
   p = (unsigned char *) _realloc_r (rptr, (void *) (fp->_ub._base), i << 1);
   if (p == NULL)
     return EOF;
-  _CAST_VOID memcpy ((void *) (p + i), (void *) p, (size_t) i);
+  (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/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index 8009699e4..d76d94b8c 100644
--- a/newlib/libc/stdio/vfscanf.c
+++ b/newlib/libc/stdio/vfscanf.c
@@ -367,7 +367,7 @@  _DEFUN(_sfread_r, (ptr, buf, size, count, fp),
 
   while (resid > (r = fp->_r))
     {
-      _CAST_VOID memcpy ((void *) p, (void *) fp->_p, (size_t) r);
+      (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 ((void *) p, (void *) fp->_p, resid);
+  (void) memcpy ((void *) p, (void *) fp->_p, resid);
   fp->_r -= resid;
   fp->_p += resid;
   return count;
diff --git a/newlib/libc/stdio64/tmpfile64.c b/newlib/libc/stdio64/tmpfile64.c
index d58aa1472..58b945d5b 100644
--- a/newlib/libc/stdio64/tmpfile64.c
+++ b/newlib/libc/stdio64/tmpfile64.c
@@ -76,7 +76,7 @@  _DEFUN (_tmpfile64_r, (ptr),
   e = ptr->_errno;
   if (!fp)
     _close_r (ptr, fd);
-  _CAST_VOID _remove_r (ptr, f);
+  (void) _remove_r (ptr, f);
   ptr->_errno = e;
   return fp;
 }
diff --git a/newlib/libc/string/u_strerr.c b/newlib/libc/string/u_strerr.c
index d3204df72..174d9170f 100644
--- a/newlib/libc/string/u_strerr.c
+++ b/newlib/libc/string/u_strerr.c
@@ -7,9 +7,9 @@  _DEFUN(_user_strerror, (errnum, internal, errptr),
        int *errptr)
 {
   /* prevent warning about unused parameters */
-  _CAST_VOID errnum;
-  _CAST_VOID internal;
-  _CAST_VOID errptr;
+  (void) errnum;
+  (void) internal;
+  (void) errptr;
 
   return 0;
 }