Fixed compiler warnings

Fixed some compiler warnings.
Added work around for a gcc warning bug.
This commit is contained in:
Landon Curt Noll
2018-02-21 12:37:46 -08:00
parent 83c898cc2b
commit b4cd692bae
3 changed files with 20 additions and 7 deletions

15
CHANGES
View File

@@ -1,7 +1,18 @@
The following are the changes from calc version 2.12.6.5 to date:
The following are the changes from calc version 2.12.6.6 to date:
For historical purposes, in lucas.cal, gen_v1(1, n) always returns 4.
Fixed some compiler warnings, thanks to a report by Mike
<michael dot d dot ince at gmail dot com>.
Added work around for a gcc warning bug, thanks to a report by Mike
<michael dot d dot ince at gmail dot com>.
The following are the changes from calc version 2.12.6.4 to 2.12.6.5:
Fixed warning about undefined operations involving the qlink(q)
macro by deplacing that macro with an inline-function. Thanks goes
macro by replacing that macro with an inline-function. Thanks goes
to David Haller <dnh at opensuse dot org> for this fix.
NOTE for Windows 10 users: Pavel Nemec <pane at seznam dot cz>

10
calc.c
View File

@@ -104,6 +104,7 @@ main(int argc, char **argv)
int c; /* option */
int index;
int maxindex;
int unusedint = 0; /* avoids gcc compiler warning bug - '...assigned, but never used...' */
char *cp;
char *endcp;
char *bp;
@@ -278,7 +279,7 @@ main(int argc, char **argv)
exit(6);
}
calc_debug = cp;
(void) strtol(cp, &endcp, 10);
unusedint = strtol(cp, &endcp, 10); /* avoids gcc compiler warning bug */
cp = endcp;
if (*cp != '\0' &&
*cp != ' ' && *cp != ':') {
@@ -310,7 +311,7 @@ main(int argc, char **argv)
exit(9);
}
resource_debug = cp;
(void) strtol(cp, &endcp, 10);
unusedint = strtol(cp, &endcp, 10); /* avoids gcc compiler warning bug */
cp = endcp;
if (*cp != '\0' &&
*cp != ' ' && *cp != ':') {
@@ -340,7 +341,7 @@ main(int argc, char **argv)
exit(12);
}
user_debug = cp;
(void) strtol(cp, &endcp, 10);
unusedint = strtol(cp, &endcp, 10); /* avoids gcc compiler warning bug */
cp = endcp;
if (*cp != '\0' && *cp != ' ') {
fprintf(stderr, "Bad syntax in"
@@ -721,8 +722,9 @@ main(int argc, char **argv)
printf("main: run_state = %s\n", run_state_name(run_state));
/*
* all done
* All done! - Jessica Noll, Age 2
*/
unusedint++; /* avoids gcc compiler warning bug */
libcalc_call_me_last();
return (run_state == RUN_EXIT_WITH_ERROR ||
run_state == RUN_ZERO) ? 1 : 0;

View File

@@ -2944,7 +2944,7 @@ printestr(VALUE *vp)
bp = vp->v_nblock->blk;
}
i = bp->datalen;
math_fmt("%ld,%d)", i, bp->blkchunk);
math_fmt("%ld,%d)", i, (int) bp->blkchunk);
cp = bp->data;
if (i > 0) {
math_str("={");