Fix some warnings under clang.

This commit is contained in:
Toby Thain 2015-02-01 20:02:49 -05:00
parent 4ea315e2d2
commit 7ab53debb8
6 changed files with 14 additions and 18 deletions

View File

@ -547,7 +547,7 @@ static int assemble(
buffer_free(macbuf);
} else {
strncpy(macfile, label, sizeof(macfile));
strncat(macfile, ".MAC", sizeof(macfile) - strlen(macfile));
strncat(macfile, ".MAC", sizeof(macfile) - strlen(macfile) - 1);
my_searchenv(macfile, "MCALL", hitfile, sizeof(hitfile));
if (hitfile[0])
macstr = new_file_stream(hitfile);

View File

@ -598,7 +598,7 @@ void got_isd(
char *cp,
int len)
{
printf("ISD len=%o\n");
printf("ISD len=%o\n", len);
}
void got_endmod(

View File

@ -60,7 +60,7 @@ void list_source(
if (!binline)
binline = memcheck(malloc(sizeof(LSTFORMAT) + 16));
sprintf(binline, "%*s%*d", SIZEOF_MEMBER(LSTFORMAT, flag), "", SIZEOF_MEMBER(LSTFORMAT, line_number),
sprintf(binline, "%*s%*d", (int)SIZEOF_MEMBER(LSTFORMAT, flag), "", (int)SIZEOF_MEMBER(LSTFORMAT, line_number),
str->line);
}
}
@ -87,21 +87,18 @@ static void list_fit(
STREAM *str,
unsigned addr)
{
int len = strlen(binline);
size_t col1 = offsetof(LSTFORMAT, source);
size_t col2 = offsetof(LSTFORMAT, pc);
if (strlen(binline) >= col1) {
int offset = offsetof(LSTFORMAT, pc);
list_flush();
listline[0] = 0;
binline[0] = 0;
sprintf(binline, "%*s %6.6o", offsetof(LSTFORMAT, pc), "", addr);
sprintf(binline, "%*s %6.6o", (int)offsetof(LSTFORMAT, pc), "", addr);
padto(binline, offsetof(LSTFORMAT, words));
} else if (strlen(binline) <= col2) {
sprintf(binline, "%*s%*d %6.6o", SIZEOF_MEMBER(LSTFORMAT, flag), "",
SIZEOF_MEMBER(LSTFORMAT, line_number), str->line, addr);
sprintf(binline, "%*s%*d %6.6o", (int)SIZEOF_MEMBER(LSTFORMAT, flag), "",
(int)SIZEOF_MEMBER(LSTFORMAT, line_number), str->line, addr);
padto(binline, offsetof(LSTFORMAT, words));
}
}
@ -115,8 +112,8 @@ void list_value(
if (dolist()) {
/* Print the value and go */
binline[0] = 0;
sprintf(binline, "%*s%*d %6.6o", SIZEOF_MEMBER(LSTFORMAT, flag), "",
SIZEOF_MEMBER(LSTFORMAT, line_number), str->line, word & 0177777);
sprintf(binline, "%*s%*d %6.6o", (int)SIZEOF_MEMBER(LSTFORMAT, flag), "",
(int)SIZEOF_MEMBER(LSTFORMAT, line_number), str->line, word & 0177777);
}
}

View File

@ -146,9 +146,7 @@ int main(
char *fnames[32];
int nr_files = 0;
FILE *obj = NULL;
static char line[1024];
TEXT_RLD tr;
char *macname = NULL;
char *objname = NULL;
char *lstname = NULL;
int arg;

View File

@ -197,7 +197,8 @@ MACRO *defmacro(
while (!EOL(*cp)) {
arg = new_arg();
if (arg->locsym = (*cp == '?')) /* special argument flag? */
arg->locsym = *cp == '?';
if (arg->locsym) /* special argument flag? */
cp++;
arg->label = get_symbol(cp, &cp, NULL);
if (arg->label == NULL) {
@ -335,8 +336,8 @@ BUFFER *subst_args(
if (issym(*in)) {
label = get_symbol(in, &next, NULL);
if (label) {
if (arg = find_arg(args, label)) {
/* An apostrophy may appear before or after the symbol. */
if ((arg = find_arg(args, label))) {
/* An apostrophe may appear before or after the symbol. */
/* In either case, remove it from the expansion. */
if (in > begin && in[-1] == '\'')

View File

@ -322,7 +322,7 @@ int parse_float(
}
}
flt[0] = (unsigned) (sign | (exp << 7) | (ufrac >> 48) & 0x7F);
flt[0] = (unsigned) (sign | (exp << 7) | ((ufrac >> 48) & 0x7F));
if (size > 1) {
flt[1] = (unsigned) ((ufrac >> 32) & 0xffff);
if (size > 2) {
@ -509,7 +509,7 @@ char *get_symbol(
if (symcp[len - 1] == '$') {
char *newsym = memcheck(malloc(32)); /* Overkill */
sprintf(newsym, "%d$%d", strtol(symcp, NULL, 10), lsb);
sprintf(newsym, "%ld$%d", strtol(symcp, NULL, 10), lsb);
free(symcp);
symcp = newsym;
if (islocal)