On Tue, Dec 14, 2004 at 10:27:03AM -0500, Stas Bekman wrote:
> Joe Orton wrote:
> >On Mon, Dec 13, 2004 at 08:12:19PM -0500, Stas Bekman wrote:
> >
> >>In fact we already somewhat handle that in modperl_io_apache.h
> >>
> >>
> >>
> >>#ifdef PERLIO_LAYERS
> >>[...]
> >>MP_INLINE void modperl_io_apache_init(pTHX);
> >>
> >>#else /* #ifdef PERLIO_LAYERS */
> >>
> >>#define modperl_io_apache_init(pTHX)
> >
> >
> >>
> >>but for some reason define doesn't do the trick, when it gets to do:
> >>
> >> const void *modperl_hack_io_apache_init =
> >>    (const void *)modperl_io_apache_init;
> >
> >
> >The C preprocessor won't expand a parameterized macro unless it's called
> >with parameters:
> >
> >$ cpp
> >#define foo(bar) bar
> >foo(norman)
> >foo blah
> ># 1 "<stdin>"
> ># 1 "<built-in>"
> ># 1 "<command line>"
> ># 1 "<stdin>"
> >
> >norman
> >foo blah
> 
> Thanks Joe. So what kind of hack of the hack can we use here? I suppose 
> that even if it did expand it, there would have been a problem since we 
> have:
> 
>   #define modperl_io_apache_init(pTHX)
> 
> so it expands to nothing. Of course the right solution is to never include 
> this in the autogenerated modperl_exports.c but this will require C 
> parsing with some messy sed like Apache/APR do. Is there some other 
> solution for this kind of functions?

Just make the generated export stub code #ifndef'ed?

#ifndef modperl_io_apache_init
const void *modperl_hack_io_apache_init = (const void *)modperl_io_apache_init;
#endif

if the symbol is a macro then there's no point in generating a stub for
it anyway...

joe

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to