Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#504 closed change (fixed (in master))

Compiler warnings (MacOS, r754)

Reported by: roustk@… Owned by:
Milestone: 3.1.0 Keywords:
Cc:

Description

Compiler warnings for [7f01f7f] (SVN r754) (under MacOS 10.5.2):

01) attack.c:716: warning: passing argument 1 of 'target_get' from incompatible pointer type

02) attack.c:716: warning: passing argument 2 of 'target_get' from incompatible pointer type

03) attack.c:1008: warning: passing argument 1 of 'target_get' from incompatible pointer type

04) attack.c:1008: warning: passing argument 2 of 'target_get' from incompatible pointer type

05) button.c:57: warning: 'prompt_end' defined but not used

06) death.c:313: warning: implicit declaration of function 'do_cmd_messages'

07) effects.c:157: warning: enumeration value 'EF_XXX' not handled in switch

08) effects.c:157: warning: enumeration value 'EF_PROBE' not handled in switch

09) effects.c:157: warning: enumeration value 'EF_MAX' not handled in switch

10) load.c:346: warning: unused variable 'tmp8u'

11) obj-desc.c:347: warning: 'endmark' may be used uninitialized in this function

12) obj-desc.c:315: warning: 'endmark' may be used uninitialized in this function

13) obj-make.c:1290: warning: 'kind_is_good' defined but not used

14) target.c:1074: warning: implicit declaration of function 'do_cmd_pathfind'

15) util.c:2136: warning: assignment discards qualifiers from pointer target type

16) z-file.c:549: warning: pointer targets in passing argument 2 of 'file_write' differ in signedness

Warning 06 seems to be because death.c doesn't #include "cmds.h". Warning 14 is similar for target.c -- no #include "cmds.h". Both of these are liable to be serious problems.

Warnings 01-04 involve passing an int when an s16b is expected. Warning 15 refers to the "start = next" line, where a const char needs to be cast as a char. Warning 16 is casting a byte as a const char. I'm a bit leery of the 01-04 errors, as int may not always be 16 bits, but the others should be more safe.

The remaining warnings may indicate logic problems, and probably should be considered by someone who knows those parts of the code.

Kevin

Change History (2)

comment:1 Changed 12 years ago by takkaria

  • Resolution set to fixed
  • Status changed from new to closed

I'm pretty sure all of these have been fixed now, except EF_PROBE, which has its own bug (#495). Please comment if this is not the case. Thanks!

comment:2 Changed 12 years ago by roustk@…

All the warnings I listed have been resolved, although two warnings are left in [fcf6b2b] (SVN r779):

1) game-event.c:25: warning: useless storage class specifier in empty declaration

2) xtra3.c:921: warning: 'trace_map_updates' defined but not used

(1) is new and caused by the addition of "typedef" on game-event.c:25 in [8fb385a] (SVN r759):

typedef struct event_handler_entry;

I believe this line is entirely unneeded, as event_handler_entry is a perfectly valid linked-list element without it. (Of course, we actually are just arraying these, which seems to make the *next pointer redundant...)

(2) is one *I* missed before. The event_add_handler() entry for this function is #if 0'd out at xtra3.c:1571. So be it.

Note: See TracTickets for help on using tickets.