Crank up the warning levels, and adjust the code to silence ...

several compilers:
- gcc version 4.5.3 (NetBSD nb2 20110806)
- gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
- Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)

The warnings were mostly about local variables shadowing others,
unused function parameters, and C++ style comments. Some variables were
indeed used before set.

Note that on Linux, using -std=c99 does stupid things like *remove* the
declaration of strdup() from <string.h>. Therefore I've reluctantly used
-std=gnu99.
This commit is contained in:
Olaf Seibert
2015-05-27 21:51:26 +02:00
parent 8a2ba3adf0
commit d38f4009c4
17 changed files with 133 additions and 110 deletions

View File

@@ -163,7 +163,7 @@ static int gsd_write(
char *cp;
unsigned radtbl[2];
if (gsd->offset > sizeof(gsd->buf) - 8) {
if (gsd->offset > (int)sizeof(gsd->buf) - 8) {
if (!gsd_flush(gsd))
return 0;
}
@@ -220,6 +220,10 @@ int gsd_xfer(
char *name,
unsigned value)
{
/*
* MACRO V05.05 uses 050 as flags.
* The Task Builder Manual shows them to be 0.
*/
return gsd_write(gsd, name, 010, GSD_XFER, value);
}
@@ -328,8 +332,9 @@ static int text_fit(
int txtsize,
int rldsize)
{
if (tr->txt_offset + txtsize <= sizeof(tr->text) && tr->rld_offset + rldsize <= sizeof(tr->rld)
&& (txtsize == 0 || tr->txt_addr + tr->txt_offset - 4 == addr))
if (tr->txt_offset + txtsize <= (int)sizeof(tr->text) &&
tr->rld_offset + rldsize <= (int)sizeof(tr->rld) &&
(txtsize == 0 || tr->txt_addr + tr->txt_offset - 4 == addr))
return 1; /* All's well. */
if (!text_flush(tr))
@@ -792,7 +797,7 @@ static char *text_complex_fit(
{
int len;
if (tx->len + size > sizeof(tx->accum))
if (tx->len + size > (int)sizeof(tx->accum))
return NULL; /* Expression has grown too complex. */
len = tx->len;