changeset 21183:e7fda94aec6b

eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro * m4/acinclude.m4 (OCTAVE_CXX_ISO_COMPLIANT_LIBRARY): Delete macro definition. * configure.ac: Don't use it. * c-file-ptr-stream.h, c-file-ptr-stream.cc, oct-fstrm.cc: Always assume CXX_ISO_COMPLIANT_LIBRARY is true.
author John W. Eaton <jwe@octave.org>
date Wed, 03 Feb 2016 16:50:38 -0500
parents 82a44483dbff
children 3db899f1d54c
files configure.ac libinterp/corefcn/c-file-ptr-stream.cc libinterp/corefcn/c-file-ptr-stream.h libinterp/corefcn/oct-fstrm.cc m4/acinclude.m4
diffstat 5 files changed, 10 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Wed Feb 03 15:10:15 2016 -0500
+++ b/configure.ac	Wed Feb 03 16:50:38 2016 -0500
@@ -2232,9 +2232,6 @@
 ## Check that C compiler and libraries support IEEE754 data format.
 OCTAVE_IEEE754_DATA_FORMAT
 
-## Is C++ runtime library ISO compliant?
-OCTAVE_CXX_ISO_COMPLIANT_LIBRARY
-
 ## Are bit_and, bit_or, and bit_xor defined as templated operators?
 OCTAVE_CXX_BITWISE_OP_TEMPLATES
 
--- a/libinterp/corefcn/c-file-ptr-stream.cc	Wed Feb 03 15:10:15 2016 -0500
+++ b/libinterp/corefcn/c-file-ptr-stream.cc	Wed Feb 03 16:50:38 2016 -0500
@@ -50,17 +50,10 @@
 c_file_ptr_buf::int_type
 c_file_ptr_buf::overflow (int_type c)
 {
-#if defined (CXX_ISO_COMPLIANT_LIBRARY)
   if (f)
     return (c != traits_type::eof ()) ? gnulib::fputc (c, f) : flush ();
   else
     return traits_type::not_eof (c);
-#else
-  if (f)
-    return (c != EOF) ? gnulib::fputc (c, f) : flush ();
-  else
-    return EOF;
-#endif
 }
 
 c_file_ptr_buf::int_type
@@ -70,33 +63,20 @@
     {
       int_type c = gnulib::fgetc (f);
 
-      if (! bump
-#if defined (CXX_ISO_COMPLIANT_LIBRARY)
-          && c != traits_type::eof ())
-#else
-          && c != EOF)
-#endif
+      if (! bump && c != traits_type::eof ())
         ungetc (c, f);
 
       return c;
     }
   else
-#if defined (CXX_ISO_COMPLIANT_LIBRARY)
     return traits_type::eof ();
-#else
-    return EOF;
-#endif
 }
 
 c_file_ptr_buf::int_type
 c_file_ptr_buf::pbackfail (int_type c)
 {
-#if defined (CXX_ISO_COMPLIANT_LIBRARY)
-  return (c != traits_type::eof () && f) ? ungetc (c, f)
-                                         : traits_type::not_eof (c);
-#else
-  return (c != EOF && f) ? ungetc (c, f) : EOF;
-#endif
+  return ((c != traits_type::eof () && f)
+          ? ungetc (c, f) : traits_type::not_eof (c));
 }
 
 std::streamsize
@@ -120,10 +100,10 @@
 static inline int
 seekdir_to_whence (std::ios::seekdir dir)
 {
-  return ((dir == std::ios::beg) ? SEEK_SET :
-          (dir == std::ios::cur) ? SEEK_CUR :
-          (dir == std::ios::end) ? SEEK_END :
-          dir);
+  return (dir == std::ios::beg
+          ? SEEK_SET : (dir == std::ios::cur
+                        ? SEEK_CUR : (dir == std::ios::end
+                                      ? SEEK_END : dir)));
 }
 
 std::streampos
@@ -222,17 +202,10 @@
 c_zfile_ptr_buf::int_type
 c_zfile_ptr_buf::overflow (int_type c)
 {
-#if defined (CXX_ISO_COMPLIANT_LIBRARY)
   if (f)
     return (c != traits_type::eof ()) ? gzputc (f, c) : flush ();
   else
     return traits_type::not_eof (c);
-#else
-  if (f)
-    return (c != EOF) ? gzputc (f, c) : flush ();
-  else
-    return EOF;
-#endif
 }
 
 c_zfile_ptr_buf::int_type
@@ -242,33 +215,20 @@
     {
       int_type c = gzgetc (f);
 
-      if (! bump
-#if defined (CXX_ISO_COMPLIANT_LIBRARY)
-          && c != traits_type::eof ())
-#else
-          && c != EOF)
-#endif
+      if (! bump && c != traits_type::eof ())
         gzungetc (c, f);
 
       return c;
     }
   else
