Patch to define __restrict_arr

Joseph S. Myers jsm28@cam.ac.uk
Fri May 25 04:38:00 GMT 2001


This patch defines __restrict_arr appropriately for glibc, now I've
added support for the syntax to GCC.

2001-05-25  Joseph S. Myers  <jsm28@cam.ac.uk>

	* misc/sys/cdefs.h (__restrict_arr): Define appropriately for GCC
	3.1 and non-GCC C99 compilers.

--- misc/sys/cdefs.h.orig	Sat Dec 30 17:46:38 2000
+++ misc/sys/cdefs.h	Fri May 25 11:33:51 2001
@@ -195,8 +195,20 @@
 
 /* ISO C99 also allows to declare arrays as non-overlapping.  The syntax is
      array_name[restrict]
-   But gcc so far does not support this syntax.  We define a separate macro
-   for this which can be enabled if the underlying compiler supports it.  */
-#define __restrict_arr
+   GCC 3.1 supports this.  */
+#if __GNUC_PREREQ (3,1)
+# define __restrict_arr	__restrict
+#else
+# ifdef __GNUC__
+#  define __restrict_arr	/* Not supported in old GCC.  */
+# else
+#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#   define __restrict_arr	restrict
+#  else
+/* Some other non-C99 compiler.  */
+#   define __restrict_arr	/* Not supported.  */
+#  endif
+# endif
+#endif
 
 #endif	 /* sys/cdefs.h */

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Libc-alpha mailing list