help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compiling with Sun's compiler under Solaris fails


From: John W. Eaton
Subject: Compiling with Sun's compiler under Solaris fails
Date: Tue, 23 Oct 2007 20:32:33 -0400

On 21-Oct-2007, Moritz Borgmann wrote:

| I'm trying to compile the latest Octave 2.9.15 under Solaris 8 with 
| Sun's compiler, but unfortunately it chokes on some of the C++ code. 
| Any help would be appreciated, as my C++ skills are a bit rusty.
| 
| If I'm simply using the wrong compiler, flags, libraries, whatever, 
| I'm also all ears.

| And finally the error. After a long while of compiling, the build aborts:
| ===
| [mythen:~/software/octave-2.9.15] moriborg% gmake
| [...]
| CC-11.0 -c -I/usr/pack/readline-5.1-mo/sun4u-sun-solaris2.8/include 
| -I/home/moriborg/soft/zlib-1.2.3-mb/sun4u-sun-solaris2.8/include 
| -I/home/moriborg/soft/fftw-3.1.2-mb/sun4u-sun-solaris2.8/include 
| -I/usr/pack/atlas-3.6.0-ds/sun4u-sun-solaris2.8/include 
| -I/usr/pack/pcre-6.3-mo/include -I/usr/pack/curl-7.12.3-rp/include 
| -xtarget=native -xarch=v8plusa -dalign -xO3 -KPIC -I. -I.. 
| -I../liboctave -I../src -I../libcruft/misc   -DHAVE_CONFIG_H 
| -I/usr/pack/readline-5.1-mo/sun4u-sun-solaris2.8/include 
| -I/home/moriborg/soft/zlib-1.2.3-mb/sun4u-sun-solaris2.8/include 
| -I/home/moriborg/soft/fftw-3.1.2-mb/sun4u-sun-solaris2.8/include 
| -I/usr/pack/atlas-3.6.0-ds/sun4u-sun-solaris2.8/include 
| -I/usr/pack/pcre-6.3-mo/include -I/usr/pack/curl-7.12.3-rp/include 
| -xtarget=native -xarch=v8plusa -dalign -xO3 graphics.cc -o 
| pic/graphics.o
| "mxarray.h", line 75: Warning: Identifier expected instead of "}".

I think there is an extra comma at the end of an enum decl.  I think
the patch to mxarray.h below should fix this problem.

| "ov-builtin.h", line 85: Warning: Too few arguments in macro 
| DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2.

Does to ov-builtin.h below avoid this warning?  If not, then maybe
there is a compiler option that will avoid it.

| "../liboctave/Array.h", line 101: Warning (Anachronism): Formal 
| argument cmp of type extern "C" int(*)(const void*,const void*) in 
| call to octave_qsort(void*, unsigned, unsigned, extern "C" 
| int(*)(const void*,const void*)) is being passed int(*)(const 
| void*,const void*).
| "../liboctave/Array.h", line 490:     Where: While instantiating 
| "Array<double>::ArrayRep::qsort(int(*)(const void*,const void*))".
| "../liboctave/Array.h", line 490:     Where: Instantiated from 
| non-template code.

I think you'll have to find a compiler option to avoid this warning,
or suggest a patch.

| "graphics.cc", line 1377: Error: Overloading ambiguity between 
| "graphics_handle::operator double() const" and 
| "graphics_handle::operator bool() const".
| "graphics.cc", line 1386: Error: Overloading ambiguity between 
| "graphics_handle::operator double() const" and 
| "graphics_handle::operator bool() const".
| "graphics.cc", line 1395: Error: Overloading ambiguity between 
| "graphics_handle::operator double() const" and 
| "graphics_handle::operator bool() const".
| "graphics.cc", line 1404: Error: Overloading ambiguity between 
| "graphics_handle::operator double() const" and 
| "graphics_handle::operator bool() const".

Does the patch to graphics.h.in and graphics.cc below fix this
problem?

BTW, it is best to report bugs to the address@hidden list.

