changeset 8806:c7864bb74914

avoid some GCC warnings
author John W. Eaton <jwe@octave.org>
date Wed, 18 Feb 2009 13:45:20 -0500
parents 065a05eb148a
children 401d54a83690
files liboctave/CMatrix.cc liboctave/ChangeLog liboctave/CmplxQR.cc liboctave/dMatrix.cc liboctave/dbleQR.cc liboctave/fCMatrix.cc liboctave/fCmplxQR.cc liboctave/fMatrix.cc liboctave/floatQR.cc src/ChangeLog src/mex.cc src/ov-mex-fcn.cc
diffstat 12 files changed, 39 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/CMatrix.cc	Wed Feb 18 13:05:04 2009 -0500
+++ b/liboctave/CMatrix.cc	Wed Feb 18 13:45:20 2009 -0500
@@ -1553,7 +1553,8 @@
 
 ComplexDET
 ComplexMatrix::determinant (MatrixType& mattype,
-                            octave_idx_type& info, double& rcon, int calc_cond) const
+                            octave_idx_type& info, double& rcon,
+			    int calc_cond) const
 {
   ComplexDET retval (1.0);
 
@@ -1564,7 +1565,7 @@
     (*current_liboctave_error_handler) ("matrix must be square");
   else
     {
-      int typ = mattype.type ();
+      volatile int typ = mattype.type ();
 
       if (typ == MatrixType::Unknown)
         typ = mattype.type (*this);
--- a/liboctave/ChangeLog	Wed Feb 18 13:05:04 2009 -0500
+++ b/liboctave/ChangeLog	Wed Feb 18 13:45:20 2009 -0500
@@ -1,5 +1,19 @@
 2009-02-18  John W. Eaton  <jwe@octave.org>
 
+	* dMatrix.cc (Matrix::determinant):
+	Declare local variables volatile as needed to avoid "maybe
+	clobbered by vfork" warning from GCC.
+	* fMatrix.cc (FloatMatrix::determinant): Likewise.
+	* CMatrix.cc (ComplexMatrix::determinant): Likewise.
+	* fCMatrix.cc (FloatComplexMatrix::determinant): Likewise.
+	* dbleQR.cc (QR::update, QR::insert_col, QR::delete_col): Likewise.
+	* floatQR.cc (FloatQR::update, FloatQR::insert_col,
+	FloatQR::delete_col): Likewise.
+	* CmplxQR.cc (ComplexQR::update, ComplexQR::insert_col,
+	ComplexQR::delete_col): Likewise.
+	* fCmplxQR.cc (FloatComplexQR::update, FloatComplexQR::insert_col,
+	FloatComplexQR::delete_col): Likewise.
+
 	* dMatrix.cc (padec, solve_singularity_warning): Delete unused
 	static variable and function.
 	* CMatrix.cc (padec, solve_singularity_warning): Ditto.
--- a/liboctave/CmplxQR.cc	Wed Feb 18 13:05:04 2009 -0500
+++ b/liboctave/CmplxQR.cc	Wed Feb 18 13:45:20 2009 -0500
@@ -243,7 +243,7 @@
     {
       OCTAVE_LOCAL_BUFFER (Complex, w, k);
       OCTAVE_LOCAL_BUFFER (double, rw, k);
-      for (octave_idx_type i = 0; i < u.cols (); i++)
+      for (volatile octave_idx_type i = 0; i < u.cols (); i++)
         {
           ComplexColumnVector utmp = u.column (i), vtmp = v.column (i);
           F77_XFCN (zqr1up, ZQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k,
@@ -319,7 +319,7 @@
         }
 
       OCTAVE_LOCAL_BUFFER (double, rw, kmax);
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.length (); i++)
         {
           ComplexColumnVector utmp = u.column (jsi(i));
           F77_XFCN (zqrinc, ZQRINC, (m, n + i, std::min (kmax, k + i), 
@@ -378,7 +378,7 @@
   else if (nj > 0)
     {
       OCTAVE_LOCAL_BUFFER (double, rw, k);
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.length (); i++)
         {
           F77_XFCN (zqrdec, ZQRDEC, (m, n - i, k == m ? k : k - i, 
                                      q.fortran_vec (), q.rows (),
--- a/liboctave/dMatrix.cc	Wed Feb 18 13:05:04 2009 -0500
+++ b/liboctave/dMatrix.cc	Wed Feb 18 13:45:20 2009 -0500
@@ -1239,7 +1239,7 @@
     (*current_liboctave_error_handler) ("matrix must be square");
   else
     {
-      int typ = mattype.type ();
+      volatile int typ = mattype.type ();
 
       if (typ == MatrixType::Unknown)
         typ = mattype.type (*this);
--- a/liboctave/dbleQR.cc	Wed Feb 18 13:05:04 2009 -0500
+++ b/liboctave/dbleQR.cc	Wed Feb 18 13:45:20 2009 -0500
@@ -239,7 +239,7 @@
   if (u.rows () == m && v.rows () == n && u.cols () == v.cols ())
     {
       OCTAVE_LOCAL_BUFFER (double, w, 2*k);
-      for (octave_idx_type i = 0; i < u.cols (); i++)
+      for (volatile octave_idx_type i = 0; i < u.cols (); i++)
         {
           ColumnVector utmp = u.column (i), vtmp = v.column (i);
           F77_XFCN (dqr1up, DQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k,
@@ -315,7 +315,7 @@
         }
 
       OCTAVE_LOCAL_BUFFER (double, w, kmax);
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.length (); i++)
         {
           ColumnVector utmp = u.column (jsi(i));
           F77_XFCN (dqrinc, DQRINC, (m, n + i, std::min (kmax, k + i), 
@@ -374,7 +374,7 @@
   else if (nj > 0)
     {
       OCTAVE_LOCAL_BUFFER (double, w, k);
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.length (); i++)
         {
           F77_XFCN (dqrdec, DQRDEC, (m, n - i, k == m ? k : k - i, 
                                      q.fortran_vec (), q.rows (),
--- a/liboctave/fCMatrix.cc	Wed Feb 18 13:05:04 2009 -0500
+++ b/liboctave/fCMatrix.cc	Wed Feb 18 13:45:20 2009 -0500
@@ -1558,7 +1558,7 @@
     (*current_liboctave_error_handler) ("matrix must be square");
   else
     {
-      int typ = mattype.type ();
+      volatile int typ = mattype.type ();
 
       if (typ == MatrixType::Unknown)
         typ = mattype.type (*this);
--- a/liboctave/fCmplxQR.cc	Wed Feb 18 13:05:04 2009 -0500
+++ b/liboctave/fCmplxQR.cc	Wed Feb 18 13:45:20 2009 -0500
@@ -243,7 +243,7 @@
     {
       OCTAVE_LOCAL_BUFFER (FloatComplex, w, k);
       OCTAVE_LOCAL_BUFFER (float, rw, k);
-      for (octave_idx_type i = 0; i < u.cols (); i++)
+      for (volatile octave_idx_type i = 0; i < u.cols (); i++)
         {
           FloatComplexColumnVector utmp = u.column (i), vtmp = v.column (i);
           F77_XFCN (cqr1up, CQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k,
@@ -319,7 +319,7 @@
         }
 
       OCTAVE_LOCAL_BUFFER (float, rw, kmax);
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.length (); i++)
         {
           F77_XFCN (cqrinc, CQRINC, (m, n + i, std::min (kmax, k + i), 
                                      q.fortran_vec (), q.rows (),
@@ -377,7 +377,7 @@
   else if (nj > 0)
     {
       OCTAVE_LOCAL_BUFFER (float, rw, k);
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.length (); i++)
         {
           F77_XFCN (cqrdec, CQRDEC, (m, n - i, k == m ? k : k - i, 
                                      q.fortran_vec (), q.rows (),
--- a/liboctave/fMatrix.cc	Wed Feb 18 13:05:04 2009 -0500
+++ b/liboctave/fMatrix.cc	Wed Feb 18 13:45:20 2009 -0500
@@ -1238,7 +1238,7 @@
     (*current_liboctave_error_handler) ("matrix must be square");
   else
     {
-      int typ = mattype.type ();
+      volatile int typ = mattype.type ();
 
       if (typ == MatrixType::Unknown)
         typ = mattype.type (*this);
--- a/liboctave/floatQR.cc	Wed Feb 18 13:05:04 2009 -0500
+++ b/liboctave/floatQR.cc	Wed Feb 18 13:45:20 2009 -0500
@@ -239,7 +239,7 @@
   if (u.rows () == m && v.rows () == n && u.cols () == v.cols ())
     {
       OCTAVE_LOCAL_BUFFER (float, w, 2*k);
-      for (octave_idx_type i = 0; i < u.cols (); i++)
+      for (volatile octave_idx_type i = 0; i < u.cols (); i++)
         {
           FloatColumnVector utmp = u.column (i), vtmp = v.column (i);
           F77_XFCN (sqr1up, SQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k,
@@ -315,7 +315,7 @@
         }
 
       OCTAVE_LOCAL_BUFFER (float, w, kmax);
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.length (); i++)
         {
           FloatColumnVector utmp = u.column (jsi(i));
           F77_XFCN (sqrinc, SQRINC, (m, n + i, std::min (kmax, k + i), 
@@ -374,7 +374,7 @@
   else if (nj > 0)
     {
       OCTAVE_LOCAL_BUFFER (float, w, k);
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.length (); i++)
         {
           F77_XFCN (sqrdec, SQRDEC, (m, n - i, k == m ? k : k - i, 
                                      q.fortran_vec (), q.rows (),
--- a/src/ChangeLog	Wed Feb 18 13:05:04 2009 -0500
+++ b/src/ChangeLog	Wed Feb 18 13:45:20 2009 -0500
@@ -1,5 +1,8 @@
 2009-02-18  John W. Eaton  <jwe@octave.org>
 
+	* mex.cc (call_mex): Declare local nargout variable volatile to
+	avoid "maybe clobbered by vfork" warning from GCC.
+
 	* ov-cx-mat.cc (xabs): Comment out unused static function.
 	* ov-flt-cx-mat.cc (xabs): Ditto.
 
--- a/src/mex.cc	Wed Feb 18 13:05:04 2009 -0500
+++ b/src/mex.cc	Wed Feb 18 13:45:20 2009 -0500
@@ -3022,11 +3022,13 @@
 
 octave_value_list
 call_mex (bool have_fmex, void *f, const octave_value_list& args,
-	  int nargout, octave_mex_function *curr_mex_fcn)
+	  int nargout_arg, octave_mex_function *curr_mex_fcn)
 {
   // Use at least 1 for nargout since even for zero specified args,
   // still want to be able to return an ans.
 
+  volatile int nargout = nargout_arg;
+
   int nargin = args.length ();
   OCTAVE_LOCAL_BUFFER (mxArray *, argin, nargin);
   for (int i = 0; i < nargin; i++)
--- a/src/ov-mex-fcn.cc	Wed Feb 18 13:05:04 2009 -0500
+++ b/src/ov-mex-fcn.cc	Wed Feb 18 13:45:20 2009 -0500
@@ -121,6 +121,7 @@
   return retval;
 }
 
+// FIXME -- shouldn't this declaration be a header file somewhere?
 extern octave_value_list
 call_mex (bool have_fmex, void *f, const octave_value_list& args,
 	  int nargout, octave_mex_function *curr_mex_fcn);