Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys There are some places where C99 allows a restrict mo...



details:   https://anonhg.NetBSD.org/src/rev/5df5934a5c0f
branches:  trunk
changeset: 777508:5df5934a5c0f
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Feb 21 10:53:08 2012 +0000

description:
There are some places where C99 allows a restrict modifier (and posix
demands it), but C++ does not allow it. So add a C only version of
__restrict, which expands to nothing if compiling C++.
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347 for a discussion.

diffstat:

 sys/sys/cdefs.h |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 16c8f61a26f0 -r 5df5934a5c0f sys/sys/cdefs.h
--- a/sys/sys/cdefs.h   Tue Feb 21 10:43:46 2012 +0000
+++ b/sys/sys/cdefs.h   Tue Feb 21 10:53:08 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.90 2012/02/17 18:58:51 joerg Exp $ */
+/*     $NetBSD: cdefs.h,v 1.91 2012/02/21 10:53:08 martin Exp $        */
 
 /*
  * Copyright (c) 1991, 1993
@@ -266,10 +266,13 @@
 #define        __BEGIN_EXTERN_C        extern "C" {
 #define        __END_EXTERN_C          }
 #define        __static_cast(x,y)      static_cast<x>(y)
+/* C++ does not allow a __restrict modifier everywhere C99 does */
+#define        __conly_restrict
 #else
 #define        __BEGIN_EXTERN_C
 #define        __END_EXTERN_C
 #define        __static_cast(x,y)      (x)y
+#define        __conly_restrict        __restrict
 #endif
 
 #if __GNUC_PREREQ__(4, 0)



Home | Main Index | Thread Index | Old Index