Commit 24d2b60e authored by Brad King's avatar Brad King

Remove support for pre-C++98 streams

Remove the checks for KWSYS_IOS_USE_ANSI and KWSYS_IOS_HAVE_STD and uses
of the results.

Change-Id: I67d756a70a08636175a9d131c6b3e27a3f74b175
parent 198957cf
......@@ -35,15 +35,6 @@
# SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR})
# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
#
# KWSYS_IOS_FORCE_OLD = Force use of old non-ANSI C++ streams even if
# new streams are available. This may be used
# by projects that cannot configure their
# streams library.
# Example:
#
# SET(KWSYS_IOS_FORCE_OLD 1)
#
#
# Optional settings to setup install rules are as follows:
#
# KWSYS_INSTALL_BIN_DIR = The installation target directories into
......@@ -354,20 +345,6 @@ ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAVE_STD
"Checking whether STL classes are in std namespace" DIRECT)
IF(KWSYS_IOS_FORCE_OLD)
SET(KWSYS_IOS_USE_ANSI 0)
ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_ANSI
"Checking whether ANSI stream headers are available" DIRECT)
ENDIF()
IF(KWSYS_IOS_USE_ANSI)
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_STD
"Checking whether ANSI streams are in std namespace" DIRECT)
ELSE()
SET(KWSYS_IOS_HAVE_STD 0)
ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CSTDDEF
"Checking whether header cstddef is available" DIRECT)
......@@ -406,7 +383,7 @@ ELSE()
ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_OBJECTS
"Checking whether stl containers support allocator objects." DIRECT)
IF(KWSYS_IOS_USE_ANSI AND NOT WATCOM)
IF(NOT WATCOM)
# ANSI streams always have string operators.
SET(KWSYS_STL_STRING_HAVE_OSTREAM 1)
SET(KWSYS_STL_STRING_HAVE_ISTREAM 1)
......@@ -417,10 +394,6 @@ ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_ISTREAM
"Checking whether stl string has istream operator>>" DIRECT)
ENDIF()
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
-DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
-DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD})
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
"Checking whether \"<>\" is needed for template friends" INVERT)
......@@ -539,9 +512,6 @@ ENDIF()
IF(KWSYS_USE_IOStream)
# Determine whether iostreams support long long.
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
-DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
-DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD})
IF(KWSYS_CXX_HAS_LONG_LONG)
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM_LONG_LONG
"Checking if istream supports long long" DIRECT)
......@@ -560,7 +530,6 @@ IF(KWSYS_USE_IOStream)
SET(KWSYS_IOS_HAS_ISTREAM___INT64 0)
SET(KWSYS_IOS_HAS_OSTREAM___INT64 0)
ENDIF()
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
ENDIF()
IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
......
......@@ -15,12 +15,6 @@
/* Include C configuration. */
#include <@KWSYS_NAMESPACE@/Configure.h>
/* Whether ANSI C++ stream headers are to be used. */
#define @KWSYS_NAMESPACE@_IOS_USE_ANSI @KWSYS_IOS_USE_ANSI@
/* Whether ANSI C++ streams are in std namespace. */
#define @KWSYS_NAMESPACE@_IOS_HAVE_STD @KWSYS_IOS_HAVE_STD@
/* Whether STL is in std namespace. */
#define @KWSYS_NAMESPACE@_STL_HAVE_STD @KWSYS_STL_HAVE_STD@
......@@ -115,8 +109,6 @@
# endif
# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define KWSYS_STL_HAVE_STD @KWSYS_NAMESPACE@_STL_HAVE_STD
# define KWSYS_IOS_HAVE_STD @KWSYS_NAMESPACE@_IOS_HAVE_STD
# define KWSYS_IOS_USE_ANSI @KWSYS_NAMESPACE@_IOS_USE_ANSI
# define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM
# define KWSYS_CXX_HAS_CSTDDEF @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF
# define KWSYS_STL_STRING_HAVE_OSTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM
......
......@@ -12,16 +12,6 @@
#include "kwsysPrivate.h"
#include KWSYS_HEADER(Configure.hxx)
// Configure the implementation for the current streams library.
#if !KWSYS_IOS_USE_ANSI
# define ios_base ios
# if defined(__HP_aCC)
# define protected public
# include <iostream.h> // Hack access to some private stream methods.
# undef protected
# endif
#endif
// Include the streams library.
#include <iostream>
#include KWSYS_HEADER(IOStream.hxx)
......@@ -139,18 +129,11 @@ IOStreamScanTemplate(std::istream& is, T& value, char type)
int state = std::ios_base::goodbit;
// Skip leading whitespace.
# if KWSYS_IOS_USE_ANSI
std::istream::sentry okay(is);
# else
is.eatwhite();
std::istream& okay = is;
# endif
if(okay)
{
# if KWSYS_IOS_USE_ANSI
try {
# endif
// Copy the string to a buffer and construct the format string.
char buffer[KWSYS_IOS_INT64_MAX_DIG];
# if defined(_MSC_VER)
......@@ -176,16 +159,10 @@ IOStreamScanTemplate(std::istream& is, T& value, char type)
if(is.peek() == EOF) { state |= std::ios_base::eofbit; }
if(!success) { state |= std::ios_base::failbit; }
else { value = result; }
# if KWSYS_IOS_USE_ANSI
} catch(...) { state |= std::ios_base::badbit; }
# endif
}
# if KWSYS_IOS_USE_ANSI
is.setstate(std::ios_base::iostate(state));
# else
is.clear(state);
# endif
return is;
}
......@@ -194,16 +171,10 @@ template <class T>
std::ostream&
IOStreamPrintTemplate(std::ostream& os, T value, char type)
{
# if KWSYS_IOS_USE_ANSI
std::ostream::sentry okay(os);
# else
std::ostream& okay = os;
# endif
if(okay)
{
# if KWSYS_IOS_USE_ANSI
try {
# endif
// Construct the format string.
char format[8];
char* f = format;
......@@ -227,9 +198,7 @@ IOStreamPrintTemplate(std::ostream& os, T value, char type)
char buffer[2*KWSYS_IOS_INT64_MAX_DIG];
sprintf(buffer, format, value);
os << buffer;
# if KWSYS_IOS_USE_ANSI
} catch(...) { os.clear(os.rdstate() | std::ios_base::badbit); }
# endif
}
return os;
}
......
......@@ -18,52 +18,21 @@
# endif
#endif
// Setup for tests that use iostreams.
#if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
# if defined(_MSC_VER)
# pragma warning (push,1)
# endif
# if KWSYS_IOS_USE_ANSI
# include <iostream>
# else
# include <iostream.h>
# endif
# if defined(_MSC_VER)
# pragma warning (pop)
# endif
# if KWSYS_IOS_HAVE_STD
# define kwsys_ios std
# else
# define kwsys_ios
# endif
#endif
#ifdef TEST_KWSYS_STL_HAVE_STD
#include <list>
void f(std ::list<int>*) {}
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_IOS_USE_ANSI
#include <iosfwd>
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_IOS_HAVE_STD
#include <iosfwd>
void f(std ::ostream*) {}
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
# include <iostream.h>
# include <iostream>
# include <string>
void f(ostream& os, const kwsys_stl::string& s) { os << s; }
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
# include <iostream.h>
# include <iostream>
# include <string>
void f(istream& is, kwsys_stl::string& s) { is >> s; }
int main() { return 0; }
......@@ -297,50 +266,54 @@ int main()
#endif
#ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
int test_istream(kwsys_ios::istream& is, long long& x)
# include <iostream>
int test_istream(std::istream& is, long long& x)
{
return (is >> x)? 1:0;
}
int main()
{
long long x = 0;
return test_istream(kwsys_ios::cin, x);
return test_istream(std::cin, x);
}
#endif
#ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
int test_ostream(kwsys_ios::ostream& os, long long x)
# include <iostream>
int test_ostream(std::ostream& os, long long x)
{
return (os << x)? 1:0;
}
int main()
{
long long x = 0;
return test_ostream(kwsys_ios::cout, x);
return test_ostream(std::cout, x);
}
#endif
#ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64
int test_istream(kwsys_ios::istream& is, __int64& x)
# include <iostream>
int test_istream(std::istream& is, __int64& x)
{
return (is >> x)? 1:0;
}
int main()
{
__int64 x = 0;
return test_istream(kwsys_ios::cin, x);
return test_istream(std::cin, x);
}
#endif
#ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64
int test_ostream(kwsys_ios::ostream& os, __int64 x)
# include <iostream>
int test_ostream(std::ostream& os, __int64 x)
{
return (os << x)? 1:0;
}
int main()
{
__int64 x = 0;
return test_ostream(kwsys_ios::cout, x);
return test_ostream(std::cout, x);
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment