On Mon, Mar 18, 2024 at 10:00 AM Ruediger Pluem <rpl...@apache.org> wrote:
>
> On 3/15/24 2:35 PM, yla...@apache.org wrote:
> >
> > -#if defined(offsetof) && !defined(__cplusplus)
> > +#if defined(__has_builtin) && __has_builtin(__builtin_offsetof)
>
> This causes an
>
> ./include/apr_general.h:109:45: error: missing binary operator before token 
> "("
>
> with gcc 8.5.0 for me. Following 
> https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fbuiltin.html
> and changing it to
>
> Index: include/apr_general.h
> ===================================================================
> --- include/apr_general.h       (revision 1916382)
> +++ include/apr_general.h       (working copy)
> @@ -106,13 +106,18 @@
>   * @param field  data field within the structure
>   * @return offset
>   */
> -#if defined(__has_builtin) && __has_builtin(__builtin_offsetof)
> +#if defined(__has_builtin)
> +#if __has_builtin(__builtin_offsetof)
>  #define APR_OFFSETOF(s_type,field) __builtin_offsetof(s_type,field)
> -#elif defined(offsetof) && !defined(__cplusplus)
> +#endif
> +#endif
> +#if !defined(APR_OFFSETOF)
> +#if defined(offsetof) && !defined(__cplusplus)
>  #define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
>  #else
>  #define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
>  #endif
> +#endif
>
>
> Looks like to me that __has_builtin does not like to be used within an '&&' 
> operation for whatever reason.

oO well, ok: r1916385 (plus backports to 1.[78])

Thanks;
Yann.

Reply via email to