Patch - Remove restrict from TRAD_SYNOPSIS

Joel Sherrill joel.sherrill@oarcorp.com
Tue Nov 26 14:42:00 GMT 2013


Hi

I was concerned that restrict might have accidentally slipped
into TRAD_SYNOPSIS sections of the documentation. I ran this
command to get the files to check. If this isn't the best idea,
let me know:

find . -name "*.c" | xargs -e grep -l __restrict  | xargs -e grep -l
"TRAD_SYN"

That produced a list of 30 files to check. I didn't spot any
with restrict in the traditional synopsis. But I did spot a
number of places where the prototype was over 80 columns.
The attached patch addresses that.

I compiled for sparc-rtems, build docs, and built RTEMS.

OK to commit?

2013-11-26  Joel Sherrill <joel.sherrill@oarcorp.com>

        * libc/machine/powerpc/vfscanf.c, libc/stdio/fgetpos.c,
libc/stdio/fgets.c,
        libc/stdio/fputs.c, libc/stdio/fread.c, libc/stdio/freopen.c,
        libc/stdio/fwrite.c, libc/stdio/sscanf.c, libc/stdlib/mbstowcs.c,
        libc/stdlib/mbtowc.c, libc/stdlib/strtod.c, libc/stdlib/strtol.c,
        libc/stdlib/strtoll.c, libc/stdlib/strtoul.c,
libc/stdlib/strtoull.c,
        libc/stdlib/wcstombs.c: Fix documentation prototypes which were over
        eighty columns.


-- 
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 --------------
? cscope.out
? libc/libc.info
? libc/machine/powerpc/.vfscanf.c.swp
? libm/libm.info
Index: libc/machine/powerpc/vfscanf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/powerpc/vfscanf.c,v
retrieving revision 1.18
diff -u -r1.18 vfscanf.c
--- libc/machine/powerpc/vfscanf.c	18 Nov 2013 17:28:03 -0000	1.18
+++ libc/machine/powerpc/vfscanf.c	26 Nov 2013 14:32:00 -0000
@@ -13,15 +13,17 @@
 	#include <stdio.h>
 	#include <stdarg.h>
 	int vscanf(const char *restrict <[fmt]>, va_list <[list]>);
-	int vfscanf(FILE *restrict <[fp]>, const char *restrict <[fmt]>, va_list <[list]>);
-	int vsscanf(const char *restrict <[str]>, const char *restrict <[fmt]>, va_list <[list]>);
+	int vfscanf(FILE *restrict <[fp]>, const char *restrict <[fmt]>,
+	            va_list <[list]>);
+	int vsscanf(const char *restrict <[str]>, const char *restrict <[fmt]>,
+	            va_list <[list]>);
 
 	int _vscanf_r(void *<[reent]>, const char *restrict <[fmt]>, 
-                       va_list <[list]>);
-	int _vfscanf_r(void *<[reent]>, FILE *restrict <[fp]>, const char *restrict <[fmt]>, 
-                       va_list <[list]>);
-	int _vsscanf_r(void *<[reent]>, const char *restrict <[str]>, const char *restrict <[fmt]>, 
-                       va_list <[list]>);
+                      va_list <[list]>);
+	int _vfscanf_r(void *<[reent]>, FILE *restrict <[fp]>,
+	               const char *restrict <[fmt]>, va_list <[list]>);
+	int _vsscanf_r(void *<[reent]>, const char *restrict <[str]>,
+	               const char *restrict <[fmt]>, va_list <[list]>);
 
 TRAD_SYNOPSIS
 	#include <stdio.h>
Index: libc/stdio/fgetpos.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fgetpos.c,v
retrieving revision 1.7
diff -u -r1.7 fgetpos.c
--- libc/stdio/fgetpos.c	18 Nov 2013 17:28:05 -0000	1.7
+++ libc/stdio/fgetpos.c	26 Nov 2013 14:32:00 -0000
@@ -27,7 +27,8 @@
 ANSI_SYNOPSIS
 	#include <stdio.h>
 	int fgetpos(FILE *restrict <[fp]>, fpos_t *restrict <[pos]>);
