weewonder / garglk

Automatically exported from code.google.com/p/garglk
Other
0 stars 0 forks source link

Fixes for some warnings generated by -Wall #118

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Building garglk with -Wall produces a number of diagnostics.  I've fixed up the 
ones that have obvious solutions.  There are still a few left that will require 
a bit of actual work rather than the simple fixes I've done here.

The patch has a few classes of change:
* Unused variables removed
* Additional header included
* Prototypes added to garglk.h
* SDL audio locking function calls were missing the ()
* Signed/unsigned mismatches
* Checking the address of an array against NULL

Some of the remaining issues are signed/unsigned that don't have fixes that are 
quite as obvious; potential use of uninitialized variables; and potentially 
incorrect combinations of && and ||.

Gcc often requests parentheses around && and || when it's not necessary (it's 
more of a style diagnostic)... but often I've seen it get things right, so it's 
at least worth looking at by somebody who understands the code.

So far I have only looked at garglk.  The interpreters would probably also 
benefit, and I may do that as well when I have time.

Original issue reported on code.google.com by cspiegel@gmail.com on 29 Aug 2010 at 12:40

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the patch! I really appreciate all the work you're putting into this.

Original comment by bcressey@gmail.com on 30 Aug 2010 at 6:16

GoogleCodeExporter commented 8 years ago
I ran garglk through Intel's compiler to see what it might turn up.  It seems 
to me that this issue is close enough that there's no reason to create a new 
one.

This patch is somewhat less substantial than the gcc-inspired one, mainly, I 
suppose, because gcc is pretty good with diagnostics.  Intel's compiler is 
slightly better at finding unused variables (it diagnoses those set but never 
subsequently used), so that's what this patch addresses.

The PNG function calls that I've removed have no side effects, so it's OK not 
to call them.

Original comment by cspiegel@gmail.com on 1 Sep 2010 at 5:34

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks! I've applied this patch as well.

Original comment by bcressey@gmail.com on 7 Sep 2010 at 11:56

GoogleCodeExporter commented 8 years ago

Original comment by bcressey@gmail.com on 13 Sep 2010 at 5:09