[ofa-general] [PATCH] Allow paths to the device specific library to be absolute

Roland Dreier rdreier at cisco.com
Wed Jul 22 15:05:48 PDT 2009


 > # cat t.cc
 > enum bar {FOO=1, BAR=2};
 > enum bar1 {FOO1=1, BAR1=2};
 > enum bar1 x = FOO|BAR;
 > # g++ -c -Wall t.cc
 > t.cc:3: error: invalid conversion from 'int' to 'bar1'
 > 
 > I'd like to see a result for ia64 and ppc64.. Roland do you have a
 > Debian machine logon? Could you check this on merulo.debian.org (or
 > merkel)?  Unfortunately I don't think pescetti is a ppc64 :|

I don't have a debian logon, but I do have an ia64 machine:

$ uname -m
ia64
$ g++ -c -Wall t.cc
t.cc:3: error: invalid conversion from ‘int’ to ‘bar1’

and a cross-compiler shows:

$ powerpc64-unknown-linux-gnu-g++ -m64 -Wall -c t.cc
t.cc:3: error: invalid conversion from 'int' to 'bar1'

so int covers the "major" platforms.

Of course this is just with the specific g++ version I tried (4.3.3 on
ia64, 4.1.1 on ppc64).  Could change with g++ version too I assume.

 > To fix this.. Well..
 > 
 > int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
 >                   enum ibv_qp_attr_mask attr_mask);
 > 
 > becomes:
 > 
 > int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
 >                   ENUM_TYPE attr_mask);

 > What I've been mulling over is exactly what ENUM_TYPE should be to
 > have guarenteed ABI compatibility on ppc 32/64, i386 and x86-64.

Yuck... the C standard says

    The identifiers in an enumerator list are declared as constants that
    have type int and may appear wherever such are permitted.

so using int in the function declaration would be fine, except:

    Each enumerated type shall be compatible with an integer type. The
    choice of type is implementation-defined

so we might be changing the function signature on some obscure platform
without knowing it.  I'm not sure if just ppc32/64, x86, ia64 is really
good enough -- but on the other hand unbreaking C++ would be nice too.

sigh...

 - R.



More information about the general mailing list