diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index bba7e389d3..eeb6809606 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -395,17 +395,17 @@ ELSE(KWSYS_STL_HAS_ALLOCATOR_TEMPLATE) ENDIF(KWSYS_STL_HAS_ALLOCATOR_TEMPLATE) KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_OBJECTS "Checking whether stl containers support allocator objects." DIRECT) -IF(KWSYS_IOS_USE_ANSI) +IF(KWSYS_IOS_USE_ANSI AND NOT WATCOM) # ANSI streams always have string operators. SET(KWSYS_STL_STRING_HAVE_OSTREAM 1) SET(KWSYS_STL_STRING_HAVE_ISTREAM 1) -ELSE(KWSYS_IOS_USE_ANSI) +ELSE(KWSYS_IOS_USE_ANSI AND NOT WATCOM) # There may not be string operators for old streams. KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_OSTREAM "Checking whether stl string has ostream operator<<" DIRECT) KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_ISTREAM "Checking whether stl string has istream operator>>" DIRECT) -ENDIF(KWSYS_IOS_USE_ANSI) +ENDIF(KWSYS_IOS_USE_ANSI AND NOT WATCOM) SET(KWSYS_PLATFORM_CXX_TEST_DEFINES) KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS diff --git a/Source/kwsys/kwsys_stl_string.hxx.in b/Source/kwsys/kwsys_stl_string.hxx.in index 3124c119f5..37e023f2e1 100644 --- a/Source/kwsys/kwsys_stl_string.hxx.in +++ b/Source/kwsys/kwsys_stl_string.hxx.in @@ -29,6 +29,13 @@ # define @KWSYS_NAMESPACE@_STL_STRING_ISTREAM_DEFINED # include // isspace # include <@KWSYS_NAMESPACE@/ios/iostream> +# if defined(__WATCOMC__) +namespace @KWSYS_NAMESPACE@ +{ +struct ios_istream_hack: public kwsys_ios::istream +{ void eatwhite() { this->@KWSYS_NAMESPACE@_ios::istream::eatwhite(); } }; +} +# endif inline @KWSYS_NAMESPACE@_ios::istream& operator>>(@KWSYS_NAMESPACE@_ios::istream& is, @KWSYS_NAMESPACE@_stl::string& s) @@ -43,8 +50,12 @@ operator>>(@KWSYS_NAMESPACE@_ios::istream& is, s.erase(); // Skip leading whitespace. +#if defined(__WATCOMC__) + static_cast<@KWSYS_NAMESPACE@::ios_istream_hack&>(is).eatwhite(); +#else is.eatwhite(); - istream& okay = is; +#endif + @KWSYS_NAMESPACE@_ios::istream& okay = is; if(okay) {