Rationalised use of #includes to be more standards-compliant.
authordtrg <none@none>
Sat, 22 Jul 2006 12:28:20 +0000 (12:28 +0000)
committerdtrg <none@none>
Sat, 22 Jul 2006 12:28:20 +0000 (12:28 +0000)
mach/proto/top/top.c
util/topgen/hash.c
util/topgen/main.c
util/topgen/pattern.c
util/topgen/symtab.c
util/topgen/topgen.g

index 8964750..e44580a 100644 (file)
@@ -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 <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #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 */
index b94501e..7661dd3 100644 (file)
@@ -8,8 +8,10 @@
  * maintains the the lists of hashed patterns
  * Functions : addtohashtable() and printhashtable()
  */
-# include <stdio.h>
-# include "misc.h"
+#include <stdlib.h>
+#include <stdio.h>
+#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);
index 128730d..dd6c4c8 100644 (file)
@@ -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 <stdio.h>
+#include <stdlib.h>
+#include <stdio.h>
 
 extern int lineno, newline;
 
index 5ae7008..bc5b7a6 100644 (file)
@@ -9,10 +9,12 @@
  * it maintains a table of information about the patterns
  * Functions : addpattern() and printpatterns()
  */
-# include <stdio.h>
-# include <ctype.h>
-# include "misc.h"
-# include "symtab.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#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 */
index 05b1ed3..b5511d0 100644 (file)
@@ -8,7 +8,10 @@
  * Contains the routine findident, which builds the symbol table and
  * searches identifiers
  */
-# include "symtab.h"
+#include <stdlib.h>
+#include <string.h>
+#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;
 
index cd187ae..45c573e 100644 (file)
 %start LLparse, optim_description;
 
 {
-# include <stdio.h>
-# include "token.h"
-# include "symtab.h"
-# include "misc.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#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 */