[Openib-windows] Re: [PATCH] Opensm - asserts before OSM_LOG_ENTER

Hal Rosenstock halr at voltaire.com
Wed Feb 1 06:15:09 PST 2006


Hi Michael,
,
On Wed, 2006-02-01 at 08:40, Michael S. Tsirkin wrote:
> Quoting r. Yael Kalka <yael at mellanox.co.il>:
> > Subject: [PATCH] Opensm - asserts before OSM_LOG_ENTER
> > 
> > 
> > Hi Hal,
> > 
> > When trying to compile the windows stack with some late updates, I've
> > encountered an issue with the addition/change of place of asserts to
> > before the OSM_LOG_ENTER. Since OSM_LOG_ENTER declares a variable,
> > then these asserts cause failure due to declaration in the middle of
> > the function.
> > These asserts are all on the reciever object or the manager object, so
> > I don't think they are really necessary.
> > 
> > The Following patch removes these asserts.
> > 
> > Thanks,
> > Yael
> > 
> > Signed-off-by:  Yael Kalka <yael at mellanox.co.il>
> 
> Macros that declare variables are evil. Macros that end with ';'
> are evil too.
> 
> ---
> 
> gcc has __func__, and Visual has __FUNCTION__, so ugly
> hackery around OSM_LOG_ENTER is not needed anymore.
> 
> Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
> 
> Index: openib/src/userspace/management/osm/include/opensm/osm_log.h
> ===================================================================
> --- openib.orig/src/userspace/management/osm/include/opensm/osm_log.h	2005-10-16 10:49:04.791297000 +0200
> +++ openib/src/userspace/management/osm/include/opensm/osm_log.h	2006-02-01 15:36:38.652180000 +0200
> @@ -71,17 +71,13 @@ BEGIN_C_DECLS
>  #define LOG_ENTRY_SIZE_MAX		4096
>  #define BUF_SIZE				LOG_ENTRY_SIZE_MAX
>  
> -#define OSM_LOG_DEFINE_FUNC( NAME ) \
> -	static const char osm_log_func_name[] = #NAME
> -
>  #define OSM_LOG_ENTER( OSM_LOG_PTR, NAME ) \
> -	OSM_LOG_DEFINE_FUNC( NAME ); \
>  	osm_log( OSM_LOG_PTR, OSM_LOG_FUNCS, \
> -		 "%s: [\n", osm_log_func_name );
> +		 "%s: [\n", __func__ )
>  
>  #define OSM_LOG_EXIT( OSM_LOG_PTR ) \
>  	osm_log( OSM_LOG_PTR, OSM_LOG_FUNCS, \
> -		 "%s: ]\n", osm_log_func_name );
> +		 "%s: ]\n", __func__ )
>  
>  /****h* OpenSM/Log
>  * NAME


This looks fine for Linux to me but since this file is shared by
Windows, doesn't it need a conditionalization for those builds ? 

Also, will __FUNCTION__ work in all the Windows cases ?

-- Hal




More information about the ofw mailing list