You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Craig Holmquist <cr...@gmail.com> on 2008/12/06 20:40:07 UTC

APR_BRIGADE_SENTINEL macro causes compile error

Use of the APR_BRIGADE_SENTINEL macro now causes compile errors with
the current APR headers.  This was observed trying to compile
mod_python with the httpd 2.2.10 headers, on MS Windows with Visual
Studio 2008, but I suspect it affects all platforms.

The error is:

C:\Download\tmp\mod_python-3.3.1\src\connobject.c(142) : error C2037:
left of 'next' specifies undefined struct/union 'apr_bucket_alloc_t'

After investigating, I think the cause of problem is this change to apr_ring.h:

http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_ring.h?r1=566349&r2=662299

 #define APR_RING_SENTINEL(hp, elem, link)				\
-    (struct elem *)((char *)(hp) - APR_OFFSETOF(struct elem, link))
+    (struct elem *)((char *)(&(hp)->next) - APR_OFFSETOF(struct elem, link))

What's passed to APR_RING_SENTINEL (as "hp") is a pointer to
apr_bucket_alloc_t, which is declared in apr_buckets.h but not
actually defined anywhere (as far as I can tell, at least nowhere in
the headers that are bundled with the Windows installation of httpd
2.2.10), therefore none of its members can be referenced.

mod_python compiles without any errors using the httpd 2.2.8 headers.

Re: APR_BRIGADE_SENTINEL macro causes compile error

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Ruediger Pluem wrote:
> This is a bug in mod_python. Instead of
> 
> !(b == APR_BRIGADE_SENTINEL(b) ||
> 
> it must be
> 
> !(b == APR_BRIGADE_SENTINEL(bb) ||
> 
> They pass a bucket to APR_BRIGADE_SENTINEL which is wrong.
> 
> This is fixed in mod_python trunk.
> See http://svn.eu.apache.org/viewvc?view=rev&revision=676904
FWIW, this patch has been sitting in FreeBSD ports tree for a while now...


-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) c: 703.336.9354
Consultant - P6M7G8 Inc.  http://p6m7g8.net
Senior System Admin - RideCharge, Inc.  http://ridecharge.com
1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70  3F8C 75B8 8FFB DB9B 8C1C

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.

Re: APR_BRIGADE_SENTINEL macro causes compile error

Posted by Ruediger Pluem <rp...@apache.org>.

On 12/06/2008 08:40 PM, Craig Holmquist wrote:
> Use of the APR_BRIGADE_SENTINEL macro now causes compile errors with
> the current APR headers.  This was observed trying to compile
> mod_python with the httpd 2.2.10 headers, on MS Windows with Visual
> Studio 2008, but I suspect it affects all platforms.
> 
> The error is:
> 
> C:\Download\tmp\mod_python-3.3.1\src\connobject.c(142) : error C2037:
> left of 'next' specifies undefined struct/union 'apr_bucket_alloc_t'
> 
> After investigating, I think the cause of problem is this change to apr_ring.h:
> 
> http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_ring.h?r1=566349&r2=662299
> 
>  #define APR_RING_SENTINEL(hp, elem, link)				\
> -    (struct elem *)((char *)(hp) - APR_OFFSETOF(struct elem, link))
> +    (struct elem *)((char *)(&(hp)->next) - APR_OFFSETOF(struct elem, link))
> 
> What's passed to APR_RING_SENTINEL (as "hp") is a pointer to
> apr_bucket_alloc_t, which is declared in apr_buckets.h but not
> actually defined anywhere (as far as I can tell, at least nowhere in
> the headers that are bundled with the Windows installation of httpd
> 2.2.10), therefore none of its members can be referenced.
> 
> mod_python compiles without any errors using the httpd 2.2.8 headers.

This is a bug in mod_python. Instead of

!(b == APR_BRIGADE_SENTINEL(b) ||

it must be

!(b == APR_BRIGADE_SENTINEL(bb) ||

They pass a bucket to APR_BRIGADE_SENTINEL which is wrong.

This is fixed in mod_python trunk.
See http://svn.eu.apache.org/viewvc?view=rev&revision=676904


Regards

RĂ¼diger