* [PATCH] opensm - add OSM_CDECL to qsort compare function definitions
@ 2009-10-08 16:46 Stan C. Smith
2009-10-08 17:10 ` Sean Hefty
0 siblings, 1 reply; 4+ messages in thread
From: Stan C. Smith @ 2009-10-08 16:46 UTC (permalink / raw)
To: 'Sasha Khapyorsky'; +Cc: ofw, 'linux-rdma'
X86 linkage requires __cdecl attribute on qsort() compare function definition; matches Windows qsort() prototype.
Add existing OSM_CDECL to qsort() compare function defintions.
OSM_CDECL defined blank for Linux.
Signed-off-by: stan smith <stan.smith@intel.com>
diff --git a/opensm/opensm/osm_mesh.c b/opensm/opensm/osm_mesh.c
index 9469420..a2a3a12 100644
--- a/opensm/opensm/osm_mesh.c
+++ b/opensm/opensm/osm_mesh.c
@@ -1368,7 +1368,7 @@ static int reorder_links(lash_t *p_lash, mesh_t *mesh)
/*
* compare two switches in a sort
*/
-static int compare_switches(const void *p1, const void *p2)
+static int OSM_CDECL compare_switches(const void *p1, const void *p2)
{
const comp_t *cp1 = p1, *cp2 = p2;
const sort_ctx_t *ctx = &cp1->ctx;
diff --git a/opensm/opensm/osm_ucast_ftree.c b/opensm/opensm/osm_ucast_ftree.c
index 1defd95..bafe9ce 100644
--- a/opensm/opensm/osm_ucast_ftree.c
+++ b/opensm/opensm/osm_ucast_ftree.c
@@ -225,7 +225,7 @@ typedef struct ftree_fabric_t_ {
**
***************************************************/
-static int compare_switches_by_index(IN const void *p1, IN const void *p2)
+static int OSM_CDECL compare_switches_by_index(IN const void *p1, IN const void *p2)
{
ftree_sw_t **pp_sw1 = (ftree_sw_t **) p1;
ftree_sw_t **pp_sw2 = (ftree_sw_t **) p2;
@@ -242,7 +242,7 @@ static int compare_switches_by_index(IN const void *p1, IN const void *p2)
/***************************************************/
-static int
+static int OSM_CDECL
compare_port_groups_by_remote_switch_index(IN const void *p1, IN const void *p2)
{
ftree_port_group_t **pp_g1 = (ftree_port_group_t **) p1;
diff --git a/opensm/opensm/osm_ucast_mgr.c b/opensm/opensm/osm_ucast_mgr.c
index be37df9..57cf2ad 100644
--- a/opensm/opensm/osm_ucast_mgr.c
+++ b/opensm/opensm/osm_ucast_mgr.c
@@ -723,7 +723,7 @@ static void sw_count_endport_links(osm_switch_t * sw)
}
}
-static int compar_sw_load(const void *s1, const void *s2)
+static int OSM_CDECL compar_sw_load(const void *s1, const void *s2)
{
#define get_sw_endport_links(s) (*(osm_switch_t **)s)->endport_links
return get_sw_endport_links(s2) - get_sw_endport_links(s1);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] opensm - add OSM_CDECL to qsort compare function definitions
2009-10-08 16:46 [PATCH] opensm - add OSM_CDECL to qsort compare function definitions Stan C. Smith
@ 2009-10-08 17:10 ` Sean Hefty
[not found] ` <7E11A1A23B5A46DB8BB84556E67BF487-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Sean Hefty @ 2009-10-08 17:10 UTC (permalink / raw)
To: Smith, Stan, 'Sasha Khapyorsky'; +Cc: ofw, 'linux-rdma'
>X86 linkage requires __cdecl attribute on qsort() compare function definition;
>matches Windows qsort() prototype.
>Add existing OSM_CDECL to qsort() compare function defintions.
>OSM_CDECL defined blank for Linux.
ibping also requires the use __cdecl. So far, I've been maintaining that patch
separately and applying it before updating the winof code base. If multiple
users of __cdecl are required, maybe we can find a common place for the
definition.
- Sean
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ofw] [PATCH] opensm - add OSM_CDECL to qsort compare function definitions
[not found] ` <7E11A1A23B5A46DB8BB84556E67BF487-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
@ 2009-10-08 17:59 ` Jason Gunthorpe
2009-10-08 18:09 ` Sean Hefty
0 siblings, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2009-10-08 17:59 UTC (permalink / raw)
To: Sean Hefty
Cc: Smith, Stan, 'Sasha Khapyorsky',
ofw-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5, 'linux-rdma'
On Thu, Oct 08, 2009 at 10:10:34AM -0700, Sean Hefty wrote:
> >X86 linkage requires __cdecl attribute on qsort() compare function definition;
> >matches Windows qsort() prototype.
> >Add existing OSM_CDECL to qsort() compare function defintions.
> >OSM_CDECL defined blank for Linux.
>
> ibping also requires the use __cdecl. So far, I've been maintaining
> that patch separately and applying it before updating the winof code
> base. If multiple users of __cdecl are required, maybe we can find
> a common place for the definition.
I don't get it - how can an ISO C conforming compiler require a
non-standard declaration on the function argument to the ISO C
function qsort?
Has the default calling convention been changed for some reason?
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] opensm - add OSM_CDECL to qsort compare function definitions
2009-10-08 17:59 ` [ofw] " Jason Gunthorpe
@ 2009-10-08 18:09 ` Sean Hefty
0 siblings, 0 replies; 4+ messages in thread
From: Sean Hefty @ 2009-10-08 18:09 UTC (permalink / raw)
To: 'Jason Gunthorpe'
Cc: ofw, 'Sasha Khapyorsky', 'linux-rdma'
>> ibping also requires the use __cdecl. So far, I've been maintaining
>> that patch separately and applying it before updating the winof code
>> base. If multiple users of __cdecl are required, maybe we can find
>> a common place for the definition.
>
>I don't get it - how can an ISO C conforming compiler require a
>non-standard declaration on the function argument to the ISO C
>function qsort?
The windows compiler uses stdcall as the default function type. With ibping,
the signal() call, and I'm guessing this is the same with qsort(), requires that
the function passed in as an arg be cdecl. So, in the case of ibping:
void report(int sig)
needs to be written as
void __cdecl report(int sig)
to compile for x86. I have no idea why only the x86 build that complains.
Since this is the only difference between the linux and windows code, I've just
maintained the patch to add it separately.
- Sean
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-10-08 18:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-08 16:46 [PATCH] opensm - add OSM_CDECL to qsort compare function definitions Stan C. Smith
2009-10-08 17:10 ` Sean Hefty
[not found] ` <7E11A1A23B5A46DB8BB84556E67BF487-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2009-10-08 17:59 ` [ofw] " Jason Gunthorpe
2009-10-08 18:09 ` Sean Hefty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox