On (03/09/13 12:15), Sumit Bose wrote:
On Mon, Sep 02, 2013 at 07:04:22PM +0200, Lukas Slebodnik wrote:
> ehlo
>
> Patches are attached.
I haven't tested to patches so far but already have some comments.
bye,
Sumit
>
> LS
> From 6e3b789f4b24198b2ec4b40fb09e8b97e578044a Mon Sep 17 00:00:00 2001
> From: Lukas Slebodnik <lslebodn(a)redhat.com>
> Date: Sat, 31 Aug 2013 01:12:01 +0200
> Subject: [PATCH 2/9] AUTOTOOLS: add check for type intptr_t
>
> We check whether HAVE_INTPTR_T is defined in definition of macro
> discard_const_p, but autootols macro AC_CHECK_TYPE did not generate it.
> ---
> src/external/sizes.m4 | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/external/sizes.m4 b/src/external/sizes.m4
> index
53df61dedc3ae748c50ca9a3935632087834155d..1018d846016541043d81fb2a53609ad9c562071a 100644
> --- a/src/external/sizes.m4
> +++ b/src/external/sizes.m4
> @@ -37,8 +37,7 @@ AC_CHECK_SIZEOF(off_t)
> AC_CHECK_SIZEOF(size_t)
> AC_CHECK_SIZEOF(ssize_t)
>
> +AC_CHECK_TYPES([intptr_t])
> AC_CHECK_TYPE(intptr_t, long long)
> AC_CHECK_TYPE(uintptr_t, unsigned long long)
> AC_CHECK_TYPE(ptrdiff_t, unsigned long long)
I guess we missed the change of AC_CHECK_TYPE in Autoconf 2.14 where the
style used above still worked. If I understand the docs correctly it
should still work, but you should remove the old AC_CHECK_TYPE for
intptr_t.
just a comment to this point.
It may be litle bit confusing.
There are 3 macros with similar names.
AC_CHECK_TYPE (type, [action-if-found], [action-if-not-found],
[includes = ‘AC_INCLUDES_DEFAULT’])
AC_CHECK_TYPES (types, [action-if-found], [action-if-not-found],
[includes = ‘AC_INCLUDES_DEFAULT’])
And obsolete macro:
AC_CHECK_TYPE (type, default)
--If the type type is not defined, define it to be the C (or C++) builtin
type default, e.g., ‘short int’ or ‘unsigned int’.
--missing types are defined using #define and not typedef
I hope we used obsolete version. There is a patter how to rewrite it using
new macro. We can ged rid of them.
And now about non obsolete versions.
There is a difference between AC_CHECK_TYPE and AC_CHECK_TYPES
The second version: For each type of the types that is defined,
define HAVE_type
> +AC_CHECK_TYPES([intptr_t])
-> this generate
HAVE_INTPTR_T if exists intptr_t
> AC_CHECK_TYPE(intptr_t, long long)
-> this generate
"#define intptr_t longlong" unless exists intptr_t
And here is how discard_const_p is defined.
#ifndef discard_const_p
#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T)
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
This is not portable This was not generated by autoconf
# define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr)))
#else
# define discard_const_p(type, ptr) ((type *)(ptr))
#endif
#endif
If intptr_t is not default(builtin) type, we will define it in macro
AC_CHECK_TYPE (new one or obsolete).
Which branch of discard_const_p should be used?
I need to know how to use macro.
And the second question. Do wee need defined HAVE_type for all types?
(only HAVE_INTPTR_T is used in code)
LS