changeset 21187:f569ba0ee237

eliminate FCN_PTR_CAST macro and associated configure test * acinclude.m4 (CTAVE_CXX_BROKEN_REINTERPRET_CAST): Delete macro definition. * configure.ac: Don't use it. * oct-conf-post.in.h (FCN_PTR_CAST): Delete macro definition. * dynamic-ld.cc, mex.cc: Use reinterpret_cast instead of FCN_PTR_CAST macro.
author John W. Eaton <jwe@octave.org>
date Thu, 04 Feb 2016 00:30:42 -0500
parents 7f35125714b4
children 833667470c9b
files configure.ac libinterp/corefcn/dynamic-ld.cc libinterp/corefcn/mex.cc m4/acinclude.m4 oct-conf-post.in.h
diffstat 5 files changed, 3 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Wed Feb 03 23:44:49 2016 -0500
+++ b/configure.ac	Thu Feb 04 00:30:42 2016 -0500
@@ -2223,9 +2223,6 @@
 
 ### Check compiler characteristics.
 
-## Does reinterpret_cast fail for function pointers?
-OCTAVE_CXX_BROKEN_REINTERPRET_CAST
-
 ## Check if C++ compiler can auto allocate variable sized arrays.
 OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS
 
--- a/libinterp/corefcn/dynamic-ld.cc	Wed Feb 03 23:44:49 2016 -0500
+++ b/libinterp/corefcn/dynamic-ld.cc	Thu Feb 04 00:30:42 2016 -0500
@@ -282,7 +282,7 @@
   if (function)
     {
       octave_dld_fcn_getter f
-        = FCN_PTR_CAST (octave_dld_fcn_getter, function);
+        = reinterpret_cast<octave_dld_fcn_getter> (function);
 
       retval = f (oct_file, relative);
 
--- a/libinterp/corefcn/mex.cc	Wed Feb 03 23:44:49 2016 -0500
+++ b/libinterp/corefcn/mex.cc	Thu Feb 04 00:30:42 2016 -0500
@@ -3000,7 +3000,7 @@
 
   if (have_fmex)
     {
-      fmex_fptr fcn = FCN_PTR_CAST (fmex_fptr, f);
+      fmex_fptr fcn = reinterpret_cast<fmex_fptr> (f);
 
       int tmp_nargout = nargout;
       int tmp_nargin = nargin;
@@ -3009,7 +3009,7 @@
     }
   else
     {
-      cmex_fptr fcn = FCN_PTR_CAST (cmex_fptr, f);
+      cmex_fptr fcn = reinterpret_cast<cmex_fptr> (f);
 
       fcn (nargout, argout, nargin, argin);
     }
--- a/m4/acinclude.m4	Wed Feb 03 23:44:49 2016 -0500
+++ b/m4/acinclude.m4	Thu Feb 04 00:30:42 2016 -0500
@@ -1339,30 +1339,6 @@
   fi
 ])
 dnl
-dnl Check if C++ reinterpret cast works for function pointers.
-dnl
-AC_DEFUN([OCTAVE_CXX_BROKEN_REINTERPRET_CAST],
-  [AC_REQUIRE([AC_PROG_CXX])
-  AC_CACHE_CHECK([for broken C++ reinterpret_cast],
-    [octave_cv_cxx_broken_reinterpret_cast],
-    [AC_LANG_PUSH(C++)
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-        #include <cmath> ]], [[
-        typedef double (*fptr) (double);
-        fptr psin = sin;
-        void *vptr = reinterpret_cast<void *> (psin);
-        psin = reinterpret_cast<fptr> (vptr);
-      ]])],
-      octave_cv_cxx_broken_reinterpret_cast=no,
-      octave_cv_cxx_broken_reinterpret_cast=yes)
-    AC_LANG_POP(C++)
-  ])
-  if test $octave_cv_cxx_broken_reinterpret_cast = yes; then
-    AC_DEFINE(CXX_BROKEN_REINTERPRET_CAST, 1,
-      [Define to 1 if C++ reinterpret_cast fails for function pointers.])
-  fi
-])
-dnl
 dnl Check if the C++ library has functions to access real and imaginary
 dnl parts of complex numbers independently via references.
 dnl
--- a/oct-conf-post.in.h	Wed Feb 03 23:44:49 2016 -0500
+++ b/oct-conf-post.in.h	Thu Feb 04 00:30:42 2016 -0500
@@ -51,12 +51,6 @@
 
 #define X_CAST(T, E) (T) (E)
 
-#if defined (CXX_BROKEN_REINTERPRET_CAST)
-#define FCN_PTR_CAST(T, E) (T) (E)
-#else
-#define FCN_PTR_CAST(T, E) reinterpret_cast<T> (E)
-#endif
-
 #if ! defined (HAVE_DEV_T)
 typedef short dev_t;
 #endif