-	int _fgetpos_r(struct _reent *<[ptr]>, FILE *restrict <[fp]>, fpos_t *restrict <[pos]>);
+	int _fgetpos_r(struct _reent *<[ptr]>, FILE *restrict <[fp]>,
+	               fpos_t *restrict <[pos]>);
 
 TRAD_SYNOPSIS
 	#include <stdio.h>
Index: libc/stdio/fgets.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fgets.c,v
retrieving revision 1.12
diff -u -r1.12 fgets.c
--- libc/stdio/fgets.c	18 Nov 2013 17:28:05 -0000	1.12
+++ libc/stdio/fgets.c	26 Nov 2013 14:32:00 -0000
@@ -29,7 +29,8 @@
 	char *fgets(char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
 
         #include <stdio.h>
-	char *_fgets_r(struct _reent *<[ptr]>, char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
+	char *_fgets_r(struct _reent *<[ptr]>, char *restrict <[buf]>,
+	               int <[n]>, FILE *restrict <[fp]>);
 
 TRAD_SYNOPSIS
 	#include <stdio.h>
Index: libc/stdio/fputs.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fputs.c,v
retrieving revision 1.10
diff -u -r1.10 fputs.c
--- libc/stdio/fputs.c	18 Nov 2013 17:28:05 -0000	1.10
+++ libc/stdio/fputs.c	26 Nov 2013 14:32:00 -0000
@@ -29,7 +29,8 @@
 	int fputs(const char *restrict <[s]>, FILE *restrict <[fp]>);
 
 	#include <stdio.h>
-	int _fputs_r(struct _reent *<[ptr]>, const char *restrict <[s]>, FILE *restrict <[fp]>);
+	int _fputs_r(struct _reent *<[ptr]>, const char *restrict <[s]>,
+	             FILE *restrict <[fp]>);
 
 TRAD_SYNOPSIS
 	#include <stdio.h>
Index: libc/stdio/fread.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fread.c,v
retrieving revision 1.22
diff -u -r1.22 fread.c
--- libc/stdio/fread.c	18 Nov 2013 17:28:05 -0000	1.22
+++ libc/stdio/fread.c	26 Nov 2013 14:32:00 -0000
@@ -31,7 +31,8 @@
 
 	#include <stdio.h>
 	size_t _fread_r(struct _reent *<[ptr]>, void *restrict <[buf]>,
-	                size_t <[size]>, size_t <[count]>, FILE *restrict <[fp]>);
+	                size_t <[size]>, size_t <[count]>,
+	                FILE *restrict <[fp]>);
 
 TRAD_SYNOPSIS
 	#include <stdio.h>
Index: libc/stdio/freopen.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/freopen.c,v
retrieving revision 1.29
diff -u -r1.29 freopen.c
--- libc/stdio/freopen.c	18 Nov 2013 17:28:05 -0000	1.29
+++ libc/stdio/freopen.c	26 Nov 2013 14:32:00 -0000
@@ -26,8 +26,8 @@
 
 ANSI_SYNOPSIS
 	#include <stdio.h>
-	FILE *freopen(const char *restrict <[file]>, const char *restrict <[mode]>,
-		      FILE *restrict <[fp]>);
+	FILE *freopen(const char *restrict <[file]>,
+	              const char *restrict <[mode]>, FILE *restrict <[fp]>);
 	FILE *_freopen_r(struct _reent *<[ptr]>, const char *restrict <[file]>,
 		      const char *restrict <[mode]>, FILE *restrict <[fp]>);
 
Index: libc/stdio/fwrite.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fwrite.c,v
retrieving revision 1.11
diff -u -r1.11 fwrite.c
--- libc/stdio/fwrite.c	18 Nov 2013 17:28:05 -0000	1.11
+++ libc/stdio/fwrite.c	26 Nov 2013 14:32:00 -0000
@@ -30,8 +30,9 @@
 		      size_t <[count]>, FILE *restrict <[fp]>);
 
 	#include <stdio.h>
-	size_t _fwrite_r(struct _reent *<[ptr]>, const void *restrict <[buf]>, size_t <[size]>,
-		      size_t <[count]>, FILE *restrict <[fp]>);
+	size_t _fwrite_r(struct _reent *<[ptr]>, const void *restrict <[buf]>,
+	                 size_t <[size]>, size_t <[count]>,
+	                 FILE *restrict <[fp]>);
 
 TRAD_SYNOPSIS
 	#include <stdio.h>
