changeset 21245:933083fee7ae

maint: Periodic merge of stable to default.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2016 15:00:22 -0500
parents 1473547f50f5 (current diff) f09f7dd58503 (diff)
children 101489515a70
files configure.ac libinterp/corefcn/oct-stream.cc libinterp/dldfcn/__osmesa_print__.cc liboctave/util/oct-inttypes.h
diffstat 4 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Wed Feb 10 14:25:53 2016 -0500
+++ b/configure.ac	Wed Feb 10 15:00:22 2016 -0500
@@ -2229,6 +2229,25 @@
 
 AC_STRUCT_TIMEZONE
 
+## Check if C++ compiler allows overload of char, int8_t, and uint8_t.
+AC_CACHE_CHECK([whether ${CXX-g++} allows overload of char, int8_t, and uint8_t],
+  [octave_cv_overload_char_int8_t],
+  [AC_LANG_PUSH(C++)
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+    #include <stdint.h>
+    void somefunc(char x) {};
+    void somefunc(int8_t x) {};
+    void somefunc(uint8_t x) {};
+    ]])],
+    octave_cv_overload_char_int8_t=yes,
+    octave_cv_overload_char_int8_t=no)
+  AC_LANG_POP(C++)
+  ])
+if test $octave_cv_overload_char_int8_t = yes; then
+  AC_DEFINE(HAVE_OVERLOAD_CHAR_INT8_TYPES, 1,
+    [Define to 1 if C++ allows overload of char, int8_t, and uint8_t types.])
+fi
+
 ### Check compiler characteristics.
 
 ## Check if C++ compiler can auto allocate variable sized arrays.
--- a/libinterp/corefcn/oct-stream.cc	Wed Feb 10 14:25:53 2016 -0500
+++ b/libinterp/corefcn/oct-stream.cc	Wed Feb 10 15:00:22 2016 -0500
@@ -3809,7 +3809,9 @@
 INSTANTIATE_WRITE (int64_t);
 INSTANTIATE_WRITE (uint64_t);
 INSTANTIATE_WRITE (bool);
+#if defined (HAVE_OVERLOAD_CHAR_INT8_TYPES)
 INSTANTIATE_WRITE (char);
+#endif
 INSTANTIATE_WRITE (float);
 INSTANTIATE_WRITE (double);
 
--- a/libinterp/dldfcn/__osmesa_print__.cc	Wed Feb 10 14:25:53 2016 -0500
+++ b/libinterp/dldfcn/__osmesa_print__.cc	Wed Feb 10 15:00:22 2016 -0500
@@ -27,6 +27,12 @@
 #  include <config.h>
 #endif
 
+#if defined (HAVE_OSMESA_H)
+#  include <osmesa.h>
+#elif defined (HAVE_GL_OSMESA_H)
+#  include <GL/osmesa.h>
+#endif
+
 #include "oct-locbuf.h"
 #include "unwind-prot.h"
 
@@ -37,12 +43,6 @@
 #include "graphics.h"
 #include "oct-opengl.h"
 
-#if defined (HAVE_OSMESA_H)
-#  include "osmesa.h"
-#elif defined (HAVE_GL_OSMESA_H)
-#  include "GL/osmesa.h"
-#endif
-
 #if defined (HAVE_OSMESA) && defined (HAVE_OPENGL)
 
 static void
--- a/liboctave/util/oct-inttypes.h	Wed Feb 10 14:25:53 2016 -0500
+++ b/liboctave/util/oct-inttypes.h	Wed Feb 10 15:00:22 2016 -0500
@@ -839,10 +839,12 @@
 
   octave_int (T i) : ival (i) { }
 
+#if defined (HAVE_OVERLOAD_CHAR_INT8_TYPES)
   // Always treat characters as unsigned.
   octave_int (char c)
     : ival (octave_int_base<T>::truncate_int (static_cast<unsigned char> (c)))
   { }
+#endif
 
   octave_int (double d) : ival (octave_int_base<T>::convert_real (d)) { }