This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Correct __GNUC_PREREQ for __const__ and __noreturn__ attributes.


On 03/20/2017 01:52 PM, Kang-Che Sung wrote:
> 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.

Kang-Che,

So you did not test this change with a gcc-2.5 compiler?

> 	* misc/sys/cdefs.h (__attribute_const__): Correct __GNUC_PREREQ
> 	to (2,7).
> 	(_Noreturn): Likewise.

Jakub, Marek,

Are either of you able to verify the correctness of this for us?

Thanks.
 
> 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
> 


-- 
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]