gallium: Define C99 restrict keyword where absent.
authorJosé Fonseca <jfonseca@vmware.com>
Sun, 22 Aug 2010 16:27:56 +0000 (17:27 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 11 Oct 2010 12:05:31 +0000 (13:05 +0100)
src/gallium/include/pipe/p_compiler.h

index 50205995911ec691f243ea9697c5ab0915f7bb91..3d6b5b5c81d4fcf0babf750caf8ab6aea33426f1 100644 (file)
@@ -122,6 +122,27 @@ typedef unsigned char boolean;
 #  endif
 #endif
 
+/*
+ * Define the C99 restrict keyword.
+ *
+ * See also:
+ * - http://cellperformance.beyond3d.com/articles/2006/05/demystifying-the-restrict-keyword.html
+ */
+#ifndef restrict
+#  if (__STDC_VERSION__ >= 199901L)
+     /* C99 */
+#  elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
+     /* C99 */
+#  elif defined(__GNUC__)
+#    define restrict __restrict__
+#  elif defined(_MSC_VER)
+#    define restrict __restrict
+#  else
+#    define restrict /* */
+#  endif
+#endif
+
+
 /* Function visibility */
 #ifndef PUBLIC
 #  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))