Share

gnuplot development

Tracker: Patches

5 Silence -Wall and valgrind - ID: 2889632
Last Update: Comment added ( sf-robot )

This patch adds some initializations to satisfy gcc -Wall and
ensures a clean deallocation of xargv to tidy up valgrind output.

Additionally adds some closing quotes to demos.

Juergen


Juergen Wieferink ( wieferink ) - 2009-10-30 18:47

5

Closed

Accepted

Nobody/Anonymous

None

None

Public


Comments ( 5 )

Date: 2009-11-17 02:20
Sender: sf-robotSourceForge.net Site Admin

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).


Date: 2009-11-02 20:18
Sender: sfeamProject Admin

In the absence of png support, that routine should never be called, so the
return value is not relevant. But the compiler is right to warn about the
inconsistency, so I'll fix it.


Date: 2009-11-02 08:03
Sender: wieferink

Thanks for commiting your additional patch.

There is one warning left for me in the fallback dummy definition of
df_libgd_get_pixel() (breaders.c:299), which is of type int and does not
return anything. I do not know if that's a problem, if it could simply
return 0. or if this hints to a true bug.

Juergen



Date: 2009-10-31 10:54
Sender: wieferink

You are of course right. I have just implemented a poor man's solution to
get (otherwise) clean -Wall output. I was not aware of something like the
__attribute__ extension, but from the gcc docs it is a C extension. The
first paragraph in the C extension section reads:

GNU C provides several language features not found in ISO standard C. (The
-pedantic option directs GCC to print a warning message if any of these
features is used.) To test for the availability of these features in
conditional compilation, check for a predefined macro __GNUC__, which is
always defined under GCC.

I haven't tried __GNUC__, but it seems sensible. Even gcc-2.95 supports
this __attribute__ so this conditional should be fine I think.

Juergen



Date: 2009-10-31 05:32
Sender: sfeamProject Admin

I've taken most of this cleanup into CVS.
But I draw the line at 'fixing' perfectly good code because the compiler
is being ignorant.
For example, there are several warnings about "foo may be uninitialized"
from this
construct:

char *foo;
if (END_OF_COMMAND || !(foo = try_to_get_string())
int_error(NO_CARET, "message");

The better fix is to mark int_error() as having
__attribute__((noreturn))
That shuts up gcc nicely. But I haven't figures out how to make wrap this
in a test for gcc. Do you know how?

void int_error __PROTO((int, const char *, ...))
#ifdef _GCC /* doesn't work, but something like this should be
available */
__attribute__((noreturn))
#endif
;



Attached File ( 1 )

Filename Description Download
tidy_up.patch Patch to silence -Wall and valgrind Download

Changes ( 11 )

Field Old Value Date By
allow_comments 1 2009-11-17 02:20 sf-robot
status_id Pending 2009-11-17 02:20 sf-robot
close_date 2009-11-02 08:03 2009-11-17 02:20 sf-robot
close_date - 2009-11-02 08:03 wieferink
status_id Open 2009-11-02 08:03 wieferink
close_date 2009-10-31 05:32 2009-10-31 10:54 wieferink
status_id Pending 2009-10-31 10:54 wieferink
close_date - 2009-10-31 05:32 sfeam
resolution_id None 2009-10-31 05:32 sfeam
status_id Open 2009-10-31 05:32 sfeam
File Added 348888: tidy_up.patch 2009-10-30 18:47 wieferink