octave-maintainers
[Top][All Lists]
Advanced

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

Re: Unwarranted old-style cast warning and non-critical error


From: John W. Eaton
Subject: Re: Unwarranted old-style cast warning and non-critical error
Date: Thu, 23 Aug 2012 18:04:29 -0400

On 23-Aug-2012, Daniel J Sebald wrote:

| Most of these are what look to be one time C code, stored as an ll file,
| converted to a cc file.  In such files it looks like casting 0 to
| something is the common warning.  I'd help rid some of these, if you
| like.  You'd have to review though.

I don't know how you can get rid of warnings in code generated by flex
unless you fix flex so that it conditionally generates C++ style casts
when the output file is supposed to be C++ code.

| There are a few easy ones in there like "unused args".

Some of those need to actually be fixed by making the code do
something useful, not simply by removing the symbol names from the
argument lists.

| Otherwise, there is some (probably original from years back) C++ code
| syntactical issues in one file.  This actually may be more of a concern
| than one would think because I see "conflicts: 16 shift/reduce, 1
| reduce/reduce".

That's a message from Bison about the Matlab/Octave language grammar,
not a C++ syntax problem.

| Also there are some shadowed variables which doesn't look like a major
| issue, just that "index" must be declared globally somewhere.  I'm not
| seeing it anywhere; most uses of "index" appear to be member variables
| or member functions.  And the code that the warnings are coming from is
| C code so it can't be shadowing a member variable...warning says
| "global" anyway so again, not member.  Is there a function or variable
| with name "index" in some library header?

"index" is a C function.

| <strings.h> has a function "index".  Perhaps that is the conflict.
| Commenting out that header file from gl2ps.c results in those warnings
| going away (so yes, it is a conflict with <strings.h>) but of course
| then memcpy, strlen, strcpy aren't declared and create other warnings.
| 
| So that is it.  I've attached a patch for gl2ps.c which replaces "index"
| with "idx" in the offending locations if you want.  ("idx" didn't appear
| in gl2ps.c prior to this patch.)

I don't want to fork and maintain gl2ps.c separately from its upstream
source, so patching it in the Octave sources is not what we want to
do.  Instead, get the problems fixed upstream and then we can import a
new version into the Octave sources.

jwe


reply via email to

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