[C++-sig] Boost.Python, AIX, and gcc

Mike Owen mikeowen at comcast.net
Tue Nov 4 09:02:29 CET 2003


OK, I've tried out your debug print with the example I have, and here's the output I get from the compiler:

... type_traits/type_with_alignment.hpp: In instantiation of` boost::type_with_alignment<8>':
...
type_traits/type_with_alignment.hpp:142: no type named `type' in `struct boost::maybe_print_align<false, 8>'

So this is telling me that the type is 8 bit aligned (just like your example on Mac below), but
how should I follow up on this?  Also, how bad is it that this assert is failing?  I've been able
to make my small test cases work by just excluding these asserts on AIX, but I assume this
is eventually going to cause trouble.

By the way, the test case I'm using to generate this error is really small, so I could provide it if
that would be helpful.  I'm not sure if that's useful, though, since you have to have an AIX
machine handy to reproduce the problem.

On Monday 03 November 2003 20:04, Ralf W. Grosse-Kunstleve wrote:
> --- "J. Michael Owen" <mikeowen at llnl.gov> wrote:
> > > Index: boost/type_traits/type_with_alignment.hpp
> >
> > ===================================================================
> > RCS file:
> > /cvsroot/boost/boost/boost/type_traits/type_with_alignment.hpp,v
> > retrieving revision 1.14
> > diff -u -r1.14 type_with_alignment.hpp
> > --- boost/type_traits/type_with_alignment.hpp	3 Sep 2003 15:19:12
> > -0000	1.14 +++ boost/type_traits/type_with_alignment.hpp	4 Nov 2003
> > 00:31:00 -0000 @@ -132,7 +132,7 @@
> >
> >      BOOST_STATIC_CONSTANT(std::size_t, found =
> > alignment_of<align_t>::value);
> >
> > -#if !(defined(__APPLE__) && defined(__MACH__) && defined(__GNUC__))
> > +#if !(((defined(__APPLE__) && defined(__MACH__)) || defined(_AIX)) &&
> > defined(__GNUC__))
> >      BOOST_STATIC_ASSERT(found >= Align);
> >      BOOST_STATIC_ASSERT(found % Align == 0);
> >  #endif
>
> I am afraid I am responsible for the __APPLE__ hack. It would be good if we
> could get rid of this. Could you please try this:
>
> --- Douglas Gregor <gregod at cs.rpi.edu> wrote:
> > My apologies for the very late reply. I was away for a while and am still
> > sorting through my inbox...
> >
> > > Platform:
> > >   Mac OS 10.2
> > >   gcc 3.3 compiled from sources
> > >   boost cvs from last Friday
> > >
> > > When porting the Boost.Python bindings for some custom libraries I ran
> > > into a problem with static asserts in type_with_alignment.hpp:
> >
> > [snip patch]
> >
> > > This patch allows me to compile and link, and our regression test
> > > runs fine.
> > >
> > > Reducing my code to a minimal test is most likely a time-consuming
> > > project that I'd like to avoid if possible (compilation is quite slow
> > > to make things worse). Do the authors of the code above have any ideas
> > > what could be going wrong? Are there things that I could try first
> > > before chopping my code into pieces?
> >
> > If you could figure out what alignment value you're trying to get a type
> > for it would help greatly. One way you could do it would be to replace
> > the static assertion lines with something that will halt the compile and
> > give back the Align value in an error message, e.g.,
> >
> > // somewhere
> > template<bool DontPrintIt, std::size_t Align> struct maybe_print_align {
> > typedef void type; }
> > template<std::size_t Align> struct maybe_print_align<false, Align> {};
> >
> > // instead of the static asserts:
> > typedef typename maybe_print_align<(found >= Align), Align>::type foobar;
> >
> > Note that when those static asserts fail, it means that you aren't
> > getting back a type with the right alignment.
> >
> >     Doug
>
> Here is the result for the Mac:
>
> From: "Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com>
> To: "Boost mailing list" <boost at lists.boost.org>
> Sent: Saturday, June 07, 2003 5:50 AM
> Subject: Re: [boost] Mac OS 10 & type_traits/type_with_alignment.hpp
>
> > --- Douglas Gregor <gregod at cs.rpi.edu> wrote:
> > /var/tmp/mac/boost/boost/type_traits/type_with_alignment.hpp:120:
> > error: no type named `type' in `boost::maybe_print_align<false, 8, 4>'
>
> So you have a type that is 8-byte aligned, but we don't have any types in
> the list of possible types that have an alignment of 8 on that
> architecture, so it fails. We'll just have to find a type that has 8-byte
> alignment and add it to the list. I'll see if I can dig one up tomorrow.
>
>     Doug
>
>
> As of today we are still waiting. Maybe if we can give Doug a little more
> incentive he'll be able to help.
>
> Ralf
>
>
> __________________________________
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard
> http://antispam.yahoo.com/whatsnewfree

-- 
 "Hey...where are the sunflower seeds?" |       J. Michael Owen         
        o_o /                           |       Phone:  925-423-7160     
        (")                             |       Email:  mikeowen at comcast.net
       \/'\/                            |
____(__(,_,)_______________________________________________________________




More information about the Cplusplus-sig mailing list