From: David Given Date: Sun, 6 Aug 2017 10:42:17 +0000 (+0200) Subject: Ansification, warning fixes, C89ification. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=789f79b;p=ack.git Ansification, warning fixes, C89ification. --- diff --git a/modules/h/em_label.h b/modules/h/em_label.h index 018b0d345..2ff378274 100644 --- a/modules/h/em_label.h +++ b/modules/h/em_label.h @@ -4,5 +4,9 @@ */ /* $Id$ */ +#ifndef _MODULES_H_EM_LABEL_H +#define _MODULES_H_EM_LABEL_H + typedef unsigned int label; +#endif diff --git a/util/arch/archiver.c b/util/arch/archiver.c index bae09a168..65684232a 100644 --- a/util/arch/archiver.c +++ b/util/arch/archiver.c @@ -109,7 +109,7 @@ char *temp_arch = &temp_buf[0]; extern char *mktemp(); extern char *ctime(); -void do_object(); +void do_object(int f, long size); void write_symdef(); void add(); @@ -184,7 +184,7 @@ register int mode; magic = rd_unsigned2(fd); if (magic != AALMAG && magic != ARMAG) error(TRUE, "%s is not in ar format\n", name); - + return fd; } @@ -206,7 +206,7 @@ char *argv[]; if (argc < 3) usage(); - + for (ptr = argv[1]; *ptr; ptr++) { switch (*ptr) { case 't' : @@ -268,7 +268,7 @@ char *argv[]; if (app_fl + ex_fl + del_fl + rep_fl + show_fl + pr_fl != 1) usage(); - + if (u_fl && ! rep_fl) usage(); @@ -289,7 +289,7 @@ char *argv[]; signal(SIGINT, catch); get(argc, argv); - + 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'. */ int @@ -689,9 +689,7 @@ is_outhead(headp) return !BADMAGIC(*headp) && headp->oh_nname != 0; } -void -do_object(f, size) - long size; +void do_object(int f, long size) { struct outhead headbuf; diff --git a/util/mcgg/iburg.c b/util/mcgg/iburg.c index 23705c7d8..4441b6a4a 100644 --- a/util/mcgg/iburg.c +++ b/util/mcgg/iburg.c @@ -136,7 +136,7 @@ int main(int argc, char* argv[]) exit(1); } } - + emitheader(); registerterminals(); @@ -1074,7 +1074,7 @@ static bool find_child_index(Tree node, const char* name, int* index, Tree* foun return true; return false; } - + static void emit_predicate_expr(Rule r, struct expr* p) { bool first = true; @@ -1254,10 +1254,10 @@ static void emitinsndata(Rule rules) int index = 0; emit_input_regs(r->pattern, &index); } - + emit_output_constraints(r); emit_input_constraints(r); - + while (f) { char* data = strdup(f->data); @@ -1276,10 +1276,10 @@ static void emitinsndata(Rule rules) { Tree node; int index = 0; + Nonterm nt; + if (!find_child_index(r->pattern, label, &index, &node)) label_not_found(r, label); - Nonterm nt = node->op; - if (nt->kind == NONTERM) { if (nt->is_fragment) @@ -1310,7 +1310,7 @@ static void emitinsndata(Rule rules) assert(f->data[1] == 0); print("%1data->emit_eoi();\n"); break; - + default: print("%1data->emit_string(\"%s\");\n", f->data); }