Ansification, warning fixes, C89ification.

This commit is contained in:
David Given 2017-08-06 12:42:17 +02:00
parent b79d9fd7f4
commit 789f79b369
3 changed files with 18 additions and 16 deletions

View file

@ -4,5 +4,9 @@
*/ */
/* $Id$ */ /* $Id$ */
#ifndef _MODULES_H_EM_LABEL_H
#define _MODULES_H_EM_LABEL_H
typedef unsigned int label; typedef unsigned int label;
#endif

View file

@ -109,7 +109,7 @@ char *temp_arch = &temp_buf[0];
extern char *mktemp(); extern char *mktemp();
extern char *ctime(); extern char *ctime();
void do_object(); void do_object(int f, long size);
void write_symdef(); void write_symdef();
void add(); void add();
@ -184,7 +184,7 @@ register int mode;
magic = rd_unsigned2(fd); magic = rd_unsigned2(fd);
if (magic != AALMAG && magic != ARMAG) if (magic != AALMAG && magic != ARMAG)
error(TRUE, "%s is not in ar format\n", name); error(TRUE, "%s is not in ar format\n", name);
return fd; return fd;
} }
@ -206,7 +206,7 @@ char *argv[];
if (argc < 3) if (argc < 3)
usage(); usage();
for (ptr = argv[1]; *ptr; ptr++) { for (ptr = argv[1]; *ptr; ptr++) {
switch (*ptr) { switch (*ptr) {
case 't' : case 't' :
@ -268,7 +268,7 @@ char *argv[];
if (app_fl + ex_fl + del_fl + rep_fl + show_fl + pr_fl != 1) if (app_fl + ex_fl + del_fl + rep_fl + show_fl + pr_fl != 1)
usage(); usage();
if (u_fl && ! rep_fl) if (u_fl && ! rep_fl)
usage(); usage();
@ -289,7 +289,7 @@ char *argv[];
signal(SIGINT, catch); signal(SIGINT, catch);
get(argc, argv); get(argc, argv);
return 0; return 0;
} }
@ -678,7 +678,7 @@ write_symdef()
} }
/* /*
* Return whether the bytes in `buf' form a good object header. * Return whether the bytes in `buf' form a good object header.
* The header is put in `headp'. * The header is put in `headp'.
*/ */
int int
@ -689,9 +689,7 @@ is_outhead(headp)
return !BADMAGIC(*headp) && headp->oh_nname != 0; return !BADMAGIC(*headp) && headp->oh_nname != 0;
} }
void void do_object(int f, long size)
do_object(f, size)
long size;
{ {
struct outhead headbuf; struct outhead headbuf;

View file

@ -136,7 +136,7 @@ int main(int argc, char* argv[])
exit(1); exit(1);
} }
} }
emitheader(); emitheader();
registerterminals(); registerterminals();
@ -1074,7 +1074,7 @@ static bool find_child_index(Tree node, const char* name, int* index, Tree* foun
return true; return true;
return false; return false;
} }
static void emit_predicate_expr(Rule r, struct expr* p) static void emit_predicate_expr(Rule r, struct expr* p)
{ {
bool first = true; bool first = true;
@ -1254,10 +1254,10 @@ static void emitinsndata(Rule rules)
int index = 0; int index = 0;
emit_input_regs(r->pattern, &index); emit_input_regs(r->pattern, &index);
} }
emit_output_constraints(r); emit_output_constraints(r);
emit_input_constraints(r); emit_input_constraints(r);
while (f) while (f)
{ {
char* data = strdup(f->data); char* data = strdup(f->data);
@ -1276,10 +1276,10 @@ static void emitinsndata(Rule rules)
{ {
Tree node; Tree node;
int index = 0; int index = 0;
Nonterm nt;
if (!find_child_index(r->pattern, label, &index, &node)) if (!find_child_index(r->pattern, label, &index, &node))
label_not_found(r, label); label_not_found(r, label);
Nonterm nt = node->op;
if (nt->kind == NONTERM) if (nt->kind == NONTERM)
{ {
if (nt->is_fragment) if (nt->is_fragment)
@ -1310,7 +1310,7 @@ static void emitinsndata(Rule rules)
assert(f->data[1] == 0); assert(f->data[1] == 0);
print("%1data->emit_eoi();\n"); print("%1data->emit_eoi();\n");
break; break;
default: default:
print("%1data->emit_string(\"%s\");\n", f->data); print("%1data->emit_string(\"%s\");\n", f->data);
} }