Re: [exim-dev] [Bug 1050] [PATCH] Portability fixes for memc…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Steen Hammerum
Datum:  
To: Tony Finch
CC: exim-dev, Chris Thompson, Steen Hammerum
Betreff: Re: [exim-dev] [Bug 1050] [PATCH] Portability fixes for memcheck.h.
It may not be of any interest now, but 4.73 will not compile
under HP's ANSI-C compiler. It doesn't like the VALGRIND
references (complaints follow below):

cc: "store.c", line 179: error 1000: Unexpected symbol: "{".
cc: "store.c", line 179: error 1000: Unexpected symbol: ")".
cc: "store.c", line 204: error 1000: Unexpected symbol: "{".
cc: "store.c", line 204: error 1000: Unexpected symbol: ")".
cc: "store.c", line 299: error 1000: Unexpected symbol: "{".
cc: "store.c", line 299: error 1000: Unexpected symbol: ")".
cc: "store.c", line 358: error 1000: Unexpected symbol: "{".
cc: "store.c", line 358: error 1000: Unexpected symbol: ")".
cc: "store.c", line 372: error 1000: Unexpected symbol: "{".
cc: "store.c", line 372: error 1000: Unexpected symbol: ")".

Best wishes,
Steen

> Exim doesn't compile with Sun or HP CC since Valgrind support was
> added. Although valgrind.h protects against usage on unsupported
> platforms, memcheck.h uses the __extension__() macro without checking.
> Remove all uses since VALGRIND_DO_CLIENT_REQUEST() has all the
> necessary portability support.
> ---
>
> Chris and Steen,
>
> Could you please try this patch and see if it fixes the
> compilation problems with 4.73?
>
> Tony.
> --
> <fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
> N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
> \N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}
>
>
> src/src/memcheck.h | 48 ++++++++++++++++++++++++------------------------
> 1 files changed, 24 insertions(+), 24 deletions(-)
>
>
> diff --git a/src/src/memcheck.h b/src/src/memcheck.h
> index fc50dab..d159c22 100644
> --- a/src/src/memcheck.h
> +++ b/src/src/memcheck.h
> @@ -107,66 +107,66 @@ typedef
>
>  /* Mark memory at _qzz_addr as unaddressable for _qzz_len bytes. */
>  #define VALGRIND_MAKE_MEM_NOACCESS(_qzz_addr,_qzz_len)           \
> -   (__extension__({unsigned long _qzz_res;                       \
> +   {unsigned long _qzz_res;                                      \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
>                              VG_USERREQ__MAKE_MEM_NOACCESS,       \
>                              _qzz_addr, _qzz_len, 0, 0, 0);       \
>      _qzz_res;                                                    \
> -   }))
> -      
> +   }
> +
>  /* Similarly, mark memory at _qzz_addr as addressable but undefined
>     for _qzz_len bytes. */
>  #define VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr,_qzz_len)          \
> -   (__extension__({unsigned long _qzz_res;                       \
> +   {unsigned long _qzz_res;                                      \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
>                              VG_USERREQ__MAKE_MEM_UNDEFINED,      \
>                              _qzz_addr, _qzz_len, 0, 0, 0);       \
>      _qzz_res;                                                    \
> -   }))
> +   }

>
>  /* Similarly, mark memory at _qzz_addr as addressable and defined
>     for _qzz_len bytes. */
>  #define VALGRIND_MAKE_MEM_DEFINED(_qzz_addr,_qzz_len)            \
> -   (__extension__({unsigned long _qzz_res;                       \
> +   {unsigned long _qzz_res;                                      \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
>                              VG_USERREQ__MAKE_MEM_DEFINED,        \
>                              _qzz_addr, _qzz_len, 0, 0, 0);       \
>      _qzz_res;                                                    \
> -   }))
> +   }

>
>  /* Similar to VALGRIND_MAKE_MEM_DEFINED except that addressability is
>     not altered: bytes which are addressable are marked as defined,
>     but those which are not addressable are left unchanged. */
>  #define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(_qzz_addr,_qzz_len) \
> -   (__extension__({unsigned long _qzz_res;                       \
> +   {unsigned long _qzz_res;                                      \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
>                              VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE, \
>                              _qzz_addr, _qzz_len, 0, 0, 0);       \
>      _qzz_res;                                                    \
> -   }))
> +   }

