Add restrict keyword to sys/stat.h

Joel Sherrill joel.sherrill@oarcorp.com
Thu Nov 21 14:33:00 GMT 2013


Hi

This adds restrict to the methods in <sys/stat.h>. I have
attached one diff but it touches a few files in libgloss.

OK to commit?

2013-11-21 Daniel Ramirez <javamonn@gmail.com>

	* libgloss/d30v/syscalls.c, libgloss/i960/mon960.c,
	libgloss/m68k/io-stat.c, libgloss/mt/stat.c, libgloss/spu/lstat.c,
	libgloss/spu/stat.c: Add restrict keyword.

2013-11-21 Daniel Ramirez <javamonn@gmail.com>

	* libc/include/sys/stat.h, libc/sys/linux/sys/stat.h,
	libc/sys/m88kbug/syscalls.c, libc/sys/rdos/stat.c,
	libc/sys/sparc64/sys/stat.h: Add restrict keyword.



-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985
-------------- next part --------------
? newlib/.TODO.swp
? newlib/TODO
? newlib/libc/libc.info
? newlib/libm/libm.info
Index: libgloss/d30v/syscalls.c
===================================================================
RCS file: /cvs/src/src/libgloss/d30v/syscalls.c,v
retrieving revision 1.2
diff -u -r1.2 syscalls.c
--- libgloss/d30v/syscalls.c	15 Apr 2002 20:45:59 -0000	1.2
+++ libgloss/d30v/syscalls.c	21 Nov 2013 14:30:25 -0000
@@ -119,7 +119,7 @@
 }
 
 int
-stat (const char *filename, void *info)
+stat (const char *__restrict filename, void *__restrict info)
 {
   return __syscall (filename, info, 0, 0, SYS_stat);
 }
Index: libgloss/i960/mon960.c
===================================================================
RCS file: /cvs/src/src/libgloss/i960/mon960.c,v
retrieving revision 1.1
diff -u -r1.1 mon960.c
--- libgloss/i960/mon960.c	17 Mar 2000 22:48:50 -0000	1.1
+++ libgloss/i960/mon960.c	21 Nov 2013 14:30:25 -0000
@@ -37,7 +37,7 @@
 }
 
 int
-stat (const char *filename, struct stat *st)
+stat (const char *__restrict filename, struct stat *__restrict st)
 {
   st->st_mode = S_IFCHR;
   return 0;
Index: libgloss/m68k/io-stat.c
===================================================================
RCS file: /cvs/src/src/libgloss/m68k/io-stat.c,v
retrieving revision 1.2
diff -u -r1.2 io-stat.c
--- libgloss/m68k/io-stat.c	11 Dec 2006 19:58:01 -0000	1.2
+++ libgloss/m68k/io-stat.c	21 Nov 2013 14:30:25 -0000
@@ -34,7 +34,7 @@
  */
 
 
-int stat (const char *filename, struct stat *buf)
+int stat (const char *__restrict filename, struct stat *__restrict buf)
 {
 #if HOSTED
   gdb_parambuf_t parameters;
Index: libgloss/mt/stat.c
===================================================================
RCS file: /cvs/src/src/libgloss/mt/stat.c,v
retrieving revision 1.1
diff -u -r1.1 stat.c
--- libgloss/mt/stat.c	12 Dec 2005 11:16:41 -0000	1.1
+++ libgloss/mt/stat.c	21 Nov 2013 14:30:26 -0000
@@ -5,7 +5,7 @@
 
 
 int
-stat (const char *path, struct stat *st)
+stat (const char *__restrict path, struct stat *__restrict st)
 
 {
   return TRAP0 (SYS_stat, path, st, 0);
Index: libgloss/spu/lstat.c
===================================================================
RCS file: /cvs/src/src/libgloss/spu/lstat.c,v
retrieving revision 1.1
diff -u -r1.1 lstat.c
--- libgloss/spu/lstat.c	20 Jun 2007 21:41:33 -0000	1.1
+++ libgloss/spu/lstat.c	21 Nov 2013 14:30:26 -0000
@@ -44,7 +44,7 @@
 } syscall_stat_t;
 
 int
-lstat (const char *pathname, struct stat *pstat)
+lstat (const char *__restrict pathname, struct stat *__restrict pstat)
 {
   syscall_stat_t sys;
   struct jsre_stat pjstat;
Index: newlib/libc/include/sys/stat.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/stat.h,v
retrieving revision 1.25
diff -u -r1.25 stat.h
--- newlib/libc/include/sys/stat.h	23 Apr 2013 09:42:25 -0000	1.25
+++ newlib/libc/include/sys/stat.h	21 Nov 2013 14:30:26 -0000
@@ -147,17 +147,17 @@
 int	_EXFUN(fstat,( int __fd, struct stat *__sbuf ));
 int	_EXFUN(mkdir,( const char *_path, mode_t __mode ));
 int	_EXFUN(mkfifo,( const char *__path, mode_t __mode ));
-int	_EXFUN(stat,( const char *__path, struct stat *__sbuf ));
+int	_EXFUN(stat,( const char *__restrict __path, struct stat *__restrict __sbuf ));
 mode_t	_EXFUN(umask,( mode_t __mask ));
 
 #if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
-int	_EXFUN(lstat,( const char *__path, struct stat *__buf ));
+int	_EXFUN(lstat,( const char *__restrict __path, struct stat *__restrict __buf ));
 int	_EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev ));
 #endif
 
 #if defined (__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
 int	_EXFUN(fchmodat, (int, const char *, mode_t, int));
-int	_EXFUN(fstatat, (int, const char *, struct stat *, int));
+int	_EXFUN(fstatat, (int, const char *__restrict , struct stat *__restrict, int));
 int	_EXFUN(mkdirat, (int, const char *, mode_t));
 int	_EXFUN(mkfifoat, (int, const char *, mode_t));
 int	_EXFUN(mknodat, (int, const char *, mode_t, dev_t));
@@ -169,11 +169,11 @@
    provided in newlib for some compilers.  */
 #ifdef _COMPILING_NEWLIB
 int	_EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
-int	_EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
+int	_EXFUN(_stat,( const char *__restrict __path, struct stat *__restrict __sbuf ));
 int	_EXFUN(_mkdir,( const char *_path, mode_t __mode ));
 #ifdef __LARGE64_FILES
 struct stat64;
-int	_EXFUN(_stat64,( const char *__path, struct stat64 *__sbuf ));
+int	_EXFUN(_stat64,( const char *__restrict __path, struct stat64 *__restrict __sbuf ));
 int	_EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf ));
 #endif
 #endif
