[Insight-developers] OS X 10.7.3 breaks kwsys
Brad King
brad.king at kitware.com
Tue Mar 13 13:16:09 EDT 2012
On 3/13/2012 11:59 AM, Williams, Norman K wrote:
> This is one of those 'oh great' moments. I updated my Mac to 10.7.3 and
> ITK and VTK compiles broke, with this error:
>
> In file included from
> /scratch/kent/ants/brainsia/build/ITKv4/Modules/ThirdParty/KWSys/src/KWSys/
> SystemTools.cxx:26:
> /scratch/kent/ants/brainsia/build/ITKv4-build/Modules/ThirdParty/KWSys/src/
> itksys/ios/sstream:176:29: error: cannot initialize a
> parameter of type 'iostate' (aka 'std::_Ios_Iostate') with an lvalue
> of type 'int'
> this->IStrStream::clear(flags);
> ^~~~~
> /usr/include/c++/4.2.1/bits/basic_ios.h:133:21: note: passing argument to
> parameter '__state' here
> clear(iostate __state = goodbit);
>
> The problem is that the function signature for ios::clear changed between
> 10.7.2 and 10.7.3 -- and for some reason the compiler won't do the
> conversion between int and iostate.
>
> It's vexing to me because I can't imagine ever calling ios::clear() with
> an argument. Clear is clear, right?
There is also "setsetate" which just sets the bits passed but leaves
others untouched. The "clear" method sets the bits passed and clears
the rest of the bits. It is defined by C++98 27.4.4.3/4 to take an
argument of type iostate.
KWSys uses "int" because "iostate" had portability problems with older
compilers. The actual type of "iostate" is implementation-defined so
it is not guaranteed to be convertible from an int. However, the code
in question should not appear at all on a modern compiler because it
exists only to implement <sstream> on compilers that do not provide it.
This configuration check:
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_SSTREAM
"Checking whether ANSI string stream is available" DIRECT)
should pass and prevent the code from being used at all. Check the
CMakeFiles/CMakeError.log to see why it doesn't pass.
-Brad
More information about the Insight-developers
mailing list