-#if defined (CXX_ISO_COMPLIANT_LIBRARY)
     return traits_type::eof ();
-#else
-    return EOF;
-#endif
 }
 
 c_zfile_ptr_buf::int_type
 c_zfile_ptr_buf::pbackfail (int_type c)
 {
-#if defined (CXX_ISO_COMPLIANT_LIBRARY)
-  return (c != traits_type::eof () && f) ? gzungetc (c, f)
-                                         : traits_type::not_eof (c);
-#else
-  return (c != EOF && f) ? gzungetc (c, f) : EOF;
-#endif
+  return ((c != traits_type::eof () && f)
+          ? gzungetc (c, f) : traits_type::not_eof (c));
 }
 
 std::streamsize
--- a/libinterp/corefcn/c-file-ptr-stream.h	Wed Feb 03 15:10:15 2016 -0500
+++ b/libinterp/corefcn/c-file-ptr-stream.h	Wed Feb 03 16:50:38 2016 -0500
@@ -32,11 +32,7 @@
 {
 public:
 
-#if ! defined (CXX_ISO_COMPLIANT_LIBRARY)
-  typedef int int_type;
-#else
   typedef std::streambuf::int_type int_type;
-#endif
 
   typedef int (*close_fcn) (FILE *);
 
@@ -152,11 +148,7 @@
 {
 public:
 
-#if ! defined (CXX_ISO_COMPLIANT_LIBRARY)
-  typedef int int_type;
-#else
   typedef std::streambuf::int_type int_type;
-#endif
 
   typedef int (*close_fcn) (gzFile);
 
--- a/libinterp/corefcn/oct-fstrm.cc	Wed Feb 03 15:10:15 2016 -0500
+++ b/libinterp/corefcn/oct-fstrm.cc	Wed Feb 03 16:50:38 2016 -0500
@@ -42,19 +42,8 @@
                                 oct_mach_info::float_format ff)
   : octave_base_stream (arg_md, ff), nm (nm_arg)
 {
-
-#if CXX_ISO_COMPLIANT_LIBRARY
-
   fs.open (nm.c_str (), arg_md);
 
-#else
-  // Override default protection of 0664 so that umask will appear to
-  // do the right thing.
-
-  fs.open (nm.c_str (), arg_md, 0666);
-
-#endif
-
   if (! fs)
     // Note: error is inherited from octave_base_stream, not ::error.
     error (gnulib::strerror (errno));
--- a/m4/acinclude.m4	Wed Feb 03 15:10:15 2016 -0500
+++ b/m4/acinclude.m4	Wed Feb 03 16:50:38 2016 -0500
@@ -1460,45 +1460,6 @@
   fi
 ])
 dnl
-dnl Check if the C++ library is ISO compliant.
-dnl FIXME: This is obviously very simplistic, and trivially fooled.
-dnl
-AC_DEFUN([OCTAVE_CXX_ISO_COMPLIANT_LIBRARY], [
-  AC_REQUIRE([AC_PROG_CXX])
-  AC_MSG_CHECKING([if C++ library is ISO compliant])
-  AC_CACHE_VAL([octave_cv_cxx_iso_compliant_library],
-    [AC_LANG_PUSH(C++)
-    rm -f conftest.h
-    ## Omitting cwctype for now, since it is broken with gcc-3.0.x and
-    ## possibly other versions...
-    for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \
-        climits clocale cmath complex csetjmp csignal cstdarg cstddef \
-        cstdio cstdlib cstring ctime cwchar deque exception \
-        fstream functional iomanip ios iosfwd iostream istream iterator \
-        limits list locale map memory new numeric ostream queue set \
-        sstream stack stdexcept streambuf string strstream typeinfo \
-        utility valarray vector; do
-      echo "#include <$inc>" >> conftest.h
-    done
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-        #include "conftest.h"
-        ]], [[
-        std::bitset<50> flags;
-        flags.set();
-        int digits = std::numeric_limits<unsigned long>::digits;
-        digits = 0;
-      ]])],
-      octave_cv_cxx_iso_compliant_library=yes,
-      octave_cv_cxx_iso_compliant_library=no)
-    AC_LANG_POP(C++)
-  ])
-  AC_MSG_RESULT([$octave_cv_cxx_iso_compliant_library])
-  if test $octave_cv_cxx_iso_compliant_library = yes; then
-    AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1,
-      [Define to 1 if your C++ runtime library is ISO compliant.])
-  fi
-])
-dnl
 dnl Allow the user disable support for command line editing using GNU
 dnl readline.
 dnl