This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Correct __GNUC_PREREQ for __const__ and __noreturn__ attributes.
- From: Kang-Che Sung <explorer09 at gmail dot com>
- To: libc-alpha at sourceware dot org
- Cc: Kang-Che Sung <explorer09 at gmail dot com>
- Date: Tue, 21 Mar 2017 01:52:39 +0800
- Subject: [PATCH] Correct __GNUC_PREREQ for __const__ and __noreturn__ attributes.
- Authentication-results: sourceware.org; auth=none
Although GCC 2.5 introduced 'const' and 'noreturn' function
attributes, the '__const__' and '__noreturn__' were not available
until 2.6.2. So check __GNU_PREREQ(2,7) for these.
Note: I'm here only to correct an inaccurate info. Because I guess
very few people would use such an old compiler now, I'm not bothered to
test, nor add support for __attribute__((const)) just for it's sake.
* misc/sys/cdefs.h (__attribute_const__): Correct __GNUC_PREREQ
to (2,7).
(_Noreturn): Likewise.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
---
ChangeLog | 6 ++++++
misc/sys/cdefs.h | 10 +++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 578714c4fb..e0ddc4497f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-21 Kang-Che Sung <explorer09@gmail.com>
+
+ * misc/sys/cdefs.h (__attribute_const__): Correct __GNUC_PREREQ
+ to (2,7).
+ (_Noreturn): Likewise.
+
2017-03-20 Mike Frysinger <vapier@gentoo.org>
[BZ #21275]
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index b03ebda22f..d040f72b70 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -221,8 +221,10 @@
# define __attribute_pure__ /* Ignore */
#endif
-/* This declaration tells the compiler that the value is constant. */
-#if __GNUC_PREREQ (2,5)
+/* This declaration tells the compiler that the value is constant.
+ Although `const' attribute was introduced in gcc 2.5, we need at least
+ gcc 2.6.2 for the `__const__' name. */
+#if __GNUC_PREREQ (2,7)
# define __attribute_const__ __attribute__ ((__const__))
#else
# define __attribute_const__ /* Ignore */
@@ -398,7 +400,9 @@
#if (!defined _Noreturn \
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
&& !__GNUC_PREREQ (4,7))
-# if __GNUC_PREREQ (2,8)
+/* Although `noreturn' attribute was introduced in gcc 2.5, we need at least
+ gcc 2.6.2 for the `__noreturn__' name. */
+# if __GNUC_PREREQ (2,7)
# define _Noreturn __attribute__ ((__noreturn__))
# else
# define _Noreturn
--
2.11.0