Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Aug 2023 04:37:55 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4e94219d5582 - stable/13 - sys/cdefs.h: fix for use __restrict in C++
Message-ID:  <202308130437.37D4btvW035924@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=4e94219d55824b19693287052edd8a1da76e3541

commit 4e94219d55824b19693287052edd8a1da76e3541
Author:     Sebastian Huber <sebastian.huber@embedded-brains.de>
AuthorDate: 2023-08-06 13:27:27 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-08-13 04:35:41 +0000

    sys/cdefs.h: fix for use __restrict in C++
    
    PR:     272723
    
    (cherry picked from commit 15876d9fd83fdfa7d541ea747eb40faeade975d2)
---
 sys/sys/cdefs.h | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 28e464122e58..3fde24f0b9e9 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -404,17 +404,15 @@
 #endif
 
 /*
- * GCC 2.95 provides `__restrict' as an extension to C90 to support the
- * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
- * a way to define the `restrict' type qualifier without disturbing older
- * software that is unaware of C99 keywords.
+ * We use `__restrict' as a way to define the `restrict' type qualifier
+ * without disturbing older software that is unaware of C99 keywords.
+ * GCC also provides `__restrict' as an extension to support C99-style
+ * restricted pointers in other language modes.
  */
-#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
-#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901
-#define	__restrict
-#else
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901
 #define	__restrict	restrict
-#endif
+#elif !__GNUC_PREREQ__(2, 95)
+#define	__restrict
 #endif
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202308130437.37D4btvW035924>