From fdcdaadcb8b0dd81028a5565b022b1c4ca22d63b Mon Sep 17 00:00:00 2001 From: dtrg Date: Sat, 22 Jul 2006 12:28:20 +0000 Subject: [PATCH] Rationalised use of #includes to be more standards-compliant. --- mach/proto/top/top.c | 11 +++++++---- util/topgen/hash.c | 7 ++++--- util/topgen/main.c | 4 +++- util/topgen/pattern.c | 11 ++++++----- util/topgen/symtab.c | 7 ++++--- util/topgen/topgen.g | 12 ++++++------ 6 files changed, 30 insertions(+), 22 deletions(-) diff --git a/mach/proto/top/top.c b/mach/proto/top/top.c index 8964750d8..e44580af9 100644 --- a/mach/proto/top/top.c +++ b/mach/proto/top/top.c @@ -3,21 +3,24 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ + +#include #include +#include #include "gen.h" #include "top.h" #include "queue.h" +/* Defined in the string module, which has no header file. FIXME. */ + +extern char* strindex(char *s, int c); + /* STANDARD MACHINE-INDEPENT C CODE *************/ extern char *lstrip(); extern instr_p newinstr(); extern instr_p read_instr(); extern instr_p gen_instr(); -extern char * malloc(); -extern char *strcat(); -extern char *strcpy(); -extern char *strncpy(); struct variable var[NRVARS+1]; struct variable ANY; /* ANY symbol matching any instruction */ diff --git a/util/topgen/hash.c b/util/topgen/hash.c index b94501e61..7661dd375 100644 --- a/util/topgen/hash.c +++ b/util/topgen/hash.c @@ -8,8 +8,10 @@ * maintains the the lists of hashed patterns * Functions : addtohashtable() and printhashtable() */ -# include -# include "misc.h" + +#include +#include +#include "misc.h" struct hlist { /* linear list of pattern numbers */ int h_patno; @@ -40,7 +42,6 @@ addtohashtable(s,n) char *s; { */ unsigned hval; register struct hlist *p; - char *malloc(); hval = hash(s); p = (struct hlist *) malloc(sizeof *p); diff --git a/util/topgen/main.c b/util/topgen/main.c index 128730daf..dd6c4c8a2 100644 --- a/util/topgen/main.c +++ b/util/topgen/main.c @@ -8,7 +8,9 @@ * Contains the main program, the error reporting routine, and a routine * to check wether a constraint consists only of space */ -# include + +#include +#include extern int lineno, newline; diff --git a/util/topgen/pattern.c b/util/topgen/pattern.c index 5ae700817..bc5b7a64f 100644 --- a/util/topgen/pattern.c +++ b/util/topgen/pattern.c @@ -9,10 +9,12 @@ * it maintains a table of information about the patterns * Functions : addpattern() and printpatterns() */ -# include -# include -# include "misc.h" -# include "symtab.h" + +#include +#include +#include +#include "misc.h" +#include "symtab.h" struct pattern { char *p_constraint; /* constraint of this pattern */ @@ -37,7 +39,6 @@ addpattern(str,l,np,nr) char *str; { * "nr" is the number of instructions in the replacement * Space is allocated in chunks of 50 */ - char *malloc(), *realloc(); register struct pattern *p; if (!pattable) { /* No space allocated yet */ diff --git a/util/topgen/symtab.c b/util/topgen/symtab.c index 05b1ed326..b5511d0dc 100644 --- a/util/topgen/symtab.c +++ b/util/topgen/symtab.c @@ -8,7 +8,10 @@ * Contains the routine findident, which builds the symbol table and * searches identifiers */ -# include "symtab.h" + +#include +#include +#include "symtab.h" struct symtab *idtable, *deftable; @@ -20,8 +23,6 @@ findident(s, mode, table) char *s; struct symtab **table; { * If mode = ENTERING, a new entry will be made if s is not in the * table yet, otherwise an error results */ - char *malloc(); - char *strcpy(); register struct symtab *p; register n; diff --git a/util/topgen/topgen.g b/util/topgen/topgen.g index cd187aee6..45c573e94 100644 --- a/util/topgen/topgen.g +++ b/util/topgen/topgen.g @@ -15,16 +15,16 @@ %start LLparse, optim_description; { -# include -# include "token.h" -# include "symtab.h" -# include "misc.h" +#include +#include +#include +#include "token.h" +#include "symtab.h" +#include "misc.h" char idbuf[BUFSIZ], buf[BUFSIZ]; int countid; /* # of variables */ int countpat; /* # of patterns */ -char * malloc(); -char * strcpy(); static int patlen; /* Maximum number of instructions in pattern */ static int maxoperand; /* Maximum number of operands of instruction */ extern FILE *input; /* file descriptor of inputfile */ -- 2.34.1