Index: newlib/libc/sys/linux/sys/stat.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/linux/sys/stat.h,v
retrieving revision 1.5
diff -u -r1.5 stat.h
--- newlib/libc/sys/linux/sys/stat.h	16 Dec 2005 19:11:10 -0000	1.5
+++ newlib/libc/sys/linux/sys/stat.h	21 Nov 2013 14:30:26 -0000
@@ -20,14 +20,14 @@
 int     _EXFUN(fstat,( int __fd, struct stat *__sbuf ));
 int     _EXFUN(mkdir,( const char *_path, mode_t __mode ));
 int     _EXFUN(mkfifo,( const char *__path, mode_t __mode ));
-int     _EXFUN(stat,( const char *__path, struct stat *__sbuf ));
+int     _EXFUN(stat,( const char *__restrict __path, struct stat *__restrict __sbuf ));
 mode_t  _EXFUN(umask,( mode_t __mask ));
 
 #ifndef _POSIX_SOURCE
 int     _EXFUN(fstat64,( int __fd, struct stat64 *__sbuf ));
-int	_EXFUN(lstat,( const char *file_name, struct stat64 *buf));
-int	_EXFUN(lstat64,( const char *file_name, struct stat64 *buf));
-int     _EXFUN(stat64,( const char *__path, struct stat64 *__sbuf ));
+int	_EXFUN(lstat,( const char *__restrict file_name, struct stat64 *__restrict buf));
+int	_EXFUN(lstat64,( const char *__restrict file_name, struct stat64 *__restrict buf));
+int     _EXFUN(stat64,( const char *__restrict __path, struct stat64 *__restrict __sbuf ));
 #endif /* _POSIX_SOURCE */
 
 #endif /* _SYS_STAT_H */
Index: newlib/libc/sys/m88kbug/syscalls.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/m88kbug/syscalls.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 syscalls.c
--- newlib/libc/sys/m88kbug/syscalls.c	17 Feb 2000 19:39:50 -0000	1.1.1.1
+++ newlib/libc/sys/m88kbug/syscalls.c	21 Nov 2013 14:30:26 -0000
@@ -76,7 +76,7 @@
   return(0);
 }
 
-int stat(char *filename, struct stat *st) {
+int stat(char *__restrict filename, struct stat *__restrict st) {
   st->st_mode = S_IFCHR;
   return(0);
 }
Index: newlib/libc/sys/rdos/stat.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/rdos/stat.c,v
retrieving revision 1.1
diff -u -r1.1 stat.c
--- newlib/libc/sys/rdos/stat.c	31 Jan 2006 19:33:56 -0000	1.1
+++ newlib/libc/sys/rdos/stat.c	21 Nov 2013 14:30:26 -0000
@@ -5,7 +5,7 @@
 #include <sys/stat.h>
 #include <errno.h>
 
-int stat(const char *file, struct stat *st)
++int stat(const char *__restrict file, struct stat *__restrict st)
 {
   errno = ENOSYS;
   return -1;
Index: newlib/libc/sys/sparc64/sys/stat.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/sparc64/sys/stat.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 stat.h
--- newlib/libc/sys/sparc64/sys/stat.h	17 Feb 2000 19:39:50 -0000	1.1.1.1
+++ newlib/libc/sys/sparc64/sys/stat.h	21 Nov 2013 14:30:26 -0000
@@ -122,7 +122,7 @@
 int	_EXFUN(fstat,( int _fd, struct stat *_sbuf ));
 int	_EXFUN(mkdir,( char *_path, mode_t _mode ));
 int	_EXFUN(mkfifo,( char *_path, mode_t _mode ));
-int	_EXFUN(stat,( const char *_path, struct stat *_sbuf ));
+int	_EXFUN(stat,( const char *__restrict _path, struct stat *__restrict _sbuf ));
 mode_t	_EXFUN(umask,( mode_t _mask ));
 
 #ifdef __cplusplus


More information about the Newlib mailing list