octave-maintainers
[Top][All Lists]
Advanced

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

Re: warnings originating in gl2ps -- update


From: CdeMills
Subject: Re: warnings originating in gl2ps -- update
Date: Thu, 10 Feb 2011 07:45:16 -0800 (PST)


John W. Eaton wrote:
> 
> On 10-Feb-2011, John W. Eaton wrote:
> 
> The shadowed declarations warnings were actually coming from gl2ps.c.
> My crude method of extracting and counting the warnings didn't catch
> that.
> 
> I fixed the deprecated function warnings.
> 
> 

I wrote a small test case reproducing the warning found in src/load-path.c,
line 620. To be compiled as
gcc -g -pedantic -Wsign-compare  -o test_sign test_sign.c

The good news: all comparisons gives the expected output, even in the case
where the unsigned int has a value driving the signed int into overflow.
To remove the warning, one option is to patch load-path.c like this:

diff -r 357d593d87c1 src/load-path.cc
--- a/src/load-path.cc  Thu Feb 10 00:58:31 2011 -0500
+++ b/src/load-path.cc  Thu Feb 10 16:11:40 2011 +0100
@@ -617,7 +617,7 @@
   while (k > 1 && file_ops::is_dir_sep (dir[k-1]))
     k--;
 
-  if (k < dir.length ())
+  if (((octave_idx_type)(k - dir.length ())) < 0)
     dir.resize (k);
 
   return dir;



Should we apply this for each warning ?

Regards

Pascal
http://octave.1599824.n4.nabble.com/file/n3299407/test_sign.c test_sign.c 

-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/warnings-originating-in-gl2ps-update-tp3298345p3299407.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

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