gcc 3.4.2 + fpack-struct + hash_map
Thierry MARTIN
thierry.martin@accellent-group.com
Wed Mar 23 16:09:00 GMT 2005
Hi,
I have to build a program with g++ and fpack-struct option turned on.
1) version gcc 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
2) testh.cpp
#include <ext/hash_map>
using namespace __gnu_cxx;
int main (int argc, char* argv[])
{
hash_map<int, int> inttale;
return 0;
}
3)The command line to build :
# g++ testh.cpp -fpack-struct
In file included from
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/ios:49,
from
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/ostream:4
5,
from
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/iterator:
71,
from
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/ext/hasht
able.h:69,
from
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/ext/hash_
map:65,
from testh.cpp:1:
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/ios_
base.h:
In member function `std::_Ios_Fmtflags
std::ios_base::setf(std::_Ios_Fmtflags)':
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/ios_
base.h:536:
error: cannot bind packed field
`((std::ios_base*)this)->std::ios_base::_M_flags' to
`std::_Ios_Fmtflags&'
(... to make it short :-) )
4)
I know that I can apply a specific attribute to the structures that
have to be packed. May be a #pragma pack could also do the trick.
BUT: the program I have to build is made of hundred of source files
and has always been built with the pack-struct option. Thus it's a
very hard task to modify the sources and I would realy prefer a nicer
way to do it :-).
So, I am just looking for a good advice...
Thanks for your help !!
More information about the Gcc-help
mailing list