On Thu, 2010-07-15 at 07:21 -0400, Jeff Squyres wrote:
> On Jul 15, 2010, at 2:14 AM, nadia.derbey wrote:
> 
> > The only warning I'm getting in the part of the code impacted by the
> > patch is:
> > ---------------------
> > ../../../../../ompi/mca/btl/openib/btl_openib_async.c(322): warning
> > #188: enumerated type mixed with another type
> >               event_type ^= IBV_XRC_QP_EVENT_FLAG;
> > ---------------------
> 
> Ya, that's the one.
> 
> Is there any way to get rid of that @!#@#$ warning?  I'm not sure what it's 
> complaining about -- event_type and IBV_XRC_QP_EVENT_FLAG are the same type, 
> no?
> 

well, the problem is that event->event_type is declared as an enumerated
type (ibv_event_type).
In case of XRC it is OR'd with another enumerated type
(ibv_event_flags).

So the solution is:
 1. leave the intermediate event_type declared as an int.
 2. then:
      . either cast it to ibv_event_type when calling
openib_event_to_str()
      . or declare openib_event_to_str as accepting an int instead of an
ibv_event_type.

Both solutions attached

Regards,
Nadia


> Specifically: I think your patch is good.  But it would be good to not 
> introduce yet another / fix all these intel compiler warnings about mixing 
> ints and enums.
> 


-- 
nadia.derbey <nadia.der...@bull.net>
Wrong event_type value passed in to show_help when getting xrc async events

diff -r e4bab4451664 ompi/mca/btl/openib/btl_openib_async.c
--- a/ompi/mca/btl/openib/btl_openib_async.c	Tue May 25 01:30:35 2010 +0200
+++ b/ompi/mca/btl/openib/btl_openib_async.c	Thu Jul 15 14:09:33 2010 +0200
@@ -350,13 +350,15 @@ static int btl_openib_async_deviceh(stru
             case IBV_EVENT_SRQ_ERR:
                 orte_show_help("help-mpi-btl-openib.txt", "of error event",
                     true,orte_process_info.nodename, orte_process_info.pid,
-                    event.event_type, openib_event_to_str(event.event_type),
+                    event_type,
+                    openib_event_to_str((enum ibv_event_type)event_type),
                     xrc_event ? "true" : "false");
                 break;
             case IBV_EVENT_PORT_ERR:
                 orte_show_help("help-mpi-btl-openib.txt", "of error event",
                     true,orte_process_info.nodename, orte_process_info.pid,
-                    event.event_type, openib_event_to_str(event.event_type),
+                    event_type,
+                    openib_event_to_str((enum ibv_event_type)event_type),
                     xrc_event ? "true" : "false");
                 /* Set the flag to indicate port error */
                 device->got_port_event = true;
@@ -385,7 +387,7 @@ static int btl_openib_async_deviceh(stru
             default:
                 orte_show_help("help-mpi-btl-openib.txt", "of unknown event",
                         true,orte_process_info.nodename, orte_process_info.pid,
-                        event.event_type, xrc_event ? "true" : "false");
+                        event_type, xrc_event ? "true" : "false");
         }
         ibv_ack_async_event(&event);
     } else {
Wrong event_type value passed in to show_help when getting xrc async events

diff -r e4bab4451664 ompi/mca/btl/openib/btl_openib_async.c
--- a/ompi/mca/btl/openib/btl_openib_async.c	Tue May 25 01:30:35 2010 +0200
+++ b/ompi/mca/btl/openib/btl_openib_async.c	Thu Jul 15 14:14:59 2010 +0200
@@ -41,13 +41,13 @@ static int return_status = OMPI_ERROR;
 static int btl_openib_async_poll_init(struct mca_btl_openib_async_poll *hcas_poll);
 static int btl_openib_async_commandh(struct mca_btl_openib_async_poll *hcas_poll);
 static int btl_openib_async_deviceh(struct mca_btl_openib_async_poll *hcas_poll, int index);
-static const char *openib_event_to_str (enum ibv_event_type event);
+static const char *openib_event_to_str (int event);
 static int send_command_comp(int in);

 /* Function converts event to string (name)
  * Open Fabris don't have function that do this job :(
  */
-static const char *openib_event_to_str (enum ibv_event_type event)
+static const char *openib_event_to_str (int event)
 {
     switch (event) {
     case IBV_EVENT_CQ_ERR:
@@ -350,13 +350,13 @@ static int btl_openib_async_deviceh(stru
             case IBV_EVENT_SRQ_ERR:
                 orte_show_help("help-mpi-btl-openib.txt", "of error event",
                     true,orte_process_info.nodename, orte_process_info.pid,
-                    event.event_type, openib_event_to_str(event.event_type),
+                    event_type, openib_event_to_str(event_type),
                     xrc_event ? "true" : "false");
                 break;
             case IBV_EVENT_PORT_ERR:
                 orte_show_help("help-mpi-btl-openib.txt", "of error event",
                     true,orte_process_info.nodename, orte_process_info.pid,
-                    event.event_type, openib_event_to_str(event.event_type),
+                    event_type, openib_event_to_str(event_type),
                     xrc_event ? "true" : "false");
                 /* Set the flag to indicate port error */
                 device->got_port_event = true;
@@ -385,7 +385,7 @@ static int btl_openib_async_deviceh(stru
             default:
                 orte_show_help("help-mpi-btl-openib.txt", "of unknown event",
                         true,orte_process_info.nodename, orte_process_info.pid,
-                        event.event_type, xrc_event ? "true" : "false");
+                        event_type, xrc_event ? "true" : "false");
         }
         ibv_ack_async_event(&event);
     } else {

Reply via email to