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: Daniel J Sebald
Subject: Re: Unwarranted old-style cast warning and non-critical error
Date: Thu, 23 Aug 2012 17:26:17 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 08/23/2012 05:04 PM, John W. Eaton wrote:
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.

Oh, flex creates that? I didn't know it added that much. Can some redefining macros be used somehow to compile that file? I.e., define DBL_MAX to be some valid C++ cast? Or is it better to go after a fix for flex?


| 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.

Leave them as warnings then.  Or touch the variables in some trivial way.


| 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.

Oh, that originates from somewhere else?  I'll drop the developer(s) a note.

Most of the low hanging warnings fruit has been picked then.

Dan


reply via email to

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