>
>  /* Create a block-description handle.  The description is an ascii
>     string which is included in any messages pertaining to addresses
>     within the specified memory range.  Has no other effect on the
>     properties of the memory range. */
> -#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc)     \
> -    (__extension__({unsigned long _qzz_res;             \
> +#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc)     \
> +   {unsigned long _qzz_res;                                      \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
>                              VG_USERREQ__CREATE_BLOCK,            \
>                              _qzz_addr, _qzz_len, _qzz_desc,      \
>                              0, 0);                               \
> -    _qzz_res;                             \
> -   }))
> +    _qzz_res;                                                    \
> +   }

>
>  /* Discard a block-description-handle. Returns 1 for an
>     invalid handle, 0 for a valid handle. */
>  #define VALGRIND_DISCARD(_qzz_blkindex)                          \
> -   (__extension__ ({unsigned long _qzz_res;                      \
> +   {unsigned long _qzz_res;                                      \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
>                              VG_USERREQ__DISCARD,                 \
>                              0, _qzz_blkindex, 0, 0, 0);          \
>      _qzz_res;                                                    \
> -   }))
> +   }

>
>
>  /* Client-code macros to check the state of memory. */
> @@ -176,24 +176,24 @@ typedef
>     error message and returns the address of the first offending byte.
>     Otherwise it returns zero. */
>  #define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len)    \
> -   (__extension__({unsigned long _qzz_res;                       \
> +   {unsigned long _qzz_res;                                      \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
>                              VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,\
>                              _qzz_addr, _qzz_len, 0, 0, 0);       \
>      _qzz_res;                                                    \
> -   }))
> +   }

>
>  /* Check that memory at _qzz_addr is addressable and defined for
>     _qzz_len bytes.  If suitable addressibility and definedness are not
>     established, Valgrind prints an error message and returns the
>     address of the first offending byte.  Otherwise it returns zero. */
>  #define VALGRIND_CHECK_MEM_IS_DEFINED(_qzz_addr,_qzz_len)        \
> -   (__extension__({unsigned long _qzz_res;                       \
> +   {unsigned long _qzz_res;                                      \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
>                              VG_USERREQ__CHECK_MEM_IS_DEFINED,    \
>                              _qzz_addr, _qzz_len, 0, 0, 0);       \
>      _qzz_res;                                                    \
> -   }))
> +   }

>
>  /* Use this macro to force the definedness and addressibility of an
>     lvalue to be checked.  If suitable addressibility and definedness
> @@ -215,7 +215,7 @@ typedef
>     }

>
>  /* Do a summary memory leak check (like --leak-check=summary) mid-execution. */
> -#define VALGRIND_DO_QUICK_LEAK_CHECK                 \
> +#define VALGRIND_DO_QUICK_LEAK_CHECK                             \
>     {unsigned long _qzz_res;                                      \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
>                              VG_USERREQ__DO_LEAK_CHECK,           \
> @@ -277,14 +277,14 @@ typedef
>     impossible to segfault your system by using this call.
>  */
>  #define VALGRIND_GET_VBITS(zza,zzvbits,zznbytes)                 \
> -   (__extension__({unsigned long _qzz_res;                       \
> +   {unsigned long _qzz_res;                                      \
>      char* czza     = (char*)zza;                                 \
>      char* czzvbits = (char*)zzvbits;                             \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
>                              VG_USERREQ__GET_VBITS,               \
>                              czza, czzvbits, zznbytes, 0, 0 );    \
>      _qzz_res;                                                    \
> -   }))
> +   }

>
>  /* Set the validity data for addresses [zza..zza+zznbytes-1], copying it
>     from the provided zzvbits array.  Return values:
> @@ -296,14 +296,14 @@ typedef
>     impossible to segfault your system by using this call.
>  */
>  #define VALGRIND_SET_VBITS(zza,zzvbits,zznbytes)                 \
> -   (__extension__({unsigned int _qzz_res;                        \
> +   {unsigned int _qzz_res;                                       \
>      char* czza     = (char*)zza;                                 \
>      char* czzvbits = (char*)zzvbits;                             \
>      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
>                              VG_USERREQ__SET_VBITS,               \
>                              czza, czzvbits, zznbytes, 0, 0 );    \
>      _qzz_res;                                                    \
> -   }))
> +   }

>
> #endif
>
> --
> 1.7.3.GIT
>
>



--
    
Steen Hammerum                                           steen@???
Department of Chemistry                              (+45) 35 32 02 08
University of Copenhagen, Denmark               fax: (+45) 35 32 02 12