Tue Feb 21 10:53:08 2012 UTC ()
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.


(martin)
diff -r1.90 -r1.91 src/sys/sys/cdefs.h

cvs diff -r1.90 -r1.91 src/sys/sys/cdefs.h (expand / switch to unified diff)

--- src/sys/sys/cdefs.h 2012/02/17 18:58:51 1.90
+++ src/sys/sys/cdefs.h 2012/02/21 10:53:08 1.91
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cdefs.h,v 1.90 2012/02/17 18:58:51 joerg Exp $ */ 1/* $NetBSD: cdefs.h,v 1.91 2012/02/21 10:53:08 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1991, 1993 4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Berkeley Software Design, Inc. 8 * Berkeley Software Design, Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -256,30 +256,33 @@ @@ -256,30 +256,33 @@
256#define __used __unused 256#define __used __unused
257#endif 257#endif
258 258
259#if __GNUC_PREREQ__(3, 1) 259#if __GNUC_PREREQ__(3, 1)
260#define __noprofile __attribute__((__no_instrument_function__)) 260#define __noprofile __attribute__((__no_instrument_function__))
261#else 261#else
262#define __noprofile /* nothing */ 262#define __noprofile /* nothing */
263#endif 263#endif
264 264
265#if defined(__cplusplus) 265#if defined(__cplusplus)
266#define __BEGIN_EXTERN_C extern "C" { 266#define __BEGIN_EXTERN_C extern "C" {
267#define __END_EXTERN_C } 267#define __END_EXTERN_C }
268#define __static_cast(x,y) static_cast<x>(y) 268#define __static_cast(x,y) static_cast<x>(y)
 269/* C++ does not allow a __restrict modifier everywhere C99 does */
 270#define __conly_restrict
269#else 271#else
270#define __BEGIN_EXTERN_C 272#define __BEGIN_EXTERN_C
271#define __END_EXTERN_C 273#define __END_EXTERN_C
272#define __static_cast(x,y) (x)y 274#define __static_cast(x,y) (x)y
 275#define __conly_restrict __restrict
273#endif 276#endif
274 277
275#if __GNUC_PREREQ__(4, 0) 278#if __GNUC_PREREQ__(4, 0)
276# define __dso_public __attribute__((__visibility__("default"))) 279# define __dso_public __attribute__((__visibility__("default")))
277# define __dso_hidden __attribute__((__visibility__("hidden"))) 280# define __dso_hidden __attribute__((__visibility__("hidden")))
278# define __BEGIN_PUBLIC_DECLS \ 281# define __BEGIN_PUBLIC_DECLS \
279 _Pragma("GCC visibility push(default)") __BEGIN_EXTERN_C 282 _Pragma("GCC visibility push(default)") __BEGIN_EXTERN_C
280# define __END_PUBLIC_DECLS __END_EXTERN_C _Pragma("GCC visibility pop") 283# define __END_PUBLIC_DECLS __END_EXTERN_C _Pragma("GCC visibility pop")
281# define __BEGIN_HIDDEN_DECLS \ 284# define __BEGIN_HIDDEN_DECLS \
282 _Pragma("GCC visibility push(hidden)") __BEGIN_EXTERN_C 285 _Pragma("GCC visibility push(hidden)") __BEGIN_EXTERN_C
283# define __END_HIDDEN_DECLS __END_EXTERN_C _Pragma("GCC visibility pop") 286# define __END_HIDDEN_DECLS __END_EXTERN_C _Pragma("GCC visibility pop")
284#else 287#else
285# define __dso_public 288# define __dso_public