Mesa (master): gallium: Define C99 restrict keyword where absent.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Oct 11 12:07:59 UTC 2010


Module: Mesa
Branch: master
Commit: 6c1aa4fd49dab7af21902726d274e0a5a7fea8df
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c1aa4fd49dab7af21902726d274e0a5a7fea8df

Author: José Fonseca <jfonseca at vmware.com>
Date:   Sun Aug 22 17:27:56 2010 +0100

gallium: Define C99 restrict keyword where absent.

---

 src/gallium/include/pipe/p_compiler.h |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 5020599..3d6b5b5 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -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))




More information about the mesa-commit mailing list