Thanks,

jwe


src/ChangeLog:

2007-10-23  John W. Eaton  <address@hidden>

        * graphics.cc (is_handle (const graphics_handle&)): New function.
        (gh_manager::do_free, reparent, base_properties::set_parent,
        properties::get_title, properties::get_xlabel,
        properties::get_ylabel, properties::get_zlabel,
        properties::remove_child, make_graphics_object, F__go_figure__,
        F__go_delete__, __go_axes_init__): Call OK on graphics handle
        object instead of relying on implicit conversion operator.
        * graphics.h.in (graphics_handle::operator double ()): Delete.
        (graphics_handle::operator bool ()): Delete.
        (gh_manager::do_handle_list, gh_manager::do_figure_handle_list,
        base_properties::adopt): Call VALUE on graphics handle object
        instead of relying on implicit conversion operator.

        * ov-base.h (DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA): Call
        DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 with "( )" as arg list
        instead of "()".

        * mxarray.h.in (mxClassID): Delete trailing comma in enum decl.

 
Index: src/graphics.cc
===================================================================
RCS file: /cvs/octave/src/graphics.cc,v
retrieving revision 1.41
diff -u -u -r1.41 graphics.cc
--- src/graphics.cc     15 Oct 2007 13:20:01 -0000      1.41
+++ src/graphics.cc     24 Oct 2007 00:31:01 -0000
@@ -461,7 +461,7 @@
 void
 gh_manager::do_free (const graphics_handle& h)
 {
-  if (h)
+  if (h.ok ())
     {
       if (h.value () != 0)
        {
@@ -523,7 +523,7 @@
     {
       h = gh_manager::lookup (val);
 
-      if (h)
+      if (h.ok ())
        {
          graphics_object obj = gh_manager::get_object (h);
          
@@ -576,6 +576,12 @@
 }
 
 static bool
+is_handle (const graphics_handle& h)
+{
+  return h.ok ();
+}
+
+static bool
 is_handle (double val)
 {
   graphics_handle h = gh_manager::lookup (val);
@@ -709,7 +715,7 @@
     {
       new_parent = gh_manager::lookup (tmp);
 
-      if (new_parent)
+      if (new_parent.ok ())
        {
          graphics_object parent_obj = gh_manager::get_object (parent);
 
@@ -1374,7 +1380,7 @@
 graphics_handle
 axes::properties::get_title (void) const
 {
-  if (! title)
+  if (! title.ok ())
     title = gh_manager::make_graphics_handle ("text", __myhandle__);
 
   return title;
@@ -1383,7 +1389,7 @@
 graphics_handle
 axes::properties::get_xlabel (void) const
 {
-  if (! xlabel)
+  if (! xlabel.ok ())
     xlabel = gh_manager::make_graphics_handle ("text", __myhandle__);
 
   return xlabel;
@@ -1392,7 +1398,7 @@
 graphics_handle
 axes::properties::get_ylabel (void) const
 {
-  if (! ylabel)
+  if (! ylabel.ok ())
     ylabel = gh_manager::make_graphics_handle ("text", __myhandle__);
 
   return ylabel;
@@ -1401,7 +1407,7 @@
 graphics_handle
 axes::properties::get_zlabel (void) const
 {
-  if (! zlabel)
+  if (! zlabel.ok ())
     zlabel = gh_manager::make_graphics_handle ("text", __myhandle__);
 
   return zlabel;
@@ -1592,13 +1598,13 @@
 void
 axes::properties::remove_child (const graphics_handle& h)
 {
-  if (title && h == title)
+  if (title.ok () && h == title)
     title = gh_manager::make_graphics_handle ("text", __myhandle__);
-  else if (xlabel && h == xlabel)
+  else if (xlabel.ok () && h == xlabel)
     xlabel = gh_manager::make_graphics_handle ("text", __myhandle__);
-  else if (ylabel && h == ylabel)
+  else if (ylabel.ok () && h == ylabel)
     ylabel = gh_manager::make_graphics_handle ("text", __myhandle__);
-  else if (zlabel && h == zlabel)
+  else if (zlabel.ok () && h == zlabel)
     zlabel = gh_manager::make_graphics_handle ("text", __myhandle__);
   else
     base_properties::remove_child (h);
@@ -2651,7 +2657,7 @@
     {
       graphics_handle parent = gh_manager::lookup (val);
 
-      if (parent)
+      if (parent.ok ())
        {
          graphics_handle h
            = gh_manager::make_graphics_handle (go_name, parent);
@@ -2710,7 +2716,7 @@
              else
                error ("__go_figure__: invalid figure number");
 
-             if (! error_state && h)
+             if (! error_state && h.ok ())
                {
                  adopt (0, h);
 
@@ -2813,7 +2819,7 @@
        {
          h = gh_manager::lookup (val);
 
-         if (h)
+         if (h.ok ())
            {
              graphics_object obj = gh_manager::get_object (h);
 
@@ -2867,7 +2873,7 @@
        {
          h = gh_manager::lookup (val);
 
-         if (h)
+         if (h.ok ())
            {
              graphics_object obj = gh_manager::get_object (h);
 
Index: src/graphics.h.in
===================================================================
RCS file: /cvs/octave/src/graphics.h.in,v
retrieving revision 1.10
diff -u -u -r1.10 graphics.h.in
--- src/graphics.h.in   13 Oct 2007 05:13:29 -0000      1.10
+++ src/graphics.h.in   24 Oct 2007 00:31:01 -0000
@@ -464,8 +464,6 @@
 
   ~graphics_handle (void) { }
 
-  operator double (void) const { return val; }
-
   double value (void) const { return val; }
 
   octave_value as_octave_value (void) const
@@ -501,8 +499,6 @@
 
   bool ok (void) const { return ! xisnan (val); }
 
-  operator bool () const { return ok (); }
-
 private:
   double val;
 };
@@ -579,7 +575,7 @@
   {
     octave_idx_type n = children.numel ();
     children.resize (1, n+1);
-    children(n) = h;
+    children(n) = h.value ();
   }
 
   void set_parent (const octave_value& val);
@@ -1913,7 +1909,10 @@
     Matrix retval (1, handle_map.size ());
     octave_idx_type i = 0;
     for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++)
-      retval(i++) = p->first;
+      {
+       graphics_handle h = p->first;
+       retval(i++) = h.value ();
+      }
     return retval;
   }
 
@@ -1924,7 +1923,10 @@
     for (const_figure_list_iterator p = figure_list.begin ();
         p != figure_list.end ();
         p++)
-      retval(i++) = *p;
+      {
+       graphics_handle h = *p;
+       retval(i++) = h.value ();
+      }
     return retval;
   }
 
Index: src/mxarray.h.in
===================================================================
RCS file: /cvs/octave/src/mxarray.h.in,v
retrieving revision 1.4
diff -u -u -r1.4 mxarray.h.in
--- src/mxarray.h.in    12 Oct 2007 21:27:30 -0000      1.4
+++ src/mxarray.h.in    24 Oct 2007 00:31:01 -0000
@@ -71,7 +71,7 @@
     mxUINT32_CLASS,
     mxINT64_CLASS,
     mxUINT64_CLASS,
-    mxFUNCTION_CLASS,
+    mxFUNCTION_CLASS
   }
   mxClassID;
 
Index: src/ov-base.h
===================================================================
RCS file: /cvs/octave/src/ov-base.h,v
retrieving revision 1.105
diff -u -u -r1.105 ov-base.h
--- src/ov-base.h       12 Oct 2007 21:27:31 -0000      1.105
+++ src/ov-base.h       24 Oct 2007 00:31:01 -0000
@@ -61,7 +61,7 @@
 // T_ID is the type id of struct objects, set by register_type().
 // T_NAME is the type name of struct objects.
 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2()
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 ( )
 
 #define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA \
   DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(virtual)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]