# HG changeset patch # User John W. Eaton # Date 1454563842 18000 # Node ID f569ba0ee237e0315769761d16208cbb9d04a259 # Parent 7f35125714b43aa57267974a48cec503ec93a773 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. diff -r 7f35125714b4 -r f569ba0ee237 configure.ac --- 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 diff -r 7f35125714b4 -r f569ba0ee237 libinterp/corefcn/dynamic-ld.cc --- 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 (function); retval = f (oct_file, relative); diff -r 7f35125714b4 -r f569ba0ee237 libinterp/corefcn/mex.cc --- 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 (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 (f); fcn (nargout, argout, nargin, argin); } diff -r 7f35125714b4 -r f569ba0ee237 m4/acinclude.m4 --- 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 ]], [[ - typedef double (*fptr) (double); - fptr psin = sin; - void *vptr = reinterpret_cast (psin); - psin = reinterpret_cast (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 diff -r 7f35125714b4 -r f569ba0ee237 oct-conf-post.in.h --- 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 (E) -#endif - #if ! defined (HAVE_DEV_T) typedef short dev_t; #endif