Patch - Add restrict to signal.h

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


Hi

Another patch in the Google Code-In restrict series.

Just to note publicly, once this is committed, there is
a corresponding patch to the RTEMS signal code to
add restrict which will need to be applied.

OK to commit?

2013-11-20  Bryan Dunsmore <dunsmoreb@gmail.com>

        * libc/include/sys/signal.h, libc/machine/cris/sys/signal.h,
        libc/posix/un-namespace.h, libc/sys/rtems/crt0.c: 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 --------------
? libc/libc.info
? libm/libm.info
Index: libc/include/sys/signal.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/signal.h,v
retrieving revision 1.22
diff -u -r1.22 signal.h
--- libc/include/sys/signal.h	26 Oct 2012 09:23:46 -0000	1.22
+++ libc/include/sys/signal.h	21 Nov 2013 00:03:28 -0000
@@ -132,10 +132,12 @@
 #define sigfillset(what)    (*(what) = ~(0), 0)
 #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
 
-int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
+int _EXFUN(sigprocmask, (int how, const sigset_t *__restrict set,
+			 sigset_t *__restrict oset));
 
 #if defined(_POSIX_THREADS)
-int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
+int _EXFUN(pthread_sigmask, (int how, const sigset_t *__restrict set,
+			     sigset_t *__restrict oset));
 #endif
 
 /* protos for functions found in winsup sources for CYGWIN */
@@ -151,7 +153,8 @@
 #endif
 int _EXFUN(kill, (pid_t, int));
 int _EXFUN(killpg, (pid_t, int));
-int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
+int _EXFUN(sigaction, (int, const struct sigaction *__restrict,
+		       struct sigaction *__restrict));
 int _EXFUN(sigaddset, (sigset_t *, const int));
 int _EXFUN(sigdelset, (sigset_t *, const int));
 int _EXFUN(sigismember, (const sigset_t *, int));
@@ -175,11 +178,12 @@
 /*  3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
     NOTE: P1003.1c/D10, p. 39 adds sigwait().  */
 
-int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t *info));
-int _EXFUN(sigtimedwait,
-  (const sigset_t *set, siginfo_t *info, const struct timespec  *timeout)
-);
-int _EXFUN(sigwait, (const sigset_t *set, int *sig));
+int _EXFUN(sigwaitinfo, (const sigset_t *__restrict set,
+			 siginfo_t *__restrict info));
+int _EXFUN(sigtimedwait, (const sigset_t *__restrict set,
+			  siginfo_t *__restrict info,
+			  const struct timespec *__restrict timeout));
+int _EXFUN(sigwait, (const sigset_t *__restrict set, int *__restrict sig));
 
 /*  3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
 int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
Index: libc/machine/cris/sys/signal.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/cris/sys/signal.h,v
retrieving revision 1.1
diff -u -r1.1 signal.h
--- libc/machine/cris/sys/signal.h	27 Jan 2005 23:54:46 -0000	1.1
+++ libc/machine/cris/sys/signal.h	21 Nov 2013 00:03:28 -0000
@@ -42,7 +42,8 @@
 #define sigaddset(what,sig) (*(what) |= (1<<(sig)))
 #define sigemptyset(what)   (*(what) = 0)
 
-int sigprocmask (int __how, const sigset_t *__a, sigset_t *__b);
+int sigprocmask (int __how, const sigset_t *__restrict __a,
+		 sigset_t *__restrict __b);
 
 #define SIGHUP		 1
 #define SIGINT		 2
Index: libc/posix/un-namespace.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/posix/un-namespace.h,v
retrieving revision 1.1
diff -u -r1.1 un-namespace.h
--- libc/posix/un-namespace.h	31 Oct 2008 21:03:41 -0000	1.1
+++ libc/posix/un-namespace.h	21 Nov 2013 00:03:28 -0000
@@ -122,7 +122,8 @@
 #endif	/* 0 */
 
 #ifdef _SIGNAL_H_
-int     	_sigaction(int, const struct sigaction *, struct sigaction *);
+int     	_sigaction(int, const struct sigaction *__restrict,
+			   struct sigaction *__restrict);
 #endif
 
 #ifdef _SYS_EVENT_H_
Index: libc/sys/rtems/crt0.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/rtems/crt0.c,v
retrieving revision 1.14
diff -u -r1.14 crt0.c
--- libc/sys/rtems/crt0.c	9 May 2012 09:03:06 -0000	1.14
+++ libc/sys/rtems/crt0.c	21 Nov 2013 00:03:29 -0000
@@ -72,7 +72,7 @@
 RTEMS_STUB(_ssize_t, read(int fd, void *buf, size_t count), { return -1; })
 RTEMS_STUB(int, sched_yield(void), { return -1; })
 RTEMS_STUB(int, sigfillset(sigset_t *set), { return -1; })
-RTEMS_STUB(int, sigprocmask(int how, const sigset_t *set, sigset_t *oldset), { return -1; })
+RTEMS_STUB(int, sigprocmask(int how, const sigset_t *__restrict set, sigset_t *__restrict oldset), { return -1; })
 RTEMS_STUB(int, stat(const char *path, struct stat *buf), { return -1; })
 RTEMS_STUB(int, unlink(const char *pathname), { return -1; })
 RTEMS_STUB(pid_t, vfork(void), { return -1; })


More information about the Newlib mailing list