MestreLion / roguepc

Port of original PC-DOS Epyx Rogue to modern platforms
27 stars 6 forks source link

Silence compiler warnings #19

Closed jwt27 closed 3 years ago

jwt27 commented 3 years ago

GCC 11 makes the following complaints:

rip.c: In function ‘pr_scores’:
rip.c:205:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  205 |         if (COLS == 40)
      |         ^~
rip.c:207:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  207 |                 if (altmsg == NULL)
      |                 ^~
fight.c: In function ‘check_level’:
fight.c:293:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  293 |                 if ((pstats.s_hpt += add) > max_hp)
      |                 ^~
fight.c:295:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  295 |                         msg("and achieve the rank of \"%s\"", he_man[i-1]);
      |                         ^~~
things.c: In function ‘nothing’:
things.c:583:9: warning: ‘tystr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  583 |         sprintf(sp, " about any %ss", tystr);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The first two are clearly cases of mixed indentation, easy to fix. For the latter one I used the weird otherwise macro from rogue.h to be consistent with the surrounding code. I don't know if that's something to be encouraged.