On Wed, May 11, 2011 at 7:42 PM, <traw...@apache.org> wrote: > Author: trawick > Date: Wed May 11 23:42:05 2011 > New Revision: 1102138 > > URL: http://svn.apache.org/viewvc?rev=1102138&view=rev > Log: > Don't unconditionally include apr_dbg_win32_handles.h > anywhere (misc.c), as it enables special handle debugging > support within APR. > > In lieu of editing apr_private.h, allow enabling this > handle debugging by defining APR_DBG_WIN32_HANDLES at > compile time. > > Modified: > apr/apr/trunk/include/arch/win32/apr_dbg_win32_handles.h > apr/apr/trunk/include/arch/win32/apr_private.h > apr/apr/trunk/misc/win32/misc.c > > Modified: apr/apr/trunk/include/arch/win32/apr_dbg_win32_handles.h > URL: > http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/win32/apr_dbg_win32_handles.h?rev=1102138&r1=1102137&r2=1102138&view=diff > ============================================================================== > --- apr/apr/trunk/include/arch/win32/apr_dbg_win32_handles.h (original) > +++ apr/apr/trunk/include/arch/win32/apr_dbg_win32_handles.h Wed May 11 > 23:42:05 2011 > @@ -23,9 +23,12 @@ extern "C" { > > /* USAGE: > * > - * Add the following include to apr_private.h for internal debugging, > - * or copy this header into apr/include add the include below to apr.h > - * for really global debugging; > + * To enable for APR only: > + * Define APR_DBG_WIN32_HANDLES at compile time, or edit apr_private.h > + * and make the include of apr_dbg_win32_handles.h unconditional. > + * > + * To enable for APR applications as well: > + * Copy this header into apr/include add the include below to apr.h. > * > * #include "apr_dbg_win32_handles.h" > * > @@ -53,6 +56,10 @@ extern "C" { > * treated as a handle. > */ > > +#ifndef APR_DBG_WIN32_HANDLES > +#define APR_DBG_WIN32_HANDLES > +#endif > + > APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, > int nh,/* HANDLE *hv, char *dsc */...); > > > Modified: apr/apr/trunk/include/arch/win32/apr_private.h > URL: > http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/win32/apr_private.h?rev=1102138&r1=1102137&r2=1102138&view=diff > ============================================================================== > --- apr/apr/trunk/include/arch/win32/apr_private.h (original) > +++ apr/apr/trunk/include/arch/win32/apr_private.h Wed May 11 23:42:05 2011 > @@ -193,4 +193,12 @@ APR_DECLARE_DATA int errno; > #include <process.h> > #endif > > +/* Define APR_DBG_WIN32_HANDLES for the APR build, or just unconditionally > + * include apr_dbg_win32_handles.h below to enable handle debugging for > + * APR internals. See apr_dbg_win32_handles.h for more information. > + */ > +#ifdef APR_DBG_WIN32_HANDLES > +#include "apr_dbg_win32_handles.h" > +#endif > + > #endif /*APR_PRIVATE_H*/ > > Modified: apr/apr/trunk/misc/win32/misc.c > URL: > http://svn.apache.org/viewvc/apr/apr/trunk/misc/win32/misc.c?rev=1102138&r1=1102137&r2=1102138&view=diff > ============================================================================== > --- apr/apr/trunk/misc/win32/misc.c (original) > +++ apr/apr/trunk/misc/win32/misc.c Wed May 11 23:42:05 2011 > @@ -17,7 +17,6 @@ > #include "apr_private.h" > #include "apr_arch_misc.h" > #include "apr_arch_file_io.h" > -#include "apr_dbg_win32_handles.h" > #include "assert.h" > #include "apr_lib.h" > #include "tchar.h" > @@ -192,7 +191,10 @@ FARPROC apr_load_dll_func(apr_dlltoken_e > } > > /* Declared in include/arch/win32/apr_dbg_win32_handles.h > + * Enabled by defining APR_DBG_WIN32_HANDLES or by including > + * apr_dbg_win32_handles.h in specific files. > */ > +#ifdef APR_DBG_WIN32_HANDLES > APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, > int nh, /* HANDLE hv, char *dsc */...) > { > @@ -265,3 +267,4 @@ APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(c > } > return ha; > } > +#endif /* ifdef APR_DBG_WIN32_HANDLES */
unfortunately, with Visual or gcc it has to be disabled manually for fileio/win32/close.c, as the macro ends up trying to take &INVALID_HANDLE (or some constant like that) with gcc it has to be disabled for pipe.c as well (maybe a simpler issue there) defining APR_DBG_WIN32_HANDLES seems to be the best way to enable, because you can always undef it in the 1-2 source files where the macros break