[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] stdlib: support non-GCC __attribute__
From: |
Bruno Haible |
Subject: |
Re: [PATCH] stdlib: support non-GCC __attribute__ |
Date: |
Sun, 13 Feb 2011 02:11:58 +0100 |
User-agent: |
KMail/1.9.9 |
Hi Paul,
> @@ -119,7 +113,12 @@ struct random_data
> /* Terminate the current process with the given return code, without running
> the 'atexit' handlers. */
> # if address@hidden@
> -_GL_FUNCDECL_SYS (_Exit, void, (int status) __attribute__ ((__noreturn__)));
> +# if @HAVE_ATTRIBUTE_NORETURN@
> +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
> +# else
> +# define _GL_ATTRIBUTE_NORETURN
> +# endif
> +_GL_FUNCDECL_SYS (_Exit, void, (int status)) _GL_ATTRIBUTE_NORETURN;
> # endif
> _GL_CXXALIAS_SYS (_Exit, void, (int status));
> _GL_CXXALIASWARN (_Exit);
This patch substitutes compiler dependent values into the generated stdlib.h.
This goes against our efforts to make these generated .h files as compiler
independent as possible, so that packages can install private copies of the
gnulib generated .h files (like libunistring does for stdbool.h and stdint.h,
and Simon's packages do this as well).
The net effect is that if a package installs a private copy of stdlib.h
generated with gnulib and GCC, and a user then attempts to use it with the
vendor cc on HP-UX, IRIX, OSF/1, AIX, or similar, he will get a syntax
error about __attribute__ ((__noreturn__)).
Can you please fix this?
I would do it like this: abandon the autoconf approach for this feature,
and use conditionals that involve __GNUC__ and _SUNPRO_C. It is not a
problem if these conditionals err on the conservative side, i.e. it's
allowed for the conditional to evaluate to false for compiler versions
that do understand __attribute__ ((__noreturn__)).
> @@ -7,6 +7,8 @@ dnl with or without modifications, as long as this notice is
> preserved.
> AC_DEFUN([gl_FUNC__EXIT],
> [
> AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
> + AC_REQUIRE([gl_ATTRIBUTE_NORETURN])
This does not guarantee that gl_STDLIB_H_DEFAULTS will have been expanded
before the expansion of gl_ATTRIBUTE_NORETURN. You need to add an
explicit
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
to the body of gl_ATTRIBUTE_NORETURN, in order to ensure that
the statement HAVE_ATTRIBUTE_NORETURN=0 occurs after the statement
HAVE_ATTRIBUTE_NORETURN=1.
Bruno
--
In memoriam France Bloch-Sérazin
<http://en.wikipedia.org/wiki/France_Bloch-Sérazin>
- [PATCH] stdlib: support non-GCC __attribute__, Paul Eggert, 2011/02/12
- Re: [PATCH] stdlib: support non-GCC __attribute__,
Bruno Haible <=
- Re: [PATCH] stdlib: support non-GCC __attribute__, Bruno Haible, 2011/02/13
- Re: [PATCH] stdlib: support non-GCC __attribute__, Paul Eggert, 2011/02/13
- Re: [PATCH] stdlib: support non-GCC __attribute__, Bruno Haible, 2011/02/13
- Re: [PATCH] stdlib: support non-GCC __attribute__, Jim Meyering, 2011/02/14
- Re: [PATCH] stdlib: support non-GCC __attribute__, Paul Eggert, 2011/02/14