From bug-request at octave dot org Thu Aug 5 08:26:37 2004 Subject: Compile problem with g++ 3.4.1 with CVS From: "John W. Eaton" To: David Bateman Cc: bug at octave dot org Date: Thu, 5 Aug 2004 09:25:33 -0400 On 5-Aug-2004, David Bateman wrote: | I get this compile problem with g++ 3.4.1 with the CVS | | In file included from int8NDArray.cc:34: | intNDArray.cc: In member function `boolNDArray intNDArray::operator!() const' | : | intNDArray.cc:42: error: there are no arguments to `dims' that depend on a templ | ate parameter, so a declaration of `dims' must be available | intNDArray.cc:42: error: (if you use `-fpermissive', G++ will accept your code, | but allowing the use of an undeclared name is deprecated) Please try the following patch. jwe liboctave/ChangeLog: 2004-08-05 John W. Eaton * intNDArray.cc (intNDArray::operator !, intNDArray::all, intNDArray::any): Sprinkle with this-> as needed. * mx-inlines.cc (MX_ND_REDUCTION, MX_ND_CUMULATIVE_OP): Likewise. src/ChangeLog: 2004-08-05 John W. Eaton * ov-base-int.cc (octave_base_int_matrix::save_ascii, octave_base_int_matrix::load_ascii, octave_base_int_matrix::save_binary, octave_base_int_matrix::load_binary, octave_base_int_matrix::save_hdf5, octave_base_int_matrix::load_hdf5, octave_base_int_matrix::try_narrowing_conversion, octave_base_int_scalar::print_raw, octave_base_int_scalar::save_ascii, octave_base_int_scalar::load_ascii, octave_base_int_scalar::save_binary, octave_base_int_scalar::load_binary, octave_base_int_scalar::save_hdf5, octave_base_int_scalar::load_hdf5): Sprinkle with this-> as needed. * Makefile.in (EXTRAS): New macro. Move ov-base-int.cc here from OV_INTTYPE_SRC. (INCLUDES_FOR_INSTALL): New macro. (install-inc, uninstall): Use it instead of INCLUDES. Index: liboctave/intNDArray.cc =================================================================== RCS file: /usr/local/cvsroot/octave/liboctave/intNDArray.cc,v retrieving revision 1.2 diff -u -r1.2 intNDArray.cc --- a/liboctave/intNDArray.cc 23 Jul 2004 19:01:23 -0000 1.2 +++ b/liboctave/intNDArray.cc 5 Aug 2004 13:10:23 -0000 at @ -39,10 +39,10 @@ boolNDArray intNDArray::operator ! (void) const { - boolNDArray b (dims ()); + boolNDArray b (this->dims ()); - for (int i = 0; i < length (); i++) - b.elem (i) = ! elem (i); + for (int i = 0; i < this->length (); i++) + b.elem (i) = ! this->elem (i); return b; } at @ -53,14 +53,14 @@ boolNDArray intNDArray::all (int dim) const { - MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (elem (iter_idx) == T (0)), true); + MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (this->elem (iter_idx) == T (0)), true); } template boolNDArray intNDArray::any (int dim) const { - MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (elem (iter_idx) == T (0)), false); + MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (this->elem (iter_idx) == T (0)), false); } template Index: liboctave/mx-inlines.cc =================================================================== RCS file: /usr/local/cvsroot/octave/liboctave/mx-inlines.cc,v retrieving revision 1.35 diff -u -r1.35 mx-inlines.cc --- a/liboctave/mx-inlines.cc 8 Jun 2004 15:08:51 -0000 1.35 +++ b/liboctave/mx-inlines.cc 5 Aug 2004 13:10:23 -0000 at @ -383,7 +383,7 @@ \ RET_TYPE retval; \ \ - dim_vector dv = dims (); \ + dim_vector dv = this->dims (); \ \ int empty = true; \ \ at @ -454,7 +454,7 @@ dv(dim) = 1; \ \ /* This finds the number of elements in retval */ \ - int num_iter = (numel () / dim_length); \ + int num_iter = (this->numel () / dim_length); \ \ /* Make sure retval has correct dimensions */ \ retval.resize (dv, RET_ELT_TYPE ()); \ at @ -501,7 +501,7 @@ #define MX_ND_CUMULATIVE_OP(RET_TYPE, ACC_TYPE, VAL, OP) \ RET_TYPE retval; \ \ - dim_vector dv = dims (); \ + dim_vector dv = this->dims (); \ \ int empty = true; \ \ at @ -574,7 +574,7 @@ dv (dim) = 1; \ \ /* This finds the number of elements in retval */ \ - int num_iter = (numel () / dim_length); \ + int num_iter = (this->numel () / dim_length); \ \ Array iter_idx (dv.length (), 0); \ \ Index: src/ov-base-int.cc =================================================================== RCS file: /usr/local/cvsroot/octave/src/ov-base-int.cc,v retrieving revision 1.2 diff -u -r1.2 ov-base-int.cc --- a/src/ov-base-int.cc 27 Jul 2004 14:03:03 -0000 1.2 +++ b/src/ov-base-int.cc 5 Aug 2004 13:10:23 -0000 at @ -64,8 +64,8 @@ { octave_value *retval = 0; - if (matrix.nelem () == 1) - retval = new typename octave_value_int_traits::scalar_type (matrix (0)); + if (this->matrix.nelem () == 1) + retval = new typename octave_value_int_traits::scalar_type (this->matrix (0)); return retval; } at @ -74,14 +74,14 @@ bool octave_base_int_matrix::save_ascii (std::ostream& os, bool&, bool) { - dim_vector d = dims (); + dim_vector d = this->dims (); os << "# ndims: " << d.length () << "\n"; for (int i = 0; i < d.length (); i++) os << " " << d (i); - os << "\n" << matrix; + os << "\n" << this->matrix; return true; } at @ -113,7 +113,7 @@ success = false; } - matrix = tmp; + this->matrix = tmp; } else { at @ -131,7 +131,7 @@ bool octave_base_int_matrix::save_binary (std::ostream& os, bool&) { - dim_vector d = dims (); + dim_vector d = this->dims (); if (d.length() < 1) return false; at @ -144,7 +144,7 @@ os.write (X_CAST (char *, &tmp), 4); } - os.write (X_CAST(char *, matrix.data()), byte_size()); + os.write (X_CAST(char *, this->matrix.data()), this->byte_size()); return true; } at @ -203,7 +203,7 @@ } } - matrix = m; + this->matrix = m; return true; } at @ -215,7 +215,7 @@ { hid_t save_type_hid = HDF5_SAVE_TYPE; bool retval = true; - dim_vector dv = dims (); + dim_vector dv = this->dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0); at @ -241,7 +241,7 @@ } retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL, - H5P_DEFAULT, matrix.data()) >= 0; + H5P_DEFAULT, this->matrix.data()) >= 0; H5Dclose (data_hid); H5Sclose (space_hid); at @ -259,7 +259,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + this->matrix.resize(dv); if (empty) return (empty > 0); at @ -299,7 +299,7 @@ H5P_DEFAULT, m.fortran_vec()) >= 0) { retval = true; - matrix = m; + this->matrix = m; } H5Sclose (space_id); at @ -315,15 +315,15 @@ octave_base_int_matrix::print_raw (std::ostream& os, bool pr_as_read_syntax) const { - octave_print_internal (os, matrix, pr_as_read_syntax, - current_print_indent_level ()); + octave_print_internal (os, this->matrix, pr_as_read_syntax, + this->current_print_indent_level ()); } template bool octave_base_int_scalar::save_ascii (std::ostream& os, bool& , bool) { - os << scalar << "\n"; + os << this->scalar << "\n"; return true; } at @ -331,7 +331,7 @@ bool octave_base_int_scalar::load_ascii (std::istream& is) { - is >> scalar; + is >> this->scalar; if (!is) { error ("load: failed to load scalar constant"); at @ -344,7 +344,7 @@ bool octave_base_int_scalar::save_binary (std::ostream& os, bool&) { - os.write (X_CAST(char *, &scalar), byte_size()); + os.write (X_CAST(char *, &(this->scalar)), this->byte_size()); return true; } at @ -354,11 +354,11 @@ oct_mach_info::float_format) { T tmp; - if (! is.read (X_CAST (char *, &tmp), byte_size())) + if (! is.read (X_CAST (char *, &tmp), this->byte_size())) return false; if (swap) - switch (byte_size()) + switch (this->byte_size()) { case 8: swap_8_bytes (X_CAST (char *, &tmp)); at @ -373,7 +373,7 @@ default: break; } - scalar = tmp; + this->scalar = tmp; return true; } at @ -399,7 +399,7 @@ } retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL, - H5P_DEFAULT, &scalar) >= 0; + H5P_DEFAULT, &(this->scalar)) >= 0; H5Dclose (data_hid); H5Sclose (space_hid); at @ -432,7 +432,7 @@ return false; } - scalar = tmp; + this->scalar = tmp; H5Dclose (data_hid); Index: src/Makefile.in =================================================================== RCS file: /usr/local/cvsroot/octave/src/Makefile.in,v retrieving revision 1.340 retrieving revision 1.341 diff -u -r1.340 -r1.341 --- a/src/Makefile.in 2 Aug 2004 22:09:47 -0000 1.340 +++ b/src/Makefile.in 5 Aug 2004 13:05:31 -0000 1.341 at @ -117,7 +117,7 @@ OP_SRC := $(addprefix OPERATORS/, $(OP_XSRC)) -OV_INTTYPE_SRC := ov-base-int.cc \ +OV_INTTYPE_SRC := \ ov-int8.cc ov-int16.cc ov-int32.cc ov-int64.cc \ ov-uint8.cc ov-uint16.cc ov-uint32.cc ov-uint64.cc at @ -154,6 +154,10 @@ SOURCES := $(DIST_SRC) $(OP_SRC) $(TI_SRC) +EXTRAS := ov-base-int.cc + +INCLUDES_FOR_INSTALL := $(INCLUDES) $(EXTRAS) + OBJECTS_4 := $(notdir $(SOURCES)) OBJECTS_3 := $(patsubst %.l, %.o, $(OBJECTS_4)) OBJECTS_2 := $(patsubst %.y, %.o, $(OBJECTS_3)) at @ -401,7 +405,7 @@ install-inc: $(top_srcdir)/mkinstalldirs $(DESTDIR)$(octincludedir)/octave - for f in $(INCLUDES); do \ + for f in $(INCLUDES_FOR_INSTALL); do \ rm -f $(DESTDIR)$(octincludedir)/octave/$$f; \ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(octincludedir)/octave/$$f; \ done at @ -424,7 +428,7 @@ rm -f $(DESTDIR)$(bindir)/liboctinterp.$(SHLBIN); \ rm -f $(DESTDIR)$(bindir)/liboctinterp.$(SHLBIN_VER); \ fi - for f in $(INCLUDES) defaults.h oct-conf.h; do \ + for f in $(INCLUDES_FOR_INSTALL) defaults.h oct-conf.h; do \ rm -f $(DESTDIR)$(octincludedir)/octave/$$f; \ done .PHONY: uninstall ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------