[PATCH:x11proto] Bug 51009: _X_RESTRICT_KYWD fix for g++ 4.6 & later on Solaris

Alan Coopersmith alan.coopersmith at oracle.com
Mon Aug 27 08:59:44 PDT 2012


g++ 4.6 & later on Solaris set the __STDC_VERSION__ define to indicate
C99 mode to expose C99/Unix03 functions in the system headers, even
though they don't recognize the C99 restrict keyword, as explained in
http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01308.html

Thus we avoid using the restrict keyword here if __cplusplus is also
defined, falling back to the __GNUC__ case using __restrict__ instead.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=51009

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 Xfuncproto.h.in |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in
index dc913fa..3eac5d5 100644
--- a/Xfuncproto.h.in
+++ b/Xfuncproto.h.in
@@ -161,7 +161,8 @@ in this Software without prior written authorization from The Open Group.
 /* requires xproto >= 7.0.21 */
 #ifndef _X_RESTRICT_KYWD
 # if defined(restrict) /* assume autoconf set it correctly */ || \
-   (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */
+    (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \
+     && !defined(__cplusplus)) /* Workaround g++ issue on Solaris */
 #  define _X_RESTRICT_KYWD  restrict
 # elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
 #  define _X_RESTRICT_KYWD __restrict__
-- 
1.7.9.2



More information about the xorg-devel mailing list