Module: Mesa
Branch: staging/19.2
Commit: 23801734333a94d09957f3325da3963704ee500d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=23801734333a94d09957f3325da3963704ee500d

Author: Alan Coopersmith <[email protected]>
Date:   Sat Sep 10 09:46:02 2016 -0700

c99_compat.h: Don't try to use 'restrict' in C++ code

Fixes build failures on Solaris in C++ files using gcc:

../src/util/u_math.h:628:41: error: expected ‘,’ or ‘...’ before ‘dest’
  628 | util_memcpy_cpu_to_le32(void * restrict dest, const void * restrict 
src, size_t n)
      |                                         ^~~~
../src/util/u_math.h: In function ‘void* util_memcpy_cpu_to_le32(void*)’:
../src/util/u_math.h:641:18: error: ‘dest’ was not declared in this scope
  641 |    return memcpy(dest, src, n);
      |                  ^~~~
../src/util/u_math.h:641:24: error: ‘src’ was not declared in this scope
  641 |    return memcpy(dest, src, n);
      |                        ^~~
../src/util/u_math.h:641:29: error: ‘n’ was not declared in this scope; did you 
mean ‘yn’?
  641 |    return memcpy(dest, src, n);
      |                             ^
      |                             yn

Signed-off-by: Alan Coopersmith <[email protected]>
Acked-by: Eric Engestrom <[email protected]>
(cherry picked from commit ddde652e7000a13e3431316ad9ad7d1237552a0b)

---

 include/c99_compat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/c99_compat.h b/include/c99_compat.h
index d704baf12b9..729b5b79868 100644
--- a/include/c99_compat.h
+++ b/include/c99_compat.h
@@ -96,7 +96,7 @@
  * - 
http://cellperformance.beyond3d.com/articles/2006/05/demystifying-the-restrict-keyword.html
  */
 #ifndef restrict
-#  if (__STDC_VERSION__ >= 199901L)
+#  if (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus)
      /* C99 */
 #  elif defined(__GNUC__)
 #    define restrict __restrict__

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to