Index: libc/stdio/sscanf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/sscanf.c,v
retrieving revision 1.16
diff -u -r1.16 sscanf.c
--- libc/stdio/sscanf.c	18 Nov 2013 17:28:06 -0000	1.16
+++ libc/stdio/sscanf.c	26 Nov 2013 14:32:00 -0000
@@ -37,9 +37,11 @@
 
         int scanf(const char *restrict <[format]>, ...);
         int fscanf(FILE *restrict <[fd]>, const char *restrict <[format]>, ...);
-        int sscanf(const char *restrict <[str]>, const char *restrict <[format]>, ...);
+        int sscanf(const char *restrict <[str]>,
+                   const char *restrict <[format]>, ...);
 
-        int _scanf_r(struct _reent *<[ptr]>, const char *restrict <[format]>, ...);
+        int _scanf_r(struct _reent *<[ptr]>,
+                     const char *restrict <[format]>, ...);
         int _fscanf_r(struct _reent *<[ptr]>, FILE *restrict <[fd]>, 
                       const char *restrict <[format]>, ...);
         int _sscanf_r(struct _reent *<[ptr]>, const char *restrict <[str]>,
Index: libc/stdlib/mbstowcs.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/mbstowcs.c,v
retrieving revision 1.5
diff -u -r1.5 mbstowcs.c
--- libc/stdlib/mbstowcs.c	18 Nov 2013 17:26:51 -0000	1.5
+++ libc/stdlib/mbstowcs.c	26 Nov 2013 14:32:00 -0000
@@ -7,7 +7,8 @@
 
 ANSI_SYNOPSIS
 	#include <stdlib.h>
-	int mbstowcs(wchar_t *restrict <[pwc]>, const char *restrict <[s]>, size_t <[n]>);
+	int mbstowcs(wchar_t *restrict <[pwc]>, const char *restrict <[s]>,
+                     size_t <[n]>);
 
 TRAD_SYNOPSIS
 	#include <stdlib.h>
Index: libc/stdlib/mbtowc.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/mbtowc.c,v
retrieving revision 1.8
diff -u -r1.8 mbtowc.c
--- libc/stdlib/mbtowc.c	18 Nov 2013 17:26:51 -0000	1.8
+++ libc/stdlib/mbtowc.c	26 Nov 2013 14:32:00 -0000
@@ -7,7 +7,8 @@
 
 ANSI_SYNOPSIS
 	#include <stdlib.h>
-	int mbtowc(wchar_t *restrict <[pwc]>, const char *restrict <[s]>, size_t <[n]>);
+	int mbtowc(wchar_t *restrict <[pwc]>, const char *restrict <[s]>,
+                   size_t <[n]>);
 
 TRAD_SYNOPSIS
 	#include <stdlib.h>
Index: libc/stdlib/strtod.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/strtod.c,v
retrieving revision 1.22
diff -u -r1.22 strtod.c
--- libc/stdlib/strtod.c	18 Nov 2013 17:26:51 -0000	1.22
+++ libc/stdlib/strtod.c	26 Nov 2013 14:32:00 -0000
@@ -14,8 +14,8 @@
         double strtod(const char *restrict <[str]>, char **restrict <[tail]>);
         float strtof(const char *restrict <[str]>, char **restrict <[tail]>);
 
-        double _strtod_r(void *<[reent]>,
-                         const char *restrict <[str]>, char **restrict <[tail]>);
+        double _strtod_r(void *<[reent]>, const char *restrict <[str]>,
+                         char **restrict <[tail]>);
 
 TRAD_SYNOPSIS
         #include <stdlib.h>
Index: libc/stdlib/strtol.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/strtol.c,v
retrieving revision 1.4
diff -u -r1.4 strtol.c
--- libc/stdlib/strtol.c	18 Nov 2013 17:26:51 -0000	1.4
+++ libc/stdlib/strtol.c	26 Nov 2013 14:32:00 -0000
@@ -9,10 +9,11 @@
 
 ANSI_SYNOPSIS
 	#include <stdlib.h>
-        long strtol(const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>);
+        long strtol(const char *restrict <[s]>, char **restrict <[ptr]>,
+                    int <[base]>);
 
-        long _strtol_r(void *<[reent]>, 
-                       const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>);
+        long _strtol_r(void *<[reent]>, const char *restrict <[s]>,
+                       char **restrict <[ptr]>,int <[base]>);
 
 TRAD_SYNOPSIS
 	#include <stdlib.h>
Index: libc/stdlib/strtoll.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/strtoll.c,v
retrieving revision 1.4
diff -u -r1.4 strtoll.c
--- libc/stdlib/strtoll.c	18 Nov 2013 17:26:51 -0000	1.4
+++ libc/stdlib/strtoll.c	26 Nov 2013 14:32:00 -0000
@@ -9,10 +9,11 @@
 
 ANSI_SYNOPSIS
 	#include <stdlib.h>
-        long long strtoll(const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>);
+        long long strtoll(const char *restrict <[s]>, char **restrict <[ptr]>,
+                          int <[base]>);
 
-        long long _strtoll_r(void *<[reent]>, 
-                       const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>);
+        long long _strtoll_r(void *<[reent]>, const char *restrict <[s]>,
+                          char **restrict <[ptr]>,int <[base]>);
 
 TRAD_SYNOPSIS
 	#include <stdlib.h>
Index: libc/stdlib/strtoul.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/strtoul.c,v
retrieving revision 1.4
diff -u -r1.4 strtoul.c
--- libc/stdlib/strtoul.c	18 Nov 2013 17:26:52 -0000	1.4
+++ libc/stdlib/strtoul.c	26 Nov 2013 14:32:00 -0000
@@ -9,8 +9,8 @@
 
 ANSI_SYNOPSIS
 	#include <stdlib.h>
-        unsigned long strtoul(const char *restrict <[s]>, char **restrict <[ptr]>,
-                              int <[base]>);
+        unsigned long strtoul(const char *restrict <[s]>,
+                              char **restrict <[ptr]>, int <[base]>);
 
         unsigned long _strtoul_r(void *<[reent]>, const char *restrict <[s]>,
                               char **restrict <[ptr]>, int <[base]>);
Index: libc/stdlib/strtoull.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/strtoull.c,v
retrieving revision 1.3
diff -u -r1.3 strtoull.c
--- libc/stdlib/strtoull.c	18 Nov 2013 17:26:52 -0000	1.3
+++ libc/stdlib/strtoull.c	26 Nov 2013 14:32:00 -0000
@@ -9,11 +9,12 @@
 
 ANSI_SYNOPSIS
 	#include <stdlib.h>
-        unsigned long long strtoull(const char *restrict <[s]>, char **restrict <[ptr]>,
-                              int <[base]>);
+        unsigned long long strtoull(const char *restrict <[s]>,
+                 char **restrict <[ptr]>, int <[base]>);
 
-        unsigned long long _strtoull_r(void *<[reent]>, const char *restrict <[s]>,
-                              char **restrict <[ptr]>, int <[base]>);
+        unsigned long long _strtoull_r(void *<[reent]>,
+                 const char *restrict <[s]>, char **restrict <[ptr]>,
+                 int <[base]>);
 
 TRAD_SYNOPSIS
 	#include <stdlib.h>
Index: libc/stdlib/wcstombs.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/wcstombs.c,v
retrieving revision 1.7
diff -u -r1.7 wcstombs.c
--- libc/stdlib/wcstombs.c	18 Nov 2013 17:26:52 -0000	1.7
+++ libc/stdlib/wcstombs.c	26 Nov 2013 14:32:00 -0000
@@ -7,7 +7,8 @@
 
 ANSI_SYNOPSIS
 	#include <stdlib.h>
-	size_t wcstombs(char *restrict <[s]>, const wchar_t *restrict <[pwc]>, size_t <[n]>);
+	size_t wcstombs(char *restrict <[s]>, const wchar_t *restrict <[pwc]>,
+                        size_t <[n]>);
 
 TRAD_SYNOPSIS
 	#include <stdlib.h>


More information about the Newlib mailing list