apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Fogel <kfo...@newton.ch.collab.net>
Subject Re: bogus compiler warnings in macros that take `socket'
Date Tue, 16 Jul 2002 03:27:35 GMT
Cliff Woolley <jwoolley@virginia.edu> writes:
> This is not the kind of warning you would get at the preprocessor stage --
> you'll only get this after macro expansion has already occurred.  Sounds
> like a legitimate bug in APR to me.

Oh, I see it now.  The problem is that the expansions use the same
`name' for the parameter of the function:

 /**
  * @param name Set Inheritance for this Socket/File Handle
  */
 #define APR_DECLARE_INHERIT_SET(name) \
     APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *name)
   
 /**
  * @param name Unset Inheritance for this Socket/File Handle
  */
 #define APR_DECLARE_INHERIT_UNSET(name) \
     APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *name)
   
Bleargh.  I guess we should just make them take a second parameter, to
be used for the expanded parameter name.  For example:

 /**
  * @param name Set Inheritance for this Socket/File Handle
  */
 #define APR_DECLARE_INHERIT_SET(name, param) \
     APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *param)

...change the call, and then go change the function defs in (say)
sockets.c.  That's a pain because we have to do the same to the
APR_IMPLEMENT_INHERIT_SET and APR_IMPLEMENT_INHERIT_UNSET macros in
the arch-specific inherit.h's.

But I don't see a better way.  Unless... <evil grin>...

Unless we just rename the parameter to "sock".  Then we have to change
apr_socket_t to apr_sock_t, and the interfaces to apr_sock_*().  But
if we're willing to do those things, then this change is very easy to
make.

Thoughts?,
-Karl


Mime
View raw message